diff options
Diffstat (limited to 'include/linux/mfd/mc13783.h')
-rw-r--r-- | include/linux/mfd/mc13783.h | 142 |
1 files changed, 117 insertions, 25 deletions
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h index b3a2a7243573..8895d9d8879c 100644 --- a/include/linux/mfd/mc13783.h +++ b/include/linux/mfd/mc13783.h | |||
@@ -1,28 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> | 2 | * Copyright 2009 Pengutronix |
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
3 | * | 4 | * |
4 | * Initial development of this code was funded by | 5 | * This program is free software; you can redistribute it and/or modify it under |
5 | * Phytec Messtechnik GmbH, http://www.phytec.de | 6 | * the terms of the GNU General Public License version 2 as published by the |
6 | * | 7 | * Free Software Foundation. |
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, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | 8 | */ |
9 | #ifndef __LINUX_MFD_MC13783_H | ||
10 | #define __LINUX_MFD_MC13783_H | ||
21 | 11 | ||
22 | #ifndef __INCLUDE_LINUX_MFD_MC13783_H | 12 | #include <linux/interrupt.h> |
23 | #define __INCLUDE_LINUX_MFD_MC13783_H | ||
24 | 13 | ||
25 | struct mc13783; | 14 | struct mc13783; |
15 | |||
16 | void mc13783_lock(struct mc13783 *mc13783); | ||
17 | void mc13783_unlock(struct mc13783 *mc13783); | ||
18 | |||
19 | int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val); | ||
20 | int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val); | ||
21 | int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, | ||
22 | u32 mask, u32 val); | ||
23 | |||
24 | int mc13783_irq_request(struct mc13783 *mc13783, int irq, | ||
25 | irq_handler_t handler, const char *name, void *dev); | ||
26 | int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, | ||
27 | irq_handler_t handler, const char *name, void *dev); | ||
28 | int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); | ||
29 | |||
30 | int mc13783_irq_mask(struct mc13783 *mc13783, int irq); | ||
31 | int mc13783_irq_unmask(struct mc13783 *mc13783, int irq); | ||
32 | int mc13783_irq_status(struct mc13783 *mc13783, int irq, | ||
33 | int *enabled, int *pending); | ||
34 | int mc13783_irq_ack(struct mc13783 *mc13783, int irq); | ||
35 | |||
36 | static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated; | ||
37 | static inline int mc13783_mask(struct mc13783 *mc13783, int irq) | ||
38 | { | ||
39 | return mc13783_irq_mask(mc13783, irq); | ||
40 | } | ||
41 | |||
42 | static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated; | ||
43 | static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) | ||
44 | { | ||
45 | return mc13783_irq_unmask(mc13783, irq); | ||
46 | } | ||
47 | |||
48 | static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated; | ||
49 | static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) | ||
50 | { | ||
51 | return mc13783_irq_ack(mc13783, irq); | ||
52 | } | ||
53 | |||
54 | #define MC13783_ADC0 43 | ||
55 | #define MC13783_ADC0_ADREFEN (1 << 10) | ||
56 | #define MC13783_ADC0_ADREFMODE (1 << 11) | ||
57 | #define MC13783_ADC0_TSMOD0 (1 << 12) | ||
58 | #define MC13783_ADC0_TSMOD1 (1 << 13) | ||
59 | #define MC13783_ADC0_TSMOD2 (1 << 14) | ||
60 | #define MC13783_ADC0_ADINC1 (1 << 16) | ||
61 | #define MC13783_ADC0_ADINC2 (1 << 17) | ||
62 | |||
63 | #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \ | ||
64 | MC13783_ADC0_TSMOD1 | \ | ||
65 | MC13783_ADC0_TSMOD2) | ||
66 | |||
67 | /* to be cleaned up */ | ||
26 | struct regulator_init_data; | 68 | struct regulator_init_data; |
27 | 69 | ||
28 | struct mc13783_regulator_init_data { | 70 | struct mc13783_regulator_init_data { |
@@ -30,23 +72,30 @@ struct mc13783_regulator_init_data { | |||
30 | struct regulator_init_data *init_data; | 72 | struct regulator_init_data *init_data; |
31 | }; | 73 | }; |
32 | 74 | ||
33 | struct mc13783_platform_data { | 75 | struct mc13783_regulator_platform_data { |
34 | struct mc13783_regulator_init_data *regulators; | ||
35 | int num_regulators; | 76 | int num_regulators; |
36 | unsigned int flags; | 77 | struct mc13783_regulator_init_data *regulators; |
37 | }; | 78 | }; |
38 | 79 | ||
39 | /* mc13783_platform_data flags */ | 80 | struct mc13783_platform_data { |
81 | int num_regulators; | ||
82 | struct mc13783_regulator_init_data *regulators; | ||
83 | |||
40 | #define MC13783_USE_TOUCHSCREEN (1 << 0) | 84 | #define MC13783_USE_TOUCHSCREEN (1 << 0) |
41 | #define MC13783_USE_CODEC (1 << 1) | 85 | #define MC13783_USE_CODEC (1 << 1) |
42 | #define MC13783_USE_ADC (1 << 2) | 86 | #define MC13783_USE_ADC (1 << 2) |
43 | #define MC13783_USE_RTC (1 << 3) | 87 | #define MC13783_USE_RTC (1 << 3) |
44 | #define MC13783_USE_REGULATOR (1 << 4) | 88 | #define MC13783_USE_REGULATOR (1 << 4) |
89 | unsigned int flags; | ||
90 | }; | ||
91 | |||
92 | #define MC13783_ADC_MODE_TS 1 | ||
93 | #define MC13783_ADC_MODE_SINGLE_CHAN 2 | ||
94 | #define MC13783_ADC_MODE_MULT_CHAN 3 | ||
45 | 95 | ||
46 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, | 96 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, |
47 | unsigned int channel, unsigned int *sample); | 97 | unsigned int channel, unsigned int *sample); |
48 | 98 | ||
49 | void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status); | ||
50 | 99 | ||
51 | #define MC13783_SW_SW1A 0 | 100 | #define MC13783_SW_SW1A 0 |
52 | #define MC13783_SW_SW1B 1 | 101 | #define MC13783_SW_SW1B 1 |
@@ -79,6 +128,49 @@ void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status); | |||
79 | #define MC13783_REGU_V2 28 | 128 | #define MC13783_REGU_V2 28 |
80 | #define MC13783_REGU_V3 29 | 129 | #define MC13783_REGU_V3 29 |
81 | #define MC13783_REGU_V4 30 | 130 | #define MC13783_REGU_V4 30 |
131 | #define MC13783_REGU_PWGT1SPI 31 | ||
132 | #define MC13783_REGU_PWGT2SPI 32 | ||
82 | 133 | ||
83 | #endif /* __INCLUDE_LINUX_MFD_MC13783_H */ | 134 | #define MC13783_IRQ_ADCDONE 0 |
135 | #define MC13783_IRQ_ADCBISDONE 1 | ||
136 | #define MC13783_IRQ_TS 2 | ||
137 | #define MC13783_IRQ_WHIGH 3 | ||
138 | #define MC13783_IRQ_WLOW 4 | ||
139 | #define MC13783_IRQ_CHGDET 6 | ||
140 | #define MC13783_IRQ_CHGOV 7 | ||
141 | #define MC13783_IRQ_CHGREV 8 | ||
142 | #define MC13783_IRQ_CHGSHORT 9 | ||
143 | #define MC13783_IRQ_CCCV 10 | ||
144 | #define MC13783_IRQ_CHGCURR 11 | ||
145 | #define MC13783_IRQ_BPON 12 | ||
146 | #define MC13783_IRQ_LOBATL 13 | ||
147 | #define MC13783_IRQ_LOBATH 14 | ||
148 | #define MC13783_IRQ_UDP 15 | ||
149 | #define MC13783_IRQ_USB 16 | ||
150 | #define MC13783_IRQ_ID 19 | ||
151 | #define MC13783_IRQ_SE1 21 | ||
152 | #define MC13783_IRQ_CKDET 22 | ||
153 | #define MC13783_IRQ_UDM 23 | ||
154 | #define MC13783_IRQ_1HZ 24 | ||
155 | #define MC13783_IRQ_TODA 25 | ||
156 | #define MC13783_IRQ_ONOFD1 27 | ||
157 | #define MC13783_IRQ_ONOFD2 28 | ||
158 | #define MC13783_IRQ_ONOFD3 29 | ||
159 | #define MC13783_IRQ_SYSRST 30 | ||
160 | #define MC13783_IRQ_RTCRST 31 | ||
161 | #define MC13783_IRQ_PC 32 | ||
162 | #define MC13783_IRQ_WARM 33 | ||
163 | #define MC13783_IRQ_MEMHLD 34 | ||
164 | #define MC13783_IRQ_PWRRDY 35 | ||
165 | #define MC13783_IRQ_THWARNL 36 | ||
166 | #define MC13783_IRQ_THWARNH 37 | ||
167 | #define MC13783_IRQ_CLK 38 | ||
168 | #define MC13783_IRQ_SEMAF 39 | ||
169 | #define MC13783_IRQ_MC2B 41 | ||
170 | #define MC13783_IRQ_HSDET 42 | ||
171 | #define MC13783_IRQ_HSL 43 | ||
172 | #define MC13783_IRQ_ALSPTH 44 | ||
173 | #define MC13783_IRQ_AHSSHORT 45 | ||
174 | #define MC13783_NUM_IRQ 46 | ||
84 | 175 | ||
176 | #endif /* __LINUX_MFD_MC13783_H */ | ||