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> | |
547f384f | 8 | * Daniel Willerud <daniel.willerud@stericsson.com> |
4f724bea SI |
9 | * |
10 | * MOP500 board specific initialization for regulators | |
11 | */ | |
12 | #include <linux/kernel.h> | |
13 | #include <linux/regulator/machine.h> | |
a1e516e3 | 14 | #include <linux/regulator/ab8500.h> |
d1de85a2 | 15 | #include "board-mop500-regulators.h" |
0fbc8007 | 16 | #include "id.h" |
d1de85a2 | 17 | |
0b5ea1e2 LJ |
18 | static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { |
19 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | |
20 | }; | |
21 | ||
22 | struct regulator_init_data gpio_en_3v3_regulator = { | |
23 | .constraints = { | |
24 | .name = "EN-3V3", | |
25 | .min_uV = 3300000, | |
26 | .max_uV = 3300000, | |
27 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
28 | }, | |
29 | .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers), | |
30 | .consumer_supplies = gpio_en_3v3_consumers, | |
31 | }; | |
32 | ||
fe67dfc8 LW |
33 | /* |
34 | * TPS61052 regulator | |
35 | */ | |
36 | static struct regulator_consumer_supply tps61052_vaudio_consumers[] = { | |
37 | /* | |
38 | * Boost converter supply to raise voltage on audio speaker, this | |
39 | * is actually connected to three pins, VInVhfL (left amplifier) | |
40 | * VInVhfR (right amplifier) and VIntDClassInt - all three must | |
41 | * be connected to the same voltage. | |
42 | */ | |
43 | REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"), | |
44 | }; | |
45 | ||
46 | struct regulator_init_data tps61052_regulator = { | |
47 | .constraints = { | |
48 | .name = "vaudio-hf", | |
49 | .min_uV = 4500000, | |
50 | .max_uV = 4500000, | |
51 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
52 | }, | |
53 | .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers), | |
54 | .consumer_supplies = tps61052_vaudio_consumers, | |
55 | }; | |
56 | ||
d1de85a2 | 57 | static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { |
27f26de1 LJ |
58 | /* Main display, u8500 R3 uib */ |
59 | REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"), | |
60 | /* Main display, u8500 uib and ST uib */ | |
61 | REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"), | |
62 | /* Secondary display, ST uib */ | |
63 | REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"), | |
d1de85a2 LW |
64 | /* SFH7741 proximity sensor */ |
65 | REGULATOR_SUPPLY("vcc", "gpio-keys.0"), | |
66 | /* BH1780GLS ambient light sensor */ | |
67 | REGULATOR_SUPPLY("vcc", "2-0029"), | |
68 | /* lsm303dlh accelerometer */ | |
69 | REGULATOR_SUPPLY("vdd", "3-0018"), | |
cb6795ac LJ |
70 | /* lsm303dlhc accelerometer */ |
71 | REGULATOR_SUPPLY("vdd", "2-0019"), | |
d1de85a2 | 72 | /* lsm303dlh magnetometer */ |
cb6795ac | 73 | REGULATOR_SUPPLY("vdd", "2-001e"), |
d1de85a2 LW |
74 | /* Rohm BU21013 Touchscreen devices */ |
75 | REGULATOR_SUPPLY("avdd", "3-005c"), | |
76 | REGULATOR_SUPPLY("avdd", "3-005d"), | |
77 | /* Synaptics RMI4 Touchscreen device */ | |
78 | REGULATOR_SUPPLY("vdd", "3-004b"), | |
efb34d27 LJ |
79 | /* L3G4200D Gyroscope device */ |
80 | REGULATOR_SUPPLY("vdd", "2-0068"), | |
2d0266ab LJ |
81 | /* Ambient light sensor device */ |
82 | REGULATOR_SUPPLY("vdd", "3-0029"), | |
4336c1d2 LJ |
83 | /* Pressure sensor device */ |
84 | REGULATOR_SUPPLY("vdd", "2-005c"), | |
5379f026 LJ |
85 | /* Cypress TrueTouch Touchscreen device */ |
86 | REGULATOR_SUPPLY("vcpin", "spi8.0"), | |
fa679523 LJ |
87 | /* Camera device */ |
88 | REGULATOR_SUPPLY("vaux12v5", "mmio_camera"), | |
d1de85a2 LW |
89 | }; |
90 | ||
91 | static struct regulator_consumer_supply ab8500_vaux2_consumers[] = { | |
92 | /* On-board eMMC power */ | |
93 | REGULATOR_SUPPLY("vmmc", "sdi4"), | |
94 | /* AB8500 audio codec */ | |
95 | REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"), | |
96 | }; | |
97 | ||
98 | static struct regulator_consumer_supply ab8500_vaux3_consumers[] = { | |
99 | /* External MMC slot power */ | |
100 | REGULATOR_SUPPLY("vmmc", "sdi0"), | |
101 | }; | |
102 | ||
547f384f LJ |
103 | static struct regulator_consumer_supply ab8505_vaux4_consumers[] = { |
104 | }; | |
105 | ||
106 | static struct regulator_consumer_supply ab8505_vaux5_consumers[] = { | |
107 | }; | |
108 | ||
109 | static struct regulator_consumer_supply ab8505_vaux6_consumers[] = { | |
110 | }; | |
111 | ||
112 | static struct regulator_consumer_supply ab8505_vaux8_consumers[] = { | |
113 | /* AB8500 audio codec device */ | |
114 | REGULATOR_SUPPLY("v-aux8", NULL), | |
115 | }; | |
116 | ||
117 | static struct regulator_consumer_supply ab8505_vadc_consumers[] = { | |
118 | /* Internal general-purpose ADC */ | |
119 | REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), | |
120 | /* ADC for charger */ | |
121 | REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"), | |
122 | }; | |
123 | ||
d1de85a2 LW |
124 | static struct regulator_consumer_supply ab8500_vtvout_consumers[] = { |
125 | /* TV-out DENC supply */ | |
126 | REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"), | |
127 | /* Internal general-purpose ADC */ | |
128 | REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), | |
129 | }; | |
130 | ||
29bd2ab8 OL |
131 | static struct regulator_consumer_supply ab8500_vaud_consumers[] = { |
132 | /* AB8500 audio-codec main supply */ | |
133 | REGULATOR_SUPPLY("vaud", "ab8500-codec.0"), | |
134 | }; | |
135 | ||
136 | static struct regulator_consumer_supply ab8500_vamic1_consumers[] = { | |
137 | /* AB8500 audio-codec Mic1 supply */ | |
138 | REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"), | |
139 | }; | |
140 | ||
141 | static struct regulator_consumer_supply ab8500_vamic2_consumers[] = { | |
142 | /* AB8500 audio-codec Mic2 supply */ | |
143 | REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"), | |
144 | }; | |
145 | ||
146 | static struct regulator_consumer_supply ab8500_vdmic_consumers[] = { | |
147 | /* AB8500 audio-codec DMic supply */ | |
148 | REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"), | |
149 | }; | |
150 | ||
d1de85a2 LW |
151 | static struct regulator_consumer_supply ab8500_vintcore_consumers[] = { |
152 | /* SoC core supply, no device */ | |
153 | REGULATOR_SUPPLY("v-intcore", NULL), | |
7c9d440e | 154 | /* USB Transceiver */ |
d1de85a2 LW |
155 | REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"), |
156 | }; | |
157 | ||
547f384f LJ |
158 | static struct regulator_consumer_supply ab8505_usb_consumers[] = { |
159 | /* HS USB OTG physical interface */ | |
160 | REGULATOR_SUPPLY("v-ape", NULL), | |
161 | }; | |
162 | ||
d1de85a2 LW |
163 | static struct regulator_consumer_supply ab8500_vana_consumers[] = { |
164 | /* External displays, connector on board, 1v8 power supply */ | |
165 | REGULATOR_SUPPLY("vsmps2", "mcde.0"), | |
166 | }; | |
4f724bea | 167 | |
dfa3a824 | 168 | /* ab8500 regulator register initialization */ |
732805a5 | 169 | static struct ab8500_regulator_reg_init ab8500_reg_init[] = { |
dfa3a824 BJ |
170 | /* |
171 | * VanaRequestCtrl = HP/LP depending on VxRequest | |
172 | * VextSupply1RequestCtrl = HP/LP depending on VxRequest | |
173 | */ | |
43a5911b | 174 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00), |
dfa3a824 BJ |
175 | /* |
176 | * VextSupply2RequestCtrl = HP/LP depending on VxRequest | |
177 | * VextSupply3RequestCtrl = HP/LP depending on VxRequest | |
178 | * Vaux1RequestCtrl = HP/LP depending on VxRequest | |
179 | * Vaux2RequestCtrl = HP/LP depending on VxRequest | |
180 | */ | |
3c1b8438 | 181 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00), |
dfa3a824 BJ |
182 | /* |
183 | * Vaux3RequestCtrl = HP/LP depending on VxRequest | |
184 | * SwHPReq = Control through SWValid disabled | |
185 | */ | |
3c1b8438 | 186 | INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00), |
dfa3a824 BJ |
187 | /* |
188 | * VanaSysClkReq1HPValid = disabled | |
189 | * Vaux1SysClkReq1HPValid = disabled | |
190 | * Vaux2SysClkReq1HPValid = disabled | |
191 | * Vaux3SysClkReq1HPValid = disabled | |
192 | */ | |
43a5911b | 193 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), |
dfa3a824 BJ |
194 | /* |
195 | * VextSupply1SysClkReq1HPValid = disabled | |
196 | * VextSupply2SysClkReq1HPValid = disabled | |
197 | * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled | |
198 | */ | |
3c1b8438 | 199 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40), |
dfa3a824 BJ |
200 | /* |
201 | * VanaHwHPReq1Valid = disabled | |
202 | * Vaux1HwHPreq1Valid = disabled | |
203 | * Vaux2HwHPReq1Valid = disabled | |
204 | * Vaux3HwHPReqValid = disabled | |
205 | */ | |
3c1b8438 | 206 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00), |
dfa3a824 BJ |
207 | /* |
208 | * VextSupply1HwHPReq1Valid = disabled | |
209 | * VextSupply2HwHPReq1Valid = disabled | |
210 | * VextSupply3HwHPReq1Valid = disabled | |
211 | */ | |
3c1b8438 | 212 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00), |
dfa3a824 BJ |
213 | /* |
214 | * VanaHwHPReq2Valid = disabled | |
215 | * Vaux1HwHPReq2Valid = disabled | |
216 | * Vaux2HwHPReq2Valid = disabled | |
217 | * Vaux3HwHPReq2Valid = disabled | |
218 | */ | |
3c1b8438 | 219 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00), |
dfa3a824 BJ |
220 | /* |
221 | * VextSupply1HwHPReq2Valid = disabled | |
222 | * VextSupply2HwHPReq2Valid = disabled | |
223 | * VextSupply3HwHPReq2Valid = HWReq2 controlled | |
224 | */ | |
3c1b8438 | 225 | INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04), |
dfa3a824 BJ |
226 | /* |
227 | * VanaSwHPReqValid = disabled | |
228 | * Vaux1SwHPReqValid = disabled | |
229 | */ | |
3c1b8438 | 230 | INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00), |
dfa3a824 BJ |
231 | /* |
232 | * Vaux2SwHPReqValid = disabled | |
233 | * Vaux3SwHPReqValid = disabled | |
234 | * VextSupply1SwHPReqValid = disabled | |
235 | * VextSupply2SwHPReqValid = disabled | |
236 | * VextSupply3SwHPReqValid = disabled | |
237 | */ | |
3c1b8438 | 238 | INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00), |
dfa3a824 BJ |
239 | /* |
240 | * SysClkReq2Valid1 = SysClkReq2 controlled | |
241 | * SysClkReq3Valid1 = disabled | |
242 | * SysClkReq4Valid1 = SysClkReq4 controlled | |
243 | * SysClkReq5Valid1 = disabled | |
244 | * SysClkReq6Valid1 = SysClkReq6 controlled | |
245 | * SysClkReq7Valid1 = disabled | |
246 | * SysClkReq8Valid1 = disabled | |
247 | */ | |
3c1b8438 | 248 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a), |
dfa3a824 BJ |
249 | /* |
250 | * SysClkReq2Valid2 = disabled | |
251 | * SysClkReq3Valid2 = disabled | |
252 | * SysClkReq4Valid2 = disabled | |
253 | * SysClkReq5Valid2 = disabled | |
254 | * SysClkReq6Valid2 = SysClkReq6 controlled | |
255 | * SysClkReq7Valid2 = disabled | |
256 | * SysClkReq8Valid2 = disabled | |
257 | */ | |
3c1b8438 | 258 | INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20), |
dfa3a824 BJ |
259 | /* |
260 | * VTVoutEna = disabled | |
261 | * Vintcore12Ena = disabled | |
262 | * Vintcore12Sel = 1.25 V | |
263 | * Vintcore12LP = inactive (HP) | |
264 | * VTVoutLP = inactive (HP) | |
265 | */ | |
3c1b8438 | 266 | INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10), |
dfa3a824 BJ |
267 | /* |
268 | * VaudioEna = disabled | |
269 | * VdmicEna = disabled | |
270 | * Vamic1Ena = disabled | |
271 | * Vamic2Ena = disabled | |
272 | */ | |
3c1b8438 | 273 | INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00), |
dfa3a824 BJ |
274 | /* |
275 | * Vamic1_dzout = high-Z when Vamic1 is disabled | |
276 | * Vamic2_dzout = high-Z when Vamic2 is disabled | |
277 | */ | |
3c1b8438 | 278 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00), |
d79df329 | 279 | /* |
43a5911b | 280 | * VPll = Hw controlled (NOTE! PRCMU bits) |
dfa3a824 BJ |
281 | * VanaRegu = force off |
282 | */ | |
3c1b8438 | 283 | INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02), |
dfa3a824 BJ |
284 | /* |
285 | * VrefDDREna = disabled | |
286 | * VrefDDRSleepMode = inactive (no pulldown) | |
287 | */ | |
3c1b8438 | 288 | INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), |
dfa3a824 | 289 | /* |
a387ac5f LJ |
290 | * VextSupply1Regu = force LP |
291 | * VextSupply2Regu = force OFF | |
292 | * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) | |
dfa3a824 BJ |
293 | * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 |
294 | * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 | |
295 | */ | |
a387ac5f | 296 | INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), |
dfa3a824 BJ |
297 | /* |
298 | * Vaux1Regu = force HP | |
299 | * Vaux2Regu = force off | |
300 | */ | |
3c1b8438 | 301 | INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01), |
dfa3a824 | 302 | /* |
d79df329 | 303 | * Vaux3Regu = force off |
dfa3a824 | 304 | */ |
43a5911b | 305 | INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00), |
dfa3a824 BJ |
306 | /* |
307 | * Vaux1Sel = 2.5 V | |
308 | */ | |
3c1b8438 | 309 | INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x08), |
dfa3a824 BJ |
310 | /* |
311 | * Vaux2Sel = 2.9 V | |
312 | */ | |
3c1b8438 | 313 | INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d), |
dfa3a824 BJ |
314 | /* |
315 | * Vaux3Sel = 2.91 V | |
316 | */ | |
3c1b8438 | 317 | INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07), |
dfa3a824 BJ |
318 | /* |
319 | * VextSupply12LP = disabled (no LP) | |
320 | */ | |
3c1b8438 | 321 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00), |
dfa3a824 BJ |
322 | /* |
323 | * Vaux1Disch = short discharge time | |
324 | * Vaux2Disch = short discharge time | |
325 | * Vaux3Disch = short discharge time | |
326 | * Vintcore12Disch = short discharge time | |
327 | * VTVoutDisch = short discharge time | |
328 | * VaudioDisch = short discharge time | |
329 | */ | |
3c1b8438 | 330 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00), |
dfa3a824 BJ |
331 | /* |
332 | * VanaDisch = short discharge time | |
333 | * VdmicPullDownEna = pulldown disabled when Vdmic is disabled | |
334 | * VdmicDisch = short discharge time | |
335 | */ | |
3c1b8438 | 336 | INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00), |
dfa3a824 BJ |
337 | }; |
338 | ||
a1e516e3 | 339 | /* AB8500 regulators */ |
732805a5 | 340 | static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { |
a1e516e3 BJ |
341 | /* supplies to the display/camera */ |
342 | [AB8500_LDO_AUX1] = { | |
343 | .constraints = { | |
344 | .name = "V-DISPLAY", | |
345 | .min_uV = 2500000, | |
346 | .max_uV = 2900000, | |
347 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
348 | REGULATOR_CHANGE_STATUS, | |
db24520f LW |
349 | .boot_on = 1, /* display is on at boot */ |
350 | /* | |
351 | * This voltage cannot be disabled right now because | |
352 | * it is somehow affecting the external MMC | |
353 | * functionality, though that typically will use | |
354 | * AUX3. | |
355 | */ | |
356 | .always_on = 1, | |
a1e516e3 | 357 | }, |
d1de85a2 LW |
358 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), |
359 | .consumer_supplies = ab8500_vaux1_consumers, | |
4f724bea | 360 | }, |
a1e516e3 BJ |
361 | /* supplies to the on-board eMMC */ |
362 | [AB8500_LDO_AUX2] = { | |
363 | .constraints = { | |
364 | .name = "V-eMMC1", | |
365 | .min_uV = 1100000, | |
366 | .max_uV = 3300000, | |
367 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
368 | REGULATOR_CHANGE_STATUS, | |
369 | }, | |
d1de85a2 LW |
370 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), |
371 | .consumer_supplies = ab8500_vaux2_consumers, | |
4f724bea | 372 | }, |
a1e516e3 BJ |
373 | /* supply for VAUX3, supplies to SDcard slots */ |
374 | [AB8500_LDO_AUX3] = { | |
375 | .constraints = { | |
376 | .name = "V-MMC-SD", | |
377 | .min_uV = 1100000, | |
378 | .max_uV = 3300000, | |
379 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
380 | REGULATOR_CHANGE_STATUS, | |
381 | }, | |
d1de85a2 LW |
382 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), |
383 | .consumer_supplies = ab8500_vaux3_consumers, | |
4f724bea | 384 | }, |
a1e516e3 BJ |
385 | /* supply for tvout, gpadc, TVOUT LDO */ |
386 | [AB8500_LDO_TVOUT] = { | |
387 | .constraints = { | |
388 | .name = "V-TVOUT", | |
389 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
390 | }, | |
d1de85a2 LW |
391 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers), |
392 | .consumer_supplies = ab8500_vtvout_consumers, | |
4f724bea | 393 | }, |
a1e516e3 BJ |
394 | /* supply for ab8500-vaudio, VAUDIO LDO */ |
395 | [AB8500_LDO_AUDIO] = { | |
396 | .constraints = { | |
397 | .name = "V-AUD", | |
398 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
399 | }, | |
29bd2ab8 OL |
400 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), |
401 | .consumer_supplies = ab8500_vaud_consumers, | |
4f724bea | 402 | }, |
a1e516e3 BJ |
403 | /* supply for v-anamic1 VAMic1-LDO */ |
404 | [AB8500_LDO_ANAMIC1] = { | |
405 | .constraints = { | |
406 | .name = "V-AMIC1", | |
407 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
408 | }, | |
29bd2ab8 OL |
409 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), |
410 | .consumer_supplies = ab8500_vamic1_consumers, | |
4f724bea | 411 | }, |
a1e516e3 BJ |
412 | /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ |
413 | [AB8500_LDO_ANAMIC2] = { | |
414 | .constraints = { | |
415 | .name = "V-AMIC2", | |
416 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
417 | }, | |
29bd2ab8 OL |
418 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), |
419 | .consumer_supplies = ab8500_vamic2_consumers, | |
4f724bea | 420 | }, |
a1e516e3 BJ |
421 | /* supply for v-dmic, VDMIC LDO */ |
422 | [AB8500_LDO_DMIC] = { | |
423 | .constraints = { | |
424 | .name = "V-DMIC", | |
425 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
426 | }, | |
29bd2ab8 OL |
427 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers), |
428 | .consumer_supplies = ab8500_vdmic_consumers, | |
4f724bea | 429 | }, |
a1e516e3 BJ |
430 | /* supply for v-intcore12, VINTCORE12 LDO */ |
431 | [AB8500_LDO_INTCORE] = { | |
432 | .constraints = { | |
433 | .name = "V-INTCORE", | |
434 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
435 | }, | |
d1de85a2 LW |
436 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), |
437 | .consumer_supplies = ab8500_vintcore_consumers, | |
4f724bea | 438 | }, |
a1e516e3 BJ |
439 | /* supply for U8500 CSI/DSI, VANA LDO */ |
440 | [AB8500_LDO_ANA] = { | |
441 | .constraints = { | |
442 | .name = "V-CSI/DSI", | |
443 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
444 | }, | |
d1de85a2 LW |
445 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), |
446 | .consumer_supplies = ab8500_vana_consumers, | |
4f724bea SI |
447 | }, |
448 | }; | |
732805a5 | 449 | |
a387ac5f LJ |
450 | /* supply for VextSupply3 */ |
451 | static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { | |
452 | /* SIM supply for 3 V SIM cards */ | |
453 | REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), | |
454 | }; | |
455 | ||
456 | /* extended configuration for VextSupply2, only used for HREFP_V20 boards */ | |
457 | static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = { | |
458 | .hwreq = true, | |
459 | }; | |
460 | ||
461 | /* | |
462 | * AB8500 external regulators | |
463 | */ | |
464 | static struct regulator_init_data ab8500_ext_regulators[] = { | |
465 | /* fixed Vbat supplies VSMPS1_EXT_1V8 */ | |
466 | [AB8500_EXT_SUPPLY1] = { | |
467 | .constraints = { | |
468 | .name = "ab8500-ext-supply1", | |
469 | .min_uV = 1800000, | |
470 | .max_uV = 1800000, | |
471 | .initial_mode = REGULATOR_MODE_IDLE, | |
472 | .boot_on = 1, | |
473 | .always_on = 1, | |
474 | }, | |
475 | }, | |
476 | /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ | |
477 | [AB8500_EXT_SUPPLY2] = { | |
478 | .constraints = { | |
479 | .name = "ab8500-ext-supply2", | |
480 | .min_uV = 1360000, | |
481 | .max_uV = 1360000, | |
482 | }, | |
483 | }, | |
484 | /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ | |
485 | [AB8500_EXT_SUPPLY3] = { | |
486 | .constraints = { | |
487 | .name = "ab8500-ext-supply3", | |
488 | .min_uV = 3400000, | |
489 | .max_uV = 3400000, | |
490 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
491 | .boot_on = 1, | |
492 | }, | |
493 | .num_consumer_supplies = | |
494 | ARRAY_SIZE(ab8500_ext_supply3_consumers), | |
495 | .consumer_supplies = ab8500_ext_supply3_consumers, | |
496 | }, | |
497 | }; | |
498 | ||
547f384f LJ |
499 | /* ab8505 regulator register initialization */ |
500 | static struct ab8500_regulator_reg_init ab8505_reg_init[] = { | |
501 | /* | |
502 | * VarmRequestCtrl | |
503 | * VsmpsCRequestCtrl | |
504 | * VsmpsARequestCtrl | |
505 | * VsmpsBRequestCtrl | |
506 | */ | |
507 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL1, 0x00, 0x00), | |
508 | /* | |
509 | * VsafeRequestCtrl | |
510 | * VpllRequestCtrl | |
511 | * VanaRequestCtrl = HP/LP depending on VxRequest | |
512 | */ | |
513 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL2, 0x30, 0x00), | |
514 | /* | |
515 | * Vaux1RequestCtrl = HP/LP depending on VxRequest | |
516 | * Vaux2RequestCtrl = HP/LP depending on VxRequest | |
517 | */ | |
518 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL3, 0xf0, 0x00), | |
519 | /* | |
520 | * Vaux3RequestCtrl = HP/LP depending on VxRequest | |
521 | * SwHPReq = Control through SWValid disabled | |
522 | */ | |
523 | INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL4, 0x07, 0x00), | |
524 | /* | |
525 | * VsmpsASysClkReq1HPValid | |
526 | * VsmpsBSysClkReq1HPValid | |
527 | * VsafeSysClkReq1HPValid | |
528 | * VanaSysClkReq1HPValid = disabled | |
529 | * VpllSysClkReq1HPValid | |
530 | * Vaux1SysClkReq1HPValid = disabled | |
531 | * Vaux2SysClkReq1HPValid = disabled | |
532 | * Vaux3SysClkReq1HPValid = disabled | |
533 | */ | |
534 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), | |
535 | /* | |
536 | * VsmpsCSysClkReq1HPValid | |
537 | * VarmSysClkReq1HPValid | |
538 | * VbbSysClkReq1HPValid | |
539 | * VsmpsMSysClkReq1HPValid | |
540 | */ | |
541 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID2, 0x00, 0x00), | |
542 | /* | |
543 | * VsmpsAHwHPReq1Valid | |
544 | * VsmpsBHwHPReq1Valid | |
545 | * VsafeHwHPReq1Valid | |
546 | * VanaHwHPReq1Valid = disabled | |
547 | * VpllHwHPReq1Valid | |
548 | * Vaux1HwHPreq1Valid = disabled | |
549 | * Vaux2HwHPReq1Valid = disabled | |
550 | * Vaux3HwHPReqValid = disabled | |
551 | */ | |
552 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID1, 0xe8, 0x00), | |
553 | /* | |
554 | * VsmpsMHwHPReq1Valid | |
555 | */ | |
556 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID2, 0x00, 0x00), | |
557 | /* | |
558 | * VsmpsAHwHPReq2Valid | |
559 | * VsmpsBHwHPReq2Valid | |
560 | * VsafeHwHPReq2Valid | |
561 | * VanaHwHPReq2Valid = disabled | |
562 | * VpllHwHPReq2Valid | |
563 | * Vaux1HwHPReq2Valid = disabled | |
564 | * Vaux2HwHPReq2Valid = disabled | |
565 | * Vaux3HwHPReq2Valid = disabled | |
566 | */ | |
567 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID1, 0xe8, 0x00), | |
568 | /* | |
569 | * VsmpsMHwHPReq2Valid | |
570 | */ | |
571 | INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID2, 0x00, 0x00), | |
572 | /** | |
573 | * VsmpsCSwHPReqValid | |
574 | * VarmSwHPReqValid | |
575 | * VsmpsASwHPReqValid | |
576 | * VsmpsBSwHPReqValid | |
577 | * VsafeSwHPReqValid | |
578 | * VanaSwHPReqValid | |
579 | * VanaSwHPReqValid = disabled | |
580 | * VpllSwHPReqValid | |
581 | * Vaux1SwHPReqValid = disabled | |
582 | */ | |
583 | INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID1, 0xa0, 0x00), | |
584 | /* | |
585 | * Vaux2SwHPReqValid = disabled | |
586 | * Vaux3SwHPReqValid = disabled | |
587 | * VsmpsMSwHPReqValid | |
588 | */ | |
589 | INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID2, 0x03, 0x00), | |
590 | /* | |
591 | * SysClkReq2Valid1 = SysClkReq2 controlled | |
592 | * SysClkReq3Valid1 = disabled | |
593 | * SysClkReq4Valid1 = SysClkReq4 controlled | |
594 | */ | |
595 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID1, 0x0e, 0x0a), | |
596 | /* | |
597 | * SysClkReq2Valid2 = disabled | |
598 | * SysClkReq3Valid2 = disabled | |
599 | * SysClkReq4Valid2 = disabled | |
600 | */ | |
601 | INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID2, 0x0e, 0x00), | |
602 | /* | |
603 | * Vaux4SwHPReqValid | |
604 | * Vaux4HwHPReq2Valid | |
605 | * Vaux4HwHPReq1Valid | |
606 | * Vaux4SysClkReq1HPValid | |
607 | */ | |
608 | INIT_REGULATOR_REGISTER(AB8505_REGUVAUX4REQVALID, 0x00, 0x00), | |
609 | /* | |
610 | * VadcEna = disabled | |
611 | * VintCore12Ena = disabled | |
612 | * VintCore12Sel = 1.25 V | |
613 | * VintCore12LP = inactive (HP) | |
614 | * VadcLP = inactive (HP) | |
615 | */ | |
616 | INIT_REGULATOR_REGISTER(AB8505_REGUMISC1, 0xfe, 0x10), | |
617 | /* | |
618 | * VaudioEna = disabled | |
619 | * Vaux8Ena = disabled | |
620 | * Vamic1Ena = disabled | |
621 | * Vamic2Ena = disabled | |
622 | */ | |
623 | INIT_REGULATOR_REGISTER(AB8505_VAUDIOSUPPLY, 0x1e, 0x00), | |
624 | /* | |
625 | * Vamic1_dzout = high-Z when Vamic1 is disabled | |
626 | * Vamic2_dzout = high-Z when Vamic2 is disabled | |
627 | */ | |
628 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRL1VAMIC, 0x03, 0x00), | |
629 | /* | |
630 | * VsmpsARegu | |
631 | * VsmpsASelCtrl | |
632 | * VsmpsAAutoMode | |
633 | * VsmpsAPWMMode | |
634 | */ | |
635 | INIT_REGULATOR_REGISTER(AB8505_VSMPSAREGU, 0x00, 0x00), | |
636 | /* | |
637 | * VsmpsBRegu | |
638 | * VsmpsBSelCtrl | |
639 | * VsmpsBAutoMode | |
640 | * VsmpsBPWMMode | |
641 | */ | |
642 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBREGU, 0x00, 0x00), | |
643 | /* | |
644 | * VsafeRegu | |
645 | * VsafeSelCtrl | |
646 | * VsafeAutoMode | |
647 | * VsafePWMMode | |
648 | */ | |
649 | INIT_REGULATOR_REGISTER(AB8505_VSAFEREGU, 0x00, 0x00), | |
650 | /* | |
651 | * VPll = Hw controlled (NOTE! PRCMU bits) | |
652 | * VanaRegu = force off | |
653 | */ | |
654 | INIT_REGULATOR_REGISTER(AB8505_VPLLVANAREGU, 0x0f, 0x02), | |
655 | /* | |
656 | * VextSupply1Regu = force OFF (OTP_ExtSupply12LPnPolarity 1) | |
657 | * VextSupply2Regu = force OFF (OTP_ExtSupply12LPnPolarity 1) | |
658 | * VextSupply3Regu = force OFF (OTP_ExtSupply3LPnPolarity 0) | |
659 | * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 | |
660 | * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 | |
661 | */ | |
662 | INIT_REGULATOR_REGISTER(AB8505_EXTSUPPLYREGU, 0xff, 0x30), | |
663 | /* | |
664 | * Vaux1Regu = force HP | |
665 | * Vaux2Regu = force off | |
666 | */ | |
667 | INIT_REGULATOR_REGISTER(AB8505_VAUX12REGU, 0x0f, 0x01), | |
668 | /* | |
669 | * Vaux3Regu = force off | |
670 | */ | |
671 | INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3REGU, 0x03, 0x00), | |
672 | /* | |
673 | * VsmpsASel1 | |
674 | */ | |
675 | INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL1, 0x00, 0x00), | |
676 | /* | |
677 | * VsmpsASel2 | |
678 | */ | |
679 | INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL2, 0x00, 0x00), | |
680 | /* | |
681 | * VsmpsASel3 | |
682 | */ | |
683 | INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL3, 0x00, 0x00), | |
684 | /* | |
685 | * VsmpsBSel1 | |
686 | */ | |
687 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL1, 0x00, 0x00), | |
688 | /* | |
689 | * VsmpsBSel2 | |
690 | */ | |
691 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL2, 0x00, 0x00), | |
692 | /* | |
693 | * VsmpsBSel3 | |
694 | */ | |
695 | INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL3, 0x00, 0x00), | |
696 | /* | |
697 | * VsafeSel1 | |
698 | */ | |
699 | INIT_REGULATOR_REGISTER(AB8505_VSAFESEL1, 0x00, 0x00), | |
700 | /* | |
701 | * VsafeSel2 | |
702 | */ | |
703 | INIT_REGULATOR_REGISTER(AB8505_VSAFESEL2, 0x00, 0x00), | |
704 | /* | |
705 | * VsafeSel3 | |
706 | */ | |
707 | INIT_REGULATOR_REGISTER(AB8505_VSAFESEL3, 0x00, 0x00), | |
708 | /* | |
709 | * Vaux1Sel = 2.8 V | |
710 | */ | |
711 | INIT_REGULATOR_REGISTER(AB8505_VAUX1SEL, 0x0f, 0x0C), | |
712 | /* | |
713 | * Vaux2Sel = 2.9 V | |
714 | */ | |
715 | INIT_REGULATOR_REGISTER(AB8505_VAUX2SEL, 0x0f, 0x0d), | |
716 | /* | |
717 | * Vaux3Sel = 2.91 V | |
718 | */ | |
719 | INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3SEL, 0x07, 0x07), | |
720 | /* | |
721 | * Vaux4RequestCtrl | |
722 | */ | |
723 | INIT_REGULATOR_REGISTER(AB8505_VAUX4REQCTRL, 0x00, 0x00), | |
724 | /* | |
725 | * Vaux4Regu | |
726 | */ | |
727 | INIT_REGULATOR_REGISTER(AB8505_VAUX4REGU, 0x00, 0x00), | |
728 | /* | |
729 | * Vaux4Sel | |
730 | */ | |
731 | INIT_REGULATOR_REGISTER(AB8505_VAUX4SEL, 0x00, 0x00), | |
732 | /* | |
733 | * Vaux1Disch = short discharge time | |
734 | * Vaux2Disch = short discharge time | |
735 | * Vaux3Disch = short discharge time | |
736 | * Vintcore12Disch = short discharge time | |
737 | * VTVoutDisch = short discharge time | |
738 | * VaudioDisch = short discharge time | |
739 | */ | |
740 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH, 0xfc, 0x00), | |
741 | /* | |
742 | * VanaDisch = short discharge time | |
743 | * Vaux8PullDownEna = pulldown disabled when Vaux8 is disabled | |
744 | * Vaux8Disch = short discharge time | |
745 | */ | |
746 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH2, 0x16, 0x00), | |
747 | /* | |
748 | * Vaux4Disch = short discharge time | |
749 | */ | |
750 | INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH3, 0x01, 0x00), | |
751 | /* | |
752 | * Vaux5Sel | |
753 | * Vaux5LP | |
754 | * Vaux5Ena | |
755 | * Vaux5Disch | |
756 | * Vaux5DisSfst | |
757 | * Vaux5DisPulld | |
758 | */ | |
759 | INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX5, 0x00, 0x00), | |
760 | /* | |
761 | * Vaux6Sel | |
762 | * Vaux6LP | |
763 | * Vaux6Ena | |
764 | * Vaux6DisPulld | |
765 | */ | |
766 | INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00), | |
767 | }; | |
768 | ||
769 | struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = { | |
770 | /* supplies to the display/camera */ | |
771 | [AB8505_LDO_AUX1] = { | |
772 | .constraints = { | |
773 | .name = "V-DISPLAY", | |
774 | .min_uV = 2800000, | |
775 | .max_uV = 3300000, | |
776 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
777 | REGULATOR_CHANGE_STATUS, | |
778 | .boot_on = 1, /* display is on at boot */ | |
779 | }, | |
780 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), | |
781 | .consumer_supplies = ab8500_vaux1_consumers, | |
782 | }, | |
783 | /* supplies to the on-board eMMC */ | |
784 | [AB8505_LDO_AUX2] = { | |
785 | .constraints = { | |
786 | .name = "V-eMMC1", | |
787 | .min_uV = 1100000, | |
788 | .max_uV = 3300000, | |
789 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
790 | REGULATOR_CHANGE_STATUS | | |
791 | REGULATOR_CHANGE_MODE, | |
792 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
793 | REGULATOR_MODE_IDLE, | |
794 | }, | |
795 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), | |
796 | .consumer_supplies = ab8500_vaux2_consumers, | |
797 | }, | |
798 | /* supply for VAUX3, supplies to SDcard slots */ | |
799 | [AB8505_LDO_AUX3] = { | |
800 | .constraints = { | |
801 | .name = "V-MMC-SD", | |
802 | .min_uV = 1100000, | |
803 | .max_uV = 3300000, | |
804 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
805 | REGULATOR_CHANGE_STATUS | | |
806 | REGULATOR_CHANGE_MODE, | |
807 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
808 | REGULATOR_MODE_IDLE, | |
809 | }, | |
810 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), | |
811 | .consumer_supplies = ab8500_vaux3_consumers, | |
812 | }, | |
813 | /* supply for VAUX4, supplies to NFC and standalone secure element */ | |
814 | [AB8505_LDO_AUX4] = { | |
815 | .constraints = { | |
816 | .name = "V-NFC-SE", | |
817 | .min_uV = 1100000, | |
818 | .max_uV = 3300000, | |
819 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
820 | REGULATOR_CHANGE_STATUS | | |
821 | REGULATOR_CHANGE_MODE, | |
822 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
823 | REGULATOR_MODE_IDLE, | |
824 | }, | |
825 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux4_consumers), | |
826 | .consumer_supplies = ab8505_vaux4_consumers, | |
827 | }, | |
828 | /* supply for VAUX5, supplies to TBD */ | |
829 | [AB8505_LDO_AUX5] = { | |
830 | .constraints = { | |
831 | .name = "V-AUX5", | |
832 | .min_uV = 1050000, | |
833 | .max_uV = 2790000, | |
834 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
835 | REGULATOR_CHANGE_STATUS | | |
836 | REGULATOR_CHANGE_MODE, | |
837 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
838 | REGULATOR_MODE_IDLE, | |
839 | }, | |
840 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux5_consumers), | |
841 | .consumer_supplies = ab8505_vaux5_consumers, | |
842 | }, | |
843 | /* supply for VAUX6, supplies to TBD */ | |
844 | [AB8505_LDO_AUX6] = { | |
845 | .constraints = { | |
846 | .name = "V-AUX6", | |
847 | .min_uV = 1050000, | |
848 | .max_uV = 2790000, | |
849 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
850 | REGULATOR_CHANGE_STATUS | | |
851 | REGULATOR_CHANGE_MODE, | |
852 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
853 | REGULATOR_MODE_IDLE, | |
854 | }, | |
855 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux6_consumers), | |
856 | .consumer_supplies = ab8505_vaux6_consumers, | |
857 | }, | |
858 | /* supply for gpadc, ADC LDO */ | |
859 | [AB8505_LDO_ADC] = { | |
860 | .constraints = { | |
861 | .name = "V-ADC", | |
862 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
863 | }, | |
864 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vadc_consumers), | |
865 | .consumer_supplies = ab8505_vadc_consumers, | |
866 | }, | |
867 | /* supply for ab8500-vaudio, VAUDIO LDO */ | |
868 | [AB8505_LDO_AUDIO] = { | |
869 | .constraints = { | |
870 | .name = "V-AUD", | |
871 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
872 | }, | |
873 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), | |
874 | .consumer_supplies = ab8500_vaud_consumers, | |
875 | }, | |
876 | /* supply for v-anamic1 VAMic1-LDO */ | |
877 | [AB8505_LDO_ANAMIC1] = { | |
878 | .constraints = { | |
879 | .name = "V-AMIC1", | |
880 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
881 | }, | |
882 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), | |
883 | .consumer_supplies = ab8500_vamic1_consumers, | |
884 | }, | |
885 | /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ | |
886 | [AB8505_LDO_ANAMIC2] = { | |
887 | .constraints = { | |
888 | .name = "V-AMIC2", | |
889 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
890 | }, | |
891 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), | |
892 | .consumer_supplies = ab8500_vamic2_consumers, | |
893 | }, | |
894 | /* supply for v-aux8, VAUX8 LDO */ | |
895 | [AB8505_LDO_AUX8] = { | |
896 | .constraints = { | |
897 | .name = "V-AUX8", | |
898 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
899 | }, | |
900 | .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux8_consumers), | |
901 | .consumer_supplies = ab8505_vaux8_consumers, | |
902 | }, | |
903 | /* supply for v-intcore12, VINTCORE12 LDO */ | |
904 | [AB8505_LDO_INTCORE] = { | |
905 | .constraints = { | |
906 | .name = "V-INTCORE", | |
907 | .min_uV = 1250000, | |
908 | .max_uV = 1350000, | |
909 | .input_uV = 1800000, | |
910 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
911 | REGULATOR_CHANGE_STATUS | | |
912 | REGULATOR_CHANGE_MODE | | |
913 | REGULATOR_CHANGE_DRMS, | |
914 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
915 | REGULATOR_MODE_IDLE, | |
916 | }, | |
917 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), | |
918 | .consumer_supplies = ab8500_vintcore_consumers, | |
919 | }, | |
920 | /* supply for LDO USB */ | |
921 | [AB8505_LDO_USB] = { | |
922 | .constraints = { | |
923 | .name = "V-USB", | |
924 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | | |
925 | REGULATOR_CHANGE_MODE, | |
926 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | |
927 | REGULATOR_MODE_IDLE, | |
928 | }, | |
929 | .num_consumer_supplies = ARRAY_SIZE(ab8505_usb_consumers), | |
930 | .consumer_supplies = ab8505_usb_consumers, | |
931 | }, | |
932 | /* supply for U8500 CSI-DSI, VANA LDO */ | |
933 | [AB8505_LDO_ANA] = { | |
934 | .constraints = { | |
935 | .name = "V-CSI-DSI", | |
936 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
937 | }, | |
938 | .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), | |
939 | .consumer_supplies = ab8500_vana_consumers, | |
940 | }, | |
941 | }; | |
942 | ||
732805a5 BJ |
943 | struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { |
944 | .reg_init = ab8500_reg_init, | |
945 | .num_reg_init = ARRAY_SIZE(ab8500_reg_init), | |
946 | .regulator = ab8500_regulators, | |
947 | .num_regulator = ARRAY_SIZE(ab8500_regulators), | |
a387ac5f LJ |
948 | .ext_regulator = ab8500_ext_regulators, |
949 | .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), | |
732805a5 | 950 | }; |
a1d49480 | 951 | |
547f384f LJ |
952 | /* Use the AB8500 init settings for AB8505 as they are the same right now */ |
953 | struct ab8500_regulator_platform_data ab8505_regulator_plat_data = { | |
954 | .reg_init = ab8505_reg_init, | |
955 | .num_reg_init = ARRAY_SIZE(ab8505_reg_init), | |
956 | .regulator = ab8505_regulators, | |
957 | .num_regulator = ARRAY_SIZE(ab8505_regulators), | |
958 | }; | |
959 | ||
a1d49480 LJ |
960 | static void ab8500_modify_reg_init(int id, u8 mask, u8 value) |
961 | { | |
962 | int i; | |
963 | ||
547f384f LJ |
964 | if (cpu_is_u8520()) { |
965 | for (i = ARRAY_SIZE(ab8505_reg_init) - 1; i >= 0; i--) { | |
966 | if (ab8505_reg_init[i].id == id) { | |
967 | u8 initval = ab8505_reg_init[i].value; | |
968 | initval = (initval & ~mask) | (value & mask); | |
969 | ab8505_reg_init[i].value = initval; | |
a1d49480 | 970 | |
547f384f LJ |
971 | BUG_ON(mask & ~ab8505_reg_init[i].mask); |
972 | return; | |
973 | } | |
974 | } | |
975 | } else { | |
976 | for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) { | |
977 | if (ab8500_reg_init[i].id == id) { | |
978 | u8 initval = ab8500_reg_init[i].value; | |
979 | initval = (initval & ~mask) | (value & mask); | |
980 | ab8500_reg_init[i].value = initval; | |
981 | ||
982 | BUG_ON(mask & ~ab8500_reg_init[i].mask); | |
983 | return; | |
984 | } | |
a1d49480 LJ |
985 | } |
986 | } | |
987 | ||
988 | BUG_ON(1); | |
989 | } | |
422d765d LJ |
990 | |
991 | void mop500_regulator_init(void) | |
992 | { | |
993 | struct regulator_init_data *regulator; | |
994 | ||
995 | /* | |
996 | * Handle VextSupply1 on older boards than HREFP_V22_V1x | |
997 | * (turn off in suspend) | |
998 | */ | |
999 | if (cpu_is_u8500v20() || cpu_is_u8500v21()) { | |
1000 | /* disable VextSupply1 in suspend */ | |
1001 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY1]; | |
1002 | regulator->constraints.state_mem.disabled = 1; | |
1003 | regulator->constraints.state_standby.disabled = 1; | |
1004 | } | |
e0c44686 | 1005 | |
547f384f LJ |
1006 | if (cpu_is_u8520()) { |
1007 | /* Vaux2 initialized to be on */ | |
1008 | ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05); | |
1009 | } | |
1010 | ||
e0c44686 LJ |
1011 | /* |
1012 | * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for | |
1013 | * all HREFP_V20 boards) | |
1014 | */ | |
1015 | if (cpu_is_u8500v20()) { | |
1016 | /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */ | |
1017 | ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01); | |
1018 | ||
1019 | /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */ | |
1020 | ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2, | |
1021 | 0x20, 0x20); | |
1022 | ||
1023 | /* VextSupply2 = force HP at initialization */ | |
1024 | ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04); | |
1025 | ||
1026 | /* enable VextSupply2 during platform active */ | |
1027 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; | |
1028 | regulator->constraints.always_on = 1; | |
1029 | ||
1030 | /* disable VextSupply2 in suspend */ | |
1031 | regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; | |
1032 | regulator->constraints.state_mem.disabled = 1; | |
1033 | regulator->constraints.state_standby.disabled = 1; | |
1034 | ||
1035 | /* enable VextSupply2 HW control (used in suspend) */ | |
1036 | regulator->driver_data = (void *)&ab8500_ext_supply2; | |
1037 | } | |
422d765d | 1038 | } |