Commit | Line | Data |
---|---|---|
4f724bea SI |
1 | /* |
2 | * Copyright (C) ST-Ericsson SA 2010 | |
3 | * | |
4 | * License Terms: GNU General Public License v2 | |
5 | * | |
a1e516e3 BJ |
6 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> |
7 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> | |
4f724bea SI |
8 | * |
9 | * MOP500 board specific initialization for regulators | |
10 | */ | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/regulator/machine.h> | |
a1e516e3 | 13 | #include <linux/regulator/ab8500.h> |
422d765d | 14 | #include <mach/id.h> /* to identify older boards for fixes */ |
d1de85a2 LW |
15 | #include "board-mop500-regulators.h" |
16 | ||
0b5ea1e2 LJ |
17 | static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { |
18 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | |
19 | }; | |
20 | ||
21 | struct regulator_init_data gpio_en_3v3_regulator = { | |
22 | .constraints = { | |
23 | .name = "EN-3V3", | |
24 | .min_uV = 3300000, | |
25 | .max_uV = 3300000, | |
26 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
27 | }, | |
28 | .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers), | |
29 | .consumer_supplies = gpio_en_3v3_consumers, | |
30 | }; | |
31 | ||
fe67dfc8 LW |
32 | /* |
33 | * TPS61052 regulator | |
34 | */ | |
35 | static struct regulator_consumer_supply tps61052_vaudio_consumers[] = { | |
36 | /* | |
37 | * Boost converter supply to raise voltage on audio speaker, this | |
38 | * is actually connected to three pins, VInVhfL (left amplifier) | |
39 | * VInVhfR (right amplifier) and VIntDClassInt - all three must | |
40 | * be connected to the same voltage. | |
41 | */ | |
42 | REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"), | |
43 | }; | |
44 | ||
45 | struct regulator_init_data tps61052_regulator = { | |
46 | .constraints = { | |
47 | .name = "vaudio-hf", | |
48 | .min_uV = 4500000, | |
49 | .max_uV = 4500000, | |
50 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
51 | }, | |
52 | .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers), | |
53 | .consumer_supplies = tps61052_vaudio_consumers, | |
54 | }; | |
55 | ||
d1de85a2 | 56 | static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { |
27f26de1 LJ |
57 | /* Main display, u8500 R3 uib */ |
58 | REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"), | |
59 | /* Main display, u8500 uib and ST uib */ | |
60 | REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"), | |
61 | /* Secondary display, ST uib */ | |
62 | REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"), | |
d1de85a2 LW |
63 | /* SFH7741 proximity sensor */ |
64 | REGULATOR_SUPPLY("vcc", "gpio-keys.0"), | |
65 | /* BH1780GLS ambient light sensor */ | |
66 | REGULATOR_SUPPLY("vcc", "2-0029"), | |
67 | /* lsm303dlh accelerometer */ | |
68 | REGULATOR_SUPPLY("vdd", "3-0018"), | |
cb6795ac LJ |
69 | /* lsm303dlhc accelerometer */ |
70 | REGULATOR_SUPPLY("vdd", "2-0019"), | |
d1de85a2 | 71 | /* lsm303dlh magnetometer */ |
cb6795ac | 72 | REGULATOR_SUPPLY("vdd", "2-001e"), |
d1de85a2 LW |
73 | /* Rohm BU21013 Touchscreen devices */ |
74 | REGULATOR_SUPPLY("avdd", "3-005c"), | |
75 | REGULATOR_SUPPLY("avdd", "3-005d"), | |
76 | /* Synaptics RMI4 Touchscreen device */ | |
77 | REGULATOR_SUPPLY("vdd", "3-004b"), | |
efb34d27 LJ |
78 | /* L3G4200D Gyroscope device */ |
79 | REGULATOR_SUPPLY("vdd", "2-0068"), | |
2d0266ab LJ |
80 | /* Ambient light sensor device */ |
81 | REGULATOR_SUPPLY("vdd", "3-0029"), | |
4336c1d2 LJ |
82 | /* Pressure sensor device */ |
83 | REGULATOR_SUPPLY("vdd", "2-005c"), | |
5379f026 LJ |
84 | /* Cypress TrueTouch Touchscreen device */ |
85 | REGULATOR_SUPPLY("vcpin", "spi8.0"), | |
fa679523 LJ |
86 | /* Camera device */ |
87 | REGULATOR_SUPPLY("vaux12v5", "mmio_camera"), | |
d1de85a2 LW |
88 | }; |
89 | ||
90 | static struct regulator_consumer_supply ab8500_vaux2_consumers[] = { | |
91 | /* On-board eMMC power */ | |
92 | REGULATOR_SUPPLY("vmmc", "sdi4"), | |
93 | /* AB8500 audio codec */ | |
94 | REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"), | |
95 | }; | |
96 | ||
97 | static struct regulator_consumer_supply ab8500_vaux3_consumers[] = { | |
98 | /* External MMC slot power */ | |
99 | REGULATOR_SUPPLY("vmmc", "sdi0"), | |
100 | }; | |
101 | ||
102 | static struct regulator_consumer_supply ab8500_vtvout_consumers[] = { | |
103 | /* TV-out DENC supply */ | |
104 | REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"), | |
105 | /* Internal general-purpose ADC */ | |
106 | REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), | |
107 | }; | |
108 | ||
29bd2ab8 OL |
109 | static struct regulator_consumer_supply ab8500_vaud_consumers[] = { |
110 | /* AB8500 audio-codec main supply */ | |
111 | REGULATOR_SUPPLY("vaud", "ab8500-codec.0"), | |
112 | }; | |
113 | ||
114 | static struct regulator_consumer_supply ab8500_vamic1_consumers[] = { | |
115 | /* AB8500 audio-codec Mic1 supply */ | |
116 | REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"), | |
117 | }; | |
118 | ||
119 | static struct regulator_consumer_supply ab8500_vamic2_consumers[] = { | |
120 | /* AB8500 audio-codec Mic2 supply */ | |
121 | REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"), | |
122 | }; | |
123 | ||
124 | static struct regulator_consumer_supply ab8500_vdmic_consumers[] = { | |
125 | /* AB8500 audio-codec DMic supply */ | |
126 | REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"), | |
127 | }; | |
128 | ||
d1de85a2 LW |
129 | static struct regulator_consumer_supply ab8500_vintcore_consumers[] = { |
130 | /* SoC core supply, no device */ | |
131 | REGULATOR_SUPPLY("v-intcore", NULL), | |
7c9d440e | 132 | /* USB Transceiver */ |
d1de85a2 LW |
133 | REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"), |
134 | }; | |
135 | ||
136 | static struct regulator_consumer_supply ab8500_vana_consumers[] = { | |
137 | /* External displays, connector on board, 1v8 power supply */ | |
138 | REGULATOR_SUPPLY("vsmps2", "mcde.0"), | |
139 | }; | |
4f724bea | 140 | |
dfa3a824 | 141 | /* ab8500 regulator register initialization */ |
732805a5 | 142 | static struct ab8500_regulator_reg_init ab8500_reg_init[] = { |
dfa3a824 BJ |
143 | /* |
144 | * VanaRequestCtrl = HP/LP depending on VxRequest | |
145 | * VextSupply1RequestCtrl = HP/LP depending on VxRequest | |
146 | */ | |
43a5911b | 147 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00), |
dfa3a824 BJ |
148 | /* |
149 | * VextSupply2RequestCtrl = HP/LP depending on VxRequest | |
150 | * VextSupply3RequestCtrl = HP/LP depending on VxRequest | |
151 | * Vaux1RequestCtrl = HP/LP depending on VxRequest | |
152 | * Vaux2RequestCtrl = HP/LP depending on VxRequest | |
153 | */ | |
3c1b8438 | 154 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00), |
dfa3a824 BJ |
155 | /* |
156 | * Vaux3RequestCtrl = HP/LP depending on VxRequest | |
157 | * SwHPReq = Control through SWValid disabled | |
158 | */ | |
3c1b8438 | 159 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00), |
dfa3a824 BJ |
160 | /* |
161 | * VanaSysClkReq1HPValid = disabled | |
162 | * Vaux1SysClkReq1HPValid = disabled | |
163 | * Vaux2SysClkReq1HPValid = disabled | |
164 | * Vaux3SysClkReq1HPValid = disabled | |
165 | */ | |
43a5911b | 166 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), |
dfa3a824 BJ |
167 | /* |
168 | * VextSupply1SysClkReq1HPValid = disabled | |
169 | * VextSupply2SysClkReq1HPValid = disabled | |
170 | * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled | |
171 | */ | |
3c1b8438 | 172 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40), |
dfa3a824 BJ |
173 | /* |
174 | * VanaHwHPReq1Valid = disabled | |
175 | * Vaux1HwHPreq1Valid = disabled | |
176 | * Vaux2HwHPReq1Valid = disabled | |
177 | * Vaux3HwHPReqValid = disabled | |
178 | */ | |
3c1b8438 | 179 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00), |
dfa3a824 BJ |
180 | /* |
181 | * VextSupply1HwHPReq1Valid = disabled | |
182 | * VextSupply2HwHPReq1Valid = disabled | |
183 | * VextSupply3HwHPReq1Valid = disabled | |
184 | */ | |
3c1b8438 | 185 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00), |
dfa3a824 BJ |
186 | /* |
187 | * VanaHwHPReq2Valid = disabled | |
188 | * Vaux1HwHPReq2Valid = disabled | |
189 | * Vaux2HwHPReq2Valid = disabled | |
190 | * Vaux3HwHPReq2Valid = disabled | |
191 | */ | |
3c1b8438 | 192 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00), |
dfa3a824 BJ |
193 | /* |
194 | * VextSupply1HwHPReq2Valid = disabled | |
195 | * VextSupply2HwHPReq2Valid = disabled | |
196 | * VextSupply3HwHPReq2Valid = HWReq2 controlled | |
197 | */ | |
3c1b8438 | 198 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04), |
dfa3a824 BJ |
199 | /* |
200 | * VanaSwHPReqValid = disabled | |
201 | * Vaux1SwHPReqValid = disabled | |
202 | */ | |
3c1b8438 | 203 | INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00), |
dfa3a824 BJ |
204 | /* |
205 | * Vaux2SwHPReqValid = disabled | |
206 | * Vaux3SwHPReqValid = disabled | |
207 | * VextSupply1SwHPReqValid = disabled | |
208 | * VextSupply2SwHPReqValid = disabled | |
209 | * VextSupply3SwHPReqValid = disabled | |
210 | */ | |
3c1b8438 | 211 | INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00), |
dfa3a824 BJ |
212 | /* |
213 | * SysClkReq2Valid1 = SysClkReq2 controlled | |
214 | * SysClkReq3Valid1 = disabled | |
215 | * SysClkReq4Valid1 = SysClkReq4 controlled | |
216 | * SysClkReq5Valid1 = disabled | |
217 | * SysClkReq6Valid1 = SysClkReq6 controlled | |
218 | * SysClkReq7Valid1 = disabled | |
219 | * SysClkReq8Valid1 = disabled | |
220 | */ | |
3c1b8438 | 221 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a), |
dfa3a824 BJ |
222 | /* |
223 | * SysClkReq2Valid2 = disabled | |
224 | * SysClkReq3Valid2 = disabled | |
225 | * SysClkReq4Valid2 = disabled | |
226 | * SysClkReq5Valid2 = disabled | |
227 | * SysClkReq6Valid2 = SysClkReq6 controlled | |
228 | * SysClkReq7Valid2 = disabled | |
229 | * SysClkReq8Valid2 = disabled | |
230 | */ | |
3c1b8438 | 231 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20), |
dfa3a824 BJ |
232 | /* |
233 | * VTVoutEna = disabled | |
234 | * Vintcore12Ena = disabled | |
235 | * Vintcore12Sel = 1.25 V | |
236 | * Vintcore12LP = inactive (HP) | |
237 | * VTVoutLP = inactive (HP) | |
238 | */ | |
3c1b8438 | 239 | INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10), |
dfa3a824 BJ |
240 | /* |
241 | * VaudioEna = disabled | |
242 | * VdmicEna = disabled | |
243 | * Vamic1Ena = disabled | |
244 | * Vamic2Ena = disabled | |
245 | */ | |
3c1b8438 | 246 | INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00), |
dfa3a824 BJ |
247 | /* |
248 | * Vamic1_dzout = high-Z when Vamic1 is disabled | |
249 | * Vamic2_dzout = high-Z when Vamic2 is disabled | |
250 | */ | |
3c1b8438 | 251 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00), |
d79df329 | 252 | /* |
43a5911b | 253 | * VPll = Hw controlled (NOTE! PRCMU bits) |
dfa3a824 BJ |
254 | * VanaRegu = force off |
255 | */ | |
3c1b8438 | 256 | INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02), |
dfa3a824 BJ |
257 | /* |
258 | * VrefDDREna = disabled | |
259 | * VrefDDRSleepMode = inactive (no pulldown) | |
260 | */ | |
3c1b8438 | 261 | INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), |
dfa3a824 | 262 | /* |
a387ac5f LJ |
263 | * VextSupply1Regu = force LP |
264 | * VextSupply2Regu = force OFF | |
265 | * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) | |
dfa3a824 BJ |
266 | * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 |
267 | * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 | |
268 | */ | |
a387ac5f | 269 | INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), |
dfa3a824 BJ |
270 | /* |
271 | * Vaux1Regu = force HP | |
272 | * Vaux2Regu = force off | |
273 | */ | |
3c1b8438 | 274 | INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01), |
dfa3a824 | 275 | /* |
d79df329 | 276 | * Vaux3Regu = force off |
dfa3a824 | 277 | */ |
43a5911b | 278 | INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00), |
dfa3a824 BJ |
279 | /* |
280 | * Vaux1Sel = 2.5 V | |
281 | */ | |
3c1b8438 | 282 | INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x08), |
dfa3a824 BJ |
283 | /* |
284 | * Vaux2Sel = 2.9 V | |
285 | */ | |
3c1b8438 | 286 | INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d), |
dfa3a824 BJ |
287 | /* |
288 | * Vaux3Sel = 2.91 V | |
289 | */ | |
3c1b8438 | 290 | INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07), |
dfa3a824 BJ |
291 | /* |
292 | * VextSupply12LP = disabled (no LP) | |
293 | */ | |
3c1b8438 | 294 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00), |
dfa3a824 BJ |
295 | /* |
296 | * Vaux1Disch = short discharge time | |
297 | * Vaux2Disch = short discharge time | |
298 | * Vaux3Disch = short discharge time | |
299 | * Vintcore12Disch = short discharge time | |
300 | * VTVoutDisch = short discharge time | |
301 | * VaudioDisch = short discharge time | |
302 | */ | |
3c1b8438 | 303 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00), |
dfa3a824 BJ |
304 | /* |
305 | * VanaDisch = short discharge time | |
306 | * VdmicPullDownEna = pulldown disabled when Vdmic is disabled | |
307 | * VdmicDisch = short discharge time | |
308 | */ | |
3c1b8438 | 309 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00), |
dfa3a824 BJ |
310 | }; |
311 | ||
a1e516e3 | 312 | /* AB8500 regulators */ |
732805a5 | 313 | static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { |
a1e516e3 BJ |
314 | /* supplies to the display/camera */ |
315 | [AB8500_LDO_AUX1] = { | |
316 | .constraints = { | |
317 | .name = "V-DISPLAY", | |
318 | .min_uV = 2500000, | |
319 | .max_uV = 2900000, | |
320 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
321 | REGULATOR_CHANGE_STATUS, | |
db24520f LW |
322 | .boot_on = 1, /* display is on at boot */ |
323 | /* | |
324 | * This voltage cannot be disabled right now because | |
325 | * it is somehow affecting the external MMC | |
326 | * functionality, though that typically will use | |
327 | * AUX3. | |
328 | */ | |
329 | .always_on = 1, | |
a1e516e3 | 330 | }, |
d1de85a2 LW |
331 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), |
332 | .consumer_supplies = ab8500_vaux1_consumers, | |
4f724bea | 333 | }, |
a1e516e3 BJ |
334 | /* supplies to the on-board eMMC */ |
335 | [AB8500_LDO_AUX2] = { | |
336 | .constraints = { | |
337 | .name = "V-eMMC1", | |
338 | .min_uV = 1100000, | |
339 | .max_uV = 3300000, | |
340 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
341 | REGULATOR_CHANGE_STATUS, | |
342 | }, | |
d1de85a2 LW |
343 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), |
344 | .consumer_supplies = ab8500_vaux2_consumers, | |
4f724bea | 345 | }, |
a1e516e3 BJ |
346 | /* supply for VAUX3, supplies to SDcard slots */ |
347 | [AB8500_LDO_AUX3] = { | |
348 | .constraints = { | |
349 | .name = "V-MMC-SD", | |
350 | .min_uV = 1100000, | |
351 | .max_uV = 3300000, | |
352 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
353 | REGULATOR_CHANGE_STATUS, | |
354 | }, | |
d1de85a2 LW |
355 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), |
356 | .consumer_supplies = ab8500_vaux3_consumers, | |
4f724bea | 357 | }, |
a1e516e3 BJ |
358 | /* supply for tvout, gpadc, TVOUT LDO */ |
359 | [AB8500_LDO_TVOUT] = { | |
360 | .constraints = { | |
361 | .name = "V-TVOUT", | |
362 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
363 | }, | |
d1de85a2 LW |
364 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers), |
365 | .consumer_supplies = ab8500_vtvout_consumers, | |
4f724bea | 366 | }, |
a1e516e3 BJ |
367 | /* supply for ab8500-vaudio, VAUDIO LDO */ |
368 | [AB8500_LDO_AUDIO] = { | |
369 | .constraints = { | |
370 | .name = "V-AUD", | |
371 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
372 | }, | |
29bd2ab8 OL |
373 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), |
374 | .consumer_supplies = ab8500_vaud_consumers, | |
4f724bea | 375 | }, |
a1e516e3 BJ |
376 | /* supply for v-anamic1 VAMic1-LDO */ |
377 | [AB8500_LDO_ANAMIC1] = { | |
378 | .constraints = { | |
379 | .name = "V-AMIC1", | |
380 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
381 | }, | |
29bd2ab8 OL |
382 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), |
383 | .consumer_supplies = ab8500_vamic1_consumers, | |
4f724bea | 384 | }, |
a1e516e3 BJ |
385 | /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ |
386 | [AB8500_LDO_ANAMIC2] = { | |
387 | .constraints = { | |
388 | .name = "V-AMIC2", | |
389 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
390 | }, | |
29bd2ab8 OL |
391 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), |
392 | .consumer_supplies = ab8500_vamic2_consumers, | |
4f724bea | 393 | }, |
a1e516e3 BJ |
394 | /* supply for v-dmic, VDMIC LDO */ |
395 | [AB8500_LDO_DMIC] = { | |
396 | .constraints = { | |
397 | .name = "V-DMIC", | |
398 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
399 | }, | |
29bd2ab8 OL |
400 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers), |
401 | .consumer_supplies = ab8500_vdmic_consumers, | |
4f724bea | 402 | }, |
a1e516e3 BJ |
403 | /* supply for v-intcore12, VINTCORE12 LDO */ |
404 | [AB8500_LDO_INTCORE] = { | |
405 | .constraints = { | |
406 | .name = "V-INTCORE", | |
407 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
408 | }, | |
d1de85a2 LW |
409 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), |
410 | .consumer_supplies = ab8500_vintcore_consumers, | |
4f724bea | 411 | }, |
a1e516e3 BJ |
412 | /* supply for U8500 CSI/DSI, VANA LDO */ |
413 | [AB8500_LDO_ANA] = { | |
414 | .constraints = { | |
415 | .name = "V-CSI/DSI", | |
416 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
417 | }, | |
d1de85a2 LW |
418 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), |
419 | .consumer_supplies = ab8500_vana_consumers, | |
4f724bea SI |
420 | }, |
421 | }; | |
732805a5 | 422 | |
a387ac5f LJ |
423 | /* supply for VextSupply3 */ |
424 | static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { | |
425 | /* SIM supply for 3 V SIM cards */ | |
426 | REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), | |
427 | }; | |
428 | ||
429 | /* extended configuration for VextSupply2, only used for HREFP_V20 boards */ | |
430 | static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = { | |
431 | .hwreq = true, | |
432 | }; | |
433 | ||
434 | /* | |
435 | * AB8500 external regulators | |
436 | */ | |
437 | static struct regulator_init_data ab8500_ext_regulators[] = { | |
438 | /* fixed Vbat supplies VSMPS1_EXT_1V8 */ | |
439 | [AB8500_EXT_SUPPLY1] = { | |
440 | .constraints = { | |
441 | .name = "ab8500-ext-supply1", | |
442 | .min_uV = 1800000, | |
443 | .max_uV = 1800000, | |
444 | .initial_mode = REGULATOR_MODE_IDLE, | |
445 | .boot_on = 1, | |
446 | .always_on = 1, | |
447 | }, | |
448 | }, | |
449 | /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ | |
450 | [AB8500_EXT_SUPPLY2] = { | |
451 | .constraints = { | |
452 | .name = "ab8500-ext-supply2", | |
453 | .min_uV = 1360000, | |
454 | .max_uV = 1360000, | |
455 | }, | |
456 | }, | |
457 | /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ | |
458 | [AB8500_EXT_SUPPLY3] = { | |
459 | .constraints = { | |
460 | .name = "ab8500-ext-supply3", | |
461 | .min_uV = 3400000, | |
462 | .max_uV = 3400000, | |
463 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
464 | .boot_on = 1, | |
465 | }, | |
466 | .num_consumer_supplies = | |
467 | ARRAY_SIZE(ab8500_ext_supply3_consumers), | |
468 | .consumer_supplies = ab8500_ext_supply3_consumers, | |
469 | }, | |
470 | }; | |
471 | ||
732805a5 BJ |
472 | struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { |
473 | .reg_init = ab8500_reg_init, | |
474 | .num_reg_init = ARRAY_SIZE(ab8500_reg_init), | |
475 | .regulator = ab8500_regulators, | |
476 | .num_regulator = ARRAY_SIZE(ab8500_regulators), | |
a387ac5f LJ |
477 | .ext_regulator = ab8500_ext_regulators, |
478 | .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), | |
732805a5 | 479 | }; |
a1d49480 LJ |
480 | |
481 | static void ab8500_modify_reg_init(int id, u8 mask, u8 value) | |
482 | { | |
483 | int i; | |
484 | ||
485 | for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) { | |
486 | if (ab8500_reg_init[i].id == id) { | |
487 | u8 initval = ab8500_reg_init[i].value; | |
488 | initval = (initval & ~mask) | (value & mask); | |
489 | ab8500_reg_init[i].value = initval; | |
490 | ||
491 | BUG_ON(mask & ~ab8500_reg_init[i].mask); | |
492 | return; | |
493 | } | |
494 | } | |
495 | ||
496 | BUG_ON(1); | |
497 | } | |
422d765d LJ |
498 | |
499 | void mop500_regulator_init(void) | |
500 | { | |
501 | struct regulator_init_data *regulator; | |
502 | ||
503 | /* | |
504 | * Handle VextSupply1 on older boards than HREFP_V22_V1x | |
505 | * (turn off in suspend) | |
506 | */ | |
507 | if (cpu_is_u8500v20() || cpu_is_u8500v21()) { | |
508 | /* disable VextSupply1 in suspend */ | |
509 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY1]; | |
510 | regulator->constraints.state_mem.disabled = 1; | |
511 | regulator->constraints.state_standby.disabled = 1; | |
512 | } | |
513 | } |