2 * Copyright 2009 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
9 #ifndef __LINUX_MFD_MC13783_H
10 #define __LINUX_MFD_MC13783_H
12 #include <linux/interrupt.h>
16 void mc13783_lock(struct mc13783 *mc13783);
17 void mc13783_unlock(struct mc13783 *mc13783);
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,
24 int mc13783_get_flags(struct mc13783 *mc13783);
26 int mc13783_irq_request(struct mc13783 *mc13783, int irq,
27 irq_handler_t handler, const char *name, void *dev);
28 int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
29 irq_handler_t handler, const char *name, void *dev);
30 int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev);
32 int mc13783_irq_mask(struct mc13783 *mc13783, int irq);
33 int mc13783_irq_unmask(struct mc13783 *mc13783, int irq);
34 int mc13783_irq_status(struct mc13783 *mc13783, int irq,
35 int *enabled, int *pending);
36 int mc13783_irq_ack(struct mc13783 *mc13783, int irq);
38 static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated;
39 static inline int mc13783_mask(struct mc13783 *mc13783, int irq)
41 return mc13783_irq_mask(mc13783, irq);
44 static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated;
45 static inline int mc13783_unmask(struct mc13783 *mc13783, int irq)
47 return mc13783_irq_unmask(mc13783, irq);
50 static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated;
51 static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
53 return mc13783_irq_ack(mc13783, irq);
56 #define MC13783_ADC0 43
57 #define MC13783_ADC0_ADREFEN (1 << 10)
58 #define MC13783_ADC0_ADREFMODE (1 << 11)
59 #define MC13783_ADC0_TSMOD0 (1 << 12)
60 #define MC13783_ADC0_TSMOD1 (1 << 13)
61 #define MC13783_ADC0_TSMOD2 (1 << 14)
62 #define MC13783_ADC0_ADINC1 (1 << 16)
63 #define MC13783_ADC0_ADINC2 (1 << 17)
65 #define MC13783_ADC0_TSMOD_MASK (MC13783_ADC0_TSMOD0 | \
66 MC13783_ADC0_TSMOD1 | \
69 struct mc13783_led_platform_data {
70 #define MC13783_LED_MD 0
71 #define MC13783_LED_AD 1
72 #define MC13783_LED_KP 2
73 #define MC13783_LED_R1 3
74 #define MC13783_LED_G1 4
75 #define MC13783_LED_B1 5
76 #define MC13783_LED_R2 6
77 #define MC13783_LED_G2 7
78 #define MC13783_LED_B2 8
79 #define MC13783_LED_R3 9
80 #define MC13783_LED_G3 10
81 #define MC13783_LED_B3 11
82 #define MC13783_LED_MAX MC13783_LED_B3
85 const char *default_trigger;
87 /* Three or two bits current selection depending on the led */
91 struct mc13783_leds_platform_data {
93 struct mc13783_led_platform_data *led;
95 #define MC13783_LED_TRIODE_MD (1 << 0)
96 #define MC13783_LED_TRIODE_AD (1 << 1)
97 #define MC13783_LED_TRIODE_KP (1 << 2)
98 #define MC13783_LED_BOOST_EN (1 << 3)
99 #define MC13783_LED_TC1HALF (1 << 4)
100 #define MC13783_LED_SLEWLIMTC (1 << 5)
101 #define MC13783_LED_SLEWLIMBL (1 << 6)
102 #define MC13783_LED_TRIODE_TC1 (1 << 7)
103 #define MC13783_LED_TRIODE_TC2 (1 << 8)
104 #define MC13783_LED_TRIODE_TC3 (1 << 9)
107 #define MC13783_LED_AB_DISABLED 0
108 #define MC13783_LED_AB_MD1 1
109 #define MC13783_LED_AB_MD12 2
110 #define MC13783_LED_AB_MD123 3
111 #define MC13783_LED_AB_MD1234 4
112 #define MC13783_LED_AB_MD1234_AD1 5
113 #define MC13783_LED_AB_MD1234_AD12 6
114 #define MC13783_LED_AB_MD1_AD 7
117 #define MC13783_LED_ABREF_200MV 0
118 #define MC13783_LED_ABREF_400MV 1
119 #define MC13783_LED_ABREF_600MV 2
120 #define MC13783_LED_ABREF_800MV 3
123 #define MC13783_LED_PERIOD_10MS 0
124 #define MC13783_LED_PERIOD_100MS 1
125 #define MC13783_LED_PERIOD_500MS 2
126 #define MC13783_LED_PERIOD_2S 3
133 /* to be cleaned up */
134 struct regulator_init_data;
136 struct mc13783_regulator_init_data {
138 struct regulator_init_data *init_data;
141 struct mc13783_regulator_platform_data {
143 struct mc13783_regulator_init_data *regulators;
146 struct mc13783_platform_data {
148 struct mc13783_regulator_init_data *regulators;
149 struct mc13783_leds_platform_data *leds;
151 #define MC13783_USE_TOUCHSCREEN (1 << 0)
152 #define MC13783_USE_CODEC (1 << 1)
153 #define MC13783_USE_ADC (1 << 2)
154 #define MC13783_USE_RTC (1 << 3)
155 #define MC13783_USE_REGULATOR (1 << 4)
156 #define MC13783_USE_LED (1 << 5)
160 #define MC13783_ADC_MODE_TS 1
161 #define MC13783_ADC_MODE_SINGLE_CHAN 2
162 #define MC13783_ADC_MODE_MULT_CHAN 3
164 int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
165 unsigned int channel, unsigned int *sample);
168 #define MC13783_SW_SW1A 0
169 #define MC13783_SW_SW1B 1
170 #define MC13783_SW_SW2A 2
171 #define MC13783_SW_SW2B 3
172 #define MC13783_SW_SW3 4
173 #define MC13783_SW_PLL 5
174 #define MC13783_REGU_VAUDIO 6
175 #define MC13783_REGU_VIOHI 7
176 #define MC13783_REGU_VIOLO 8
177 #define MC13783_REGU_VDIG 9
178 #define MC13783_REGU_VGEN 10
179 #define MC13783_REGU_VRFDIG 11
180 #define MC13783_REGU_VRFREF 12
181 #define MC13783_REGU_VRFCP 13
182 #define MC13783_REGU_VSIM 14
183 #define MC13783_REGU_VESIM 15
184 #define MC13783_REGU_VCAM 16
185 #define MC13783_REGU_VRFBG 17
186 #define MC13783_REGU_VVIB 18
187 #define MC13783_REGU_VRF1 19
188 #define MC13783_REGU_VRF2 20
189 #define MC13783_REGU_VMMC1 21
190 #define MC13783_REGU_VMMC2 22
191 #define MC13783_REGU_GPO1 23
192 #define MC13783_REGU_GPO2 24
193 #define MC13783_REGU_GPO3 25
194 #define MC13783_REGU_GPO4 26
195 #define MC13783_REGU_V1 27
196 #define MC13783_REGU_V2 28
197 #define MC13783_REGU_V3 29
198 #define MC13783_REGU_V4 30
199 #define MC13783_REGU_PWGT1SPI 31
200 #define MC13783_REGU_PWGT2SPI 32
202 #define MC13783_IRQ_ADCDONE 0
203 #define MC13783_IRQ_ADCBISDONE 1
204 #define MC13783_IRQ_TS 2
205 #define MC13783_IRQ_WHIGH 3
206 #define MC13783_IRQ_WLOW 4
207 #define MC13783_IRQ_CHGDET 6
208 #define MC13783_IRQ_CHGOV 7
209 #define MC13783_IRQ_CHGREV 8
210 #define MC13783_IRQ_CHGSHORT 9
211 #define MC13783_IRQ_CCCV 10
212 #define MC13783_IRQ_CHGCURR 11
213 #define MC13783_IRQ_BPON 12
214 #define MC13783_IRQ_LOBATL 13
215 #define MC13783_IRQ_LOBATH 14
216 #define MC13783_IRQ_UDP 15
217 #define MC13783_IRQ_USB 16
218 #define MC13783_IRQ_ID 19
219 #define MC13783_IRQ_SE1 21
220 #define MC13783_IRQ_CKDET 22
221 #define MC13783_IRQ_UDM 23
222 #define MC13783_IRQ_1HZ 24
223 #define MC13783_IRQ_TODA 25
224 #define MC13783_IRQ_ONOFD1 27
225 #define MC13783_IRQ_ONOFD2 28
226 #define MC13783_IRQ_ONOFD3 29
227 #define MC13783_IRQ_SYSRST 30
228 #define MC13783_IRQ_RTCRST 31
229 #define MC13783_IRQ_PC 32
230 #define MC13783_IRQ_WARM 33
231 #define MC13783_IRQ_MEMHLD 34
232 #define MC13783_IRQ_PWRRDY 35
233 #define MC13783_IRQ_THWARNL 36
234 #define MC13783_IRQ_THWARNH 37
235 #define MC13783_IRQ_CLK 38
236 #define MC13783_IRQ_SEMAF 39
237 #define MC13783_IRQ_MC2B 41
238 #define MC13783_IRQ_HSDET 42
239 #define MC13783_IRQ_HSL 43
240 #define MC13783_IRQ_ALSPTH 44
241 #define MC13783_IRQ_AHSSHORT 45
242 #define MC13783_NUM_IRQ 46
244 #endif /* __LINUX_MFD_MC13783_H */