arm: mfd/regulator: Adding driver for tps80031
[linux-2.6.git] / include / linux / mfd / tps80031.h
1 /*
2  * include/linux/mfd/tps80031.c
3  *
4  * Core driver interface for TI TPS80031 PMIC
5  *
6  * Copyright (C) 2011 NVIDIA Corporation
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  *
22  */
23
24 #ifndef __LINUX_MFD_TPS80031_H
25 #define __LINUX_MFD_TPS80031_H
26
27 #define tps80031_rails(_name) "tps80031_"#_name
28
29 enum {
30         TPS80031_ID_VIO,
31         TPS80031_ID_SMPS1,
32         TPS80031_ID_SMPS2,
33         TPS80031_ID_SMPS3,
34         TPS80031_ID_SMPS4,
35         TPS80031_ID_VANA,
36         TPS80031_ID_LDO1,
37         TPS80031_ID_LDO2,
38         TPS80031_ID_LDO3,
39         TPS80031_ID_LDO4,
40         TPS80031_ID_LDO5,
41         TPS80031_ID_LDO6,
42         TPS80031_ID_LDO7,
43         TPS80031_ID_LDOLN,
44         TPS80031_ID_LDOUSB,
45 };
46
47 enum {
48         TPS80031_INT_PWRON,
49         TPS80031_INT_RPWRON,
50         TPS80031_INT_SYS_VLOW,
51         TPS80031_INT_RTC_ALARM,
52         TPS80031_INT_RTC_PERIOD,
53         TPS80031_INT_HOT_DIE,
54         TPS80031_INT_VXX_SHORT,
55         TPS80031_INT_SPDURATION,
56         TPS80031_INT_WATCHDOG,
57         TPS80031_INT_BAT,
58         TPS80031_INT_SIM,
59         TPS80031_INT_MMC,
60         TPS80031_INT_RES,
61         TPS80031_INT_GPADC_RT,
62         TPS80031_INT_GPADC_SW2_EOC,
63         TPS80031_INT_CC_AUTOCAL,
64         TPS80031_INT_ID_WKUP,
65         TPS80031_INT_VBUSS_WKUP,
66         TPS80031_INT_ID,
67         TPS80031_INT_VBUS,
68         TPS80031_INT_CHRG_CTRL,
69         TPS80031_INT_EXT_CHRG,
70         TPS80031_INT_INT_CHRG,
71         TPS80031_INT_RES2,
72 };
73
74 struct tps80031_subdev_info {
75         int             id;
76         const char      *name;
77         void            *platform_data;
78 };
79
80 struct tps80031_32kclock_plat_data {
81         unsigned en_clk32kao:1;
82         unsigned en_clk32kg:1;
83         unsigned en_clk32kaudio:1;
84 };
85
86 struct tps80031_platform_data {
87         int num_subdevs;
88         struct tps80031_subdev_info *subdevs;
89         int gpio_base;
90         int irq_base;
91         struct tps80031_32kclock_plat_data *clk32k_pdata;
92 };
93
94 /*
95  * NOTE: the functions below are not intended for use outside
96  * of the TPS80031 sub-device drivers
97  */
98 extern int tps80031_write(struct device *dev, int reg, uint8_t val);
99 extern int tps80031_writes(struct device *dev, int reg, int len, uint8_t *val);
100 extern int tps80031_read(struct device *dev, int reg, uint8_t *val);
101 extern int tps80031_reads(struct device *dev, int reg, int len, uint8_t *val);
102 extern int tps80031_set_bits(struct device *dev, int reg, uint8_t bit_mask);
103 extern int tps80031_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
104 extern int tps80031_update(struct device *dev, int reg, uint8_t val,
105                            uint8_t mask);
106 extern int tps80031_power_off(void);
107
108 #endif /*__LINUX_MFD_TPS80031_H */