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_shared_mode - is used when mode is shared between
35 * @shared_regulator: pointer to the other sharing regulator
36 * @lp_mode_req: low power mode requested by this regulator
38 struct ab8500_shared_mode {
39 struct ab8500_regulator_info *shared_regulator;
44 * struct ab8500_regulator_info - ab8500 regulator information
45 * @dev: device pointer
46 * @desc: regulator description
47 * @regulator_dev: regulator device
48 * @shared_mode: used when mode is shared between two regulators
49 * @load_lp_uA: maximum load in idle (low power) mode
50 * @update_bank: bank to control on/off
51 * @update_reg: register to control on/off
52 * @update_mask: mask to enable/disable and set mode of regulator
53 * @update_val: bits holding the regulator current mode
54 * @update_val_idle: bits to enable the regulator in idle (low power) mode
55 * @update_val_normal: bits to enable the regulator in normal (high power) mode
56 * @mode_bank: bank with location of mode register
57 * @mode_reg: mode register
58 * @mode_mask: mask for setting mode
59 * @mode_val_idle: mode setting for low power
60 * @mode_val_normal: mode setting for normal power
61 * @voltage_bank: bank to control regulator voltage
62 * @voltage_reg: register to control regulator voltage
63 * @voltage_mask: mask to control regulator voltage
64 * @voltage_shift: shift to control regulator voltage
66 struct ab8500_regulator_info {
68 struct regulator_desc desc;
69 struct regulator_dev *regulator;
70 struct ab8500_shared_mode *shared_mode;
96 /* voltage tables for the vauxn/vintcore supplies */
97 static const unsigned int ldo_vauxn_voltages[] = {
116 static const unsigned int ldo_vaux3_voltages[] = {
127 static const unsigned int ldo_vaux56_voltages[] = {
138 static const unsigned int ldo_vaux3_ab8540_voltages[] = {
150 static const unsigned int ldo_vaux56_ab8540_voltages[] = {
151 750000, 760000, 770000, 780000, 790000, 800000,
152 810000, 820000, 830000, 840000, 850000, 860000,
153 870000, 880000, 890000, 900000, 910000, 920000,
154 930000, 940000, 950000, 960000, 970000, 980000,
155 990000, 1000000, 1010000, 1020000, 1030000,
156 1040000, 1050000, 1060000, 1070000, 1080000,
157 1090000, 1100000, 1110000, 1120000, 1130000,
158 1140000, 1150000, 1160000, 1170000, 1180000,
159 1190000, 1200000, 1210000, 1220000, 1230000,
160 1240000, 1250000, 1260000, 1270000, 1280000,
161 1290000, 1300000, 1310000, 1320000, 1330000,
162 1340000, 1350000, 1360000, 1800000, 2790000,
165 static const unsigned int ldo_vintcore_voltages[] = {
175 static const unsigned int ldo_sdio_voltages[] = {
186 static const unsigned int fixed_1200000_voltage[] = {
190 static const unsigned int fixed_1800000_voltage[] = {
194 static const unsigned int fixed_2000000_voltage[] = {
198 static const unsigned int fixed_2050000_voltage[] = {
202 static const unsigned int fixed_3300000_voltage[] = {
206 static const unsigned int ldo_vana_voltages[] = {
217 static const unsigned int ldo_vaudio_voltages[] = {
225 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */
228 static const unsigned int ldo_vdmic_voltages[] = {
235 static DEFINE_MUTEX(shared_mode_mutex);
236 static struct ab8500_shared_mode ldo_anamic1_shared;
237 static struct ab8500_shared_mode ldo_anamic2_shared;
238 static struct ab8500_shared_mode ab8540_ldo_anamic1_shared;
239 static struct ab8500_shared_mode ab8540_ldo_anamic2_shared;
241 static int ab8500_regulator_enable(struct regulator_dev *rdev)
244 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
247 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
251 ret = abx500_mask_and_set_register_interruptible(info->dev,
252 info->update_bank, info->update_reg,
253 info->update_mask, info->update_val);
255 dev_err(rdev_get_dev(rdev),
256 "couldn't set enable bits for regulator\n");
260 dev_vdbg(rdev_get_dev(rdev),
261 "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
262 info->desc.name, info->update_bank, info->update_reg,
263 info->update_mask, info->update_val);
268 static int ab8500_regulator_disable(struct regulator_dev *rdev)
271 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
274 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
278 ret = abx500_mask_and_set_register_interruptible(info->dev,
279 info->update_bank, info->update_reg,
280 info->update_mask, 0x0);
282 dev_err(rdev_get_dev(rdev),
283 "couldn't set disable bits for regulator\n");
287 dev_vdbg(rdev_get_dev(rdev),
288 "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
289 info->desc.name, info->update_bank, info->update_reg,
290 info->update_mask, 0x0);
295 static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
298 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
302 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
306 ret = abx500_get_register_interruptible(info->dev,
307 info->update_bank, info->update_reg, ®val);
309 dev_err(rdev_get_dev(rdev),
310 "couldn't read 0x%x register\n", info->update_reg);
314 dev_vdbg(rdev_get_dev(rdev),
315 "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
317 info->desc.name, info->update_bank, info->update_reg,
318 info->update_mask, regval);
320 if (regval & info->update_mask)
326 static unsigned int ab8500_regulator_get_optimum_mode(
327 struct regulator_dev *rdev, int input_uV,
328 int output_uV, int load_uA)
332 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
335 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
339 if (load_uA <= info->load_lp_uA)
340 mode = REGULATOR_MODE_IDLE;
342 mode = REGULATOR_MODE_NORMAL;
347 static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
355 bool dmr = false; /* Dedicated mode register */
356 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
359 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
363 if (info->shared_mode) {
365 * Special case where mode is shared between two regulators.
367 struct ab8500_shared_mode *sm = info->shared_mode;
368 mutex_lock(&shared_mode_mutex);
370 if (mode == REGULATOR_MODE_IDLE) {
371 sm->lp_mode_req = true; /* Low power mode requested */
372 if (!((sm->shared_regulator)->
373 shared_mode->lp_mode_req)) {
374 mutex_unlock(&shared_mode_mutex);
375 return 0; /* Other regulator prevent LP mode */
378 sm->lp_mode_req = false;
382 if (info->mode_mask) {
383 /* Dedicated register for handling mode */
388 case REGULATOR_MODE_NORMAL:
389 val = info->mode_val_normal;
391 case REGULATOR_MODE_IDLE:
392 val = info->mode_val_idle;
395 if (info->shared_mode)
396 mutex_unlock(&shared_mode_mutex);
400 bank = info->mode_bank;
401 reg = info->mode_reg;
402 mask = info->mode_mask;
404 /* Mode register same as enable register */
407 case REGULATOR_MODE_NORMAL:
408 info->update_val = info->update_val_normal;
409 val = info->update_val_normal;
411 case REGULATOR_MODE_IDLE:
412 info->update_val = info->update_val_idle;
413 val = info->update_val_idle;
416 if (info->shared_mode)
417 mutex_unlock(&shared_mode_mutex);
421 bank = info->update_bank;
422 reg = info->update_reg;
423 mask = info->update_mask;
426 if (dmr || ab8500_regulator_is_enabled(rdev)) {
427 ret = abx500_mask_and_set_register_interruptible(info->dev,
428 bank, reg, mask, val);
430 dev_err(rdev_get_dev(rdev),
431 "couldn't set regulator mode\n");
433 dev_vdbg(rdev_get_dev(rdev),
434 "%s-set_mode (bank, reg, mask, value): "
435 "0x%x, 0x%x, 0x%x, 0x%x\n",
436 info->desc.name, bank, reg,
440 if (info->shared_mode)
441 mutex_unlock(&shared_mode_mutex);
446 static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
448 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
455 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
459 /* Need special handling for shared mode */
460 if (info->shared_mode) {
461 if (info->shared_mode->lp_mode_req)
462 return REGULATOR_MODE_IDLE;
464 return REGULATOR_MODE_NORMAL;
467 if (info->mode_mask) {
468 /* Dedicated register for handling mode */
469 ret = abx500_get_register_interruptible(info->dev,
470 info->mode_bank, info->mode_reg, &val);
471 val = val & info->mode_mask;
473 val_normal = info->mode_val_normal;
474 val_idle = info->mode_val_idle;
476 /* Mode register same as enable register */
477 val = info->update_val;
478 val_normal = info->update_val_normal;
479 val_idle = info->update_val_idle;
482 if (val == val_normal)
483 ret = REGULATOR_MODE_NORMAL;
484 else if (val == val_idle)
485 ret = REGULATOR_MODE_IDLE;
492 static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
495 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
499 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
503 ret = abx500_get_register_interruptible(info->dev,
504 info->voltage_bank, info->voltage_reg, ®val);
506 dev_err(rdev_get_dev(rdev),
507 "couldn't read voltage reg for regulator\n");
511 dev_vdbg(rdev_get_dev(rdev),
512 "%s-get_voltage (bank, reg, mask, shift, value): "
513 "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
514 info->desc.name, info->voltage_bank,
515 info->voltage_reg, info->voltage_mask,
516 info->voltage_shift, regval);
518 val = regval & info->voltage_mask;
519 return val >> info->voltage_shift;
522 static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
525 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
526 u8 regval, regval_expand;
529 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
533 ret = abx500_get_register_interruptible(info->dev,
534 info->voltage_bank, info->voltage_reg, ®val);
537 dev_err(rdev_get_dev(rdev),
538 "couldn't read voltage reg for regulator\n");
542 ret = abx500_get_register_interruptible(info->dev,
543 info->expand_register.voltage_bank,
544 info->expand_register.voltage_reg, ®val_expand);
547 dev_err(rdev_get_dev(rdev),
548 "couldn't read voltage reg for regulator\n");
552 dev_vdbg(rdev_get_dev(rdev),
553 "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
555 info->desc.name, info->voltage_bank, info->voltage_reg,
556 info->voltage_mask, regval);
557 dev_vdbg(rdev_get_dev(rdev),
558 "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
560 info->desc.name, info->expand_register.voltage_bank,
561 info->expand_register.voltage_reg,
562 info->expand_register.voltage_mask, regval_expand);
564 if (regval_expand&(info->expand_register.voltage_mask))
565 /* Vaux3 has a different layout */
566 val = info->expand_register.voltage_limit;
568 val = (regval & info->voltage_mask) >> info->voltage_shift;
573 static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,
577 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
581 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
585 /* set the registers for the request */
586 regval = (u8)selector << info->voltage_shift;
587 ret = abx500_mask_and_set_register_interruptible(info->dev,
588 info->voltage_bank, info->voltage_reg,
589 info->voltage_mask, regval);
591 dev_err(rdev_get_dev(rdev),
592 "couldn't set voltage reg for regulator\n");
594 dev_vdbg(rdev_get_dev(rdev),
595 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
597 info->desc.name, info->voltage_bank, info->voltage_reg,
598 info->voltage_mask, regval);
603 static int ab8540_aux3_regulator_set_voltage_sel(struct regulator_dev *rdev,
607 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
611 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
615 if (selector >= info->expand_register.voltage_limit) {
616 /* Vaux3 bit4 has different layout */
617 regval = (u8)selector << info->expand_register.voltage_shift;
618 ret = abx500_mask_and_set_register_interruptible(info->dev,
619 info->expand_register.voltage_bank,
620 info->expand_register.voltage_reg,
621 info->expand_register.voltage_mask,
624 /* set the registers for the request */
625 regval = (u8)selector << info->voltage_shift;
626 ret = abx500_mask_and_set_register_interruptible(info->dev,
627 info->voltage_bank, info->voltage_reg,
628 info->voltage_mask, regval);
631 dev_err(rdev_get_dev(rdev),
632 "couldn't set voltage reg for regulator\n");
634 dev_vdbg(rdev_get_dev(rdev),
635 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
637 info->desc.name, info->voltage_bank, info->voltage_reg,
638 info->voltage_mask, regval);
643 static struct regulator_ops ab8500_regulator_volt_mode_ops = {
644 .enable = ab8500_regulator_enable,
645 .disable = ab8500_regulator_disable,
646 .is_enabled = ab8500_regulator_is_enabled,
647 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
648 .set_mode = ab8500_regulator_set_mode,
649 .get_mode = ab8500_regulator_get_mode,
650 .get_voltage_sel = ab8500_regulator_get_voltage_sel,
651 .set_voltage_sel = ab8500_regulator_set_voltage_sel,
652 .list_voltage = regulator_list_voltage_table,
655 static struct regulator_ops ab8540_aux3_regulator_volt_mode_ops = {
656 .enable = ab8500_regulator_enable,
657 .disable = ab8500_regulator_disable,
658 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
659 .set_mode = ab8500_regulator_set_mode,
660 .get_mode = ab8500_regulator_get_mode,
661 .is_enabled = ab8500_regulator_is_enabled,
662 .get_voltage_sel = ab8540_aux3_regulator_get_voltage_sel,
663 .set_voltage_sel = ab8540_aux3_regulator_set_voltage_sel,
664 .list_voltage = regulator_list_voltage_table,
667 static struct regulator_ops ab8500_regulator_volt_ops = {
668 .enable = ab8500_regulator_enable,
669 .disable = ab8500_regulator_disable,
670 .is_enabled = ab8500_regulator_is_enabled,
671 .get_voltage_sel = ab8500_regulator_get_voltage_sel,
672 .set_voltage_sel = ab8500_regulator_set_voltage_sel,
673 .list_voltage = regulator_list_voltage_table,
676 static struct regulator_ops ab8500_regulator_mode_ops = {
677 .enable = ab8500_regulator_enable,
678 .disable = ab8500_regulator_disable,
679 .is_enabled = ab8500_regulator_is_enabled,
680 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
681 .set_mode = ab8500_regulator_set_mode,
682 .get_mode = ab8500_regulator_get_mode,
683 .list_voltage = regulator_list_voltage_table,
686 static struct regulator_ops ab8500_regulator_ops = {
687 .enable = ab8500_regulator_enable,
688 .disable = ab8500_regulator_disable,
689 .is_enabled = ab8500_regulator_is_enabled,
690 .list_voltage = regulator_list_voltage_table,
693 static struct regulator_ops ab8500_regulator_anamic_mode_ops = {
694 .enable = ab8500_regulator_enable,
695 .disable = ab8500_regulator_disable,
696 .is_enabled = ab8500_regulator_is_enabled,
697 .set_mode = ab8500_regulator_set_mode,
698 .get_mode = ab8500_regulator_get_mode,
699 .list_voltage = regulator_list_voltage_table,
702 /* AB8500 regulator information */
703 static struct ab8500_regulator_info
704 ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
706 * Variable Voltage Regulators
707 * name, min mV, max mV,
708 * update bank, reg, mask, enable val
709 * volt bank, reg, mask
711 [AB8500_LDO_AUX1] = {
714 .ops = &ab8500_regulator_volt_mode_ops,
715 .type = REGULATOR_VOLTAGE,
716 .id = AB8500_LDO_AUX1,
717 .owner = THIS_MODULE,
718 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
719 .volt_table = ldo_vauxn_voltages,
727 .update_val_idle = 0x03,
728 .update_val_normal = 0x01,
729 .voltage_bank = 0x04,
731 .voltage_mask = 0x0f,
733 [AB8500_LDO_AUX2] = {
736 .ops = &ab8500_regulator_volt_mode_ops,
737 .type = REGULATOR_VOLTAGE,
738 .id = AB8500_LDO_AUX2,
739 .owner = THIS_MODULE,
740 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
741 .volt_table = ldo_vauxn_voltages,
749 .update_val_idle = 0x0c,
750 .update_val_normal = 0x04,
751 .voltage_bank = 0x04,
753 .voltage_mask = 0x0f,
755 [AB8500_LDO_AUX3] = {
758 .ops = &ab8500_regulator_volt_mode_ops,
759 .type = REGULATOR_VOLTAGE,
760 .id = AB8500_LDO_AUX3,
761 .owner = THIS_MODULE,
762 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
763 .volt_table = ldo_vaux3_voltages,
771 .update_val_idle = 0x03,
772 .update_val_normal = 0x01,
773 .voltage_bank = 0x04,
775 .voltage_mask = 0x07,
777 [AB8500_LDO_INTCORE] = {
779 .name = "LDO-INTCORE",
780 .ops = &ab8500_regulator_volt_mode_ops,
781 .type = REGULATOR_VOLTAGE,
782 .id = AB8500_LDO_INTCORE,
783 .owner = THIS_MODULE,
784 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
785 .volt_table = ldo_vintcore_voltages,
793 .update_val_idle = 0x44,
794 .update_val_normal = 0x04,
795 .voltage_bank = 0x03,
797 .voltage_mask = 0x38,
802 * Fixed Voltage Regulators
804 * update bank, reg, mask, enable val
806 [AB8500_LDO_TVOUT] = {
809 .ops = &ab8500_regulator_mode_ops,
810 .type = REGULATOR_VOLTAGE,
811 .id = AB8500_LDO_TVOUT,
812 .owner = THIS_MODULE,
814 .volt_table = fixed_2000000_voltage,
822 .update_val_idle = 0x82,
823 .update_val_normal = 0x02,
825 [AB8500_LDO_AUDIO] = {
828 .ops = &ab8500_regulator_ops,
829 .type = REGULATOR_VOLTAGE,
830 .id = AB8500_LDO_AUDIO,
831 .owner = THIS_MODULE,
834 .volt_table = fixed_2000000_voltage,
841 [AB8500_LDO_ANAMIC1] = {
843 .name = "LDO-ANAMIC1",
844 .ops = &ab8500_regulator_ops,
845 .type = REGULATOR_VOLTAGE,
846 .id = AB8500_LDO_ANAMIC1,
847 .owner = THIS_MODULE,
850 .volt_table = fixed_2050000_voltage,
857 [AB8500_LDO_ANAMIC2] = {
859 .name = "LDO-ANAMIC2",
860 .ops = &ab8500_regulator_ops,
861 .type = REGULATOR_VOLTAGE,
862 .id = AB8500_LDO_ANAMIC2,
863 .owner = THIS_MODULE,
866 .volt_table = fixed_2050000_voltage,
873 [AB8500_LDO_DMIC] = {
876 .ops = &ab8500_regulator_ops,
877 .type = REGULATOR_VOLTAGE,
878 .id = AB8500_LDO_DMIC,
879 .owner = THIS_MODULE,
882 .volt_table = fixed_1800000_voltage,
891 * Regulators with fixed voltage and normal/idle modes
896 .ops = &ab8500_regulator_mode_ops,
897 .type = REGULATOR_VOLTAGE,
898 .id = AB8500_LDO_ANA,
899 .owner = THIS_MODULE,
902 .volt_table = fixed_1200000_voltage,
909 .update_val_idle = 0x0c,
910 .update_val_normal = 0x04,
914 /* AB8505 regulator information */
915 static struct ab8500_regulator_info
916 ab8505_regulator_info[AB8505_NUM_REGULATORS] = {
918 * Variable Voltage Regulators
919 * name, min mV, max mV,
920 * update bank, reg, mask, enable val
921 * volt bank, reg, mask
923 [AB8505_LDO_AUX1] = {
926 .ops = &ab8500_regulator_volt_mode_ops,
927 .type = REGULATOR_VOLTAGE,
928 .id = AB8505_LDO_AUX1,
929 .owner = THIS_MODULE,
930 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
931 .volt_table = ldo_vauxn_voltages,
938 .update_val_idle = 0x03,
939 .update_val_normal = 0x01,
940 .voltage_bank = 0x04,
942 .voltage_mask = 0x0f,
944 [AB8505_LDO_AUX2] = {
947 .ops = &ab8500_regulator_volt_mode_ops,
948 .type = REGULATOR_VOLTAGE,
949 .id = AB8505_LDO_AUX2,
950 .owner = THIS_MODULE,
951 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
952 .volt_table = ldo_vauxn_voltages,
959 .update_val_idle = 0x0c,
960 .update_val_normal = 0x04,
961 .voltage_bank = 0x04,
963 .voltage_mask = 0x0f,
965 [AB8505_LDO_AUX3] = {
968 .ops = &ab8500_regulator_volt_mode_ops,
969 .type = REGULATOR_VOLTAGE,
970 .id = AB8505_LDO_AUX3,
971 .owner = THIS_MODULE,
972 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
973 .volt_table = ldo_vaux3_voltages,
980 .update_val_idle = 0x03,
981 .update_val_normal = 0x01,
982 .voltage_bank = 0x04,
984 .voltage_mask = 0x07,
986 [AB8505_LDO_AUX4] = {
989 .ops = &ab8500_regulator_volt_mode_ops,
990 .type = REGULATOR_VOLTAGE,
991 .id = AB8505_LDO_AUX4,
992 .owner = THIS_MODULE,
993 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
994 .volt_table = ldo_vauxn_voltages,
997 /* values for Vaux4Regu register */
1000 .update_mask = 0x03,
1002 .update_val_idle = 0x03,
1003 .update_val_normal = 0x01,
1004 /* values for Vaux4SEL register */
1005 .voltage_bank = 0x04,
1006 .voltage_reg = 0x2f,
1007 .voltage_mask = 0x0f,
1009 [AB8505_LDO_AUX5] = {
1012 .ops = &ab8500_regulator_volt_mode_ops,
1013 .type = REGULATOR_VOLTAGE,
1014 .id = AB8505_LDO_AUX5,
1015 .owner = THIS_MODULE,
1016 .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
1017 .volt_table = ldo_vaux56_voltages,
1020 /* values for CtrlVaux5 register */
1021 .update_bank = 0x01,
1023 .update_mask = 0x18,
1025 .update_val_idle = 0x18,
1026 .update_val_normal = 0x10,
1027 .voltage_bank = 0x01,
1028 .voltage_reg = 0x55,
1029 .voltage_mask = 0x07,
1031 [AB8505_LDO_AUX6] = {
1034 .ops = &ab8500_regulator_volt_mode_ops,
1035 .type = REGULATOR_VOLTAGE,
1036 .id = AB8505_LDO_AUX6,
1037 .owner = THIS_MODULE,
1038 .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
1039 .volt_table = ldo_vaux56_voltages,
1042 /* values for CtrlVaux6 register */
1043 .update_bank = 0x01,
1045 .update_mask = 0x18,
1047 .update_val_idle = 0x18,
1048 .update_val_normal = 0x10,
1049 .voltage_bank = 0x01,
1050 .voltage_reg = 0x56,
1051 .voltage_mask = 0x07,
1053 [AB8505_LDO_INTCORE] = {
1055 .name = "LDO-INTCORE",
1056 .ops = &ab8500_regulator_volt_mode_ops,
1057 .type = REGULATOR_VOLTAGE,
1058 .id = AB8505_LDO_INTCORE,
1059 .owner = THIS_MODULE,
1060 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1061 .volt_table = ldo_vintcore_voltages,
1064 .update_bank = 0x03,
1066 .update_mask = 0x44,
1068 .update_val_idle = 0x44,
1069 .update_val_normal = 0x04,
1070 .voltage_bank = 0x03,
1071 .voltage_reg = 0x80,
1072 .voltage_mask = 0x38,
1077 * Fixed Voltage Regulators
1079 * update bank, reg, mask, enable val
1081 [AB8505_LDO_ADC] = {
1084 .ops = &ab8500_regulator_mode_ops,
1085 .type = REGULATOR_VOLTAGE,
1086 .id = AB8505_LDO_ADC,
1087 .owner = THIS_MODULE,
1089 .volt_table = fixed_2000000_voltage,
1090 .enable_time = 10000,
1093 .update_bank = 0x03,
1095 .update_mask = 0x82,
1097 .update_val_idle = 0x82,
1098 .update_val_normal = 0x02,
1100 [AB8505_LDO_USB] = {
1103 .ops = &ab8500_regulator_mode_ops,
1104 .type = REGULATOR_VOLTAGE,
1105 .id = AB8505_LDO_USB,
1106 .owner = THIS_MODULE,
1108 .volt_table = fixed_3300000_voltage,
1110 .update_bank = 0x03,
1112 .update_mask = 0x03,
1114 .update_val_idle = 0x03,
1115 .update_val_normal = 0x01,
1117 [AB8505_LDO_AUDIO] = {
1119 .name = "LDO-AUDIO",
1120 .ops = &ab8500_regulator_volt_ops,
1121 .type = REGULATOR_VOLTAGE,
1122 .id = AB8505_LDO_AUDIO,
1123 .owner = THIS_MODULE,
1124 .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages),
1125 .volt_table = ldo_vaudio_voltages,
1127 .update_bank = 0x03,
1129 .update_mask = 0x02,
1131 .voltage_bank = 0x01,
1132 .voltage_reg = 0x57,
1133 .voltage_mask = 0x70,
1136 [AB8505_LDO_ANAMIC1] = {
1138 .name = "LDO-ANAMIC1",
1139 .ops = &ab8500_regulator_anamic_mode_ops,
1140 .type = REGULATOR_VOLTAGE,
1141 .id = AB8505_LDO_ANAMIC1,
1142 .owner = THIS_MODULE,
1144 .volt_table = fixed_2050000_voltage,
1146 .shared_mode = &ldo_anamic1_shared,
1147 .update_bank = 0x03,
1149 .update_mask = 0x08,
1154 .mode_val_idle = 0x04,
1155 .mode_val_normal = 0x00,
1157 [AB8505_LDO_ANAMIC2] = {
1159 .name = "LDO-ANAMIC2",
1160 .ops = &ab8500_regulator_anamic_mode_ops,
1161 .type = REGULATOR_VOLTAGE,
1162 .id = AB8505_LDO_ANAMIC2,
1163 .owner = THIS_MODULE,
1165 .volt_table = fixed_2050000_voltage,
1167 .shared_mode = &ldo_anamic2_shared,
1168 .update_bank = 0x03,
1170 .update_mask = 0x10,
1175 .mode_val_idle = 0x04,
1176 .mode_val_normal = 0x00,
1178 [AB8505_LDO_AUX8] = {
1181 .ops = &ab8500_regulator_ops,
1182 .type = REGULATOR_VOLTAGE,
1183 .id = AB8505_LDO_AUX8,
1184 .owner = THIS_MODULE,
1186 .volt_table = fixed_1800000_voltage,
1188 .update_bank = 0x03,
1190 .update_mask = 0x04,
1194 * Regulators with fixed voltage and normal/idle modes
1196 [AB8505_LDO_ANA] = {
1199 .ops = &ab8500_regulator_volt_mode_ops,
1200 .type = REGULATOR_VOLTAGE,
1201 .id = AB8505_LDO_ANA,
1202 .owner = THIS_MODULE,
1203 .n_voltages = ARRAY_SIZE(ldo_vana_voltages),
1204 .volt_table = ldo_vana_voltages,
1207 .update_bank = 0x04,
1209 .update_mask = 0x0c,
1211 .update_val_idle = 0x0c,
1212 .update_val_normal = 0x04,
1213 .voltage_bank = 0x04,
1214 .voltage_reg = 0x29,
1215 .voltage_mask = 0x7,
1219 /* AB9540 regulator information */
1220 static struct ab8500_regulator_info
1221 ab9540_regulator_info[AB9540_NUM_REGULATORS] = {
1223 * Variable Voltage Regulators
1224 * name, min mV, max mV,
1225 * update bank, reg, mask, enable val
1226 * volt bank, reg, mask
1228 [AB9540_LDO_AUX1] = {
1231 .ops = &ab8500_regulator_volt_mode_ops,
1232 .type = REGULATOR_VOLTAGE,
1233 .id = AB9540_LDO_AUX1,
1234 .owner = THIS_MODULE,
1235 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1236 .volt_table = ldo_vauxn_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 = 0x1f,
1247 .voltage_mask = 0x0f,
1249 [AB9540_LDO_AUX2] = {
1252 .ops = &ab8500_regulator_volt_mode_ops,
1253 .type = REGULATOR_VOLTAGE,
1254 .id = AB9540_LDO_AUX2,
1255 .owner = THIS_MODULE,
1256 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1257 .volt_table = ldo_vauxn_voltages,
1260 .update_bank = 0x04,
1262 .update_mask = 0x0c,
1264 .update_val_idle = 0x0c,
1265 .update_val_normal = 0x04,
1266 .voltage_bank = 0x04,
1267 .voltage_reg = 0x20,
1268 .voltage_mask = 0x0f,
1270 [AB9540_LDO_AUX3] = {
1273 .ops = &ab8500_regulator_volt_mode_ops,
1274 .type = REGULATOR_VOLTAGE,
1275 .id = AB9540_LDO_AUX3,
1276 .owner = THIS_MODULE,
1277 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
1278 .volt_table = ldo_vaux3_voltages,
1281 .update_bank = 0x04,
1283 .update_mask = 0x03,
1285 .update_val_idle = 0x03,
1286 .update_val_normal = 0x01,
1287 .voltage_bank = 0x04,
1288 .voltage_reg = 0x21,
1289 .voltage_mask = 0x07,
1291 [AB9540_LDO_AUX4] = {
1294 .ops = &ab8500_regulator_volt_mode_ops,
1295 .type = REGULATOR_VOLTAGE,
1296 .id = AB9540_LDO_AUX4,
1297 .owner = THIS_MODULE,
1298 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1299 .volt_table = ldo_vauxn_voltages,
1302 /* values for Vaux4Regu register */
1303 .update_bank = 0x04,
1305 .update_mask = 0x03,
1307 .update_val_idle = 0x03,
1308 .update_val_normal = 0x01,
1309 /* values for Vaux4SEL register */
1310 .voltage_bank = 0x04,
1311 .voltage_reg = 0x2f,
1312 .voltage_mask = 0x0f,
1314 [AB9540_LDO_INTCORE] = {
1316 .name = "LDO-INTCORE",
1317 .ops = &ab8500_regulator_volt_mode_ops,
1318 .type = REGULATOR_VOLTAGE,
1319 .id = AB9540_LDO_INTCORE,
1320 .owner = THIS_MODULE,
1321 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1322 .volt_table = ldo_vintcore_voltages,
1325 .update_bank = 0x03,
1327 .update_mask = 0x44,
1329 .update_val_idle = 0x44,
1330 .update_val_normal = 0x04,
1331 .voltage_bank = 0x03,
1332 .voltage_reg = 0x80,
1333 .voltage_mask = 0x38,
1338 * Fixed Voltage Regulators
1340 * update bank, reg, mask, enable val
1342 [AB9540_LDO_TVOUT] = {
1344 .name = "LDO-TVOUT",
1345 .ops = &ab8500_regulator_mode_ops,
1346 .type = REGULATOR_VOLTAGE,
1347 .id = AB9540_LDO_TVOUT,
1348 .owner = THIS_MODULE,
1350 .volt_table = fixed_2000000_voltage,
1351 .enable_time = 10000,
1354 .update_bank = 0x03,
1356 .update_mask = 0x82,
1358 .update_val_idle = 0x82,
1359 .update_val_normal = 0x02,
1361 [AB9540_LDO_USB] = {
1364 .ops = &ab8500_regulator_ops,
1365 .type = REGULATOR_VOLTAGE,
1366 .id = AB9540_LDO_USB,
1367 .owner = THIS_MODULE,
1369 .volt_table = fixed_3300000_voltage,
1371 .update_bank = 0x03,
1373 .update_mask = 0x03,
1375 .update_val_idle = 0x03,
1376 .update_val_normal = 0x01,
1378 [AB9540_LDO_AUDIO] = {
1380 .name = "LDO-AUDIO",
1381 .ops = &ab8500_regulator_ops,
1382 .type = REGULATOR_VOLTAGE,
1383 .id = AB9540_LDO_AUDIO,
1384 .owner = THIS_MODULE,
1386 .volt_table = fixed_2000000_voltage,
1388 .update_bank = 0x03,
1390 .update_mask = 0x02,
1393 [AB9540_LDO_ANAMIC1] = {
1395 .name = "LDO-ANAMIC1",
1396 .ops = &ab8500_regulator_ops,
1397 .type = REGULATOR_VOLTAGE,
1398 .id = AB9540_LDO_ANAMIC1,
1399 .owner = THIS_MODULE,
1401 .volt_table = fixed_2050000_voltage,
1403 .update_bank = 0x03,
1405 .update_mask = 0x08,
1408 [AB9540_LDO_ANAMIC2] = {
1410 .name = "LDO-ANAMIC2",
1411 .ops = &ab8500_regulator_ops,
1412 .type = REGULATOR_VOLTAGE,
1413 .id = AB9540_LDO_ANAMIC2,
1414 .owner = THIS_MODULE,
1416 .volt_table = fixed_2050000_voltage,
1418 .update_bank = 0x03,
1420 .update_mask = 0x10,
1423 [AB9540_LDO_DMIC] = {
1426 .ops = &ab8500_regulator_ops,
1427 .type = REGULATOR_VOLTAGE,
1428 .id = AB9540_LDO_DMIC,
1429 .owner = THIS_MODULE,
1431 .volt_table = fixed_1800000_voltage,
1433 .update_bank = 0x03,
1435 .update_mask = 0x04,
1440 * Regulators with fixed voltage and normal/idle modes
1442 [AB9540_LDO_ANA] = {
1445 .ops = &ab8500_regulator_mode_ops,
1446 .type = REGULATOR_VOLTAGE,
1447 .id = AB9540_LDO_ANA,
1448 .owner = THIS_MODULE,
1450 .volt_table = fixed_1200000_voltage,
1453 .update_bank = 0x04,
1455 .update_mask = 0x0c,
1457 .update_val_idle = 0x0c,
1458 .update_val_normal = 0x08,
1462 /* AB8540 regulator information */
1463 static struct ab8500_regulator_info
1464 ab8540_regulator_info[AB8540_NUM_REGULATORS] = {
1466 * Variable Voltage Regulators
1467 * name, min mV, max mV,
1468 * update bank, reg, mask, enable val
1469 * volt bank, reg, mask
1471 [AB8540_LDO_AUX1] = {
1474 .ops = &ab8500_regulator_volt_mode_ops,
1475 .type = REGULATOR_VOLTAGE,
1476 .id = AB8540_LDO_AUX1,
1477 .owner = THIS_MODULE,
1478 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1479 .volt_table = ldo_vauxn_voltages,
1482 .update_bank = 0x04,
1484 .update_mask = 0x03,
1486 .update_val_idle = 0x03,
1487 .update_val_normal = 0x01,
1488 .voltage_bank = 0x04,
1489 .voltage_reg = 0x1f,
1490 .voltage_mask = 0x0f,
1492 [AB8540_LDO_AUX2] = {
1495 .ops = &ab8500_regulator_volt_mode_ops,
1496 .type = REGULATOR_VOLTAGE,
1497 .id = AB8540_LDO_AUX2,
1498 .owner = THIS_MODULE,
1499 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1500 .volt_table = ldo_vauxn_voltages,
1503 .update_bank = 0x04,
1505 .update_mask = 0x0c,
1507 .update_val_idle = 0x0c,
1508 .update_val_normal = 0x04,
1509 .voltage_bank = 0x04,
1510 .voltage_reg = 0x20,
1511 .voltage_mask = 0x0f,
1513 [AB8540_LDO_AUX3] = {
1516 .ops = &ab8540_aux3_regulator_volt_mode_ops,
1517 .type = REGULATOR_VOLTAGE,
1518 .id = AB8540_LDO_AUX3,
1519 .owner = THIS_MODULE,
1520 .n_voltages = ARRAY_SIZE(ldo_vaux3_ab8540_voltages),
1521 .volt_table = ldo_vaux3_ab8540_voltages,
1524 .update_bank = 0x04,
1526 .update_mask = 0x03,
1528 .update_val_idle = 0x03,
1529 .update_val_normal = 0x01,
1530 .voltage_bank = 0x04,
1531 .voltage_reg = 0x21,
1532 .voltage_mask = 0x07,
1533 .expand_register = {
1535 .voltage_bank = 0x04,
1536 .voltage_reg = 0x01,
1537 .voltage_mask = 0x10,
1541 [AB8540_LDO_AUX4] = {
1544 .ops = &ab8500_regulator_volt_mode_ops,
1545 .type = REGULATOR_VOLTAGE,
1546 .id = AB8540_LDO_AUX4,
1547 .owner = THIS_MODULE,
1548 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1549 .volt_table = ldo_vauxn_voltages,
1552 /* values for Vaux4Regu register */
1553 .update_bank = 0x04,
1555 .update_mask = 0x03,
1557 .update_val_idle = 0x03,
1558 .update_val_normal = 0x01,
1559 /* values for Vaux4SEL register */
1560 .voltage_bank = 0x04,
1561 .voltage_reg = 0x2f,
1562 .voltage_mask = 0x0f,
1564 [AB8540_LDO_AUX5] = {
1567 .ops = &ab8500_regulator_volt_mode_ops,
1568 .type = REGULATOR_VOLTAGE,
1569 .id = AB8540_LDO_AUX5,
1570 .owner = THIS_MODULE,
1571 .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages),
1572 .volt_table = ldo_vaux56_ab8540_voltages,
1574 .load_lp_uA = 20000,
1575 /* values for Vaux5Regu register */
1576 .update_bank = 0x04,
1578 .update_mask = 0x03,
1580 .update_val_idle = 0x03,
1581 .update_val_normal = 0x01,
1582 /* values for Vaux5SEL register */
1583 .voltage_bank = 0x04,
1584 .voltage_reg = 0x33,
1585 .voltage_mask = 0x3f,
1587 [AB8540_LDO_AUX6] = {
1590 .ops = &ab8500_regulator_volt_mode_ops,
1591 .type = REGULATOR_VOLTAGE,
1592 .id = AB8540_LDO_AUX6,
1593 .owner = THIS_MODULE,
1594 .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages),
1595 .volt_table = ldo_vaux56_ab8540_voltages,
1597 .load_lp_uA = 20000,
1598 /* values for Vaux6Regu register */
1599 .update_bank = 0x04,
1601 .update_mask = 0x03,
1603 .update_val_idle = 0x03,
1604 .update_val_normal = 0x01,
1605 /* values for Vaux6SEL register */
1606 .voltage_bank = 0x04,
1607 .voltage_reg = 0x36,
1608 .voltage_mask = 0x3f,
1610 [AB8540_LDO_INTCORE] = {
1612 .name = "LDO-INTCORE",
1613 .ops = &ab8500_regulator_volt_mode_ops,
1614 .type = REGULATOR_VOLTAGE,
1615 .id = AB8540_LDO_INTCORE,
1616 .owner = THIS_MODULE,
1617 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1618 .volt_table = ldo_vintcore_voltages,
1621 .update_bank = 0x03,
1623 .update_mask = 0x44,
1625 .update_val_idle = 0x44,
1626 .update_val_normal = 0x04,
1627 .voltage_bank = 0x03,
1628 .voltage_reg = 0x80,
1629 .voltage_mask = 0x38,
1634 * Fixed Voltage Regulators
1636 * update bank, reg, mask, enable val
1638 [AB8540_LDO_TVOUT] = {
1640 .name = "LDO-TVOUT",
1641 .ops = &ab8500_regulator_mode_ops,
1642 .type = REGULATOR_VOLTAGE,
1643 .id = AB8540_LDO_TVOUT,
1644 .owner = THIS_MODULE,
1646 .volt_table = fixed_2000000_voltage,
1647 .enable_time = 10000,
1650 .update_bank = 0x03,
1652 .update_mask = 0x82,
1654 .update_val_idle = 0x82,
1655 .update_val_normal = 0x02,
1657 [AB8540_LDO_AUDIO] = {
1659 .name = "LDO-AUDIO",
1660 .ops = &ab8500_regulator_ops,
1661 .type = REGULATOR_VOLTAGE,
1662 .id = AB8540_LDO_AUDIO,
1663 .owner = THIS_MODULE,
1665 .volt_table = fixed_2000000_voltage,
1667 .update_bank = 0x03,
1669 .update_mask = 0x02,
1672 [AB8540_LDO_ANAMIC1] = {
1674 .name = "LDO-ANAMIC1",
1675 .ops = &ab8500_regulator_anamic_mode_ops,
1676 .type = REGULATOR_VOLTAGE,
1677 .id = AB8540_LDO_ANAMIC1,
1678 .owner = THIS_MODULE,
1680 .volt_table = fixed_2050000_voltage,
1682 .shared_mode = &ab8540_ldo_anamic1_shared,
1683 .update_bank = 0x03,
1685 .update_mask = 0x08,
1690 .mode_val_idle = 0x20,
1691 .mode_val_normal = 0x00,
1693 [AB8540_LDO_ANAMIC2] = {
1695 .name = "LDO-ANAMIC2",
1696 .ops = &ab8500_regulator_anamic_mode_ops,
1697 .type = REGULATOR_VOLTAGE,
1698 .id = AB8540_LDO_ANAMIC2,
1699 .owner = THIS_MODULE,
1701 .volt_table = fixed_2050000_voltage,
1703 .shared_mode = &ab8540_ldo_anamic2_shared,
1704 .update_bank = 0x03,
1706 .update_mask = 0x10,
1711 .mode_val_idle = 0x20,
1712 .mode_val_normal = 0x00,
1714 [AB8540_LDO_DMIC] = {
1717 .ops = &ab8500_regulator_volt_mode_ops,
1718 .type = REGULATOR_VOLTAGE,
1719 .id = AB8540_LDO_DMIC,
1720 .owner = THIS_MODULE,
1721 .n_voltages = ARRAY_SIZE(ldo_vdmic_voltages),
1722 .volt_table = ldo_vdmic_voltages,
1725 .update_bank = 0x03,
1727 .update_mask = 0x04,
1729 .voltage_bank = 0x03,
1730 .voltage_reg = 0x83,
1731 .voltage_mask = 0xc0,
1736 * Regulators with fixed voltage and normal/idle modes
1738 [AB8540_LDO_ANA] = {
1741 .ops = &ab8500_regulator_mode_ops,
1742 .type = REGULATOR_VOLTAGE,
1743 .id = AB8540_LDO_ANA,
1744 .owner = THIS_MODULE,
1746 .volt_table = fixed_1200000_voltage,
1749 .update_bank = 0x04,
1751 .update_mask = 0x0c,
1753 .update_val_idle = 0x0c,
1754 .update_val_normal = 0x04,
1756 [AB8540_LDO_SDIO] = {
1759 .ops = &ab8500_regulator_volt_mode_ops,
1760 .type = REGULATOR_VOLTAGE,
1761 .id = AB8540_LDO_SDIO,
1762 .owner = THIS_MODULE,
1763 .n_voltages = ARRAY_SIZE(ldo_sdio_voltages),
1764 .volt_table = ldo_sdio_voltages,
1767 .update_bank = 0x03,
1769 .update_mask = 0x30,
1771 .update_val_idle = 0x30,
1772 .update_val_normal = 0x10,
1773 .voltage_bank = 0x03,
1774 .voltage_reg = 0x88,
1775 .voltage_mask = 0x07,
1779 static struct ab8500_shared_mode ldo_anamic1_shared = {
1780 .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2],
1783 static struct ab8500_shared_mode ldo_anamic2_shared = {
1784 .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1],
1787 static struct ab8500_shared_mode ab8540_ldo_anamic1_shared = {
1788 .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC2],
1791 static struct ab8500_shared_mode ab8540_ldo_anamic2_shared = {
1792 .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC1],
1795 struct ab8500_reg_init {
1801 #define REG_INIT(_id, _bank, _addr, _mask) \
1808 /* AB8500 register init */
1809 static struct ab8500_reg_init ab8500_reg_init[] = {
1811 * 0x30, VanaRequestCtrl
1812 * 0xc0, VextSupply1RequestCtrl
1814 REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xf0),
1816 * 0x03, VextSupply2RequestCtrl
1817 * 0x0c, VextSupply3RequestCtrl
1818 * 0x30, Vaux1RequestCtrl
1819 * 0xc0, Vaux2RequestCtrl
1821 REG_INIT(AB8500_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
1823 * 0x03, Vaux3RequestCtrl
1826 REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
1828 * 0x08, VanaSysClkReq1HPValid
1829 * 0x20, Vaux1SysClkReq1HPValid
1830 * 0x40, Vaux2SysClkReq1HPValid
1831 * 0x80, Vaux3SysClkReq1HPValid
1833 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
1835 * 0x10, VextSupply1SysClkReq1HPValid
1836 * 0x20, VextSupply2SysClkReq1HPValid
1837 * 0x40, VextSupply3SysClkReq1HPValid
1839 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
1841 * 0x08, VanaHwHPReq1Valid
1842 * 0x20, Vaux1HwHPReq1Valid
1843 * 0x40, Vaux2HwHPReq1Valid
1844 * 0x80, Vaux3HwHPReq1Valid
1846 REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8),
1848 * 0x01, VextSupply1HwHPReq1Valid
1849 * 0x02, VextSupply2HwHPReq1Valid
1850 * 0x04, VextSupply3HwHPReq1Valid
1852 REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
1854 * 0x08, VanaHwHPReq2Valid
1855 * 0x20, Vaux1HwHPReq2Valid
1856 * 0x40, Vaux2HwHPReq2Valid
1857 * 0x80, Vaux3HwHPReq2Valid
1859 REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8),
1861 * 0x01, VextSupply1HwHPReq2Valid
1862 * 0x02, VextSupply2HwHPReq2Valid
1863 * 0x04, VextSupply3HwHPReq2Valid
1865 REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
1867 * 0x20, VanaSwHPReqValid
1868 * 0x80, Vaux1SwHPReqValid
1870 REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0),
1872 * 0x01, Vaux2SwHPReqValid
1873 * 0x02, Vaux3SwHPReqValid
1874 * 0x04, VextSupply1SwHPReqValid
1875 * 0x08, VextSupply2SwHPReqValid
1876 * 0x10, VextSupply3SwHPReqValid
1878 REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
1880 * 0x02, SysClkReq2Valid1
1881 * 0x04, SysClkReq3Valid1
1882 * 0x08, SysClkReq4Valid1
1883 * 0x10, SysClkReq5Valid1
1884 * 0x20, SysClkReq6Valid1
1885 * 0x40, SysClkReq7Valid1
1886 * 0x80, SysClkReq8Valid1
1888 REG_INIT(AB8500_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
1890 * 0x02, SysClkReq2Valid2
1891 * 0x04, SysClkReq3Valid2
1892 * 0x08, SysClkReq4Valid2
1893 * 0x10, SysClkReq5Valid2
1894 * 0x20, SysClkReq6Valid2
1895 * 0x40, SysClkReq7Valid2
1896 * 0x80, SysClkReq8Valid2
1898 REG_INIT(AB8500_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
1901 * 0x04, Vintcore12Ena
1902 * 0x38, Vintcore12Sel
1903 * 0x40, Vintcore12LP
1906 REG_INIT(AB8500_REGUMISC1, 0x03, 0x80, 0xfe),
1913 REG_INIT(AB8500_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
1915 * 0x01, Vamic1_dzout
1916 * 0x02, Vamic2_dzout
1918 REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
1920 * 0x03, VpllRegu (NOTE! PRCMU register bits)
1923 REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f),
1926 * 0x02, VrefDDRSleepMode
1928 REG_INIT(AB8500_VREFDDR, 0x04, 0x07, 0x03),
1930 * 0x03, VextSupply1Regu
1931 * 0x0c, VextSupply2Regu
1932 * 0x30, VextSupply3Regu
1933 * 0x40, ExtSupply2Bypass
1934 * 0x80, ExtSupply3Bypass
1936 REG_INIT(AB8500_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
1941 REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f),
1945 REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03),
1949 REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f),
1953 REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f),
1957 REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07),
1959 * 0x01, VextSupply12LP
1961 REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
1966 * 0x20, Vintcore12Disch
1970 REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
1973 * 0x04, VdmicPullDownEna
1976 REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
1979 /* AB8505 register init */
1980 static struct ab8500_reg_init ab8505_reg_init[] = {
1982 * 0x03, VarmRequestCtrl
1983 * 0x0c, VsmpsCRequestCtrl
1984 * 0x30, VsmpsARequestCtrl
1985 * 0xc0, VsmpsBRequestCtrl
1987 REG_INIT(AB8505_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
1989 * 0x03, VsafeRequestCtrl
1990 * 0x0c, VpllRequestCtrl
1991 * 0x30, VanaRequestCtrl
1993 REG_INIT(AB8505_REGUREQUESTCTRL2, 0x03, 0x04, 0x3f),
1995 * 0x30, Vaux1RequestCtrl
1996 * 0xc0, Vaux2RequestCtrl
1998 REG_INIT(AB8505_REGUREQUESTCTRL3, 0x03, 0x05, 0xf0),
2000 * 0x03, Vaux3RequestCtrl
2003 REG_INIT(AB8505_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2005 * 0x01, VsmpsASysClkReq1HPValid
2006 * 0x02, VsmpsBSysClkReq1HPValid
2007 * 0x04, VsafeSysClkReq1HPValid
2008 * 0x08, VanaSysClkReq1HPValid
2009 * 0x10, VpllSysClkReq1HPValid
2010 * 0x20, Vaux1SysClkReq1HPValid
2011 * 0x40, Vaux2SysClkReq1HPValid
2012 * 0x80, Vaux3SysClkReq1HPValid
2014 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2016 * 0x01, VsmpsCSysClkReq1HPValid
2017 * 0x02, VarmSysClkReq1HPValid
2018 * 0x04, VbbSysClkReq1HPValid
2019 * 0x08, VsmpsMSysClkReq1HPValid
2021 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x0f),
2023 * 0x01, VsmpsAHwHPReq1Valid
2024 * 0x02, VsmpsBHwHPReq1Valid
2025 * 0x04, VsafeHwHPReq1Valid
2026 * 0x08, VanaHwHPReq1Valid
2027 * 0x10, VpllHwHPReq1Valid
2028 * 0x20, Vaux1HwHPReq1Valid
2029 * 0x40, Vaux2HwHPReq1Valid
2030 * 0x80, Vaux3HwHPReq1Valid
2032 REG_INIT(AB8505_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2034 * 0x08, VsmpsMHwHPReq1Valid
2036 REG_INIT(AB8505_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x08),
2038 * 0x01, VsmpsAHwHPReq2Valid
2039 * 0x02, VsmpsBHwHPReq2Valid
2040 * 0x04, VsafeHwHPReq2Valid
2041 * 0x08, VanaHwHPReq2Valid
2042 * 0x10, VpllHwHPReq2Valid
2043 * 0x20, Vaux1HwHPReq2Valid
2044 * 0x40, Vaux2HwHPReq2Valid
2045 * 0x80, Vaux3HwHPReq2Valid
2047 REG_INIT(AB8505_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2049 * 0x08, VsmpsMHwHPReq2Valid
2051 REG_INIT(AB8505_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x08),
2053 * 0x01, VsmpsCSwHPReqValid
2054 * 0x02, VarmSwHPReqValid
2055 * 0x04, VsmpsASwHPReqValid
2056 * 0x08, VsmpsBSwHPReqValid
2057 * 0x10, VsafeSwHPReqValid
2058 * 0x20, VanaSwHPReqValid
2059 * 0x40, VpllSwHPReqValid
2060 * 0x80, Vaux1SwHPReqValid
2062 REG_INIT(AB8505_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2064 * 0x01, Vaux2SwHPReqValid
2065 * 0x02, Vaux3SwHPReqValid
2066 * 0x20, VsmpsMSwHPReqValid
2068 REG_INIT(AB8505_REGUSWHPREQVALID2, 0x03, 0x0e, 0x23),
2070 * 0x02, SysClkReq2Valid1
2071 * 0x04, SysClkReq3Valid1
2072 * 0x08, SysClkReq4Valid1
2074 REG_INIT(AB8505_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0x0e),
2076 * 0x02, SysClkReq2Valid2
2077 * 0x04, SysClkReq3Valid2
2078 * 0x08, SysClkReq4Valid2
2080 REG_INIT(AB8505_REGUSYSCLKREQVALID2, 0x03, 0x10, 0x0e),
2082 * 0x01, Vaux4SwHPReqValid
2083 * 0x02, Vaux4HwHPReq2Valid
2084 * 0x04, Vaux4HwHPReq1Valid
2085 * 0x08, Vaux4SysClkReq1HPValid
2087 REG_INIT(AB8505_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2090 * 0x04, VintCore12Ena
2091 * 0x38, VintCore12Sel
2092 * 0x40, VintCore12LP
2095 REG_INIT(AB8505_REGUMISC1, 0x03, 0x80, 0xfe),
2102 REG_INIT(AB8505_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
2104 * 0x01, Vamic1_dzout
2105 * 0x02, Vamic2_dzout
2107 REG_INIT(AB8505_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2110 * 0x0c, VsmpsASelCtrl
2111 * 0x10, VsmpsAAutoMode
2112 * 0x20, VsmpsAPWMMode
2114 REG_INIT(AB8505_VSMPSAREGU, 0x04, 0x03, 0x3f),
2117 * 0x0c, VsmpsBSelCtrl
2118 * 0x10, VsmpsBAutoMode
2119 * 0x20, VsmpsBPWMMode
2121 REG_INIT(AB8505_VSMPSBREGU, 0x04, 0x04, 0x3f),
2124 * 0x0c, VsafeSelCtrl
2125 * 0x10, VsafeAutoMode
2126 * 0x20, VsafePWMMode
2128 REG_INIT(AB8505_VSAFEREGU, 0x04, 0x05, 0x3f),
2130 * 0x03, VpllRegu (NOTE! PRCMU register bits)
2133 REG_INIT(AB8505_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2135 * 0x03, VextSupply1Regu
2136 * 0x0c, VextSupply2Regu
2137 * 0x30, VextSupply3Regu
2138 * 0x40, ExtSupply2Bypass
2139 * 0x80, ExtSupply3Bypass
2141 REG_INIT(AB8505_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2146 REG_INIT(AB8505_VAUX12REGU, 0x04, 0x09, 0x0f),
2150 REG_INIT(AB8505_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2154 REG_INIT(AB8505_VSMPSASEL1, 0x04, 0x13, 0x3f),
2158 REG_INIT(AB8505_VSMPSASEL2, 0x04, 0x14, 0x3f),
2162 REG_INIT(AB8505_VSMPSASEL3, 0x04, 0x15, 0x3f),
2166 REG_INIT(AB8505_VSMPSBSEL1, 0x04, 0x17, 0x3f),
2170 REG_INIT(AB8505_VSMPSBSEL2, 0x04, 0x18, 0x3f),
2174 REG_INIT(AB8505_VSMPSBSEL3, 0x04, 0x19, 0x3f),
2178 REG_INIT(AB8505_VSAFESEL1, 0x04, 0x1b, 0x7f),
2182 REG_INIT(AB8505_VSAFESEL2, 0x04, 0x1c, 0x7f),
2186 REG_INIT(AB8505_VSAFESEL3, 0x04, 0x1d, 0x7f),
2190 REG_INIT(AB8505_VAUX1SEL, 0x04, 0x1f, 0x0f),
2194 REG_INIT(AB8505_VAUX2SEL, 0x04, 0x20, 0x0f),
2199 REG_INIT(AB8505_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
2201 * 0x03, Vaux4RequestCtrl
2203 REG_INIT(AB8505_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2207 REG_INIT(AB8505_VAUX4REGU, 0x04, 0x2e, 0x03),
2211 REG_INIT(AB8505_VAUX4SEL, 0x04, 0x2f, 0x0f),
2216 * 0x20, Vintcore12Disch
2220 REG_INIT(AB8505_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
2223 * 0x04, VdmicPullDownEna
2226 REG_INIT(AB8505_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
2230 REG_INIT(AB8505_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2236 * 0x40, Vaux5DisSfst
2237 * 0x80, Vaux5DisPulld
2239 REG_INIT(AB8505_CTRLVAUX5, 0x01, 0x55, 0xff),
2244 * 0x80, Vaux6DisPulld
2246 REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f),
2249 /* AB9540 register init */
2250 static struct ab8500_reg_init ab9540_reg_init[] = {
2252 * 0x03, VarmRequestCtrl
2253 * 0x0c, VapeRequestCtrl
2254 * 0x30, Vsmps1RequestCtrl
2255 * 0xc0, Vsmps2RequestCtrl
2257 REG_INIT(AB9540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2259 * 0x03, Vsmps3RequestCtrl
2260 * 0x0c, VpllRequestCtrl
2261 * 0x30, VanaRequestCtrl
2262 * 0xc0, VextSupply1RequestCtrl
2264 REG_INIT(AB9540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
2266 * 0x03, VextSupply2RequestCtrl
2267 * 0x0c, VextSupply3RequestCtrl
2268 * 0x30, Vaux1RequestCtrl
2269 * 0xc0, Vaux2RequestCtrl
2271 REG_INIT(AB9540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
2273 * 0x03, Vaux3RequestCtrl
2276 REG_INIT(AB9540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2278 * 0x01, Vsmps1SysClkReq1HPValid
2279 * 0x02, Vsmps2SysClkReq1HPValid
2280 * 0x04, Vsmps3SysClkReq1HPValid
2281 * 0x08, VanaSysClkReq1HPValid
2282 * 0x10, VpllSysClkReq1HPValid
2283 * 0x20, Vaux1SysClkReq1HPValid
2284 * 0x40, Vaux2SysClkReq1HPValid
2285 * 0x80, Vaux3SysClkReq1HPValid
2287 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2289 * 0x01, VapeSysClkReq1HPValid
2290 * 0x02, VarmSysClkReq1HPValid
2291 * 0x04, VbbSysClkReq1HPValid
2292 * 0x08, VmodSysClkReq1HPValid
2293 * 0x10, VextSupply1SysClkReq1HPValid
2294 * 0x20, VextSupply2SysClkReq1HPValid
2295 * 0x40, VextSupply3SysClkReq1HPValid
2297 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f),
2299 * 0x01, Vsmps1HwHPReq1Valid
2300 * 0x02, Vsmps2HwHPReq1Valid
2301 * 0x04, Vsmps3HwHPReq1Valid
2302 * 0x08, VanaHwHPReq1Valid
2303 * 0x10, VpllHwHPReq1Valid
2304 * 0x20, Vaux1HwHPReq1Valid
2305 * 0x40, Vaux2HwHPReq1Valid
2306 * 0x80, Vaux3HwHPReq1Valid
2308 REG_INIT(AB9540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2310 * 0x01, VextSupply1HwHPReq1Valid
2311 * 0x02, VextSupply2HwHPReq1Valid
2312 * 0x04, VextSupply3HwHPReq1Valid
2313 * 0x08, VmodHwHPReq1Valid
2315 REG_INIT(AB9540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f),
2317 * 0x01, Vsmps1HwHPReq2Valid
2318 * 0x02, Vsmps2HwHPReq2Valid
2319 * 0x03, Vsmps3HwHPReq2Valid
2320 * 0x08, VanaHwHPReq2Valid
2321 * 0x10, VpllHwHPReq2Valid
2322 * 0x20, Vaux1HwHPReq2Valid
2323 * 0x40, Vaux2HwHPReq2Valid
2324 * 0x80, Vaux3HwHPReq2Valid
2326 REG_INIT(AB9540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2328 * 0x01, VextSupply1HwHPReq2Valid
2329 * 0x02, VextSupply2HwHPReq2Valid
2330 * 0x04, VextSupply3HwHPReq2Valid
2331 * 0x08, VmodHwHPReq2Valid
2333 REG_INIT(AB9540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f),
2335 * 0x01, VapeSwHPReqValid
2336 * 0x02, VarmSwHPReqValid
2337 * 0x04, Vsmps1SwHPReqValid
2338 * 0x08, Vsmps2SwHPReqValid
2339 * 0x10, Vsmps3SwHPReqValid
2340 * 0x20, VanaSwHPReqValid
2341 * 0x40, VpllSwHPReqValid
2342 * 0x80, Vaux1SwHPReqValid
2344 REG_INIT(AB9540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2346 * 0x01, Vaux2SwHPReqValid
2347 * 0x02, Vaux3SwHPReqValid
2348 * 0x04, VextSupply1SwHPReqValid
2349 * 0x08, VextSupply2SwHPReqValid
2350 * 0x10, VextSupply3SwHPReqValid
2351 * 0x20, VmodSwHPReqValid
2353 REG_INIT(AB9540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f),
2355 * 0x02, SysClkReq2Valid1
2357 * 0x80, SysClkReq8Valid1
2359 REG_INIT(AB9540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
2361 * 0x02, SysClkReq2Valid2
2363 * 0x80, SysClkReq8Valid2
2365 REG_INIT(AB9540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
2367 * 0x01, Vaux4SwHPReqValid
2368 * 0x02, Vaux4HwHPReq2Valid
2369 * 0x04, Vaux4HwHPReq1Valid
2370 * 0x08, Vaux4SysClkReq1HPValid
2372 REG_INIT(AB9540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2375 * 0x04, Vintcore12Ena
2376 * 0x38, Vintcore12Sel
2377 * 0x40, Vintcore12LP
2380 REG_INIT(AB9540_REGUMISC1, 0x03, 0x80, 0xfe),
2387 REG_INIT(AB9540_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
2389 * 0x01, Vamic1_dzout
2390 * 0x02, Vamic2_dzout
2392 REG_INIT(AB9540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2395 * 0x0c, Vsmps1SelCtrl
2396 * 0x10, Vsmps1AutoMode
2397 * 0x20, Vsmps1PWMMode
2399 REG_INIT(AB9540_VSMPS1REGU, 0x04, 0x03, 0x3f),
2402 * 0x0c, Vsmps2SelCtrl
2403 * 0x10, Vsmps2AutoMode
2404 * 0x20, Vsmps2PWMMode
2406 REG_INIT(AB9540_VSMPS2REGU, 0x04, 0x04, 0x3f),
2409 * 0x0c, Vsmps3SelCtrl
2410 * NOTE! PRCMU register
2412 REG_INIT(AB9540_VSMPS3REGU, 0x04, 0x05, 0x0f),
2417 REG_INIT(AB9540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2419 * 0x03, VextSupply1Regu
2420 * 0x0c, VextSupply2Regu
2421 * 0x30, VextSupply3Regu
2422 * 0x40, ExtSupply2Bypass
2423 * 0x80, ExtSupply3Bypass
2425 REG_INIT(AB9540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2430 REG_INIT(AB9540_VAUX12REGU, 0x04, 0x09, 0x0f),
2435 REG_INIT(AB9540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2439 REG_INIT(AB9540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
2443 REG_INIT(AB9540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
2447 REG_INIT(AB9540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
2451 REG_INIT(AB9540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
2455 REG_INIT(AB9540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
2459 REG_INIT(AB9540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
2462 * NOTE! PRCMU register
2464 REG_INIT(AB9540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
2467 * NOTE! PRCMU register
2469 REG_INIT(AB9540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
2473 REG_INIT(AB9540_VAUX1SEL, 0x04, 0x1f, 0x0f),
2477 REG_INIT(AB9540_VAUX2SEL, 0x04, 0x20, 0x0f),
2482 REG_INIT(AB9540_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
2484 * 0x01, VextSupply12LP
2486 REG_INIT(AB9540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
2488 * 0x03, Vaux4RequestCtrl
2490 REG_INIT(AB9540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2494 REG_INIT(AB9540_VAUX4REGU, 0x04, 0x2e, 0x03),
2498 REG_INIT(AB9540_VAUX4SEL, 0x04, 0x2f, 0x0f),
2505 * 0x20, Vintcore12Disch
2509 REG_INIT(AB9540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
2513 * 0x04, VdmicPullDownEna
2514 * 0x08, VpllPullDownEna
2517 REG_INIT(AB9540_REGUCTRLDISCH2, 0x04, 0x44, 0x1f),
2521 REG_INIT(AB9540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2524 /* AB8540 register init */
2525 static struct ab8500_reg_init ab8540_reg_init[] = {
2527 * 0x01, VSimSycClkReq1Valid
2528 * 0x02, VSimSycClkReq2Valid
2529 * 0x04, VSimSycClkReq3Valid
2530 * 0x08, VSimSycClkReq4Valid
2531 * 0x10, VSimSycClkReq5Valid
2532 * 0x20, VSimSycClkReq6Valid
2533 * 0x40, VSimSycClkReq7Valid
2534 * 0x80, VSimSycClkReq8Valid
2536 REG_INIT(AB8540_VSIMSYSCLKCTRL, 0x02, 0x33, 0xff),
2538 * 0x03, VarmRequestCtrl
2539 * 0x0c, VapeRequestCtrl
2540 * 0x30, Vsmps1RequestCtrl
2541 * 0xc0, Vsmps2RequestCtrl
2543 REG_INIT(AB8540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2545 * 0x03, Vsmps3RequestCtrl
2546 * 0x0c, VpllRequestCtrl
2547 * 0x30, VanaRequestCtrl
2548 * 0xc0, VextSupply1RequestCtrl
2550 REG_INIT(AB8540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
2552 * 0x03, VextSupply2RequestCtrl
2553 * 0x0c, VextSupply3RequestCtrl
2554 * 0x30, Vaux1RequestCtrl
2555 * 0xc0, Vaux2RequestCtrl
2557 REG_INIT(AB8540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
2559 * 0x03, Vaux3RequestCtrl
2562 REG_INIT(AB8540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2564 * 0x01, Vsmps1SysClkReq1HPValid
2565 * 0x02, Vsmps2SysClkReq1HPValid
2566 * 0x04, Vsmps3SysClkReq1HPValid
2567 * 0x08, VanaSysClkReq1HPValid
2568 * 0x10, VpllSysClkReq1HPValid
2569 * 0x20, Vaux1SysClkReq1HPValid
2570 * 0x40, Vaux2SysClkReq1HPValid
2571 * 0x80, Vaux3SysClkReq1HPValid
2573 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2575 * 0x01, VapeSysClkReq1HPValid
2576 * 0x02, VarmSysClkReq1HPValid
2577 * 0x04, VbbSysClkReq1HPValid
2578 * 0x10, VextSupply1SysClkReq1HPValid
2579 * 0x20, VextSupply2SysClkReq1HPValid
2580 * 0x40, VextSupply3SysClkReq1HPValid
2582 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x77),
2584 * 0x01, Vsmps1HwHPReq1Valid
2585 * 0x02, Vsmps2HwHPReq1Valid
2586 * 0x04, Vsmps3HwHPReq1Valid
2587 * 0x08, VanaHwHPReq1Valid
2588 * 0x10, VpllHwHPReq1Valid
2589 * 0x20, Vaux1HwHPReq1Valid
2590 * 0x40, Vaux2HwHPReq1Valid
2591 * 0x80, Vaux3HwHPReq1Valid
2593 REG_INIT(AB8540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2595 * 0x01, VextSupply1HwHPReq1Valid
2596 * 0x02, VextSupply2HwHPReq1Valid
2597 * 0x04, VextSupply3HwHPReq1Valid
2599 REG_INIT(AB8540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
2601 * 0x01, Vsmps1HwHPReq2Valid
2602 * 0x02, Vsmps2HwHPReq2Valid
2603 * 0x03, Vsmps3HwHPReq2Valid
2604 * 0x08, VanaHwHPReq2Valid
2605 * 0x10, VpllHwHPReq2Valid
2606 * 0x20, Vaux1HwHPReq2Valid
2607 * 0x40, Vaux2HwHPReq2Valid
2608 * 0x80, Vaux3HwHPReq2Valid
2610 REG_INIT(AB8540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2612 * 0x01, VextSupply1HwHPReq2Valid
2613 * 0x02, VextSupply2HwHPReq2Valid
2614 * 0x04, VextSupply3HwHPReq2Valid
2616 REG_INIT(AB8540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
2618 * 0x01, VapeSwHPReqValid
2619 * 0x02, VarmSwHPReqValid
2620 * 0x04, Vsmps1SwHPReqValid
2621 * 0x08, Vsmps2SwHPReqValid
2622 * 0x10, Vsmps3SwHPReqValid
2623 * 0x20, VanaSwHPReqValid
2624 * 0x40, VpllSwHPReqValid
2625 * 0x80, Vaux1SwHPReqValid
2627 REG_INIT(AB8540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2629 * 0x01, Vaux2SwHPReqValid
2630 * 0x02, Vaux3SwHPReqValid
2631 * 0x04, VextSupply1SwHPReqValid
2632 * 0x08, VextSupply2SwHPReqValid
2633 * 0x10, VextSupply3SwHPReqValid
2635 REG_INIT(AB8540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
2637 * 0x02, SysClkReq2Valid1
2639 * 0x80, SysClkReq8Valid1
2641 REG_INIT(AB8540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xff),
2643 * 0x02, SysClkReq2Valid2
2645 * 0x80, SysClkReq8Valid2
2647 REG_INIT(AB8540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xff),
2649 * 0x01, Vaux4SwHPReqValid
2650 * 0x02, Vaux4HwHPReq2Valid
2651 * 0x04, Vaux4HwHPReq1Valid
2652 * 0x08, Vaux4SysClkReq1HPValid
2654 REG_INIT(AB8540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2656 * 0x01, Vaux5SwHPReqValid
2657 * 0x02, Vaux5HwHPReq2Valid
2658 * 0x04, Vaux5HwHPReq1Valid
2659 * 0x08, Vaux5SysClkReq1HPValid
2661 REG_INIT(AB8540_REGUVAUX5REQVALID, 0x03, 0x12, 0x0f),
2663 * 0x01, Vaux6SwHPReqValid
2664 * 0x02, Vaux6HwHPReq2Valid
2665 * 0x04, Vaux6HwHPReq1Valid
2666 * 0x08, Vaux6SysClkReq1HPValid
2668 REG_INIT(AB8540_REGUVAUX6REQVALID, 0x03, 0x13, 0x0f),
2670 * 0x01, VclkbSwHPReqValid
2671 * 0x02, VclkbHwHPReq2Valid
2672 * 0x04, VclkbHwHPReq1Valid
2673 * 0x08, VclkbSysClkReq1HPValid
2675 REG_INIT(AB8540_REGUVCLKBREQVALID, 0x03, 0x14, 0x0f),
2677 * 0x01, Vrf1SwHPReqValid
2678 * 0x02, Vrf1HwHPReq2Valid
2679 * 0x04, Vrf1HwHPReq1Valid
2680 * 0x08, Vrf1SysClkReq1HPValid
2682 REG_INIT(AB8540_REGUVRF1REQVALID, 0x03, 0x15, 0x0f),
2685 * 0x04, Vintcore12Ena
2686 * 0x38, Vintcore12Sel
2687 * 0x40, Vintcore12LP
2690 REG_INIT(AB8540_REGUMISC1, 0x03, 0x80, 0xfe),
2699 REG_INIT(AB8540_VAUDIOSUPPLY, 0x03, 0x83, 0xfe),
2701 * 0x01, Vamic1_dzout
2702 * 0x02, Vamic2_dzout
2704 REG_INIT(AB8540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2707 * 0x08, VHSICOffState
2711 REG_INIT(AB8540_VHSIC, 0x03, 0x87, 0x3f),
2714 * 0x08, VSDIOOffState
2718 REG_INIT(AB8540_VSDIO, 0x03, 0x88, 0x3f),
2721 * 0x0c, Vsmps1SelCtrl
2722 * 0x10, Vsmps1AutoMode
2723 * 0x20, Vsmps1PWMMode
2725 REG_INIT(AB8540_VSMPS1REGU, 0x04, 0x03, 0x3f),
2728 * 0x0c, Vsmps2SelCtrl
2729 * 0x10, Vsmps2AutoMode
2730 * 0x20, Vsmps2PWMMode
2732 REG_INIT(AB8540_VSMPS2REGU, 0x04, 0x04, 0x3f),
2735 * 0x0c, Vsmps3SelCtrl
2736 * 0x10, Vsmps3AutoMode
2737 * 0x20, Vsmps3PWMMode
2738 * NOTE! PRCMU register
2740 REG_INIT(AB8540_VSMPS3REGU, 0x04, 0x05, 0x0f),
2745 REG_INIT(AB8540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2747 * 0x03, VextSupply1Regu
2748 * 0x0c, VextSupply2Regu
2749 * 0x30, VextSupply3Regu
2750 * 0x40, ExtSupply2Bypass
2751 * 0x80, ExtSupply3Bypass
2753 REG_INIT(AB8540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2758 REG_INIT(AB8540_VAUX12REGU, 0x04, 0x09, 0x0f),
2763 REG_INIT(AB8540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2767 REG_INIT(AB8540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
2771 REG_INIT(AB8540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
2775 REG_INIT(AB8540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
2779 REG_INIT(AB8540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
2783 REG_INIT(AB8540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
2787 REG_INIT(AB8540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
2790 * NOTE! PRCMU register
2792 REG_INIT(AB8540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
2795 * NOTE! PRCMU register
2797 REG_INIT(AB8540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
2801 REG_INIT(AB8540_VAUX1SEL, 0x04, 0x1f, 0x0f),
2805 REG_INIT(AB8540_VAUX2SEL, 0x04, 0x20, 0x0f),
2810 REG_INIT(AB8540_VRF1VAUX3SEL, 0x04, 0x21, 0x77),
2812 * 0x01, VextSupply12LP
2814 REG_INIT(AB8540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
2819 REG_INIT(AB8540_VANAVPLLSEL, 0x04, 0x29, 0x37),
2821 * 0x03, Vaux4RequestCtrl
2823 REG_INIT(AB8540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2827 REG_INIT(AB8540_VAUX4REGU, 0x04, 0x2e, 0x03),
2831 REG_INIT(AB8540_VAUX4SEL, 0x04, 0x2f, 0x0f),
2833 * 0x03, Vaux5RequestCtrl
2835 REG_INIT(AB8540_VAUX5REQCTRL, 0x04, 0x31, 0x03),
2839 REG_INIT(AB8540_VAUX5REGU, 0x04, 0x32, 0x03),
2843 REG_INIT(AB8540_VAUX5SEL, 0x04, 0x33, 0x3f),
2845 * 0x03, Vaux6RequestCtrl
2847 REG_INIT(AB8540_VAUX6REQCTRL, 0x04, 0x34, 0x03),
2851 REG_INIT(AB8540_VAUX6REGU, 0x04, 0x35, 0x03),
2855 REG_INIT(AB8540_VAUX6SEL, 0x04, 0x36, 0x3f),
2857 * 0x03, VCLKBRequestCtrl
2859 REG_INIT(AB8540_VCLKBREQCTRL, 0x04, 0x37, 0x03),
2863 REG_INIT(AB8540_VCLKBREGU, 0x04, 0x38, 0x03),
2867 REG_INIT(AB8540_VCLKBSEL, 0x04, 0x39, 0x07),
2869 * 0x03, Vrf1RequestCtrl
2871 REG_INIT(AB8540_VRF1REQCTRL, 0x04, 0x3a, 0x03),
2878 * 0x20, Vintcore12Disch
2882 REG_INIT(AB8540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
2885 * 0x04, VdmicPullDownEna
2886 * 0x08, VpllPullDownEna
2889 REG_INIT(AB8540_REGUCTRLDISCH2, 0x04, 0x44, 0x1e),
2893 REG_INIT(AB8540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2899 REG_INIT(AB8540_REGUCTRLDISCH4, 0x04, 0x49, 0x07),
2902 static struct of_regulator_match ab8500_regulator_match[] = {
2903 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, },
2904 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, },
2905 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, },
2906 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, },
2907 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, },
2908 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, },
2909 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, },
2910 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, },
2911 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, },
2912 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
2915 static struct of_regulator_match ab8505_regulator_match[] = {
2916 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, },
2917 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, },
2918 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, },
2919 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, },
2920 { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, },
2921 { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, },
2922 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, },
2923 { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, },
2924 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, },
2925 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, },
2926 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, },
2927 { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, },
2928 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, },
2931 static struct of_regulator_match ab8540_regulator_match[] = {
2932 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, },
2933 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, },
2934 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, },
2935 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, },
2936 { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8540_LDO_AUX5, },
2937 { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8540_LDO_AUX6, },
2938 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, },
2939 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, },
2940 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, },
2941 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, },
2942 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, },
2943 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, },
2944 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, },
2945 { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, },
2948 static struct of_regulator_match ab9540_regulator_match[] = {
2949 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, },
2950 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, },
2951 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, },
2952 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB9540_LDO_AUX4, },
2953 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, },
2954 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, },
2955 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, },
2956 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, },
2957 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, },
2958 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, },
2959 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, },
2963 struct ab8500_regulator_info *info;
2965 struct ab8500_reg_init *init;
2967 struct of_regulator_match *match;
2971 static void abx500_get_regulator_info(struct ab8500 *ab8500)
2973 if (is_ab9540(ab8500)) {
2974 abx500_regulator.info = ab9540_regulator_info;
2975 abx500_regulator.info_size = ARRAY_SIZE(ab9540_regulator_info);
2976 abx500_regulator.init = ab9540_reg_init;
2977 abx500_regulator.init_size = AB9540_NUM_REGULATOR_REGISTERS;
2978 abx500_regulator.match = ab9540_regulator_match;
2979 abx500_regulator.match_size = ARRAY_SIZE(ab9540_regulator_match);
2980 } else if (is_ab8505(ab8500)) {
2981 abx500_regulator.info = ab8505_regulator_info;
2982 abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info);
2983 abx500_regulator.init = ab8505_reg_init;
2984 abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS;
2985 abx500_regulator.match = ab8505_regulator_match;
2986 abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match);
2987 } else if (is_ab8540(ab8500)) {
2988 abx500_regulator.info = ab8540_regulator_info;
2989 abx500_regulator.info_size = ARRAY_SIZE(ab8540_regulator_info);
2990 abx500_regulator.init = ab8540_reg_init;
2991 abx500_regulator.init_size = AB8540_NUM_REGULATOR_REGISTERS;
2992 abx500_regulator.match = ab8540_regulator_match;
2993 abx500_regulator.match_size = ARRAY_SIZE(ab8540_regulator_match);
2995 abx500_regulator.info = ab8500_regulator_info;
2996 abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info);
2997 abx500_regulator.init = ab8500_reg_init;
2998 abx500_regulator.init_size = AB8500_NUM_REGULATOR_REGISTERS;
2999 abx500_regulator.match = ab8500_regulator_match;
3000 abx500_regulator.match_size = ARRAY_SIZE(ab8500_regulator_match);
3004 static int ab8500_regulator_init_registers(struct platform_device *pdev,
3005 int id, int mask, int value)
3007 struct ab8500_reg_init *reg_init = abx500_regulator.init;
3010 BUG_ON(value & ~mask);
3011 BUG_ON(mask & ~reg_init[id].mask);
3013 /* initialize register */
3014 err = abx500_mask_and_set_register_interruptible(
3021 "Failed to initialize 0x%02x, 0x%02x.\n",
3026 dev_vdbg(&pdev->dev,
3027 " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
3035 static int ab8500_regulator_register(struct platform_device *pdev,
3036 struct regulator_init_data *init_data,
3037 int id, struct device_node *np)
3039 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3040 struct ab8500_regulator_info *info = NULL;
3041 struct regulator_config config = { };
3044 /* assign per-regulator data */
3045 info = &abx500_regulator.info[id];
3046 info->dev = &pdev->dev;
3048 config.dev = &pdev->dev;
3049 config.init_data = init_data;
3050 config.driver_data = info;
3051 config.of_node = np;
3053 /* fix for hardware before ab8500v2.0 */
3054 if (is_ab8500_1p1_or_earlier(ab8500)) {
3055 if (info->desc.id == AB8500_LDO_AUX3) {
3056 info->desc.n_voltages =
3057 ARRAY_SIZE(ldo_vauxn_voltages);
3058 info->desc.volt_table = ldo_vauxn_voltages;
3059 info->voltage_mask = 0xf;
3063 /* register regulator with framework */
3064 info->regulator = regulator_register(&info->desc, &config);
3065 if (IS_ERR(info->regulator)) {
3066 err = PTR_ERR(info->regulator);
3067 dev_err(&pdev->dev, "failed to register regulator %s\n",
3069 /* when we fail, un-register all earlier regulators */
3071 info = &abx500_regulator.info[id];
3072 regulator_unregister(info->regulator);
3081 ab8500_regulator_of_probe(struct platform_device *pdev,
3082 struct device_node *np)
3084 struct of_regulator_match *match = abx500_regulator.match;
3087 for (i = 0; i < abx500_regulator.info_size; i++) {
3088 err = ab8500_regulator_register(
3089 pdev, match[i].init_data, i, match[i].of_node);
3097 static int ab8500_regulator_probe(struct platform_device *pdev)
3099 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3100 struct device_node *np = pdev->dev.of_node;
3101 struct ab8500_platform_data *ppdata;
3102 struct ab8500_regulator_platform_data *pdata;
3106 dev_err(&pdev->dev, "null mfd parent\n");
3110 abx500_get_regulator_info(ab8500);
3113 err = of_regulator_match(&pdev->dev, np,
3114 abx500_regulator.match,
3115 abx500_regulator.match_size);
3118 "Error parsing regulator init data: %d\n", err);
3122 err = ab8500_regulator_of_probe(pdev, np);
3126 ppdata = dev_get_platdata(ab8500->dev);
3128 dev_err(&pdev->dev, "null parent pdata\n");
3132 pdata = ppdata->regulator;
3134 dev_err(&pdev->dev, "null pdata\n");
3138 /* make sure the platform data has the correct size */
3139 if (pdata->num_regulator != abx500_regulator.info_size) {
3140 dev_err(&pdev->dev, "Configuration error: size mismatch.\n");
3144 /* initialize debug (initial state is recorded with this call) */
3145 err = ab8500_regulator_debug_init(pdev);
3149 /* initialize registers */
3150 for (i = 0; i < pdata->num_reg_init; i++) {
3151 int id, mask, value;
3153 id = pdata->reg_init[i].id;
3154 mask = pdata->reg_init[i].mask;
3155 value = pdata->reg_init[i].value;
3157 /* check for configuration errors */
3158 BUG_ON(id >= abx500_regulator.init_size);
3160 err = ab8500_regulator_init_registers(pdev, id, mask, value);
3165 if (!is_ab8505(ab8500)) {
3166 /* register external regulators (before Vaux1, 2 and 3) */
3167 err = ab8500_ext_regulator_init(pdev);
3172 /* register all regulators */
3173 for (i = 0; i < abx500_regulator.info_size; i++) {
3174 err = ab8500_regulator_register(pdev, &pdata->regulator[i],
3177 if (!is_ab8505(ab8500))
3178 ab8500_ext_regulator_exit(pdev);
3186 static int ab8500_regulator_remove(struct platform_device *pdev)
3189 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3191 for (i = 0; i < abx500_regulator.info_size; i++) {
3192 struct ab8500_regulator_info *info = NULL;
3193 info = &abx500_regulator.info[i];
3195 dev_vdbg(rdev_get_dev(info->regulator),
3196 "%s-remove\n", info->desc.name);
3198 regulator_unregister(info->regulator);
3201 /* remove external regulators (after Vaux1, 2 and 3) */
3202 if (!is_ab8505(ab8500))
3203 ab8500_ext_regulator_exit(pdev);
3205 /* remove regulator debug */
3206 err = ab8500_regulator_debug_exit(pdev);
3213 static struct platform_driver ab8500_regulator_driver = {
3214 .probe = ab8500_regulator_probe,
3215 .remove = ab8500_regulator_remove,
3217 .name = "ab8500-regulator",
3218 .owner = THIS_MODULE,
3222 static int __init ab8500_regulator_init(void)
3226 ret = platform_driver_register(&ab8500_regulator_driver);
3228 pr_err("Failed to register ab8500 regulator: %d\n", ret);
3232 subsys_initcall(ab8500_regulator_init);
3234 static void __exit ab8500_regulator_exit(void)
3236 platform_driver_unregister(&ab8500_regulator_driver);
3238 module_exit(ab8500_regulator_exit);
3240 MODULE_LICENSE("GPL v2");
3241 MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
3242 MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
3243 MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>");
3244 MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
3245 MODULE_ALIAS("platform:ab8500-regulator");