2 * Copyright (C) ST-Ericsson SA 2010
4 * License Terms: GNU General Public License v2
6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com>
7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com>
8 * Daniel Willerud <daniel.willerud@stericsson.com>
10 * MOP500 board specific initialization for regulators
12 #include <linux/kernel.h>
13 #include <linux/regulator/machine.h>
14 #include <linux/regulator/ab8500.h>
15 #include "board-mop500-regulators.h"
18 static struct regulator_consumer_supply gpio_en_3v3_consumers
[] = {
19 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
22 struct regulator_init_data gpio_en_3v3_regulator
= {
27 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
29 .num_consumer_supplies
= ARRAY_SIZE(gpio_en_3v3_consumers
),
30 .consumer_supplies
= gpio_en_3v3_consumers
,
33 static struct regulator_consumer_supply sdi0_reg_consumers
[] = {
34 REGULATOR_SUPPLY("vqmmc", "sdi0"),
37 struct regulator_init_data sdi0_reg_init_data
= {
41 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|REGULATOR_CHANGE_STATUS
,
43 .num_consumer_supplies
= ARRAY_SIZE(sdi0_reg_consumers
),
44 .consumer_supplies
= sdi0_reg_consumers
,
50 static struct regulator_consumer_supply tps61052_vaudio_consumers
[] = {
52 * Boost converter supply to raise voltage on audio speaker, this
53 * is actually connected to three pins, VInVhfL (left amplifier)
54 * VInVhfR (right amplifier) and VIntDClassInt - all three must
55 * be connected to the same voltage.
57 REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"),
60 struct regulator_init_data tps61052_regulator
= {
65 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
67 .num_consumer_supplies
= ARRAY_SIZE(tps61052_vaudio_consumers
),
68 .consumer_supplies
= tps61052_vaudio_consumers
,
71 static struct regulator_consumer_supply ab8500_vaux1_consumers
[] = {
72 /* Main display, u8500 R3 uib */
73 REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"),
74 /* Main display, u8500 uib and ST uib */
75 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"),
76 /* Secondary display, ST uib */
77 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"),
78 /* SFH7741 proximity sensor */
79 REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
80 /* BH1780GLS ambient light sensor */
81 REGULATOR_SUPPLY("vcc", "2-0029"),
82 /* lsm303dlh accelerometer */
83 REGULATOR_SUPPLY("vdd", "2-0018"),
84 /* lsm303dlhc accelerometer */
85 REGULATOR_SUPPLY("vdd", "2-0019"),
86 /* lsm303dlh magnetometer */
87 REGULATOR_SUPPLY("vdd", "2-001e"),
88 /* Rohm BU21013 Touchscreen devices */
89 REGULATOR_SUPPLY("avdd", "3-005c"),
90 REGULATOR_SUPPLY("avdd", "3-005d"),
91 /* Synaptics RMI4 Touchscreen device */
92 REGULATOR_SUPPLY("vdd", "3-004b"),
93 /* L3G4200D Gyroscope device */
94 REGULATOR_SUPPLY("vdd", "2-0068"),
95 /* Ambient light sensor device */
96 REGULATOR_SUPPLY("vdd", "3-0029"),
97 /* Pressure sensor device */
98 REGULATOR_SUPPLY("vdd", "2-005c"),
99 /* Cypress TrueTouch Touchscreen device */
100 REGULATOR_SUPPLY("vcpin", "spi8.0"),
102 REGULATOR_SUPPLY("vaux12v5", "mmio_camera"),
105 static struct regulator_consumer_supply ab8500_vaux2_consumers
[] = {
106 /* On-board eMMC power */
107 REGULATOR_SUPPLY("vmmc", "sdi4"),
108 /* AB8500 audio codec */
109 REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"),
110 /* AB8500 accessory detect 1 */
111 REGULATOR_SUPPLY("vcc-N2158", "ab8500-acc-det.0"),
112 /* AB8500 Tv-out device */
113 REGULATOR_SUPPLY("vcc-N2158", "mcde_tv_ab8500.4"),
114 /* AV8100 HDMI device */
115 REGULATOR_SUPPLY("vcc-N2158", "av8100_hdmi.3"),
118 static struct regulator_consumer_supply ab8500_vaux3_consumers
[] = {
119 REGULATOR_SUPPLY("v-SD-STM", "stm"),
120 /* External MMC slot power */
121 REGULATOR_SUPPLY("vmmc", "sdi0"),
124 static struct regulator_consumer_supply ab8505_vaux4_consumers
[] = {
127 static struct regulator_consumer_supply ab8505_vaux5_consumers
[] = {
130 static struct regulator_consumer_supply ab8505_vaux6_consumers
[] = {
133 static struct regulator_consumer_supply ab8505_vaux8_consumers
[] = {
134 /* AB8500 audio codec device */
135 REGULATOR_SUPPLY("v-aux8", NULL
),
138 static struct regulator_consumer_supply ab8505_vadc_consumers
[] = {
139 /* Internal general-purpose ADC */
140 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
141 /* ADC for charger */
142 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
145 static struct regulator_consumer_supply ab8500_vtvout_consumers
[] = {
146 /* TV-out DENC supply */
147 REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
148 /* Internal general-purpose ADC */
149 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
150 /* ADC for charger */
151 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
152 /* AB8500 Tv-out device */
153 REGULATOR_SUPPLY("vtvout", "mcde_tv_ab8500.4"),
156 static struct regulator_consumer_supply ab8500_vaud_consumers
[] = {
157 /* AB8500 audio-codec main supply */
158 REGULATOR_SUPPLY("vaud", "ab8500-codec.0"),
161 static struct regulator_consumer_supply ab8500_vamic1_consumers
[] = {
162 /* AB8500 audio-codec Mic1 supply */
163 REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"),
166 static struct regulator_consumer_supply ab8500_vamic2_consumers
[] = {
167 /* AB8500 audio-codec Mic2 supply */
168 REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"),
171 static struct regulator_consumer_supply ab8500_vdmic_consumers
[] = {
172 /* AB8500 audio-codec DMic supply */
173 REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"),
176 static struct regulator_consumer_supply ab8500_vintcore_consumers
[] = {
177 /* SoC core supply, no device */
178 REGULATOR_SUPPLY("v-intcore", NULL
),
179 /* USB Transceiver */
180 REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
181 /* Handled by abx500 clk driver */
182 REGULATOR_SUPPLY("v-intcore", "abx500-clk.0"),
185 static struct regulator_consumer_supply ab8505_usb_consumers
[] = {
186 /* HS USB OTG physical interface */
187 REGULATOR_SUPPLY("v-ape", NULL
),
190 static struct regulator_consumer_supply ab8500_vana_consumers
[] = {
192 REGULATOR_SUPPLY("vdddsi1v2", "mcde"),
193 REGULATOR_SUPPLY("vdddsi1v2", "b2r2_core"),
194 REGULATOR_SUPPLY("vdddsi1v2", "b2r2_1_core"),
195 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.0"),
196 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.1"),
197 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.2"),
199 REGULATOR_SUPPLY("vddcsi1v2", "mmio_camera"),
202 /* ab8500 regulator register initialization */
203 static struct ab8500_regulator_reg_init ab8500_reg_init
[] = {
205 * VanaRequestCtrl = HP/LP depending on VxRequest
206 * VextSupply1RequestCtrl = HP/LP depending on VxRequest
208 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2
, 0xf0, 0x00),
210 * VextSupply2RequestCtrl = HP/LP depending on VxRequest
211 * VextSupply3RequestCtrl = HP/LP depending on VxRequest
212 * Vaux1RequestCtrl = HP/LP depending on VxRequest
213 * Vaux2RequestCtrl = HP/LP depending on VxRequest
215 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3
, 0xff, 0x00),
217 * Vaux3RequestCtrl = HP/LP depending on VxRequest
218 * SwHPReq = Control through SWValid disabled
220 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4
, 0x07, 0x00),
222 * VanaSysClkReq1HPValid = disabled
223 * Vaux1SysClkReq1HPValid = disabled
224 * Vaux2SysClkReq1HPValid = disabled
225 * Vaux3SysClkReq1HPValid = disabled
227 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1
, 0xe8, 0x00),
229 * VextSupply1SysClkReq1HPValid = disabled
230 * VextSupply2SysClkReq1HPValid = disabled
231 * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled
233 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2
, 0x70, 0x40),
235 * VanaHwHPReq1Valid = disabled
236 * Vaux1HwHPreq1Valid = disabled
237 * Vaux2HwHPReq1Valid = disabled
238 * Vaux3HwHPReqValid = disabled
240 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1
, 0xe8, 0x00),
242 * VextSupply1HwHPReq1Valid = disabled
243 * VextSupply2HwHPReq1Valid = disabled
244 * VextSupply3HwHPReq1Valid = disabled
246 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2
, 0x07, 0x00),
248 * VanaHwHPReq2Valid = disabled
249 * Vaux1HwHPReq2Valid = disabled
250 * Vaux2HwHPReq2Valid = disabled
251 * Vaux3HwHPReq2Valid = disabled
253 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1
, 0xe8, 0x00),
255 * VextSupply1HwHPReq2Valid = disabled
256 * VextSupply2HwHPReq2Valid = disabled
257 * VextSupply3HwHPReq2Valid = HWReq2 controlled
259 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2
, 0x07, 0x04),
261 * VanaSwHPReqValid = disabled
262 * Vaux1SwHPReqValid = disabled
264 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1
, 0xa0, 0x00),
266 * Vaux2SwHPReqValid = disabled
267 * Vaux3SwHPReqValid = disabled
268 * VextSupply1SwHPReqValid = disabled
269 * VextSupply2SwHPReqValid = disabled
270 * VextSupply3SwHPReqValid = disabled
272 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2
, 0x1f, 0x00),
274 * SysClkReq2Valid1 = SysClkReq2 controlled
275 * SysClkReq3Valid1 = disabled
276 * SysClkReq4Valid1 = SysClkReq4 controlled
277 * SysClkReq5Valid1 = disabled
278 * SysClkReq6Valid1 = SysClkReq6 controlled
279 * SysClkReq7Valid1 = disabled
280 * SysClkReq8Valid1 = disabled
282 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1
, 0xfe, 0x2a),
284 * SysClkReq2Valid2 = disabled
285 * SysClkReq3Valid2 = disabled
286 * SysClkReq4Valid2 = disabled
287 * SysClkReq5Valid2 = disabled
288 * SysClkReq6Valid2 = SysClkReq6 controlled
289 * SysClkReq7Valid2 = disabled
290 * SysClkReq8Valid2 = disabled
292 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2
, 0xfe, 0x20),
294 * VTVoutEna = disabled
295 * Vintcore12Ena = disabled
296 * Vintcore12Sel = 1.25 V
297 * Vintcore12LP = inactive (HP)
298 * VTVoutLP = inactive (HP)
300 INIT_REGULATOR_REGISTER(AB8500_REGUMISC1
, 0xfe, 0x10),
302 * VaudioEna = disabled
303 * VdmicEna = disabled
304 * Vamic1Ena = disabled
305 * Vamic2Ena = disabled
307 INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY
, 0x1e, 0x00),
309 * Vamic1_dzout = high-Z when Vamic1 is disabled
310 * Vamic2_dzout = high-Z when Vamic2 is disabled
312 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC
, 0x03, 0x00),
314 * VPll = Hw controlled (NOTE! PRCMU bits)
315 * VanaRegu = force off
317 INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU
, 0x0f, 0x02),
319 * VrefDDREna = disabled
320 * VrefDDRSleepMode = inactive (no pulldown)
322 INIT_REGULATOR_REGISTER(AB8500_VREFDDR
, 0x03, 0x00),
324 * VextSupply1Regu = force LP
325 * VextSupply2Regu = force OFF
326 * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP)
327 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
328 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
330 INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU
, 0xff, 0x13),
332 * Vaux1Regu = force HP
333 * Vaux2Regu = force off
335 INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU
, 0x0f, 0x01),
337 * Vaux3Regu = force off
339 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU
, 0x03, 0x00),
343 INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL
, 0x0f, 0x0C),
347 INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL
, 0x0f, 0x0d),
351 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL
, 0x07, 0x07),
353 * VextSupply12LP = disabled (no LP)
355 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE
, 0x01, 0x00),
357 * Vaux1Disch = short discharge time
358 * Vaux2Disch = short discharge time
359 * Vaux3Disch = short discharge time
360 * Vintcore12Disch = short discharge time
361 * VTVoutDisch = short discharge time
362 * VaudioDisch = short discharge time
364 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH
, 0xfc, 0x00),
366 * VanaDisch = short discharge time
367 * VdmicPullDownEna = pulldown disabled when Vdmic is disabled
368 * VdmicDisch = short discharge time
370 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2
, 0x16, 0x00),
373 /* AB8500 regulators */
374 static struct regulator_init_data ab8500_regulators
[AB8500_NUM_REGULATORS
] = {
375 /* supplies to the display/camera */
376 [AB8500_LDO_AUX1
] = {
381 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
382 REGULATOR_CHANGE_STATUS
,
383 .boot_on
= 1, /* display is on at boot */
385 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaux1_consumers
),
386 .consumer_supplies
= ab8500_vaux1_consumers
,
388 /* supplies to the on-board eMMC */
389 [AB8500_LDO_AUX2
] = {
394 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
395 REGULATOR_CHANGE_STATUS
|
396 REGULATOR_CHANGE_MODE
,
397 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
400 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaux2_consumers
),
401 .consumer_supplies
= ab8500_vaux2_consumers
,
403 /* supply for VAUX3, supplies to SDcard slots */
404 [AB8500_LDO_AUX3
] = {
409 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
410 REGULATOR_CHANGE_STATUS
|
411 REGULATOR_CHANGE_MODE
,
412 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
415 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaux3_consumers
),
416 .consumer_supplies
= ab8500_vaux3_consumers
,
418 /* supply for tvout, gpadc, TVOUT LDO */
419 [AB8500_LDO_TVOUT
] = {
422 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
424 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vtvout_consumers
),
425 .consumer_supplies
= ab8500_vtvout_consumers
,
427 /* supply for ab8500-vaudio, VAUDIO LDO */
428 [AB8500_LDO_AUDIO
] = {
431 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
433 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaud_consumers
),
434 .consumer_supplies
= ab8500_vaud_consumers
,
436 /* supply for v-anamic1 VAMic1-LDO */
437 [AB8500_LDO_ANAMIC1
] = {
440 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
442 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vamic1_consumers
),
443 .consumer_supplies
= ab8500_vamic1_consumers
,
445 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
446 [AB8500_LDO_ANAMIC2
] = {
449 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
451 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vamic2_consumers
),
452 .consumer_supplies
= ab8500_vamic2_consumers
,
454 /* supply for v-dmic, VDMIC LDO */
455 [AB8500_LDO_DMIC
] = {
458 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
460 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vdmic_consumers
),
461 .consumer_supplies
= ab8500_vdmic_consumers
,
463 /* supply for v-intcore12, VINTCORE12 LDO */
464 [AB8500_LDO_INTCORE
] = {
470 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
471 REGULATOR_CHANGE_STATUS
|
472 REGULATOR_CHANGE_MODE
|
473 REGULATOR_CHANGE_DRMS
,
474 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
477 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vintcore_consumers
),
478 .consumer_supplies
= ab8500_vintcore_consumers
,
480 /* supply for U8500 CSI-DSI, VANA LDO */
484 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
486 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vana_consumers
),
487 .consumer_supplies
= ab8500_vana_consumers
,
491 /* supply for VextSupply3 */
492 static struct regulator_consumer_supply ab8500_ext_supply3_consumers
[] = {
493 /* SIM supply for 3 V SIM cards */
494 REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
497 /* extended configuration for VextSupply2, only used for HREFP_V20 boards */
498 static struct ab8500_ext_regulator_cfg ab8500_ext_supply2
= {
503 * AB8500 external regulators
505 static struct regulator_init_data ab8500_ext_regulators
[] = {
506 /* fixed Vbat supplies VSMPS1_EXT_1V8 */
507 [AB8500_EXT_SUPPLY1
] = {
509 .name
= "ab8500-ext-supply1",
512 .initial_mode
= REGULATOR_MODE_IDLE
,
517 /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */
518 [AB8500_EXT_SUPPLY2
] = {
520 .name
= "ab8500-ext-supply2",
525 /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */
526 [AB8500_EXT_SUPPLY3
] = {
528 .name
= "ab8500-ext-supply3",
531 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
534 .num_consumer_supplies
=
535 ARRAY_SIZE(ab8500_ext_supply3_consumers
),
536 .consumer_supplies
= ab8500_ext_supply3_consumers
,
540 /* ab8505 regulator register initialization */
541 static struct ab8500_regulator_reg_init ab8505_reg_init
[] = {
548 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL1
, 0x00, 0x00),
552 * VanaRequestCtrl = HP/LP depending on VxRequest
554 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL2
, 0x30, 0x00),
556 * Vaux1RequestCtrl = HP/LP depending on VxRequest
557 * Vaux2RequestCtrl = HP/LP depending on VxRequest
559 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL3
, 0xf0, 0x00),
561 * Vaux3RequestCtrl = HP/LP depending on VxRequest
562 * SwHPReq = Control through SWValid disabled
564 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL4
, 0x07, 0x00),
566 * VsmpsASysClkReq1HPValid
567 * VsmpsBSysClkReq1HPValid
568 * VsafeSysClkReq1HPValid
569 * VanaSysClkReq1HPValid = disabled
570 * VpllSysClkReq1HPValid
571 * Vaux1SysClkReq1HPValid = disabled
572 * Vaux2SysClkReq1HPValid = disabled
573 * Vaux3SysClkReq1HPValid = disabled
575 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID1
, 0xe8, 0x00),
577 * VsmpsCSysClkReq1HPValid
578 * VarmSysClkReq1HPValid
579 * VbbSysClkReq1HPValid
580 * VsmpsMSysClkReq1HPValid
582 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID2
, 0x00, 0x00),
584 * VsmpsAHwHPReq1Valid
585 * VsmpsBHwHPReq1Valid
587 * VanaHwHPReq1Valid = disabled
589 * Vaux1HwHPreq1Valid = disabled
590 * Vaux2HwHPReq1Valid = disabled
591 * Vaux3HwHPReqValid = disabled
593 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID1
, 0xe8, 0x00),
595 * VsmpsMHwHPReq1Valid
597 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID2
, 0x00, 0x00),
599 * VsmpsAHwHPReq2Valid
600 * VsmpsBHwHPReq2Valid
602 * VanaHwHPReq2Valid = disabled
604 * Vaux1HwHPReq2Valid = disabled
605 * Vaux2HwHPReq2Valid = disabled
606 * Vaux3HwHPReq2Valid = disabled
608 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID1
, 0xe8, 0x00),
610 * VsmpsMHwHPReq2Valid
612 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID2
, 0x00, 0x00),
620 * VanaSwHPReqValid = disabled
622 * Vaux1SwHPReqValid = disabled
624 INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID1
, 0xa0, 0x00),
626 * Vaux2SwHPReqValid = disabled
627 * Vaux3SwHPReqValid = disabled
630 INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID2
, 0x03, 0x00),
632 * SysClkReq2Valid1 = SysClkReq2 controlled
633 * SysClkReq3Valid1 = disabled
634 * SysClkReq4Valid1 = SysClkReq4 controlled
636 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID1
, 0x0e, 0x0a),
638 * SysClkReq2Valid2 = disabled
639 * SysClkReq3Valid2 = disabled
640 * SysClkReq4Valid2 = disabled
642 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID2
, 0x0e, 0x00),
647 * Vaux4SysClkReq1HPValid
649 INIT_REGULATOR_REGISTER(AB8505_REGUVAUX4REQVALID
, 0x00, 0x00),
652 * VintCore12Ena = disabled
653 * VintCore12Sel = 1.25 V
654 * VintCore12LP = inactive (HP)
655 * VadcLP = inactive (HP)
657 INIT_REGULATOR_REGISTER(AB8505_REGUMISC1
, 0xfe, 0x10),
659 * VaudioEna = disabled
660 * Vaux8Ena = disabled
661 * Vamic1Ena = disabled
662 * Vamic2Ena = disabled
664 INIT_REGULATOR_REGISTER(AB8505_VAUDIOSUPPLY
, 0x1e, 0x00),
666 * Vamic1_dzout = high-Z when Vamic1 is disabled
667 * Vamic2_dzout = high-Z when Vamic2 is disabled
669 INIT_REGULATOR_REGISTER(AB8505_REGUCTRL1VAMIC
, 0x03, 0x00),
676 INIT_REGULATOR_REGISTER(AB8505_VSMPSAREGU
, 0x00, 0x00),
683 INIT_REGULATOR_REGISTER(AB8505_VSMPSBREGU
, 0x00, 0x00),
690 INIT_REGULATOR_REGISTER(AB8505_VSAFEREGU
, 0x00, 0x00),
692 * VPll = Hw controlled (NOTE! PRCMU bits)
693 * VanaRegu = force off
695 INIT_REGULATOR_REGISTER(AB8505_VPLLVANAREGU
, 0x0f, 0x02),
697 * VextSupply1Regu = force OFF (OTP_ExtSupply12LPnPolarity 1)
698 * VextSupply2Regu = force OFF (OTP_ExtSupply12LPnPolarity 1)
699 * VextSupply3Regu = force OFF (OTP_ExtSupply3LPnPolarity 0)
700 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
701 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
703 INIT_REGULATOR_REGISTER(AB8505_EXTSUPPLYREGU
, 0xff, 0x30),
705 * Vaux1Regu = force HP
706 * Vaux2Regu = force off
708 INIT_REGULATOR_REGISTER(AB8505_VAUX12REGU
, 0x0f, 0x01),
710 * Vaux3Regu = force off
712 INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3REGU
, 0x03, 0x00),
716 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL1
, 0x00, 0x00),
720 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL2
, 0x00, 0x00),
724 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL3
, 0x00, 0x00),
728 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL1
, 0x00, 0x00),
732 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL2
, 0x00, 0x00),
736 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL3
, 0x00, 0x00),
740 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL1
, 0x00, 0x00),
744 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL2
, 0x00, 0x00),
748 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL3
, 0x00, 0x00),
752 INIT_REGULATOR_REGISTER(AB8505_VAUX1SEL
, 0x0f, 0x0C),
756 INIT_REGULATOR_REGISTER(AB8505_VAUX2SEL
, 0x0f, 0x0d),
760 INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3SEL
, 0x07, 0x07),
764 INIT_REGULATOR_REGISTER(AB8505_VAUX4REQCTRL
, 0x00, 0x00),
768 INIT_REGULATOR_REGISTER(AB8505_VAUX4REGU
, 0x00, 0x00),
772 INIT_REGULATOR_REGISTER(AB8505_VAUX4SEL
, 0x00, 0x00),
774 * Vaux1Disch = short discharge time
775 * Vaux2Disch = short discharge time
776 * Vaux3Disch = short discharge time
777 * Vintcore12Disch = short discharge time
778 * VTVoutDisch = short discharge time
779 * VaudioDisch = short discharge time
781 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH
, 0xfc, 0x00),
783 * VanaDisch = short discharge time
784 * Vaux8PullDownEna = pulldown disabled when Vaux8 is disabled
785 * Vaux8Disch = short discharge time
787 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH2
, 0x16, 0x00),
789 * Vaux4Disch = short discharge time
791 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH3
, 0x01, 0x00),
800 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX5
, 0x00, 0x00),
807 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6
, 0x00, 0x00),
810 struct regulator_init_data ab8505_regulators
[AB8505_NUM_REGULATORS
] = {
811 /* supplies to the display/camera */
812 [AB8505_LDO_AUX1
] = {
817 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
818 REGULATOR_CHANGE_STATUS
,
819 .boot_on
= 1, /* display is on at boot */
821 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaux1_consumers
),
822 .consumer_supplies
= ab8500_vaux1_consumers
,
824 /* supplies to the on-board eMMC */
825 [AB8505_LDO_AUX2
] = {
830 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
831 REGULATOR_CHANGE_STATUS
|
832 REGULATOR_CHANGE_MODE
,
833 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
836 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaux2_consumers
),
837 .consumer_supplies
= ab8500_vaux2_consumers
,
839 /* supply for VAUX3, supplies to SDcard slots */
840 [AB8505_LDO_AUX3
] = {
845 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
846 REGULATOR_CHANGE_STATUS
|
847 REGULATOR_CHANGE_MODE
,
848 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
851 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaux3_consumers
),
852 .consumer_supplies
= ab8500_vaux3_consumers
,
854 /* supply for VAUX4, supplies to NFC and standalone secure element */
855 [AB8505_LDO_AUX4
] = {
860 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
861 REGULATOR_CHANGE_STATUS
|
862 REGULATOR_CHANGE_MODE
,
863 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
866 .num_consumer_supplies
= ARRAY_SIZE(ab8505_vaux4_consumers
),
867 .consumer_supplies
= ab8505_vaux4_consumers
,
869 /* supply for VAUX5, supplies to TBD */
870 [AB8505_LDO_AUX5
] = {
875 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
876 REGULATOR_CHANGE_STATUS
|
877 REGULATOR_CHANGE_MODE
,
878 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
881 .num_consumer_supplies
= ARRAY_SIZE(ab8505_vaux5_consumers
),
882 .consumer_supplies
= ab8505_vaux5_consumers
,
884 /* supply for VAUX6, supplies to TBD */
885 [AB8505_LDO_AUX6
] = {
890 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
891 REGULATOR_CHANGE_STATUS
|
892 REGULATOR_CHANGE_MODE
,
893 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
896 .num_consumer_supplies
= ARRAY_SIZE(ab8505_vaux6_consumers
),
897 .consumer_supplies
= ab8505_vaux6_consumers
,
899 /* supply for gpadc, ADC LDO */
903 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
905 .num_consumer_supplies
= ARRAY_SIZE(ab8505_vadc_consumers
),
906 .consumer_supplies
= ab8505_vadc_consumers
,
908 /* supply for ab8500-vaudio, VAUDIO LDO */
909 [AB8505_LDO_AUDIO
] = {
912 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
914 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vaud_consumers
),
915 .consumer_supplies
= ab8500_vaud_consumers
,
917 /* supply for v-anamic1 VAMic1-LDO */
918 [AB8505_LDO_ANAMIC1
] = {
921 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
|
922 REGULATOR_CHANGE_MODE
,
923 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
926 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vamic1_consumers
),
927 .consumer_supplies
= ab8500_vamic1_consumers
,
929 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
930 [AB8505_LDO_ANAMIC2
] = {
933 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
|
934 REGULATOR_CHANGE_MODE
,
935 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
938 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vamic2_consumers
),
939 .consumer_supplies
= ab8500_vamic2_consumers
,
941 /* supply for v-aux8, VAUX8 LDO */
942 [AB8505_LDO_AUX8
] = {
945 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
947 .num_consumer_supplies
= ARRAY_SIZE(ab8505_vaux8_consumers
),
948 .consumer_supplies
= ab8505_vaux8_consumers
,
950 /* supply for v-intcore12, VINTCORE12 LDO */
951 [AB8505_LDO_INTCORE
] = {
957 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
958 REGULATOR_CHANGE_STATUS
|
959 REGULATOR_CHANGE_MODE
|
960 REGULATOR_CHANGE_DRMS
,
961 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
964 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vintcore_consumers
),
965 .consumer_supplies
= ab8500_vintcore_consumers
,
967 /* supply for LDO USB */
971 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
|
972 REGULATOR_CHANGE_MODE
,
973 .valid_modes_mask
= REGULATOR_MODE_NORMAL
|
976 .num_consumer_supplies
= ARRAY_SIZE(ab8505_usb_consumers
),
977 .consumer_supplies
= ab8505_usb_consumers
,
979 /* supply for U8500 CSI-DSI, VANA LDO */
983 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
985 .num_consumer_supplies
= ARRAY_SIZE(ab8500_vana_consumers
),
986 .consumer_supplies
= ab8500_vana_consumers
,
990 struct ab8500_regulator_platform_data ab8500_regulator_plat_data
= {
991 .reg_init
= ab8500_reg_init
,
992 .num_reg_init
= ARRAY_SIZE(ab8500_reg_init
),
993 .regulator
= ab8500_regulators
,
994 .num_regulator
= ARRAY_SIZE(ab8500_regulators
),
995 .ext_regulator
= ab8500_ext_regulators
,
996 .num_ext_regulator
= ARRAY_SIZE(ab8500_ext_regulators
),
999 /* Use the AB8500 init settings for AB8505 as they are the same right now */
1000 struct ab8500_regulator_platform_data ab8505_regulator_plat_data
= {
1001 .reg_init
= ab8505_reg_init
,
1002 .num_reg_init
= ARRAY_SIZE(ab8505_reg_init
),
1003 .regulator
= ab8505_regulators
,
1004 .num_regulator
= ARRAY_SIZE(ab8505_regulators
),
1007 static void ab8500_modify_reg_init(int id
, u8 mask
, u8 value
)
1011 if (cpu_is_u8520()) {
1012 for (i
= ARRAY_SIZE(ab8505_reg_init
) - 1; i
>= 0; i
--) {
1013 if (ab8505_reg_init
[i
].id
== id
) {
1014 u8 initval
= ab8505_reg_init
[i
].value
;
1015 initval
= (initval
& ~mask
) | (value
& mask
);
1016 ab8505_reg_init
[i
].value
= initval
;
1018 BUG_ON(mask
& ~ab8505_reg_init
[i
].mask
);
1023 for (i
= ARRAY_SIZE(ab8500_reg_init
) - 1; i
>= 0; i
--) {
1024 if (ab8500_reg_init
[i
].id
== id
) {
1025 u8 initval
= ab8500_reg_init
[i
].value
;
1026 initval
= (initval
& ~mask
) | (value
& mask
);
1027 ab8500_reg_init
[i
].value
= initval
;
1029 BUG_ON(mask
& ~ab8500_reg_init
[i
].mask
);
1038 void mop500_regulator_init(void)
1040 struct regulator_init_data
*regulator
;
1043 * Temporarily turn on Vaux2 on 8520 machine
1045 if (cpu_is_u8520()) {
1046 /* Vaux2 initialized to be on */
1047 ab8500_modify_reg_init(AB8505_VAUX12REGU
, 0x0f, 0x05);
1051 * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
1052 * all HREFP_V20 boards)
1054 if (cpu_is_u8500v20()) {
1055 /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */
1056 ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3
, 0x01, 0x01);
1058 /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
1059 ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2
,
1062 /* VextSupply2 = force HP at initialization */
1063 ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU
, 0x0c, 0x04);
1065 /* enable VextSupply2 during platform active */
1066 regulator
= &ab8500_ext_regulators
[AB8500_EXT_SUPPLY2
];
1067 regulator
->constraints
.always_on
= 1;
1069 /* disable VextSupply2 in suspend */
1070 regulator
= &ab8500_ext_regulators
[AB8500_EXT_SUPPLY2
];
1071 regulator
->constraints
.state_mem
.disabled
= 1;
1072 regulator
->constraints
.state_standby
.disabled
= 1;
1074 /* enable VextSupply2 HW control (used in suspend) */
1075 regulator
->driver_data
= (void *)&ab8500_ext_supply2
;