diff options
Diffstat (limited to 'include/linux/mfd/tps6591x.h')
-rw-r--r-- | include/linux/mfd/tps6591x.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/include/linux/mfd/tps6591x.h b/include/linux/mfd/tps6591x.h new file mode 100644 index 00000000000..d0d829fc8ab --- /dev/null +++ b/include/linux/mfd/tps6591x.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * include/linux/mfd/tps6591x.c | ||
3 | * Core driver interface for TI TPS6591x PMIC family | ||
4 | * | ||
5 | * Copyright (C) 2011 NVIDIA Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_MFD_TPS6591X_H | ||
24 | #define __LINUX_MFD_TPS6591X_H | ||
25 | |||
26 | #include <linux/rtc.h> | ||
27 | |||
28 | enum { | ||
29 | TPS6591X_INT_PWRHOLD_F, | ||
30 | TPS6591X_INT_VMBHI, | ||
31 | TPS6591X_INT_PWRON, | ||
32 | TPS6591X_INT_PWRON_LP, | ||
33 | TPS6591X_INT_PWRHOLD_R, | ||
34 | TPS6591X_INT_HOTDIE, | ||
35 | TPS6591X_INT_RTC_ALARM, | ||
36 | TPS6591X_INT_RTC_PERIOD, | ||
37 | TPS6591X_INT_GPIO0, | ||
38 | TPS6591X_INT_GPIO1, | ||
39 | TPS6591X_INT_GPIO2, | ||
40 | TPS6591X_INT_GPIO3, | ||
41 | TPS6591X_INT_GPIO4, | ||
42 | TPS6591X_INT_GPIO5, | ||
43 | TPS6591X_INT_WTCHDG, | ||
44 | TPS6591X_INT_VMBCH2_H, | ||
45 | TPS6591X_INT_VMBCH2_L, | ||
46 | TPS6591X_INT_PWRDN, | ||
47 | |||
48 | /* Last entry */ | ||
49 | TPS6591X_INT_NR, | ||
50 | }; | ||
51 | |||
52 | /* Gpio definitions */ | ||
53 | enum { | ||
54 | TPS6591X_GPIO_GP0 = 0, | ||
55 | TPS6591X_GPIO_GP1 = 1, | ||
56 | TPS6591X_GPIO_GP2 = 2, | ||
57 | TPS6591X_GPIO_GP3 = 3, | ||
58 | TPS6591X_GPIO_GP4 = 4, | ||
59 | TPS6591X_GPIO_GP5 = 5, | ||
60 | TPS6591X_GPIO_GP6 = 6, | ||
61 | TPS6591X_GPIO_GP7 = 7, | ||
62 | TPS6591X_GPIO_GP8 = 8, | ||
63 | |||
64 | /* Last entry */ | ||
65 | TPS6591X_GPIO_NR, | ||
66 | }; | ||
67 | |||
68 | struct tps6591x_subdev_info { | ||
69 | int id; | ||
70 | const char *name; | ||
71 | void *platform_data; | ||
72 | }; | ||
73 | |||
74 | struct tps6591x_rtc_platform_data { | ||
75 | int irq; | ||
76 | struct rtc_time time; | ||
77 | }; | ||
78 | |||
79 | struct tps6591x_sleep_keepon_data { | ||
80 | /* set 1 to maintain the following on sleep mode */ | ||
81 | unsigned therm_keepon:1; /* themal monitoring */ | ||
82 | unsigned clkout32k_keepon:1; /* CLK32KOUT */ | ||
83 | unsigned vrtc_keepon:1; /* LD0 full load capability */ | ||
84 | unsigned i2chs_keepon:1; /* high speed internal clock */ | ||
85 | }; | ||
86 | |||
87 | struct tps6591x_gpio_init_data { | ||
88 | unsigned sleep_en:1; /* Enable sleep mode */ | ||
89 | unsigned pulldn_en:1; /* Enable pull down */ | ||
90 | unsigned output_mode_en:1; /* Enable output mode during init */ | ||
91 | unsigned output_val:1; /* Output value if it is in output mode */ | ||
92 | unsigned init_apply:1; /* Apply init data on configuring gpios*/ | ||
93 | }; | ||
94 | |||
95 | struct tps6591x_platform_data { | ||
96 | int gpio_base; | ||
97 | int irq_base; | ||
98 | |||
99 | int num_subdevs; | ||
100 | struct tps6591x_subdev_info *subdevs; | ||
101 | |||
102 | bool dev_slp_en; | ||
103 | struct tps6591x_sleep_keepon_data *slp_keepon; | ||
104 | |||
105 | struct tps6591x_gpio_init_data *gpio_init_data; | ||
106 | int num_gpioinit_data; | ||
107 | |||
108 | bool use_power_off; | ||
109 | }; | ||
110 | |||
111 | /* | ||
112 | * NOTE: the functions below are not intended for use outside | ||
113 | * of the TPS6591X sub-device drivers | ||
114 | */ | ||
115 | extern int tps6591x_write(struct device *dev, int reg, uint8_t val); | ||
116 | extern int tps6591x_writes(struct device *dev, int reg, int len, uint8_t *val); | ||
117 | extern int tps6591x_read(struct device *dev, int reg, uint8_t *val); | ||
118 | extern int tps6591x_reads(struct device *dev, int reg, int len, uint8_t *val); | ||
119 | extern int tps6591x_set_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
120 | extern int tps6591x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
121 | extern int tps6591x_update(struct device *dev, int reg, uint8_t val, | ||
122 | uint8_t mask); | ||
123 | |||
124 | #endif /*__LINUX_MFD_TPS6591X_H */ | ||