2 * Copyright (C) ST-Ericsson SA 2010
4 * License Terms: GNU General Public License v2
6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
8 * Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson
10 * AB8500 peripheral regulators
12 * AB8500 supports the following regulators:
13 * VAUX1/2/3, VINTCORE, VTVOUT, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA
15 * AB8505 supports the following regulators:
16 * VAUX1/2/3/4/5/6, VINTCORE, VADC, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA
18 #include <linux/init.h>
19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/err.h>
22 #include <linux/platform_device.h>
23 #include <linux/mfd/abx500.h>
24 #include <linux/mfd/abx500/ab8500.h>
26 #include <linux/regulator/of_regulator.h>
27 #include <linux/regulator/driver.h>
28 #include <linux/regulator/machine.h>
29 #include <linux/regulator/ab8500.h>
30 #include <linux/slab.h>
33 * struct ab8500_regulator_info - ab8500 regulator information
34 * @dev: device pointer
35 * @desc: regulator description
36 * @regulator_dev: regulator device
37 * @is_enabled: status of regulator (on/off)
38 * @load_lp_uA: maximum load in idle (low power) mode
39 * @update_bank: bank to control on/off
40 * @update_reg: register to control on/off
41 * @update_mask: mask to enable/disable and set mode of regulator
42 * @update_val: bits holding the regulator current mode
43 * @update_val_idle: bits to enable the regulator in idle (low power) mode
44 * @update_val_normal: bits to enable the regulator in normal (high power) mode
45 * @voltage_bank: bank to control regulator voltage
46 * @voltage_reg: register to control regulator voltage
47 * @voltage_mask: mask to control regulator voltage
48 * @voltage_shift: shift to control regulator voltage
50 struct ab8500_regulator_info
{
52 struct regulator_desc desc
;
53 struct regulator_dev
*regulator
;
68 /* voltage tables for the vauxn/vintcore supplies */
69 static const unsigned int ldo_vauxn_voltages
[] = {
88 static const unsigned int ldo_vaux3_voltages
[] = {
99 static const unsigned int ldo_vaux56_voltages
[] = {
110 static const unsigned int ldo_vaux3_ab8540_voltages
[] = {
122 static const unsigned int ldo_vintcore_voltages
[] = {
132 static const unsigned int ldo_sdio_voltages
[] = {
143 static const unsigned int fixed_1200000_voltage
[] = {
147 static const unsigned int fixed_1800000_voltage
[] = {
151 static const unsigned int fixed_2000000_voltage
[] = {
155 static const unsigned int fixed_2050000_voltage
[] = {
159 static const unsigned int fixed_3300000_voltage
[] = {
163 static int ab8500_regulator_enable(struct regulator_dev
*rdev
)
166 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
169 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
173 ret
= abx500_mask_and_set_register_interruptible(info
->dev
,
174 info
->update_bank
, info
->update_reg
,
175 info
->update_mask
, info
->update_val
);
177 dev_err(rdev_get_dev(rdev
),
178 "couldn't set enable bits for regulator\n");
182 info
->is_enabled
= true;
184 dev_vdbg(rdev_get_dev(rdev
),
185 "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
186 info
->desc
.name
, info
->update_bank
, info
->update_reg
,
187 info
->update_mask
, info
->update_val
);
192 static int ab8500_regulator_disable(struct regulator_dev
*rdev
)
195 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
198 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
202 ret
= abx500_mask_and_set_register_interruptible(info
->dev
,
203 info
->update_bank
, info
->update_reg
,
204 info
->update_mask
, 0x0);
206 dev_err(rdev_get_dev(rdev
),
207 "couldn't set disable bits for regulator\n");
211 info
->is_enabled
= false;
213 dev_vdbg(rdev_get_dev(rdev
),
214 "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
215 info
->desc
.name
, info
->update_bank
, info
->update_reg
,
216 info
->update_mask
, 0x0);
221 static unsigned int ab8500_regulator_get_optimum_mode(
222 struct regulator_dev
*rdev
, int input_uV
,
223 int output_uV
, int load_uA
)
227 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
230 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
234 if (load_uA
<= info
->load_lp_uA
)
235 mode
= REGULATOR_MODE_IDLE
;
237 mode
= REGULATOR_MODE_NORMAL
;
242 static int ab8500_regulator_set_mode(struct regulator_dev
*rdev
,
247 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
250 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
255 case REGULATOR_MODE_NORMAL
:
256 update_val
= info
->update_val_normal
;
258 case REGULATOR_MODE_IDLE
:
259 update_val
= info
->update_val_idle
;
265 /* ab8500 regulators share mode and enable in the same register bits.
268 full powermode = 0b01
269 (HW control mode = 0b10)
270 Thus we don't write to the register when regulator is disabled.
272 if (info
->is_enabled
) {
273 ret
= abx500_mask_and_set_register_interruptible(info
->dev
,
274 info
->update_bank
, info
->update_reg
,
275 info
->update_mask
, update_val
);
277 dev_err(rdev_get_dev(rdev
),
278 "couldn't set regulator mode\n");
282 dev_vdbg(rdev_get_dev(rdev
),
283 "%s-set_mode (bank, reg, mask, value): "
284 "0x%x, 0x%x, 0x%x, 0x%x\n",
285 info
->desc
.name
, info
->update_bank
, info
->update_reg
,
286 info
->update_mask
, update_val
);
289 info
->update_val
= update_val
;
294 static unsigned int ab8500_regulator_get_mode(struct regulator_dev
*rdev
)
296 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
300 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
304 if (info
->update_val
== info
->update_val_normal
)
305 ret
= REGULATOR_MODE_NORMAL
;
306 else if (info
->update_val
== info
->update_val_idle
)
307 ret
= REGULATOR_MODE_IDLE
;
314 static int ab8500_regulator_is_enabled(struct regulator_dev
*rdev
)
317 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
321 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
325 ret
= abx500_get_register_interruptible(info
->dev
,
326 info
->update_bank
, info
->update_reg
, ®val
);
328 dev_err(rdev_get_dev(rdev
),
329 "couldn't read 0x%x register\n", info
->update_reg
);
333 dev_vdbg(rdev_get_dev(rdev
),
334 "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
336 info
->desc
.name
, info
->update_bank
, info
->update_reg
,
337 info
->update_mask
, regval
);
339 if (regval
& info
->update_mask
)
340 info
->is_enabled
= true;
342 info
->is_enabled
= false;
344 return info
->is_enabled
;
347 static int ab8500_regulator_get_voltage_sel(struct regulator_dev
*rdev
)
350 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
354 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
358 ret
= abx500_get_register_interruptible(info
->dev
,
359 info
->voltage_bank
, info
->voltage_reg
, ®val
);
361 dev_err(rdev_get_dev(rdev
),
362 "couldn't read voltage reg for regulator\n");
366 dev_vdbg(rdev_get_dev(rdev
),
367 "%s-get_voltage (bank, reg, mask, shift, value): "
368 "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
369 info
->desc
.name
, info
->voltage_bank
,
370 info
->voltage_reg
, info
->voltage_mask
,
371 info
->voltage_shift
, regval
);
373 val
= regval
& info
->voltage_mask
;
374 return val
>> info
->voltage_shift
;
377 static int ab8500_regulator_set_voltage_sel(struct regulator_dev
*rdev
,
381 struct ab8500_regulator_info
*info
= rdev_get_drvdata(rdev
);
385 dev_err(rdev_get_dev(rdev
), "regulator info null pointer\n");
389 /* set the registers for the request */
390 regval
= (u8
)selector
<< info
->voltage_shift
;
391 ret
= abx500_mask_and_set_register_interruptible(info
->dev
,
392 info
->voltage_bank
, info
->voltage_reg
,
393 info
->voltage_mask
, regval
);
395 dev_err(rdev_get_dev(rdev
),
396 "couldn't set voltage reg for regulator\n");
398 dev_vdbg(rdev_get_dev(rdev
),
399 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
401 info
->desc
.name
, info
->voltage_bank
, info
->voltage_reg
,
402 info
->voltage_mask
, regval
);
407 static struct regulator_ops ab8500_regulator_volt_mode_ops
= {
408 .enable
= ab8500_regulator_enable
,
409 .disable
= ab8500_regulator_disable
,
410 .is_enabled
= ab8500_regulator_is_enabled
,
411 .get_optimum_mode
= ab8500_regulator_get_optimum_mode
,
412 .set_mode
= ab8500_regulator_set_mode
,
413 .get_mode
= ab8500_regulator_get_mode
,
414 .get_voltage_sel
= ab8500_regulator_get_voltage_sel
,
415 .set_voltage_sel
= ab8500_regulator_set_voltage_sel
,
416 .list_voltage
= regulator_list_voltage_table
,
419 static struct regulator_ops ab8500_regulator_mode_ops
= {
420 .enable
= ab8500_regulator_enable
,
421 .disable
= ab8500_regulator_disable
,
422 .is_enabled
= ab8500_regulator_is_enabled
,
423 .get_optimum_mode
= ab8500_regulator_get_optimum_mode
,
424 .set_mode
= ab8500_regulator_set_mode
,
425 .get_mode
= ab8500_regulator_get_mode
,
426 .list_voltage
= regulator_list_voltage_linear
,
429 static struct regulator_ops ab8500_regulator_ops
= {
430 .enable
= ab8500_regulator_enable
,
431 .disable
= ab8500_regulator_disable
,
432 .is_enabled
= ab8500_regulator_is_enabled
,
433 .list_voltage
= regulator_list_voltage_linear
,
436 /* AB8500 regulator information */
437 static struct ab8500_regulator_info
438 ab8500_regulator_info
[AB8500_NUM_REGULATORS
] = {
440 * Variable Voltage Regulators
441 * name, min mV, max mV,
442 * update bank, reg, mask, enable val
443 * volt bank, reg, mask
445 [AB8500_LDO_AUX1
] = {
448 .ops
= &ab8500_regulator_volt_mode_ops
,
449 .type
= REGULATOR_VOLTAGE
,
450 .id
= AB8500_LDO_AUX1
,
451 .owner
= THIS_MODULE
,
452 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
453 .volt_table
= ldo_vauxn_voltages
,
461 .update_val_idle
= 0x03,
462 .update_val_normal
= 0x01,
463 .voltage_bank
= 0x04,
465 .voltage_mask
= 0x0f,
467 [AB8500_LDO_AUX2
] = {
470 .ops
= &ab8500_regulator_volt_mode_ops
,
471 .type
= REGULATOR_VOLTAGE
,
472 .id
= AB8500_LDO_AUX2
,
473 .owner
= THIS_MODULE
,
474 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
475 .volt_table
= ldo_vauxn_voltages
,
483 .update_val_idle
= 0x0c,
484 .update_val_normal
= 0x04,
485 .voltage_bank
= 0x04,
487 .voltage_mask
= 0x0f,
489 [AB8500_LDO_AUX3
] = {
492 .ops
= &ab8500_regulator_volt_mode_ops
,
493 .type
= REGULATOR_VOLTAGE
,
494 .id
= AB8500_LDO_AUX3
,
495 .owner
= THIS_MODULE
,
496 .n_voltages
= ARRAY_SIZE(ldo_vaux3_voltages
),
497 .volt_table
= ldo_vaux3_voltages
,
505 .update_val_idle
= 0x03,
506 .update_val_normal
= 0x01,
507 .voltage_bank
= 0x04,
509 .voltage_mask
= 0x07,
511 [AB8500_LDO_INTCORE
] = {
513 .name
= "LDO-INTCORE",
514 .ops
= &ab8500_regulator_volt_mode_ops
,
515 .type
= REGULATOR_VOLTAGE
,
516 .id
= AB8500_LDO_INTCORE
,
517 .owner
= THIS_MODULE
,
518 .n_voltages
= ARRAY_SIZE(ldo_vintcore_voltages
),
519 .volt_table
= ldo_vintcore_voltages
,
527 .update_val_idle
= 0x44,
528 .update_val_normal
= 0x04,
529 .voltage_bank
= 0x03,
531 .voltage_mask
= 0x38,
536 * Fixed Voltage Regulators
538 * update bank, reg, mask, enable val
540 [AB8500_LDO_TVOUT
] = {
543 .ops
= &ab8500_regulator_mode_ops
,
544 .type
= REGULATOR_VOLTAGE
,
545 .id
= AB8500_LDO_TVOUT
,
546 .owner
= THIS_MODULE
,
548 .volt_table
= fixed_2000000_voltage
,
556 .update_val_idle
= 0x82,
557 .update_val_normal
= 0x02,
559 [AB8500_LDO_AUDIO
] = {
562 .ops
= &ab8500_regulator_ops
,
563 .type
= REGULATOR_VOLTAGE
,
564 .id
= AB8500_LDO_AUDIO
,
565 .owner
= THIS_MODULE
,
568 .volt_table
= fixed_2000000_voltage
,
575 [AB8500_LDO_ANAMIC1
] = {
577 .name
= "LDO-ANAMIC1",
578 .ops
= &ab8500_regulator_ops
,
579 .type
= REGULATOR_VOLTAGE
,
580 .id
= AB8500_LDO_ANAMIC1
,
581 .owner
= THIS_MODULE
,
584 .volt_table
= fixed_2050000_voltage
,
591 [AB8500_LDO_ANAMIC2
] = {
593 .name
= "LDO-ANAMIC2",
594 .ops
= &ab8500_regulator_ops
,
595 .type
= REGULATOR_VOLTAGE
,
596 .id
= AB8500_LDO_ANAMIC2
,
597 .owner
= THIS_MODULE
,
600 .volt_table
= fixed_2050000_voltage
,
607 [AB8500_LDO_DMIC
] = {
610 .ops
= &ab8500_regulator_ops
,
611 .type
= REGULATOR_VOLTAGE
,
612 .id
= AB8500_LDO_DMIC
,
613 .owner
= THIS_MODULE
,
616 .volt_table
= fixed_1800000_voltage
,
625 * Regulators with fixed voltage and normal/idle modes
630 .ops
= &ab8500_regulator_mode_ops
,
631 .type
= REGULATOR_VOLTAGE
,
632 .id
= AB8500_LDO_ANA
,
633 .owner
= THIS_MODULE
,
636 .volt_table
= fixed_1200000_voltage
,
643 .update_val_idle
= 0x0c,
644 .update_val_normal
= 0x04,
648 /* AB8505 regulator information */
649 static struct ab8500_regulator_info
650 ab8505_regulator_info
[AB8505_NUM_REGULATORS
] = {
652 * Variable Voltage Regulators
653 * name, min mV, max mV,
654 * update bank, reg, mask, enable val
655 * volt bank, reg, mask, table, table length
657 [AB8505_LDO_AUX1
] = {
660 .ops
= &ab8500_regulator_volt_mode_ops
,
661 .type
= REGULATOR_VOLTAGE
,
662 .id
= AB8500_LDO_AUX1
,
663 .owner
= THIS_MODULE
,
664 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
665 .volt_table
= ldo_vauxn_voltages
,
672 .update_val_idle
= 0x03,
673 .update_val_normal
= 0x01,
674 .voltage_bank
= 0x04,
676 .voltage_mask
= 0x0f,
678 [AB8505_LDO_AUX2
] = {
681 .ops
= &ab8500_regulator_volt_mode_ops
,
682 .type
= REGULATOR_VOLTAGE
,
683 .id
= AB8500_LDO_AUX2
,
684 .owner
= THIS_MODULE
,
685 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
686 .volt_table
= ldo_vauxn_voltages
,
693 .update_val_idle
= 0x0c,
694 .update_val_normal
= 0x04,
695 .voltage_bank
= 0x04,
697 .voltage_mask
= 0x0f,
699 [AB8505_LDO_AUX3
] = {
702 .ops
= &ab8500_regulator_volt_mode_ops
,
703 .type
= REGULATOR_VOLTAGE
,
704 .id
= AB8500_LDO_AUX3
,
705 .owner
= THIS_MODULE
,
706 .n_voltages
= ARRAY_SIZE(ldo_vaux3_voltages
),
707 .volt_table
= ldo_vaux3_voltages
,
714 .update_val_idle
= 0x03,
715 .update_val_normal
= 0x01,
716 .voltage_bank
= 0x04,
718 .voltage_mask
= 0x07,
720 [AB8505_LDO_AUX4
] = {
723 .ops
= &ab8500_regulator_volt_mode_ops
,
724 .type
= REGULATOR_VOLTAGE
,
725 .id
= AB9540_LDO_AUX4
,
726 .owner
= THIS_MODULE
,
727 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
728 .volt_table
= ldo_vauxn_voltages
,
731 /* values for Vaux4Regu register */
736 .update_val_idle
= 0x03,
737 .update_val_normal
= 0x01,
738 /* values for Vaux4SEL register */
739 .voltage_bank
= 0x04,
741 .voltage_mask
= 0x0f,
743 [AB8505_LDO_AUX5
] = {
746 .ops
= &ab8500_regulator_volt_mode_ops
,
747 .type
= REGULATOR_VOLTAGE
,
748 .id
= AB8505_LDO_AUX5
,
749 .owner
= THIS_MODULE
,
750 .n_voltages
= ARRAY_SIZE(ldo_vaux56_voltages
),
751 .volt_table
= ldo_vaux56_voltages
,
754 /* values for CtrlVaux5 register */
759 .update_val_idle
= 0x18,
760 .update_val_normal
= 0x10,
761 .voltage_bank
= 0x01,
763 .voltage_mask
= 0x07,
765 [AB8505_LDO_AUX6
] = {
768 .ops
= &ab8500_regulator_volt_mode_ops
,
769 .type
= REGULATOR_VOLTAGE
,
770 .id
= AB8505_LDO_AUX6
,
771 .owner
= THIS_MODULE
,
772 .n_voltages
= ARRAY_SIZE(ldo_vaux56_voltages
),
773 .volt_table
= ldo_vaux56_voltages
,
776 /* values for CtrlVaux6 register */
781 .update_val_idle
= 0x18,
782 .update_val_normal
= 0x10,
783 .voltage_bank
= 0x01,
785 .voltage_mask
= 0x07,
787 [AB8505_LDO_INTCORE
] = {
789 .name
= "LDO-INTCORE",
790 .ops
= &ab8500_regulator_volt_mode_ops
,
791 .type
= REGULATOR_VOLTAGE
,
792 .id
= AB8500_LDO_INTCORE
,
793 .owner
= THIS_MODULE
,
794 .n_voltages
= ARRAY_SIZE(ldo_vintcore_voltages
),
795 .volt_table
= ldo_vintcore_voltages
,
802 .update_val_idle
= 0x44,
803 .update_val_normal
= 0x04,
804 .voltage_bank
= 0x03,
806 .voltage_mask
= 0x38,
811 * Fixed Voltage Regulators
813 * update bank, reg, mask, enable val
818 .ops
= &ab8500_regulator_mode_ops
,
819 .type
= REGULATOR_VOLTAGE
,
820 .id
= AB8505_LDO_ADC
,
821 .owner
= THIS_MODULE
,
823 .volt_table
= fixed_2000000_voltage
,
831 .update_val_idle
= 0x82,
832 .update_val_normal
= 0x02,
837 .ops
= &ab8500_regulator_mode_ops
,
838 .type
= REGULATOR_VOLTAGE
,
839 .id
= AB9540_LDO_USB
,
840 .owner
= THIS_MODULE
,
842 .volt_table
= fixed_3300000_voltage
,
848 .update_val_idle
= 0x03,
849 .update_val_normal
= 0x01,
851 [AB8505_LDO_AUDIO
] = {
854 .ops
= &ab8500_regulator_ops
,
855 .type
= REGULATOR_VOLTAGE
,
856 .id
= AB8500_LDO_AUDIO
,
857 .owner
= THIS_MODULE
,
859 .volt_table
= fixed_2000000_voltage
,
866 [AB8505_LDO_ANAMIC1
] = {
868 .name
= "LDO-ANAMIC1",
869 .ops
= &ab8500_regulator_ops
,
870 .type
= REGULATOR_VOLTAGE
,
871 .id
= AB8500_LDO_ANAMIC1
,
872 .owner
= THIS_MODULE
,
874 .volt_table
= fixed_2050000_voltage
,
881 [AB8505_LDO_ANAMIC2
] = {
883 .name
= "LDO-ANAMIC2",
884 .ops
= &ab8500_regulator_ops
,
885 .type
= REGULATOR_VOLTAGE
,
886 .id
= AB8500_LDO_ANAMIC2
,
887 .owner
= THIS_MODULE
,
889 .volt_table
= fixed_2050000_voltage
,
896 [AB8505_LDO_AUX8
] = {
899 .ops
= &ab8500_regulator_ops
,
900 .type
= REGULATOR_VOLTAGE
,
901 .id
= AB8505_LDO_AUX8
,
902 .owner
= THIS_MODULE
,
904 .volt_table
= fixed_1800000_voltage
,
912 * Regulators with fixed voltage and normal/idle modes
917 .ops
= &ab8500_regulator_mode_ops
,
918 .type
= REGULATOR_VOLTAGE
,
919 .id
= AB8500_LDO_ANA
,
920 .owner
= THIS_MODULE
,
922 .volt_table
= fixed_1200000_voltage
,
929 .update_val_idle
= 0x0c,
930 .update_val_normal
= 0x04,
934 /* AB9540 regulator information */
935 static struct ab8500_regulator_info
936 ab9540_regulator_info
[AB9540_NUM_REGULATORS
] = {
938 * Variable Voltage Regulators
939 * name, min mV, max mV,
940 * update bank, reg, mask, enable val
941 * volt bank, reg, mask, table, table length
943 [AB9540_LDO_AUX1
] = {
946 .ops
= &ab8500_regulator_volt_mode_ops
,
947 .type
= REGULATOR_VOLTAGE
,
948 .id
= AB8500_LDO_AUX1
,
949 .owner
= THIS_MODULE
,
950 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
951 .volt_table
= ldo_vauxn_voltages
,
958 .update_val_idle
= 0x03,
959 .update_val_normal
= 0x01,
960 .voltage_bank
= 0x04,
962 .voltage_mask
= 0x0f,
964 [AB9540_LDO_AUX2
] = {
967 .ops
= &ab8500_regulator_volt_mode_ops
,
968 .type
= REGULATOR_VOLTAGE
,
969 .id
= AB8500_LDO_AUX2
,
970 .owner
= THIS_MODULE
,
971 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
972 .volt_table
= ldo_vauxn_voltages
,
979 .update_val_idle
= 0x0c,
980 .update_val_normal
= 0x04,
981 .voltage_bank
= 0x04,
983 .voltage_mask
= 0x0f,
985 [AB9540_LDO_AUX3
] = {
988 .ops
= &ab8500_regulator_volt_mode_ops
,
989 .type
= REGULATOR_VOLTAGE
,
990 .id
= AB8500_LDO_AUX3
,
991 .owner
= THIS_MODULE
,
992 .n_voltages
= ARRAY_SIZE(ldo_vaux3_voltages
),
993 .volt_table
= ldo_vaux3_voltages
,
1000 .update_val_idle
= 0x03,
1001 .update_val_normal
= 0x01,
1002 .voltage_bank
= 0x04,
1003 .voltage_reg
= 0x21,
1004 .voltage_mask
= 0x07,
1006 [AB9540_LDO_AUX4
] = {
1009 .ops
= &ab8500_regulator_volt_mode_ops
,
1010 .type
= REGULATOR_VOLTAGE
,
1011 .id
= AB9540_LDO_AUX4
,
1012 .owner
= THIS_MODULE
,
1013 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
1014 .volt_table
= ldo_vauxn_voltages
,
1017 /* values for Vaux4Regu register */
1018 .update_bank
= 0x04,
1020 .update_mask
= 0x03,
1022 .update_val_idle
= 0x03,
1023 .update_val_normal
= 0x01,
1024 /* values for Vaux4SEL register */
1025 .voltage_bank
= 0x04,
1026 .voltage_reg
= 0x2f,
1027 .voltage_mask
= 0x0f,
1029 [AB9540_LDO_INTCORE
] = {
1031 .name
= "LDO-INTCORE",
1032 .ops
= &ab8500_regulator_volt_mode_ops
,
1033 .type
= REGULATOR_VOLTAGE
,
1034 .id
= AB8500_LDO_INTCORE
,
1035 .owner
= THIS_MODULE
,
1036 .n_voltages
= ARRAY_SIZE(ldo_vintcore_voltages
),
1037 .volt_table
= ldo_vintcore_voltages
,
1040 .update_bank
= 0x03,
1042 .update_mask
= 0x44,
1044 .update_val_idle
= 0x44,
1045 .update_val_normal
= 0x04,
1046 .voltage_bank
= 0x03,
1047 .voltage_reg
= 0x80,
1048 .voltage_mask
= 0x38,
1053 * Fixed Voltage Regulators
1055 * update bank, reg, mask, enable val
1057 [AB9540_LDO_TVOUT
] = {
1059 .name
= "LDO-TVOUT",
1060 .ops
= &ab8500_regulator_mode_ops
,
1061 .type
= REGULATOR_VOLTAGE
,
1062 .id
= AB8500_LDO_TVOUT
,
1063 .owner
= THIS_MODULE
,
1065 .volt_table
= fixed_2000000_voltage
,
1069 .update_bank
= 0x03,
1071 .update_mask
= 0x82,
1073 .update_val_idle
= 0x82,
1074 .update_val_normal
= 0x02,
1076 [AB9540_LDO_USB
] = {
1079 .ops
= &ab8500_regulator_ops
,
1080 .type
= REGULATOR_VOLTAGE
,
1081 .id
= AB9540_LDO_USB
,
1082 .owner
= THIS_MODULE
,
1084 .volt_table
= fixed_3300000_voltage
,
1086 .update_bank
= 0x03,
1088 .update_mask
= 0x03,
1090 .update_val_idle
= 0x03,
1091 .update_val_normal
= 0x01,
1093 [AB9540_LDO_AUDIO
] = {
1095 .name
= "LDO-AUDIO",
1096 .ops
= &ab8500_regulator_ops
,
1097 .type
= REGULATOR_VOLTAGE
,
1098 .id
= AB8500_LDO_AUDIO
,
1099 .owner
= THIS_MODULE
,
1101 .volt_table
= fixed_2000000_voltage
,
1103 .update_bank
= 0x03,
1105 .update_mask
= 0x02,
1108 [AB9540_LDO_ANAMIC1
] = {
1110 .name
= "LDO-ANAMIC1",
1111 .ops
= &ab8500_regulator_ops
,
1112 .type
= REGULATOR_VOLTAGE
,
1113 .id
= AB8500_LDO_ANAMIC1
,
1114 .owner
= THIS_MODULE
,
1116 .volt_table
= fixed_2050000_voltage
,
1118 .update_bank
= 0x03,
1120 .update_mask
= 0x08,
1123 [AB9540_LDO_ANAMIC2
] = {
1125 .name
= "LDO-ANAMIC2",
1126 .ops
= &ab8500_regulator_ops
,
1127 .type
= REGULATOR_VOLTAGE
,
1128 .id
= AB8500_LDO_ANAMIC2
,
1129 .owner
= THIS_MODULE
,
1131 .volt_table
= fixed_2050000_voltage
,
1133 .update_bank
= 0x03,
1135 .update_mask
= 0x10,
1138 [AB9540_LDO_DMIC
] = {
1141 .ops
= &ab8500_regulator_ops
,
1142 .type
= REGULATOR_VOLTAGE
,
1143 .id
= AB8500_LDO_DMIC
,
1144 .owner
= THIS_MODULE
,
1146 .volt_table
= fixed_1800000_voltage
,
1148 .update_bank
= 0x03,
1150 .update_mask
= 0x04,
1155 * Regulators with fixed voltage and normal/idle modes
1157 [AB9540_LDO_ANA
] = {
1160 .ops
= &ab8500_regulator_mode_ops
,
1161 .type
= REGULATOR_VOLTAGE
,
1162 .id
= AB8500_LDO_ANA
,
1163 .owner
= THIS_MODULE
,
1165 .volt_table
= fixed_1200000_voltage
,
1168 .update_bank
= 0x04,
1170 .update_mask
= 0x0c,
1172 .update_val_idle
= 0x0c,
1173 .update_val_normal
= 0x08,
1177 /* AB8540 regulator information */
1178 static struct ab8500_regulator_info
1179 ab8540_regulator_info
[AB8540_NUM_REGULATORS
] = {
1181 * Variable Voltage Regulators
1182 * name, min mV, max mV,
1183 * update bank, reg, mask, enable val
1184 * volt bank, reg, mask, table, table length
1186 [AB8540_LDO_AUX1
] = {
1189 .ops
= &ab8500_regulator_volt_mode_ops
,
1190 .type
= REGULATOR_VOLTAGE
,
1191 .id
= AB8500_LDO_AUX1
,
1192 .owner
= THIS_MODULE
,
1193 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
1194 .volt_table
= ldo_vauxn_voltages
,
1197 .update_bank
= 0x04,
1199 .update_mask
= 0x03,
1201 .update_val_idle
= 0x03,
1202 .update_val_normal
= 0x01,
1203 .voltage_bank
= 0x04,
1204 .voltage_reg
= 0x1f,
1205 .voltage_mask
= 0x0f,
1207 [AB8540_LDO_AUX2
] = {
1210 .ops
= &ab8500_regulator_volt_mode_ops
,
1211 .type
= REGULATOR_VOLTAGE
,
1212 .id
= AB8500_LDO_AUX2
,
1213 .owner
= THIS_MODULE
,
1214 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
1215 .volt_table
= ldo_vauxn_voltages
,
1218 .update_bank
= 0x04,
1220 .update_mask
= 0x0c,
1222 .update_val_idle
= 0x0c,
1223 .update_val_normal
= 0x04,
1224 .voltage_bank
= 0x04,
1225 .voltage_reg
= 0x20,
1226 .voltage_mask
= 0x0f,
1228 [AB8540_LDO_AUX3
] = {
1231 .ops
= &ab8500_regulator_volt_mode_ops
,
1232 .type
= REGULATOR_VOLTAGE
,
1233 .id
= AB8500_LDO_AUX3
,
1234 .owner
= THIS_MODULE
,
1235 .n_voltages
= ARRAY_SIZE(ldo_vaux3_ab8540_voltages
),
1236 .volt_table
= ldo_vaux3_ab8540_voltages
,
1239 .update_bank
= 0x04,
1241 .update_mask
= 0x03,
1243 .update_val_idle
= 0x03,
1244 .update_val_normal
= 0x01,
1245 .voltage_bank
= 0x04,
1246 .voltage_reg
= 0x21,
1247 .voltage_mask
= 0x07,
1249 [AB8540_LDO_AUX4
] = {
1252 .ops
= &ab8500_regulator_volt_mode_ops
,
1253 .type
= REGULATOR_VOLTAGE
,
1254 .id
= AB9540_LDO_AUX4
,
1255 .owner
= THIS_MODULE
,
1256 .n_voltages
= ARRAY_SIZE(ldo_vauxn_voltages
),
1257 .volt_table
= ldo_vauxn_voltages
,
1260 /* values for Vaux4Regu register */
1261 .update_bank
= 0x04,
1263 .update_mask
= 0x03,
1265 .update_val_idle
= 0x03,
1266 .update_val_normal
= 0x01,
1267 /* values for Vaux4SEL register */
1268 .voltage_bank
= 0x04,
1269 .voltage_reg
= 0x2f,
1270 .voltage_mask
= 0x0f,
1272 [AB8540_LDO_INTCORE
] = {
1274 .name
= "LDO-INTCORE",
1275 .ops
= &ab8500_regulator_volt_mode_ops
,
1276 .type
= REGULATOR_VOLTAGE
,
1277 .id
= AB8500_LDO_INTCORE
,
1278 .owner
= THIS_MODULE
,
1279 .n_voltages
= ARRAY_SIZE(ldo_vintcore_voltages
),
1280 .volt_table
= ldo_vintcore_voltages
,
1283 .update_bank
= 0x03,
1285 .update_mask
= 0x44,
1287 .update_val_idle
= 0x44,
1288 .update_val_normal
= 0x04,
1289 .voltage_bank
= 0x03,
1290 .voltage_reg
= 0x80,
1291 .voltage_mask
= 0x38,
1296 * Fixed Voltage Regulators
1298 * update bank, reg, mask, enable val
1300 [AB8540_LDO_TVOUT
] = {
1302 .name
= "LDO-TVOUT",
1303 .ops
= &ab8500_regulator_mode_ops
,
1304 .type
= REGULATOR_VOLTAGE
,
1305 .id
= AB8500_LDO_TVOUT
,
1306 .owner
= THIS_MODULE
,
1311 .update_bank
= 0x03,
1313 .update_mask
= 0x82,
1315 .update_val_idle
= 0x82,
1316 .update_val_normal
= 0x02,
1318 [AB8540_LDO_AUDIO
] = {
1320 .name
= "LDO-AUDIO",
1321 .ops
= &ab8500_regulator_ops
,
1322 .type
= REGULATOR_VOLTAGE
,
1323 .id
= AB8500_LDO_AUDIO
,
1324 .owner
= THIS_MODULE
,
1326 .volt_table
= fixed_2000000_voltage
,
1328 .update_bank
= 0x03,
1330 .update_mask
= 0x02,
1333 [AB8540_LDO_ANAMIC1
] = {
1335 .name
= "LDO-ANAMIC1",
1336 .ops
= &ab8500_regulator_ops
,
1337 .type
= REGULATOR_VOLTAGE
,
1338 .id
= AB8500_LDO_ANAMIC1
,
1339 .owner
= THIS_MODULE
,
1341 .volt_table
= fixed_2050000_voltage
,
1343 .update_bank
= 0x03,
1345 .update_mask
= 0x08,
1348 [AB8540_LDO_ANAMIC2
] = {
1350 .name
= "LDO-ANAMIC2",
1351 .ops
= &ab8500_regulator_ops
,
1352 .type
= REGULATOR_VOLTAGE
,
1353 .id
= AB8500_LDO_ANAMIC2
,
1354 .owner
= THIS_MODULE
,
1356 .volt_table
= fixed_2050000_voltage
,
1358 .update_bank
= 0x03,
1360 .update_mask
= 0x10,
1363 [AB8540_LDO_DMIC
] = {
1366 .ops
= &ab8500_regulator_ops
,
1367 .type
= REGULATOR_VOLTAGE
,
1368 .id
= AB8500_LDO_DMIC
,
1369 .owner
= THIS_MODULE
,
1372 .update_bank
= 0x03,
1374 .update_mask
= 0x04,
1379 * Regulators with fixed voltage and normal/idle modes
1381 [AB8540_LDO_ANA
] = {
1384 .ops
= &ab8500_regulator_mode_ops
,
1385 .type
= REGULATOR_VOLTAGE
,
1386 .id
= AB8500_LDO_ANA
,
1387 .owner
= THIS_MODULE
,
1389 .volt_table
= fixed_1200000_voltage
,
1392 .update_bank
= 0x04,
1394 .update_mask
= 0x0c,
1396 .update_val_idle
= 0x0c,
1397 .update_val_normal
= 0x04,
1399 [AB8540_LDO_SDIO
] = {
1402 .ops
= &ab8500_regulator_volt_mode_ops
,
1403 .type
= REGULATOR_VOLTAGE
,
1404 .id
= AB8540_LDO_SDIO
,
1405 .owner
= THIS_MODULE
,
1406 .n_voltages
= ARRAY_SIZE(ldo_sdio_voltages
),
1407 .volt_table
= ldo_sdio_voltages
,
1410 .update_bank
= 0x03,
1412 .update_mask
= 0x30,
1414 .update_val_idle
= 0x30,
1415 .update_val_normal
= 0x10,
1416 .voltage_bank
= 0x03,
1417 .voltage_reg
= 0x88,
1418 .voltage_mask
= 0x07,
1422 struct ab8500_reg_init
{
1428 #define REG_INIT(_id, _bank, _addr, _mask) \
1435 /* AB8500 register init */
1436 static struct ab8500_reg_init ab8500_reg_init
[] = {
1438 * 0x30, VanaRequestCtrl
1439 * 0xc0, VextSupply1RequestCtrl
1441 REG_INIT(AB8500_REGUREQUESTCTRL2
, 0x03, 0x04, 0xf0),
1443 * 0x03, VextSupply2RequestCtrl
1444 * 0x0c, VextSupply3RequestCtrl
1445 * 0x30, Vaux1RequestCtrl
1446 * 0xc0, Vaux2RequestCtrl
1448 REG_INIT(AB8500_REGUREQUESTCTRL3
, 0x03, 0x05, 0xff),
1450 * 0x03, Vaux3RequestCtrl
1453 REG_INIT(AB8500_REGUREQUESTCTRL4
, 0x03, 0x06, 0x07),
1455 * 0x08, VanaSysClkReq1HPValid
1456 * 0x20, Vaux1SysClkReq1HPValid
1457 * 0x40, Vaux2SysClkReq1HPValid
1458 * 0x80, Vaux3SysClkReq1HPValid
1460 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1
, 0x03, 0x07, 0xe8),
1462 * 0x10, VextSupply1SysClkReq1HPValid
1463 * 0x20, VextSupply2SysClkReq1HPValid
1464 * 0x40, VextSupply3SysClkReq1HPValid
1466 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2
, 0x03, 0x08, 0x70),
1468 * 0x08, VanaHwHPReq1Valid
1469 * 0x20, Vaux1HwHPReq1Valid
1470 * 0x40, Vaux2HwHPReq1Valid
1471 * 0x80, Vaux3HwHPReq1Valid
1473 REG_INIT(AB8500_REGUHWHPREQ1VALID1
, 0x03, 0x09, 0xe8),
1475 * 0x01, VextSupply1HwHPReq1Valid
1476 * 0x02, VextSupply2HwHPReq1Valid
1477 * 0x04, VextSupply3HwHPReq1Valid
1479 REG_INIT(AB8500_REGUHWHPREQ1VALID2
, 0x03, 0x0a, 0x07),
1481 * 0x08, VanaHwHPReq2Valid
1482 * 0x20, Vaux1HwHPReq2Valid
1483 * 0x40, Vaux2HwHPReq2Valid
1484 * 0x80, Vaux3HwHPReq2Valid
1486 REG_INIT(AB8500_REGUHWHPREQ2VALID1
, 0x03, 0x0b, 0xe8),
1488 * 0x01, VextSupply1HwHPReq2Valid
1489 * 0x02, VextSupply2HwHPReq2Valid
1490 * 0x04, VextSupply3HwHPReq2Valid
1492 REG_INIT(AB8500_REGUHWHPREQ2VALID2
, 0x03, 0x0c, 0x07),
1494 * 0x20, VanaSwHPReqValid
1495 * 0x80, Vaux1SwHPReqValid
1497 REG_INIT(AB8500_REGUSWHPREQVALID1
, 0x03, 0x0d, 0xa0),
1499 * 0x01, Vaux2SwHPReqValid
1500 * 0x02, Vaux3SwHPReqValid
1501 * 0x04, VextSupply1SwHPReqValid
1502 * 0x08, VextSupply2SwHPReqValid
1503 * 0x10, VextSupply3SwHPReqValid
1505 REG_INIT(AB8500_REGUSWHPREQVALID2
, 0x03, 0x0e, 0x1f),
1507 * 0x02, SysClkReq2Valid1
1508 * 0x04, SysClkReq3Valid1
1509 * 0x08, SysClkReq4Valid1
1510 * 0x10, SysClkReq5Valid1
1511 * 0x20, SysClkReq6Valid1
1512 * 0x40, SysClkReq7Valid1
1513 * 0x80, SysClkReq8Valid1
1515 REG_INIT(AB8500_REGUSYSCLKREQVALID1
, 0x03, 0x0f, 0xfe),
1517 * 0x02, SysClkReq2Valid2
1518 * 0x04, SysClkReq3Valid2
1519 * 0x08, SysClkReq4Valid2
1520 * 0x10, SysClkReq5Valid2
1521 * 0x20, SysClkReq6Valid2
1522 * 0x40, SysClkReq7Valid2
1523 * 0x80, SysClkReq8Valid2
1525 REG_INIT(AB8500_REGUSYSCLKREQVALID2
, 0x03, 0x10, 0xfe),
1528 * 0x04, Vintcore12Ena
1529 * 0x38, Vintcore12Sel
1530 * 0x40, Vintcore12LP
1533 REG_INIT(AB8500_REGUMISC1
, 0x03, 0x80, 0xfe),
1540 REG_INIT(AB8500_VAUDIOSUPPLY
, 0x03, 0x83, 0x1e),
1542 * 0x01, Vamic1_dzout
1543 * 0x02, Vamic2_dzout
1545 REG_INIT(AB8500_REGUCTRL1VAMIC
, 0x03, 0x84, 0x03),
1547 * 0x03, VpllRegu (NOTE! PRCMU register bits)
1550 REG_INIT(AB8500_VPLLVANAREGU
, 0x04, 0x06, 0x0f),
1553 * 0x02, VrefDDRSleepMode
1555 REG_INIT(AB8500_VREFDDR
, 0x04, 0x07, 0x03),
1557 * 0x03, VextSupply1Regu
1558 * 0x0c, VextSupply2Regu
1559 * 0x30, VextSupply3Regu
1560 * 0x40, ExtSupply2Bypass
1561 * 0x80, ExtSupply3Bypass
1563 REG_INIT(AB8500_EXTSUPPLYREGU
, 0x04, 0x08, 0xff),
1568 REG_INIT(AB8500_VAUX12REGU
, 0x04, 0x09, 0x0f),
1572 REG_INIT(AB8500_VRF1VAUX3REGU
, 0x04, 0x0a, 0x03),
1576 REG_INIT(AB8500_VAUX1SEL
, 0x04, 0x1f, 0x0f),
1580 REG_INIT(AB8500_VAUX2SEL
, 0x04, 0x20, 0x0f),
1584 REG_INIT(AB8500_VRF1VAUX3SEL
, 0x04, 0x21, 0x07),
1586 * 0x01, VextSupply12LP
1588 REG_INIT(AB8500_REGUCTRL2SPARE
, 0x04, 0x22, 0x01),
1593 * 0x20, Vintcore12Disch
1597 REG_INIT(AB8500_REGUCTRLDISCH
, 0x04, 0x43, 0xfc),
1600 * 0x04, VdmicPullDownEna
1603 REG_INIT(AB8500_REGUCTRLDISCH2
, 0x04, 0x44, 0x16),
1606 /* AB8505 register init */
1607 static struct ab8500_reg_init ab8505_reg_init
[] = {
1609 * 0x03, VarmRequestCtrl
1610 * 0x0c, VsmpsCRequestCtrl
1611 * 0x30, VsmpsARequestCtrl
1612 * 0xc0, VsmpsBRequestCtrl
1614 REG_INIT(AB8505_REGUREQUESTCTRL1
, 0x03, 0x03, 0xff),
1616 * 0x03, VsafeRequestCtrl
1617 * 0x0c, VpllRequestCtrl
1618 * 0x30, VanaRequestCtrl
1620 REG_INIT(AB8505_REGUREQUESTCTRL2
, 0x03, 0x04, 0x3f),
1622 * 0x30, Vaux1RequestCtrl
1623 * 0xc0, Vaux2RequestCtrl
1625 REG_INIT(AB8505_REGUREQUESTCTRL3
, 0x03, 0x05, 0xf0),
1627 * 0x03, Vaux3RequestCtrl
1630 REG_INIT(AB8505_REGUREQUESTCTRL4
, 0x03, 0x06, 0x07),
1632 * 0x01, VsmpsASysClkReq1HPValid
1633 * 0x02, VsmpsBSysClkReq1HPValid
1634 * 0x04, VsafeSysClkReq1HPValid
1635 * 0x08, VanaSysClkReq1HPValid
1636 * 0x10, VpllSysClkReq1HPValid
1637 * 0x20, Vaux1SysClkReq1HPValid
1638 * 0x40, Vaux2SysClkReq1HPValid
1639 * 0x80, Vaux3SysClkReq1HPValid
1641 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1
, 0x03, 0x07, 0xff),
1643 * 0x01, VsmpsCSysClkReq1HPValid
1644 * 0x02, VarmSysClkReq1HPValid
1645 * 0x04, VbbSysClkReq1HPValid
1646 * 0x08, VsmpsMSysClkReq1HPValid
1648 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2
, 0x03, 0x08, 0x0f),
1650 * 0x01, VsmpsAHwHPReq1Valid
1651 * 0x02, VsmpsBHwHPReq1Valid
1652 * 0x04, VsafeHwHPReq1Valid
1653 * 0x08, VanaHwHPReq1Valid
1654 * 0x10, VpllHwHPReq1Valid
1655 * 0x20, Vaux1HwHPReq1Valid
1656 * 0x40, Vaux2HwHPReq1Valid
1657 * 0x80, Vaux3HwHPReq1Valid
1659 REG_INIT(AB8505_REGUHWHPREQ1VALID1
, 0x03, 0x09, 0xff),
1661 * 0x08, VsmpsMHwHPReq1Valid
1663 REG_INIT(AB8505_REGUHWHPREQ1VALID2
, 0x03, 0x0a, 0x08),
1665 * 0x01, VsmpsAHwHPReq2Valid
1666 * 0x02, VsmpsBHwHPReq2Valid
1667 * 0x04, VsafeHwHPReq2Valid
1668 * 0x08, VanaHwHPReq2Valid
1669 * 0x10, VpllHwHPReq2Valid
1670 * 0x20, Vaux1HwHPReq2Valid
1671 * 0x40, Vaux2HwHPReq2Valid
1672 * 0x80, Vaux3HwHPReq2Valid
1674 REG_INIT(AB8505_REGUHWHPREQ2VALID1
, 0x03, 0x0b, 0xff),
1676 * 0x08, VsmpsMHwHPReq2Valid
1678 REG_INIT(AB8505_REGUHWHPREQ2VALID2
, 0x03, 0x0c, 0x08),
1680 * 0x01, VsmpsCSwHPReqValid
1681 * 0x02, VarmSwHPReqValid
1682 * 0x04, VsmpsASwHPReqValid
1683 * 0x08, VsmpsBSwHPReqValid
1684 * 0x10, VsafeSwHPReqValid
1685 * 0x20, VanaSwHPReqValid
1686 * 0x40, VpllSwHPReqValid
1687 * 0x80, Vaux1SwHPReqValid
1689 REG_INIT(AB8505_REGUSWHPREQVALID1
, 0x03, 0x0d, 0xff),
1691 * 0x01, Vaux2SwHPReqValid
1692 * 0x02, Vaux3SwHPReqValid
1693 * 0x20, VsmpsMSwHPReqValid
1695 REG_INIT(AB8505_REGUSWHPREQVALID2
, 0x03, 0x0e, 0x23),
1697 * 0x02, SysClkReq2Valid1
1698 * 0x04, SysClkReq3Valid1
1699 * 0x08, SysClkReq4Valid1
1701 REG_INIT(AB8505_REGUSYSCLKREQVALID1
, 0x03, 0x0f, 0x0e),
1703 * 0x02, SysClkReq2Valid2
1704 * 0x04, SysClkReq3Valid2
1705 * 0x08, SysClkReq4Valid2
1707 REG_INIT(AB8505_REGUSYSCLKREQVALID2
, 0x03, 0x10, 0x0e),
1709 * 0x01, Vaux4SwHPReqValid
1710 * 0x02, Vaux4HwHPReq2Valid
1711 * 0x04, Vaux4HwHPReq1Valid
1712 * 0x08, Vaux4SysClkReq1HPValid
1714 REG_INIT(AB8505_REGUVAUX4REQVALID
, 0x03, 0x11, 0x0f),
1717 * 0x04, VintCore12Ena
1718 * 0x38, VintCore12Sel
1719 * 0x40, VintCore12LP
1722 REG_INIT(AB8505_REGUMISC1
, 0x03, 0x80, 0xfe),
1729 REG_INIT(AB8505_VAUDIOSUPPLY
, 0x03, 0x83, 0x1e),
1731 * 0x01, Vamic1_dzout
1732 * 0x02, Vamic2_dzout
1734 REG_INIT(AB8505_REGUCTRL1VAMIC
, 0x03, 0x84, 0x03),
1737 * 0x0c, VsmpsASelCtrl
1738 * 0x10, VsmpsAAutoMode
1739 * 0x20, VsmpsAPWMMode
1741 REG_INIT(AB8505_VSMPSAREGU
, 0x04, 0x03, 0x3f),
1744 * 0x0c, VsmpsBSelCtrl
1745 * 0x10, VsmpsBAutoMode
1746 * 0x20, VsmpsBPWMMode
1748 REG_INIT(AB8505_VSMPSBREGU
, 0x04, 0x04, 0x3f),
1751 * 0x0c, VsafeSelCtrl
1752 * 0x10, VsafeAutoMode
1753 * 0x20, VsafePWMMode
1755 REG_INIT(AB8505_VSAFEREGU
, 0x04, 0x05, 0x3f),
1757 * 0x03, VpllRegu (NOTE! PRCMU register bits)
1760 REG_INIT(AB8505_VPLLVANAREGU
, 0x04, 0x06, 0x0f),
1762 * 0x03, VextSupply1Regu
1763 * 0x0c, VextSupply2Regu
1764 * 0x30, VextSupply3Regu
1765 * 0x40, ExtSupply2Bypass
1766 * 0x80, ExtSupply3Bypass
1768 REG_INIT(AB8505_EXTSUPPLYREGU
, 0x04, 0x08, 0xff),
1773 REG_INIT(AB8505_VAUX12REGU
, 0x04, 0x09, 0x0f),
1777 REG_INIT(AB8505_VRF1VAUX3REGU
, 0x04, 0x0a, 0x0f),
1781 REG_INIT(AB8505_VSMPSASEL1
, 0x04, 0x13, 0x3f),
1785 REG_INIT(AB8505_VSMPSASEL2
, 0x04, 0x14, 0x3f),
1789 REG_INIT(AB8505_VSMPSASEL3
, 0x04, 0x15, 0x3f),
1793 REG_INIT(AB8505_VSMPSBSEL1
, 0x04, 0x17, 0x3f),
1797 REG_INIT(AB8505_VSMPSBSEL2
, 0x04, 0x18, 0x3f),
1801 REG_INIT(AB8505_VSMPSBSEL3
, 0x04, 0x19, 0x3f),
1805 REG_INIT(AB8505_VSAFESEL1
, 0x04, 0x1b, 0x7f),
1809 REG_INIT(AB8505_VSAFESEL2
, 0x04, 0x1c, 0x7f),
1813 REG_INIT(AB8505_VSAFESEL3
, 0x04, 0x1d, 0x7f),
1817 REG_INIT(AB8505_VAUX1SEL
, 0x04, 0x1f, 0x0f),
1821 REG_INIT(AB8505_VAUX2SEL
, 0x04, 0x20, 0x0f),
1826 REG_INIT(AB8505_VRF1VAUX3SEL
, 0x04, 0x21, 0x37),
1828 * 0x03, Vaux4RequestCtrl
1830 REG_INIT(AB8505_VAUX4REQCTRL
, 0x04, 0x2d, 0x03),
1834 REG_INIT(AB8505_VAUX4REGU
, 0x04, 0x2e, 0x03),
1838 REG_INIT(AB8505_VAUX4SEL
, 0x04, 0x2f, 0x0f),
1843 * 0x20, Vintcore12Disch
1847 REG_INIT(AB8505_REGUCTRLDISCH
, 0x04, 0x43, 0xfc),
1850 * 0x04, VdmicPullDownEna
1853 REG_INIT(AB8505_REGUCTRLDISCH2
, 0x04, 0x44, 0x16),
1857 REG_INIT(AB8505_REGUCTRLDISCH3
, 0x04, 0x48, 0x01),
1863 * 0x40, Vaux5DisSfst
1864 * 0x80, Vaux5DisPulld
1866 REG_INIT(AB8505_CTRLVAUX5
, 0x01, 0x55, 0xff),
1871 * 0x80, Vaux6DisPulld
1873 REG_INIT(AB8505_CTRLVAUX6
, 0x01, 0x56, 0x9f),
1876 /* AB9540 register init */
1877 static struct ab8500_reg_init ab9540_reg_init
[] = {
1879 * 0x03, VarmRequestCtrl
1880 * 0x0c, VapeRequestCtrl
1881 * 0x30, Vsmps1RequestCtrl
1882 * 0xc0, Vsmps2RequestCtrl
1884 REG_INIT(AB9540_REGUREQUESTCTRL1
, 0x03, 0x03, 0xff),
1886 * 0x03, Vsmps3RequestCtrl
1887 * 0x0c, VpllRequestCtrl
1888 * 0x30, VanaRequestCtrl
1889 * 0xc0, VextSupply1RequestCtrl
1891 REG_INIT(AB9540_REGUREQUESTCTRL2
, 0x03, 0x04, 0xff),
1893 * 0x03, VextSupply2RequestCtrl
1894 * 0x0c, VextSupply3RequestCtrl
1895 * 0x30, Vaux1RequestCtrl
1896 * 0xc0, Vaux2RequestCtrl
1898 REG_INIT(AB9540_REGUREQUESTCTRL3
, 0x03, 0x05, 0xff),
1900 * 0x03, Vaux3RequestCtrl
1903 REG_INIT(AB9540_REGUREQUESTCTRL4
, 0x03, 0x06, 0x07),
1905 * 0x01, Vsmps1SysClkReq1HPValid
1906 * 0x02, Vsmps2SysClkReq1HPValid
1907 * 0x04, Vsmps3SysClkReq1HPValid
1908 * 0x08, VanaSysClkReq1HPValid
1909 * 0x10, VpllSysClkReq1HPValid
1910 * 0x20, Vaux1SysClkReq1HPValid
1911 * 0x40, Vaux2SysClkReq1HPValid
1912 * 0x80, Vaux3SysClkReq1HPValid
1914 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1
, 0x03, 0x07, 0xff),
1916 * 0x01, VapeSysClkReq1HPValid
1917 * 0x02, VarmSysClkReq1HPValid
1918 * 0x04, VbbSysClkReq1HPValid
1919 * 0x08, VmodSysClkReq1HPValid
1920 * 0x10, VextSupply1SysClkReq1HPValid
1921 * 0x20, VextSupply2SysClkReq1HPValid
1922 * 0x40, VextSupply3SysClkReq1HPValid
1924 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2
, 0x03, 0x08, 0x7f),
1926 * 0x01, Vsmps1HwHPReq1Valid
1927 * 0x02, Vsmps2HwHPReq1Valid
1928 * 0x04, Vsmps3HwHPReq1Valid
1929 * 0x08, VanaHwHPReq1Valid
1930 * 0x10, VpllHwHPReq1Valid
1931 * 0x20, Vaux1HwHPReq1Valid
1932 * 0x40, Vaux2HwHPReq1Valid
1933 * 0x80, Vaux3HwHPReq1Valid
1935 REG_INIT(AB9540_REGUHWHPREQ1VALID1
, 0x03, 0x09, 0xff),
1937 * 0x01, VextSupply1HwHPReq1Valid
1938 * 0x02, VextSupply2HwHPReq1Valid
1939 * 0x04, VextSupply3HwHPReq1Valid
1940 * 0x08, VmodHwHPReq1Valid
1942 REG_INIT(AB9540_REGUHWHPREQ1VALID2
, 0x03, 0x0a, 0x0f),
1944 * 0x01, Vsmps1HwHPReq2Valid
1945 * 0x02, Vsmps2HwHPReq2Valid
1946 * 0x03, Vsmps3HwHPReq2Valid
1947 * 0x08, VanaHwHPReq2Valid
1948 * 0x10, VpllHwHPReq2Valid
1949 * 0x20, Vaux1HwHPReq2Valid
1950 * 0x40, Vaux2HwHPReq2Valid
1951 * 0x80, Vaux3HwHPReq2Valid
1953 REG_INIT(AB9540_REGUHWHPREQ2VALID1
, 0x03, 0x0b, 0xff),
1955 * 0x01, VextSupply1HwHPReq2Valid
1956 * 0x02, VextSupply2HwHPReq2Valid
1957 * 0x04, VextSupply3HwHPReq2Valid
1958 * 0x08, VmodHwHPReq2Valid
1960 REG_INIT(AB9540_REGUHWHPREQ2VALID2
, 0x03, 0x0c, 0x0f),
1962 * 0x01, VapeSwHPReqValid
1963 * 0x02, VarmSwHPReqValid
1964 * 0x04, Vsmps1SwHPReqValid
1965 * 0x08, Vsmps2SwHPReqValid
1966 * 0x10, Vsmps3SwHPReqValid
1967 * 0x20, VanaSwHPReqValid
1968 * 0x40, VpllSwHPReqValid
1969 * 0x80, Vaux1SwHPReqValid
1971 REG_INIT(AB9540_REGUSWHPREQVALID1
, 0x03, 0x0d, 0xff),
1973 * 0x01, Vaux2SwHPReqValid
1974 * 0x02, Vaux3SwHPReqValid
1975 * 0x04, VextSupply1SwHPReqValid
1976 * 0x08, VextSupply2SwHPReqValid
1977 * 0x10, VextSupply3SwHPReqValid
1978 * 0x20, VmodSwHPReqValid
1980 REG_INIT(AB9540_REGUSWHPREQVALID2
, 0x03, 0x0e, 0x3f),
1982 * 0x02, SysClkReq2Valid1
1984 * 0x80, SysClkReq8Valid1
1986 REG_INIT(AB9540_REGUSYSCLKREQVALID1
, 0x03, 0x0f, 0xfe),
1988 * 0x02, SysClkReq2Valid2
1990 * 0x80, SysClkReq8Valid2
1992 REG_INIT(AB9540_REGUSYSCLKREQVALID2
, 0x03, 0x10, 0xfe),
1994 * 0x01, Vaux4SwHPReqValid
1995 * 0x02, Vaux4HwHPReq2Valid
1996 * 0x04, Vaux4HwHPReq1Valid
1997 * 0x08, Vaux4SysClkReq1HPValid
1999 REG_INIT(AB9540_REGUVAUX4REQVALID
, 0x03, 0x11, 0x0f),
2002 * 0x04, Vintcore12Ena
2003 * 0x38, Vintcore12Sel
2004 * 0x40, Vintcore12LP
2007 REG_INIT(AB9540_REGUMISC1
, 0x03, 0x80, 0xfe),
2014 REG_INIT(AB9540_VAUDIOSUPPLY
, 0x03, 0x83, 0x1e),
2016 * 0x01, Vamic1_dzout
2017 * 0x02, Vamic2_dzout
2019 REG_INIT(AB9540_REGUCTRL1VAMIC
, 0x03, 0x84, 0x03),
2022 * 0x0c, Vsmps1SelCtrl
2023 * 0x10, Vsmps1AutoMode
2024 * 0x20, Vsmps1PWMMode
2026 REG_INIT(AB9540_VSMPS1REGU
, 0x04, 0x03, 0x3f),
2029 * 0x0c, Vsmps2SelCtrl
2030 * 0x10, Vsmps2AutoMode
2031 * 0x20, Vsmps2PWMMode
2033 REG_INIT(AB9540_VSMPS2REGU
, 0x04, 0x04, 0x3f),
2036 * 0x0c, Vsmps3SelCtrl
2037 * NOTE! PRCMU register
2039 REG_INIT(AB9540_VSMPS3REGU
, 0x04, 0x05, 0x0f),
2044 REG_INIT(AB9540_VPLLVANAREGU
, 0x04, 0x06, 0x0f),
2046 * 0x03, VextSupply1Regu
2047 * 0x0c, VextSupply2Regu
2048 * 0x30, VextSupply3Regu
2049 * 0x40, ExtSupply2Bypass
2050 * 0x80, ExtSupply3Bypass
2052 REG_INIT(AB9540_EXTSUPPLYREGU
, 0x04, 0x08, 0xff),
2057 REG_INIT(AB9540_VAUX12REGU
, 0x04, 0x09, 0x0f),
2062 REG_INIT(AB9540_VRF1VAUX3REGU
, 0x04, 0x0a, 0x0f),
2066 REG_INIT(AB9540_VSMPS1SEL1
, 0x04, 0x13, 0x3f),
2070 REG_INIT(AB9540_VSMPS1SEL2
, 0x04, 0x14, 0x3f),
2074 REG_INIT(AB9540_VSMPS1SEL3
, 0x04, 0x15, 0x3f),
2078 REG_INIT(AB9540_VSMPS2SEL1
, 0x04, 0x17, 0x3f),
2082 REG_INIT(AB9540_VSMPS2SEL2
, 0x04, 0x18, 0x3f),
2086 REG_INIT(AB9540_VSMPS2SEL3
, 0x04, 0x19, 0x3f),
2089 * NOTE! PRCMU register
2091 REG_INIT(AB9540_VSMPS3SEL1
, 0x04, 0x1b, 0x7f),
2094 * NOTE! PRCMU register
2096 REG_INIT(AB9540_VSMPS3SEL2
, 0x04, 0x1c, 0x7f),
2100 REG_INIT(AB9540_VAUX1SEL
, 0x04, 0x1f, 0x0f),
2104 REG_INIT(AB9540_VAUX2SEL
, 0x04, 0x20, 0x0f),
2109 REG_INIT(AB9540_VRF1VAUX3SEL
, 0x04, 0x21, 0x37),
2111 * 0x01, VextSupply12LP
2113 REG_INIT(AB9540_REGUCTRL2SPARE
, 0x04, 0x22, 0x01),
2115 * 0x03, Vaux4RequestCtrl
2117 REG_INIT(AB9540_VAUX4REQCTRL
, 0x04, 0x2d, 0x03),
2121 REG_INIT(AB9540_VAUX4REGU
, 0x04, 0x2e, 0x03),
2125 REG_INIT(AB9540_VAUX4SEL
, 0x04, 0x2f, 0x0f),
2132 * 0x20, Vintcore12Disch
2136 REG_INIT(AB9540_REGUCTRLDISCH
, 0x04, 0x43, 0xff),
2140 * 0x04, VdmicPullDownEna
2141 * 0x08, VpllPullDownEna
2144 REG_INIT(AB9540_REGUCTRLDISCH2
, 0x04, 0x44, 0x1f),
2148 REG_INIT(AB9540_REGUCTRLDISCH3
, 0x04, 0x48, 0x01),
2151 /* AB8540 register init */
2152 static struct ab8500_reg_init ab8540_reg_init
[] = {
2154 * 0x01, VSimSycClkReq1Valid
2155 * 0x02, VSimSycClkReq2Valid
2156 * 0x04, VSimSycClkReq3Valid
2157 * 0x08, VSimSycClkReq4Valid
2158 * 0x10, VSimSycClkReq5Valid
2159 * 0x20, VSimSycClkReq6Valid
2160 * 0x40, VSimSycClkReq7Valid
2161 * 0x80, VSimSycClkReq8Valid
2163 REG_INIT(AB8540_VSIMSYSCLKCTRL
, 0x02, 0x33, 0xff),
2165 * 0x03, VarmRequestCtrl
2166 * 0x0c, VapeRequestCtrl
2167 * 0x30, Vsmps1RequestCtrl
2168 * 0xc0, Vsmps2RequestCtrl
2170 REG_INIT(AB8540_REGUREQUESTCTRL1
, 0x03, 0x03, 0xff),
2172 * 0x03, Vsmps3RequestCtrl
2173 * 0x0c, VpllRequestCtrl
2174 * 0x30, VanaRequestCtrl
2175 * 0xc0, VextSupply1RequestCtrl
2177 REG_INIT(AB8540_REGUREQUESTCTRL2
, 0x03, 0x04, 0xff),
2179 * 0x03, VextSupply2RequestCtrl
2180 * 0x0c, VextSupply3RequestCtrl
2181 * 0x30, Vaux1RequestCtrl
2182 * 0xc0, Vaux2RequestCtrl
2184 REG_INIT(AB8540_REGUREQUESTCTRL3
, 0x03, 0x05, 0xff),
2186 * 0x03, Vaux3RequestCtrl
2189 REG_INIT(AB8540_REGUREQUESTCTRL4
, 0x03, 0x06, 0x07),
2191 * 0x01, Vsmps1SysClkReq1HPValid
2192 * 0x02, Vsmps2SysClkReq1HPValid
2193 * 0x04, Vsmps3SysClkReq1HPValid
2194 * 0x08, VanaSysClkReq1HPValid
2195 * 0x10, VpllSysClkReq1HPValid
2196 * 0x20, Vaux1SysClkReq1HPValid
2197 * 0x40, Vaux2SysClkReq1HPValid
2198 * 0x80, Vaux3SysClkReq1HPValid
2200 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1
, 0x03, 0x07, 0xff),
2202 * 0x01, VapeSysClkReq1HPValid
2203 * 0x02, VarmSysClkReq1HPValid
2204 * 0x04, VbbSysClkReq1HPValid
2205 * 0x10, VextSupply1SysClkReq1HPValid
2206 * 0x20, VextSupply2SysClkReq1HPValid
2207 * 0x40, VextSupply3SysClkReq1HPValid
2209 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2
, 0x03, 0x08, 0x77),
2211 * 0x01, Vsmps1HwHPReq1Valid
2212 * 0x02, Vsmps2HwHPReq1Valid
2213 * 0x04, Vsmps3HwHPReq1Valid
2214 * 0x08, VanaHwHPReq1Valid
2215 * 0x10, VpllHwHPReq1Valid
2216 * 0x20, Vaux1HwHPReq1Valid
2217 * 0x40, Vaux2HwHPReq1Valid
2218 * 0x80, Vaux3HwHPReq1Valid
2220 REG_INIT(AB8540_REGUHWHPREQ1VALID1
, 0x03, 0x09, 0xff),
2222 * 0x01, VextSupply1HwHPReq1Valid
2223 * 0x02, VextSupply2HwHPReq1Valid
2224 * 0x04, VextSupply3HwHPReq1Valid
2226 REG_INIT(AB8540_REGUHWHPREQ1VALID2
, 0x03, 0x0a, 0x07),
2228 * 0x01, Vsmps1HwHPReq2Valid
2229 * 0x02, Vsmps2HwHPReq2Valid
2230 * 0x03, Vsmps3HwHPReq2Valid
2231 * 0x08, VanaHwHPReq2Valid
2232 * 0x10, VpllHwHPReq2Valid
2233 * 0x20, Vaux1HwHPReq2Valid
2234 * 0x40, Vaux2HwHPReq2Valid
2235 * 0x80, Vaux3HwHPReq2Valid
2237 REG_INIT(AB8540_REGUHWHPREQ2VALID1
, 0x03, 0x0b, 0xff),
2239 * 0x01, VextSupply1HwHPReq2Valid
2240 * 0x02, VextSupply2HwHPReq2Valid
2241 * 0x04, VextSupply3HwHPReq2Valid
2243 REG_INIT(AB8540_REGUHWHPREQ2VALID2
, 0x03, 0x0c, 0x07),
2245 * 0x01, VapeSwHPReqValid
2246 * 0x02, VarmSwHPReqValid
2247 * 0x04, Vsmps1SwHPReqValid
2248 * 0x08, Vsmps2SwHPReqValid
2249 * 0x10, Vsmps3SwHPReqValid
2250 * 0x20, VanaSwHPReqValid
2251 * 0x40, VpllSwHPReqValid
2252 * 0x80, Vaux1SwHPReqValid
2254 REG_INIT(AB8540_REGUSWHPREQVALID1
, 0x03, 0x0d, 0xff),
2256 * 0x01, Vaux2SwHPReqValid
2257 * 0x02, Vaux3SwHPReqValid
2258 * 0x04, VextSupply1SwHPReqValid
2259 * 0x08, VextSupply2SwHPReqValid
2260 * 0x10, VextSupply3SwHPReqValid
2262 REG_INIT(AB8540_REGUSWHPREQVALID2
, 0x03, 0x0e, 0x1f),
2264 * 0x02, SysClkReq2Valid1
2266 * 0x80, SysClkReq8Valid1
2268 REG_INIT(AB8540_REGUSYSCLKREQVALID1
, 0x03, 0x0f, 0xff),
2270 * 0x02, SysClkReq2Valid2
2272 * 0x80, SysClkReq8Valid2
2274 REG_INIT(AB8540_REGUSYSCLKREQVALID2
, 0x03, 0x10, 0xff),
2276 * 0x01, Vaux4SwHPReqValid
2277 * 0x02, Vaux4HwHPReq2Valid
2278 * 0x04, Vaux4HwHPReq1Valid
2279 * 0x08, Vaux4SysClkReq1HPValid
2281 REG_INIT(AB8540_REGUVAUX4REQVALID
, 0x03, 0x11, 0x0f),
2283 * 0x01, Vaux5SwHPReqValid
2284 * 0x02, Vaux5HwHPReq2Valid
2285 * 0x04, Vaux5HwHPReq1Valid
2286 * 0x08, Vaux5SysClkReq1HPValid
2288 REG_INIT(AB8540_REGUVAUX5REQVALID
, 0x03, 0x12, 0x0f),
2290 * 0x01, Vaux6SwHPReqValid
2291 * 0x02, Vaux6HwHPReq2Valid
2292 * 0x04, Vaux6HwHPReq1Valid
2293 * 0x08, Vaux6SysClkReq1HPValid
2295 REG_INIT(AB8540_REGUVAUX6REQVALID
, 0x03, 0x13, 0x0f),
2297 * 0x01, VclkbSwHPReqValid
2298 * 0x02, VclkbHwHPReq2Valid
2299 * 0x04, VclkbHwHPReq1Valid
2300 * 0x08, VclkbSysClkReq1HPValid
2302 REG_INIT(AB8540_REGUVCLKBREQVALID
, 0x03, 0x14, 0x0f),
2304 * 0x01, Vrf1SwHPReqValid
2305 * 0x02, Vrf1HwHPReq2Valid
2306 * 0x04, Vrf1HwHPReq1Valid
2307 * 0x08, Vrf1SysClkReq1HPValid
2309 REG_INIT(AB8540_REGUVRF1REQVALID
, 0x03, 0x15, 0x0f),
2312 * 0x04, Vintcore12Ena
2313 * 0x38, Vintcore12Sel
2314 * 0x40, Vintcore12LP
2317 REG_INIT(AB8540_REGUMISC1
, 0x03, 0x80, 0xfe),
2326 REG_INIT(AB8540_VAUDIOSUPPLY
, 0x03, 0x83, 0xfe),
2328 * 0x01, Vamic1_dzout
2329 * 0x02, Vamic2_dzout
2331 REG_INIT(AB8540_REGUCTRL1VAMIC
, 0x03, 0x84, 0x03),
2334 * 0x08, VHSICOffState
2338 REG_INIT(AB8540_VHSIC
, 0x03, 0x87, 0x3f),
2341 * 0x08, VSDIOOffState
2345 REG_INIT(AB8540_VSDIO
, 0x03, 0x88, 0x3f),
2348 * 0x0c, Vsmps1SelCtrl
2349 * 0x10, Vsmps1AutoMode
2350 * 0x20, Vsmps1PWMMode
2352 REG_INIT(AB8540_VSMPS1REGU
, 0x04, 0x03, 0x3f),
2355 * 0x0c, Vsmps2SelCtrl
2356 * 0x10, Vsmps2AutoMode
2357 * 0x20, Vsmps2PWMMode
2359 REG_INIT(AB8540_VSMPS2REGU
, 0x04, 0x04, 0x3f),
2362 * 0x0c, Vsmps3SelCtrl
2363 * 0x10, Vsmps3AutoMode
2364 * 0x20, Vsmps3PWMMode
2365 * NOTE! PRCMU register
2367 REG_INIT(AB8540_VSMPS3REGU
, 0x04, 0x05, 0x0f),
2372 REG_INIT(AB8540_VPLLVANAREGU
, 0x04, 0x06, 0x0f),
2374 * 0x03, VextSupply1Regu
2375 * 0x0c, VextSupply2Regu
2376 * 0x30, VextSupply3Regu
2377 * 0x40, ExtSupply2Bypass
2378 * 0x80, ExtSupply3Bypass
2380 REG_INIT(AB8540_EXTSUPPLYREGU
, 0x04, 0x08, 0xff),
2385 REG_INIT(AB8540_VAUX12REGU
, 0x04, 0x09, 0x0f),
2390 REG_INIT(AB8540_VRF1VAUX3REGU
, 0x04, 0x0a, 0x0f),
2394 REG_INIT(AB8540_VSMPS1SEL1
, 0x04, 0x13, 0x3f),
2398 REG_INIT(AB8540_VSMPS1SEL2
, 0x04, 0x14, 0x3f),
2402 REG_INIT(AB8540_VSMPS1SEL3
, 0x04, 0x15, 0x3f),
2406 REG_INIT(AB8540_VSMPS2SEL1
, 0x04, 0x17, 0x3f),
2410 REG_INIT(AB8540_VSMPS2SEL2
, 0x04, 0x18, 0x3f),
2414 REG_INIT(AB8540_VSMPS2SEL3
, 0x04, 0x19, 0x3f),
2417 * NOTE! PRCMU register
2419 REG_INIT(AB8540_VSMPS3SEL1
, 0x04, 0x1b, 0x7f),
2422 * NOTE! PRCMU register
2424 REG_INIT(AB8540_VSMPS3SEL2
, 0x04, 0x1c, 0x7f),
2428 REG_INIT(AB8540_VAUX1SEL
, 0x04, 0x1f, 0x0f),
2432 REG_INIT(AB8540_VAUX2SEL
, 0x04, 0x20, 0x0f),
2437 REG_INIT(AB8540_VRF1VAUX3SEL
, 0x04, 0x21, 0x77),
2439 * 0x01, VextSupply12LP
2441 REG_INIT(AB8540_REGUCTRL2SPARE
, 0x04, 0x22, 0x01),
2446 REG_INIT(AB8540_VANAVPLLSEL
, 0x04, 0x29, 0x37),
2448 * 0x03, Vaux4RequestCtrl
2450 REG_INIT(AB8540_VAUX4REQCTRL
, 0x04, 0x2d, 0x03),
2454 REG_INIT(AB8540_VAUX4REGU
, 0x04, 0x2e, 0x03),
2458 REG_INIT(AB8540_VAUX4SEL
, 0x04, 0x2f, 0x0f),
2460 * 0x03, Vaux5RequestCtrl
2462 REG_INIT(AB8540_VAUX5REQCTRL
, 0x04, 0x31, 0x03),
2466 REG_INIT(AB8540_VAUX5REGU
, 0x04, 0x32, 0x03),
2470 REG_INIT(AB8540_VAUX5SEL
, 0x04, 0x33, 0x3f),
2472 * 0x03, Vaux6RequestCtrl
2474 REG_INIT(AB8540_VAUX6REQCTRL
, 0x04, 0x34, 0x03),
2478 REG_INIT(AB8540_VAUX6REGU
, 0x04, 0x35, 0x03),
2482 REG_INIT(AB8540_VAUX6SEL
, 0x04, 0x36, 0x3f),
2484 * 0x03, VCLKBRequestCtrl
2486 REG_INIT(AB8540_VCLKBREQCTRL
, 0x04, 0x37, 0x03),
2490 REG_INIT(AB8540_VCLKBREGU
, 0x04, 0x38, 0x03),
2494 REG_INIT(AB8540_VCLKBSEL
, 0x04, 0x39, 0x07),
2496 * 0x03, Vrf1RequestCtrl
2498 REG_INIT(AB8540_VRF1REQCTRL
, 0x04, 0x3a, 0x03),
2505 * 0x20, Vintcore12Disch
2509 REG_INIT(AB8540_REGUCTRLDISCH
, 0x04, 0x43, 0xff),
2512 * 0x04, VdmicPullDownEna
2513 * 0x08, VpllPullDownEna
2516 REG_INIT(AB8540_REGUCTRLDISCH2
, 0x04, 0x44, 0x1e),
2520 REG_INIT(AB8540_REGUCTRLDISCH3
, 0x04, 0x48, 0x01),
2526 REG_INIT(AB8540_REGUCTRLDISCH4
, 0x04, 0x49, 0x07),
2529 static int ab8500_regulator_init_registers(struct platform_device
*pdev
,
2530 struct ab8500_reg_init
*reg_init
,
2531 int id
, int mask
, int value
)
2535 BUG_ON(value
& ~mask
);
2536 BUG_ON(mask
& ~reg_init
[id
].mask
);
2538 /* initialize register */
2539 err
= abx500_mask_and_set_register_interruptible(
2546 "Failed to initialize 0x%02x, 0x%02x.\n",
2551 dev_vdbg(&pdev
->dev
,
2552 " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
2560 static int ab8500_regulator_register(struct platform_device
*pdev
,
2561 struct regulator_init_data
*init_data
,
2562 struct ab8500_regulator_info
*regulator_info
,
2563 int id
, struct device_node
*np
)
2565 struct ab8500
*ab8500
= dev_get_drvdata(pdev
->dev
.parent
);
2566 struct ab8500_regulator_info
*info
= NULL
;
2567 struct regulator_config config
= { };
2570 /* assign per-regulator data */
2571 info
= ®ulator_info
[id
];
2572 info
->dev
= &pdev
->dev
;
2574 config
.dev
= &pdev
->dev
;
2575 config
.init_data
= init_data
;
2576 config
.driver_data
= info
;
2577 config
.of_node
= np
;
2579 /* fix for hardware before ab8500v2.0 */
2580 if (is_ab8500_1p1_or_earlier(ab8500
)) {
2581 if (info
->desc
.id
== AB8500_LDO_AUX3
) {
2582 info
->desc
.n_voltages
=
2583 ARRAY_SIZE(ldo_vauxn_voltages
);
2584 info
->desc
.volt_table
= ldo_vauxn_voltages
;
2585 info
->voltage_mask
= 0xf;
2589 /* register regulator with framework */
2590 info
->regulator
= regulator_register(&info
->desc
, &config
);
2591 if (IS_ERR(info
->regulator
)) {
2592 err
= PTR_ERR(info
->regulator
);
2593 dev_err(&pdev
->dev
, "failed to register regulator %s\n",
2595 /* when we fail, un-register all earlier regulators */
2597 info
= ®ulator_info
[id
];
2598 regulator_unregister(info
->regulator
);
2606 static struct of_regulator_match ab8500_regulator_match
[] = {
2607 { .name
= "ab8500_ldo_aux1", .driver_data
= (void *) AB8500_LDO_AUX1
, },
2608 { .name
= "ab8500_ldo_aux2", .driver_data
= (void *) AB8500_LDO_AUX2
, },
2609 { .name
= "ab8500_ldo_aux3", .driver_data
= (void *) AB8500_LDO_AUX3
, },
2610 { .name
= "ab8500_ldo_intcore", .driver_data
= (void *) AB8500_LDO_INTCORE
, },
2611 { .name
= "ab8500_ldo_tvout", .driver_data
= (void *) AB8500_LDO_TVOUT
, },
2612 { .name
= "ab8500_ldo_audio", .driver_data
= (void *) AB8500_LDO_AUDIO
, },
2613 { .name
= "ab8500_ldo_anamic1", .driver_data
= (void *) AB8500_LDO_ANAMIC1
, },
2614 { .name
= "ab8500_ldo_amamic2", .driver_data
= (void *) AB8500_LDO_ANAMIC2
, },
2615 { .name
= "ab8500_ldo_dmic", .driver_data
= (void *) AB8500_LDO_DMIC
, },
2616 { .name
= "ab8500_ldo_ana", .driver_data
= (void *) AB8500_LDO_ANA
, },
2619 static struct of_regulator_match ab8505_regulator_match
[] = {
2620 { .name
= "ab8500_ldo_aux1", .driver_data
= (void *) AB8505_LDO_AUX1
, },
2621 { .name
= "ab8500_ldo_aux2", .driver_data
= (void *) AB8505_LDO_AUX2
, },
2622 { .name
= "ab8500_ldo_aux3", .driver_data
= (void *) AB8505_LDO_AUX3
, },
2623 { .name
= "ab8500_ldo_aux4", .driver_data
= (void *) AB8505_LDO_AUX4
, },
2624 { .name
= "ab8500_ldo_aux5", .driver_data
= (void *) AB8505_LDO_AUX5
, },
2625 { .name
= "ab8500_ldo_aux6", .driver_data
= (void *) AB8505_LDO_AUX6
, },
2626 { .name
= "ab8500_ldo_intcore", .driver_data
= (void *) AB8505_LDO_INTCORE
, },
2627 { .name
= "ab8500_ldo_adc", .driver_data
= (void *) AB8505_LDO_ADC
, },
2628 { .name
= "ab8500_ldo_audio", .driver_data
= (void *) AB8505_LDO_AUDIO
, },
2629 { .name
= "ab8500_ldo_anamic1", .driver_data
= (void *) AB8505_LDO_ANAMIC1
, },
2630 { .name
= "ab8500_ldo_amamic2", .driver_data
= (void *) AB8505_LDO_ANAMIC2
, },
2631 { .name
= "ab8500_ldo_aux8", .driver_data
= (void *) AB8505_LDO_AUX8
, },
2632 { .name
= "ab8500_ldo_ana", .driver_data
= (void *) AB8505_LDO_ANA
, },
2635 static struct of_regulator_match ab8540_regulator_match
[] = {
2636 { .name
= "ab8500_ldo_aux1", .driver_data
= (void *) AB8540_LDO_AUX1
, },
2637 { .name
= "ab8500_ldo_aux2", .driver_data
= (void *) AB8540_LDO_AUX2
, },
2638 { .name
= "ab8500_ldo_aux3", .driver_data
= (void *) AB8540_LDO_AUX3
, },
2639 { .name
= "ab8500_ldo_aux4", .driver_data
= (void *) AB8540_LDO_AUX4
, },
2640 { .name
= "ab8500_ldo_intcore", .driver_data
= (void *) AB8540_LDO_INTCORE
, },
2641 { .name
= "ab8500_ldo_tvout", .driver_data
= (void *) AB8540_LDO_TVOUT
, },
2642 { .name
= "ab8500_ldo_audio", .driver_data
= (void *) AB8540_LDO_AUDIO
, },
2643 { .name
= "ab8500_ldo_anamic1", .driver_data
= (void *) AB8540_LDO_ANAMIC1
, },
2644 { .name
= "ab8500_ldo_amamic2", .driver_data
= (void *) AB8540_LDO_ANAMIC2
, },
2645 { .name
= "ab8500_ldo_dmic", .driver_data
= (void *) AB8540_LDO_DMIC
, },
2646 { .name
= "ab8500_ldo_ana", .driver_data
= (void *) AB8540_LDO_ANA
, },
2647 { .name
= "ab8500_ldo_sdio", .driver_data
= (void *) AB8540_LDO_SDIO
, },
2650 static struct of_regulator_match ab9540_regulator_match
[] = {
2651 { .name
= "ab8500_ldo_aux1", .driver_data
= (void *) AB9540_LDO_AUX1
, },
2652 { .name
= "ab8500_ldo_aux2", .driver_data
= (void *) AB9540_LDO_AUX2
, },
2653 { .name
= "ab8500_ldo_aux3", .driver_data
= (void *) AB9540_LDO_AUX3
, },
2654 { .name
= "ab8500_ldo_aux4", .driver_data
= (void *) AB9540_LDO_AUX4
, },
2655 { .name
= "ab8500_ldo_intcore", .driver_data
= (void *) AB9540_LDO_INTCORE
, },
2656 { .name
= "ab8500_ldo_tvout", .driver_data
= (void *) AB9540_LDO_TVOUT
, },
2657 { .name
= "ab8500_ldo_audio", .driver_data
= (void *) AB9540_LDO_AUDIO
, },
2658 { .name
= "ab8500_ldo_anamic1", .driver_data
= (void *) AB9540_LDO_ANAMIC1
, },
2659 { .name
= "ab8500_ldo_amamic2", .driver_data
= (void *) AB9540_LDO_ANAMIC2
, },
2660 { .name
= "ab8500_ldo_dmic", .driver_data
= (void *) AB9540_LDO_DMIC
, },
2661 { .name
= "ab8500_ldo_ana", .driver_data
= (void *) AB9540_LDO_ANA
, },
2665 ab8500_regulator_of_probe(struct platform_device
*pdev
,
2666 struct ab8500_regulator_info
*regulator_info
,
2667 int regulator_info_size
,
2668 struct of_regulator_match
*match
,
2669 struct device_node
*np
)
2673 for (i
= 0; i
< regulator_info_size
; i
++) {
2674 err
= ab8500_regulator_register(
2675 pdev
, match
[i
].init_data
, regulator_info
,
2676 i
, match
[i
].of_node
);
2684 static int ab8500_regulator_probe(struct platform_device
*pdev
)
2686 struct ab8500
*ab8500
= dev_get_drvdata(pdev
->dev
.parent
);
2687 struct device_node
*np
= pdev
->dev
.of_node
;
2688 struct of_regulator_match
*match
;
2689 struct ab8500_platform_data
*ppdata
;
2690 struct ab8500_regulator_platform_data
*pdata
;
2692 struct ab8500_regulator_info
*regulator_info
;
2693 int regulator_info_size
;
2694 struct ab8500_reg_init
*reg_init
;
2697 if (is_ab9540(ab8500
)) {
2698 regulator_info
= ab9540_regulator_info
;
2699 regulator_info_size
= ARRAY_SIZE(ab9540_regulator_info
);
2700 reg_init
= ab9540_reg_init
;
2701 reg_init_size
= AB9540_NUM_REGULATOR_REGISTERS
;
2702 match
= ab9540_regulator_match
;
2703 match_size
= ARRAY_SIZE(ab9540_regulator_match
)
2704 } else if (is_ab8505(ab8500
)) {
2705 regulator_info
= ab8505_regulator_info
;
2706 regulator_info_size
= ARRAY_SIZE(ab8505_regulator_info
);
2707 reg_init
= ab8505_reg_init
;
2708 reg_init_size
= AB8505_NUM_REGULATOR_REGISTERS
;
2709 } else if (is_ab8540(ab8500
)) {
2710 regulator_info
= ab8540_regulator_info
;
2711 regulator_info_size
= ARRAY_SIZE(ab8540_regulator_info
);
2712 reg_init
= ab8540_reg_init
;
2713 reg_init_size
= AB8540_NUM_REGULATOR_REGISTERS
;
2715 regulator_info
= ab8500_regulator_info
;
2716 regulator_info_size
= ARRAY_SIZE(ab8500_regulator_info
);
2717 reg_init
= ab8500_reg_init
;
2718 reg_init_size
= AB8500_NUM_REGULATOR_REGISTERS
;
2719 match
= ab8500_regulator_match
;
2720 match_size
= ARRAY_SIZE(ab8500_regulator_match
)
2724 err
= of_regulator_match(&pdev
->dev
, np
, match
, match_size
);
2727 "Error parsing regulator init data: %d\n", err
);
2731 err
= ab8500_regulator_of_probe(pdev
, regulator_info
,
2732 regulator_info_size
, match
, np
);
2737 dev_err(&pdev
->dev
, "null mfd parent\n");
2741 ppdata
= dev_get_platdata(ab8500
->dev
);
2743 dev_err(&pdev
->dev
, "null parent pdata\n");
2747 pdata
= ppdata
->regulator
;
2749 dev_err(&pdev
->dev
, "null pdata\n");
2753 /* make sure the platform data has the correct size */
2754 if (pdata
->num_regulator
!= regulator_info_size
) {
2755 dev_err(&pdev
->dev
, "Configuration error: size mismatch.\n");
2759 /* initialize debug (initial state is recorded with this call) */
2760 err
= ab8500_regulator_debug_init(pdev
);
2764 /* initialize registers */
2765 for (i
= 0; i
< pdata
->num_reg_init
; i
++) {
2766 int id
, mask
, value
;
2768 id
= pdata
->reg_init
[i
].id
;
2769 mask
= pdata
->reg_init
[i
].mask
;
2770 value
= pdata
->reg_init
[i
].value
;
2772 /* check for configuration errors */
2773 BUG_ON(id
>= AB8500_NUM_REGULATOR_REGISTERS
);
2775 err
= ab8500_regulator_init_registers(pdev
, reg_init
, id
, mask
, value
);
2780 /* register external regulators (before Vaux1, 2 and 3) */
2781 err
= ab8500_ext_regulator_init(pdev
);
2785 /* register all regulators */
2786 for (i
= 0; i
< regulator_info_size
; i
++) {
2787 err
= ab8500_regulator_register(pdev
, &pdata
->regulator
[i
],
2788 regulator_info
, i
, NULL
);
2796 static int ab8500_regulator_remove(struct platform_device
*pdev
)
2799 struct ab8500
*ab8500
= dev_get_drvdata(pdev
->dev
.parent
);
2800 struct ab8500_regulator_info
*regulator_info
;
2801 int regulator_info_size
;
2804 if (is_ab9540(ab8500
)) {
2805 regulator_info
= ab9540_regulator_info
;
2806 regulator_info_size
= ARRAY_SIZE(ab9540_regulator_info
);
2807 } else if (is_ab8505(ab8500
)) {
2808 regulator_info
= ab8505_regulator_info
;
2809 regulator_info_size
= ARRAY_SIZE(ab8505_regulator_info
);
2811 regulator_info
= ab8500_regulator_info
;
2812 regulator_info_size
= ARRAY_SIZE(ab8500_regulator_info
);
2815 for (i
= 0; i
< regulator_info_size
; i
++) {
2816 struct ab8500_regulator_info
*info
= NULL
;
2817 info
= ®ulator_info
[i
];
2819 dev_vdbg(rdev_get_dev(info
->regulator
),
2820 "%s-remove\n", info
->desc
.name
);
2822 regulator_unregister(info
->regulator
);
2825 /* remove external regulators (after Vaux1, 2 and 3) */
2826 err
= ab8500_ext_regulator_exit(pdev
);
2830 /* remove regulator debug */
2831 err
= ab8500_regulator_debug_exit(pdev
);
2838 static struct platform_driver ab8500_regulator_driver
= {
2839 .probe
= ab8500_regulator_probe
,
2840 .remove
= ab8500_regulator_remove
,
2842 .name
= "ab8500-regulator",
2843 .owner
= THIS_MODULE
,
2847 static int __init
ab8500_regulator_init(void)
2851 ret
= platform_driver_register(&ab8500_regulator_driver
);
2853 pr_err("Failed to register ab8500 regulator: %d\n", ret
);
2857 subsys_initcall(ab8500_regulator_init
);
2859 static void __exit
ab8500_regulator_exit(void)
2861 platform_driver_unregister(&ab8500_regulator_driver
);
2863 module_exit(ab8500_regulator_exit
);
2865 MODULE_LICENSE("GPL v2");
2866 MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
2867 MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
2868 MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>");
2869 MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
2870 MODULE_ALIAS("platform:ab8500-regulator");