mfd: Remove deprecated mc13783 functions
[platform/adaptation/renesas_rcar/renesas_kernel.git] / include / linux / mfd / mc13783.h
1 /*
2  * Copyright 2009 Pengutronix
3  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4  *
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.
8  */
9 #ifndef __LINUX_MFD_MC13783_H
10 #define __LINUX_MFD_MC13783_H
11
12 #include <linux/interrupt.h>
13
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_get_flags(struct mc13783 *mc13783);
25
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);
31
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);
37
38 #define MC13783_ADC0            43
39 #define MC13783_ADC0_ADREFEN            (1 << 10)
40 #define MC13783_ADC0_ADREFMODE          (1 << 11)
41 #define MC13783_ADC0_TSMOD0             (1 << 12)
42 #define MC13783_ADC0_TSMOD1             (1 << 13)
43 #define MC13783_ADC0_TSMOD2             (1 << 14)
44 #define MC13783_ADC0_ADINC1             (1 << 16)
45 #define MC13783_ADC0_ADINC2             (1 << 17)
46
47 #define MC13783_ADC0_TSMOD_MASK         (MC13783_ADC0_TSMOD0 | \
48                                         MC13783_ADC0_TSMOD1 | \
49                                         MC13783_ADC0_TSMOD2)
50
51 struct mc13783_led_platform_data {
52 #define MC13783_LED_MD          0
53 #define MC13783_LED_AD          1
54 #define MC13783_LED_KP          2
55 #define MC13783_LED_R1          3
56 #define MC13783_LED_G1          4
57 #define MC13783_LED_B1          5
58 #define MC13783_LED_R2          6
59 #define MC13783_LED_G2          7
60 #define MC13783_LED_B2          8
61 #define MC13783_LED_R3          9
62 #define MC13783_LED_G3          10
63 #define MC13783_LED_B3          11
64 #define MC13783_LED_MAX MC13783_LED_B3
65         int id;
66         const char *name;
67         const char *default_trigger;
68
69 /* Three or two bits current selection depending on the led */
70         char max_current;
71 };
72
73 struct mc13783_leds_platform_data {
74         int num_leds;
75         struct mc13783_led_platform_data *led;
76
77 #define MC13783_LED_TRIODE_MD   (1 << 0)
78 #define MC13783_LED_TRIODE_AD   (1 << 1)
79 #define MC13783_LED_TRIODE_KP   (1 << 2)
80 #define MC13783_LED_BOOST_EN    (1 << 3)
81 #define MC13783_LED_TC1HALF     (1 << 4)
82 #define MC13783_LED_SLEWLIMTC   (1 << 5)
83 #define MC13783_LED_SLEWLIMBL   (1 << 6)
84 #define MC13783_LED_TRIODE_TC1  (1 << 7)
85 #define MC13783_LED_TRIODE_TC2  (1 << 8)
86 #define MC13783_LED_TRIODE_TC3  (1 << 9)
87         int flags;
88
89 #define MC13783_LED_AB_DISABLED         0
90 #define MC13783_LED_AB_MD1              1
91 #define MC13783_LED_AB_MD12             2
92 #define MC13783_LED_AB_MD123            3
93 #define MC13783_LED_AB_MD1234           4
94 #define MC13783_LED_AB_MD1234_AD1       5
95 #define MC13783_LED_AB_MD1234_AD12      6
96 #define MC13783_LED_AB_MD1_AD           7
97         char abmode;
98
99 #define MC13783_LED_ABREF_200MV 0
100 #define MC13783_LED_ABREF_400MV 1
101 #define MC13783_LED_ABREF_600MV 2
102 #define MC13783_LED_ABREF_800MV 3
103         char abref;
104
105 #define MC13783_LED_PERIOD_10MS         0
106 #define MC13783_LED_PERIOD_100MS        1
107 #define MC13783_LED_PERIOD_500MS        2
108 #define MC13783_LED_PERIOD_2S           3
109         char bl_period;
110         char tc1_period;
111         char tc2_period;
112         char tc3_period;
113 };
114
115 /* to be cleaned up */
116 struct regulator_init_data;
117
118 struct mc13783_regulator_init_data {
119         int id;
120         struct regulator_init_data *init_data;
121 };
122
123 struct mc13783_regulator_platform_data {
124         int num_regulators;
125         struct mc13783_regulator_init_data *regulators;
126 };
127
128 struct mc13783_platform_data {
129         int num_regulators;
130         struct mc13783_regulator_init_data *regulators;
131         struct mc13783_leds_platform_data *leds;
132
133 #define MC13783_USE_TOUCHSCREEN (1 << 0)
134 #define MC13783_USE_CODEC       (1 << 1)
135 #define MC13783_USE_ADC         (1 << 2)
136 #define MC13783_USE_RTC         (1 << 3)
137 #define MC13783_USE_REGULATOR   (1 << 4)
138 #define MC13783_USE_LED         (1 << 5)
139         unsigned int flags;
140 };
141
142 #define MC13783_ADC_MODE_TS             1
143 #define MC13783_ADC_MODE_SINGLE_CHAN    2
144 #define MC13783_ADC_MODE_MULT_CHAN      3
145
146 int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
147                 unsigned int channel, unsigned int *sample);
148
149
150 #define MC13783_SW_SW1A         0
151 #define MC13783_SW_SW1B         1
152 #define MC13783_SW_SW2A         2
153 #define MC13783_SW_SW2B         3
154 #define MC13783_SW_SW3          4
155 #define MC13783_SW_PLL          5
156 #define MC13783_REGU_VAUDIO     6
157 #define MC13783_REGU_VIOHI      7
158 #define MC13783_REGU_VIOLO      8
159 #define MC13783_REGU_VDIG       9
160 #define MC13783_REGU_VGEN       10
161 #define MC13783_REGU_VRFDIG     11
162 #define MC13783_REGU_VRFREF     12
163 #define MC13783_REGU_VRFCP      13
164 #define MC13783_REGU_VSIM       14
165 #define MC13783_REGU_VESIM      15
166 #define MC13783_REGU_VCAM       16
167 #define MC13783_REGU_VRFBG      17
168 #define MC13783_REGU_VVIB       18
169 #define MC13783_REGU_VRF1       19
170 #define MC13783_REGU_VRF2       20
171 #define MC13783_REGU_VMMC1      21
172 #define MC13783_REGU_VMMC2      22
173 #define MC13783_REGU_GPO1       23
174 #define MC13783_REGU_GPO2       24
175 #define MC13783_REGU_GPO3       25
176 #define MC13783_REGU_GPO4       26
177 #define MC13783_REGU_V1         27
178 #define MC13783_REGU_V2         28
179 #define MC13783_REGU_V3         29
180 #define MC13783_REGU_V4         30
181 #define MC13783_REGU_PWGT1SPI   31
182 #define MC13783_REGU_PWGT2SPI   32
183
184 #define MC13783_IRQ_ADCDONE     0
185 #define MC13783_IRQ_ADCBISDONE  1
186 #define MC13783_IRQ_TS          2
187 #define MC13783_IRQ_WHIGH       3
188 #define MC13783_IRQ_WLOW        4
189 #define MC13783_IRQ_CHGDET      6
190 #define MC13783_IRQ_CHGOV       7
191 #define MC13783_IRQ_CHGREV      8
192 #define MC13783_IRQ_CHGSHORT    9
193 #define MC13783_IRQ_CCCV        10
194 #define MC13783_IRQ_CHGCURR     11
195 #define MC13783_IRQ_BPON        12
196 #define MC13783_IRQ_LOBATL      13
197 #define MC13783_IRQ_LOBATH      14
198 #define MC13783_IRQ_UDP         15
199 #define MC13783_IRQ_USB         16
200 #define MC13783_IRQ_ID          19
201 #define MC13783_IRQ_SE1         21
202 #define MC13783_IRQ_CKDET       22
203 #define MC13783_IRQ_UDM         23
204 #define MC13783_IRQ_1HZ         24
205 #define MC13783_IRQ_TODA        25
206 #define MC13783_IRQ_ONOFD1      27
207 #define MC13783_IRQ_ONOFD2      28
208 #define MC13783_IRQ_ONOFD3      29
209 #define MC13783_IRQ_SYSRST      30
210 #define MC13783_IRQ_RTCRST      31
211 #define MC13783_IRQ_PC          32
212 #define MC13783_IRQ_WARM        33
213 #define MC13783_IRQ_MEMHLD      34
214 #define MC13783_IRQ_PWRRDY      35
215 #define MC13783_IRQ_THWARNL     36
216 #define MC13783_IRQ_THWARNH     37
217 #define MC13783_IRQ_CLK         38
218 #define MC13783_IRQ_SEMAF       39
219 #define MC13783_IRQ_MC2B        41
220 #define MC13783_IRQ_HSDET       42
221 #define MC13783_IRQ_HSL         43
222 #define MC13783_IRQ_ALSPTH      44
223 #define MC13783_IRQ_AHSSHORT    45
224 #define MC13783_NUM_IRQ         46
225
226 #endif /* __LINUX_MFD_MC13783_H */