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
65 struct ab8500_regulator_info {
67 struct regulator_desc desc;
68 struct regulator_dev *regulator;
69 struct ab8500_shared_mode *shared_mode;
93 /* voltage tables for the vauxn/vintcore supplies */
94 static const unsigned int ldo_vauxn_voltages[] = {
113 static const unsigned int ldo_vaux3_voltages[] = {
124 static const unsigned int ldo_vaux56_voltages[] = {
135 static const unsigned int ldo_vaux3_ab8540_voltages[] = {
147 static const unsigned int ldo_vaux56_ab8540_voltages[] = {
148 750000, 760000, 770000, 780000, 790000, 800000,
149 810000, 820000, 830000, 840000, 850000, 860000,
150 870000, 880000, 890000, 900000, 910000, 920000,
151 930000, 940000, 950000, 960000, 970000, 980000,
152 990000, 1000000, 1010000, 1020000, 1030000,
153 1040000, 1050000, 1060000, 1070000, 1080000,
154 1090000, 1100000, 1110000, 1120000, 1130000,
155 1140000, 1150000, 1160000, 1170000, 1180000,
156 1190000, 1200000, 1210000, 1220000, 1230000,
157 1240000, 1250000, 1260000, 1270000, 1280000,
158 1290000, 1300000, 1310000, 1320000, 1330000,
159 1340000, 1350000, 1360000, 1800000, 2790000,
162 static const unsigned int ldo_vintcore_voltages[] = {
172 static const unsigned int ldo_sdio_voltages[] = {
183 static const unsigned int fixed_1200000_voltage[] = {
187 static const unsigned int fixed_1800000_voltage[] = {
191 static const unsigned int fixed_2000000_voltage[] = {
195 static const unsigned int fixed_2050000_voltage[] = {
199 static const unsigned int fixed_3300000_voltage[] = {
203 static const unsigned int ldo_vana_voltages[] = {
214 static const unsigned int ldo_vaudio_voltages[] = {
222 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */
225 static const unsigned int ldo_vdmic_voltages[] = {
232 static DEFINE_MUTEX(shared_mode_mutex);
233 static struct ab8500_shared_mode ldo_anamic1_shared;
234 static struct ab8500_shared_mode ldo_anamic2_shared;
235 static struct ab8500_shared_mode ab8540_ldo_anamic1_shared;
236 static struct ab8500_shared_mode ab8540_ldo_anamic2_shared;
238 static int ab8500_regulator_enable(struct regulator_dev *rdev)
241 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
244 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
248 ret = abx500_mask_and_set_register_interruptible(info->dev,
249 info->update_bank, info->update_reg,
250 info->update_mask, info->update_val);
252 dev_err(rdev_get_dev(rdev),
253 "couldn't set enable bits for regulator\n");
257 dev_vdbg(rdev_get_dev(rdev),
258 "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
259 info->desc.name, info->update_bank, info->update_reg,
260 info->update_mask, info->update_val);
265 static int ab8500_regulator_disable(struct regulator_dev *rdev)
268 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
271 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
275 ret = abx500_mask_and_set_register_interruptible(info->dev,
276 info->update_bank, info->update_reg,
277 info->update_mask, 0x0);
279 dev_err(rdev_get_dev(rdev),
280 "couldn't set disable bits for regulator\n");
284 dev_vdbg(rdev_get_dev(rdev),
285 "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
286 info->desc.name, info->update_bank, info->update_reg,
287 info->update_mask, 0x0);
292 static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
295 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
299 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
303 ret = abx500_get_register_interruptible(info->dev,
304 info->update_bank, info->update_reg, ®val);
306 dev_err(rdev_get_dev(rdev),
307 "couldn't read 0x%x register\n", info->update_reg);
311 dev_vdbg(rdev_get_dev(rdev),
312 "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
314 info->desc.name, info->update_bank, info->update_reg,
315 info->update_mask, regval);
317 if (regval & info->update_mask)
323 static unsigned int ab8500_regulator_get_optimum_mode(
324 struct regulator_dev *rdev, int input_uV,
325 int output_uV, int load_uA)
329 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
332 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
336 if (load_uA <= info->load_lp_uA)
337 mode = REGULATOR_MODE_IDLE;
339 mode = REGULATOR_MODE_NORMAL;
344 static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
348 u8 bank, reg, mask, val;
349 bool lp_mode_req = false;
350 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
353 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
357 if (info->mode_mask) {
358 bank = info->mode_bank;
359 reg = info->mode_reg;
360 mask = info->mode_mask;
362 bank = info->update_bank;
363 reg = info->update_reg;
364 mask = info->update_mask;
367 if (info->shared_mode)
368 mutex_lock(&shared_mode_mutex);
371 case REGULATOR_MODE_NORMAL:
372 if (info->shared_mode)
376 val = info->mode_val_normal;
378 val = info->update_val_normal;
380 case REGULATOR_MODE_IDLE:
381 if (info->shared_mode) {
382 struct ab8500_regulator_info *shared_regulator;
384 shared_regulator = info->shared_mode->shared_regulator;
385 if (!shared_regulator->shared_mode->lp_mode_req) {
386 /* Other regulator prevent LP mode */
387 info->shared_mode->lp_mode_req = true;
395 val = info->mode_val_idle;
397 val = info->update_val_idle;
404 if (info->mode_mask || ab8500_regulator_is_enabled(rdev)) {
405 ret = abx500_mask_and_set_register_interruptible(info->dev,
406 bank, reg, mask, val);
408 dev_err(rdev_get_dev(rdev),
409 "couldn't set regulator mode\n");
413 dev_vdbg(rdev_get_dev(rdev),
414 "%s-set_mode (bank, reg, mask, value): "
415 "0x%x, 0x%x, 0x%x, 0x%x\n",
416 info->desc.name, bank, reg,
420 if (!info->mode_mask)
421 info->update_val = val;
423 if (info->shared_mode)
424 info->shared_mode->lp_mode_req = lp_mode_req;
427 if (info->shared_mode)
428 mutex_unlock(&shared_mode_mutex);
433 static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
435 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
442 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
446 /* Need special handling for shared mode */
447 if (info->shared_mode) {
448 if (info->shared_mode->lp_mode_req)
449 return REGULATOR_MODE_IDLE;
451 return REGULATOR_MODE_NORMAL;
454 if (info->mode_mask) {
455 /* Dedicated register for handling mode */
456 ret = abx500_get_register_interruptible(info->dev,
457 info->mode_bank, info->mode_reg, &val);
458 val = val & info->mode_mask;
460 val_normal = info->mode_val_normal;
461 val_idle = info->mode_val_idle;
463 /* Mode register same as enable register */
464 val = info->update_val;
465 val_normal = info->update_val_normal;
466 val_idle = info->update_val_idle;
469 if (val == val_normal)
470 ret = REGULATOR_MODE_NORMAL;
471 else if (val == val_idle)
472 ret = REGULATOR_MODE_IDLE;
479 static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
481 int ret, voltage_shift;
482 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
486 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
490 voltage_shift = ffs(info->voltage_mask) - 1;
492 ret = abx500_get_register_interruptible(info->dev,
493 info->voltage_bank, info->voltage_reg, ®val);
495 dev_err(rdev_get_dev(rdev),
496 "couldn't read voltage reg for regulator\n");
500 dev_vdbg(rdev_get_dev(rdev),
501 "%s-get_voltage (bank, reg, mask, shift, value): "
502 "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
503 info->desc.name, info->voltage_bank,
504 info->voltage_reg, info->voltage_mask,
505 voltage_shift, regval);
507 return (regval & info->voltage_mask) >> voltage_shift;
510 static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
512 int ret, voltage_shift;
513 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
514 u8 regval, regval_expand;
517 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
521 ret = abx500_get_register_interruptible(info->dev,
522 info->expand_register.voltage_bank,
523 info->expand_register.voltage_reg, ®val_expand);
525 dev_err(rdev_get_dev(rdev),
526 "couldn't read voltage expand reg for regulator\n");
530 dev_vdbg(rdev_get_dev(rdev),
531 "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
532 info->desc.name, info->expand_register.voltage_bank,
533 info->expand_register.voltage_reg,
534 info->expand_register.voltage_mask, regval_expand);
536 if (regval_expand & info->expand_register.voltage_mask)
537 return info->expand_register.voltage_limit;
539 ret = abx500_get_register_interruptible(info->dev,
540 info->voltage_bank, info->voltage_reg, ®val);
542 dev_err(rdev_get_dev(rdev),
543 "couldn't read voltage reg for regulator\n");
547 dev_vdbg(rdev_get_dev(rdev),
548 "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
549 info->desc.name, info->voltage_bank, info->voltage_reg,
550 info->voltage_mask, regval);
552 voltage_shift = ffs(info->voltage_mask) - 1;
554 return (regval & info->voltage_mask) >> voltage_shift;
557 static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,
560 int ret, voltage_shift;
561 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
565 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
569 voltage_shift = ffs(info->voltage_mask) - 1;
571 /* set the registers for the request */
572 regval = (u8)selector << voltage_shift;
573 ret = abx500_mask_and_set_register_interruptible(info->dev,
574 info->voltage_bank, info->voltage_reg,
575 info->voltage_mask, regval);
577 dev_err(rdev_get_dev(rdev),
578 "couldn't set voltage reg for regulator\n");
580 dev_vdbg(rdev_get_dev(rdev),
581 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
583 info->desc.name, info->voltage_bank, info->voltage_reg,
584 info->voltage_mask, regval);
589 static int ab8540_aux3_regulator_set_voltage_sel(struct regulator_dev *rdev,
593 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
594 u8 regval, regval_expand;
597 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
601 if (selector < info->expand_register.voltage_limit) {
602 int voltage_shift = ffs(info->voltage_mask) - 1;
604 regval = (u8)selector << voltage_shift;
605 ret = abx500_mask_and_set_register_interruptible(info->dev,
606 info->voltage_bank, info->voltage_reg,
607 info->voltage_mask, regval);
609 dev_err(rdev_get_dev(rdev),
610 "couldn't set voltage reg for regulator\n");
614 dev_vdbg(rdev_get_dev(rdev),
615 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
616 info->desc.name, info->voltage_bank, info->voltage_reg,
617 info->voltage_mask, regval);
621 regval_expand = info->expand_register.voltage_mask;
624 ret = abx500_mask_and_set_register_interruptible(info->dev,
625 info->expand_register.voltage_bank,
626 info->expand_register.voltage_reg,
627 info->expand_register.voltage_mask,
630 dev_err(rdev_get_dev(rdev),
631 "couldn't set expand voltage reg for regulator\n");
635 dev_vdbg(rdev_get_dev(rdev),
636 "%s-set_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
637 info->desc.name, info->expand_register.voltage_bank,
638 info->expand_register.voltage_reg,
639 info->expand_register.voltage_mask, regval_expand);
644 static struct regulator_ops ab8500_regulator_volt_mode_ops = {
645 .enable = ab8500_regulator_enable,
646 .disable = ab8500_regulator_disable,
647 .is_enabled = ab8500_regulator_is_enabled,
648 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
649 .set_mode = ab8500_regulator_set_mode,
650 .get_mode = ab8500_regulator_get_mode,
651 .get_voltage_sel = ab8500_regulator_get_voltage_sel,
652 .set_voltage_sel = ab8500_regulator_set_voltage_sel,
653 .list_voltage = regulator_list_voltage_table,
656 static struct regulator_ops ab8540_aux3_regulator_volt_mode_ops = {
657 .enable = ab8500_regulator_enable,
658 .disable = ab8500_regulator_disable,
659 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
660 .set_mode = ab8500_regulator_set_mode,
661 .get_mode = ab8500_regulator_get_mode,
662 .is_enabled = ab8500_regulator_is_enabled,
663 .get_voltage_sel = ab8540_aux3_regulator_get_voltage_sel,
664 .set_voltage_sel = ab8540_aux3_regulator_set_voltage_sel,
665 .list_voltage = regulator_list_voltage_table,
668 static struct regulator_ops ab8500_regulator_volt_ops = {
669 .enable = ab8500_regulator_enable,
670 .disable = ab8500_regulator_disable,
671 .is_enabled = ab8500_regulator_is_enabled,
672 .get_voltage_sel = ab8500_regulator_get_voltage_sel,
673 .set_voltage_sel = ab8500_regulator_set_voltage_sel,
674 .list_voltage = regulator_list_voltage_table,
677 static struct regulator_ops ab8500_regulator_mode_ops = {
678 .enable = ab8500_regulator_enable,
679 .disable = ab8500_regulator_disable,
680 .is_enabled = ab8500_regulator_is_enabled,
681 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
682 .set_mode = ab8500_regulator_set_mode,
683 .get_mode = ab8500_regulator_get_mode,
684 .list_voltage = regulator_list_voltage_table,
687 static struct regulator_ops ab8500_regulator_ops = {
688 .enable = ab8500_regulator_enable,
689 .disable = ab8500_regulator_disable,
690 .is_enabled = ab8500_regulator_is_enabled,
691 .list_voltage = regulator_list_voltage_table,
694 static struct regulator_ops ab8500_regulator_anamic_mode_ops = {
695 .enable = ab8500_regulator_enable,
696 .disable = ab8500_regulator_disable,
697 .is_enabled = ab8500_regulator_is_enabled,
698 .set_mode = ab8500_regulator_set_mode,
699 .get_mode = ab8500_regulator_get_mode,
700 .list_voltage = regulator_list_voltage_table,
703 /* AB8500 regulator information */
704 static struct ab8500_regulator_info
705 ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
707 * Variable Voltage Regulators
708 * name, min mV, max mV,
709 * update bank, reg, mask, enable val
710 * volt bank, reg, mask
712 [AB8500_LDO_AUX1] = {
715 .ops = &ab8500_regulator_volt_mode_ops,
716 .type = REGULATOR_VOLTAGE,
717 .id = AB8500_LDO_AUX1,
718 .owner = THIS_MODULE,
719 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
720 .volt_table = ldo_vauxn_voltages,
722 .supply_name = "vin",
729 .update_val_idle = 0x03,
730 .update_val_normal = 0x01,
731 .voltage_bank = 0x04,
733 .voltage_mask = 0x0f,
735 [AB8500_LDO_AUX2] = {
738 .ops = &ab8500_regulator_volt_mode_ops,
739 .type = REGULATOR_VOLTAGE,
740 .id = AB8500_LDO_AUX2,
741 .owner = THIS_MODULE,
742 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
743 .volt_table = ldo_vauxn_voltages,
745 .supply_name = "vin",
752 .update_val_idle = 0x0c,
753 .update_val_normal = 0x04,
754 .voltage_bank = 0x04,
756 .voltage_mask = 0x0f,
758 [AB8500_LDO_AUX3] = {
761 .ops = &ab8500_regulator_volt_mode_ops,
762 .type = REGULATOR_VOLTAGE,
763 .id = AB8500_LDO_AUX3,
764 .owner = THIS_MODULE,
765 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
766 .volt_table = ldo_vaux3_voltages,
768 .supply_name = "vin",
775 .update_val_idle = 0x03,
776 .update_val_normal = 0x01,
777 .voltage_bank = 0x04,
779 .voltage_mask = 0x07,
781 [AB8500_LDO_INTCORE] = {
783 .name = "LDO-INTCORE",
784 .ops = &ab8500_regulator_volt_mode_ops,
785 .type = REGULATOR_VOLTAGE,
786 .id = AB8500_LDO_INTCORE,
787 .owner = THIS_MODULE,
788 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
789 .volt_table = ldo_vintcore_voltages,
797 .update_val_idle = 0x44,
798 .update_val_normal = 0x04,
799 .voltage_bank = 0x03,
801 .voltage_mask = 0x38,
805 * Fixed Voltage Regulators
807 * update bank, reg, mask, enable val
809 [AB8500_LDO_TVOUT] = {
812 .ops = &ab8500_regulator_mode_ops,
813 .type = REGULATOR_VOLTAGE,
814 .id = AB8500_LDO_TVOUT,
815 .owner = THIS_MODULE,
817 .volt_table = fixed_2000000_voltage,
825 .update_val_idle = 0x82,
826 .update_val_normal = 0x02,
828 [AB8500_LDO_AUDIO] = {
831 .ops = &ab8500_regulator_ops,
832 .type = REGULATOR_VOLTAGE,
833 .id = AB8500_LDO_AUDIO,
834 .owner = THIS_MODULE,
837 .volt_table = fixed_2000000_voltage,
844 [AB8500_LDO_ANAMIC1] = {
846 .name = "LDO-ANAMIC1",
847 .ops = &ab8500_regulator_ops,
848 .type = REGULATOR_VOLTAGE,
849 .id = AB8500_LDO_ANAMIC1,
850 .owner = THIS_MODULE,
853 .volt_table = fixed_2050000_voltage,
860 [AB8500_LDO_ANAMIC2] = {
862 .name = "LDO-ANAMIC2",
863 .ops = &ab8500_regulator_ops,
864 .type = REGULATOR_VOLTAGE,
865 .id = AB8500_LDO_ANAMIC2,
866 .owner = THIS_MODULE,
869 .volt_table = fixed_2050000_voltage,
876 [AB8500_LDO_DMIC] = {
879 .ops = &ab8500_regulator_ops,
880 .type = REGULATOR_VOLTAGE,
881 .id = AB8500_LDO_DMIC,
882 .owner = THIS_MODULE,
885 .volt_table = fixed_1800000_voltage,
894 * Regulators with fixed voltage and normal/idle modes
899 .ops = &ab8500_regulator_mode_ops,
900 .type = REGULATOR_VOLTAGE,
901 .id = AB8500_LDO_ANA,
902 .owner = THIS_MODULE,
905 .volt_table = fixed_1200000_voltage,
912 .update_val_idle = 0x0c,
913 .update_val_normal = 0x04,
917 /* AB8505 regulator information */
918 static struct ab8500_regulator_info
919 ab8505_regulator_info[AB8505_NUM_REGULATORS] = {
921 * Variable Voltage Regulators
922 * name, min mV, max mV,
923 * update bank, reg, mask, enable val
924 * volt bank, reg, mask
926 [AB8505_LDO_AUX1] = {
929 .ops = &ab8500_regulator_volt_mode_ops,
930 .type = REGULATOR_VOLTAGE,
931 .id = AB8505_LDO_AUX1,
932 .owner = THIS_MODULE,
933 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
934 .volt_table = ldo_vauxn_voltages,
941 .update_val_idle = 0x03,
942 .update_val_normal = 0x01,
943 .voltage_bank = 0x04,
945 .voltage_mask = 0x0f,
947 [AB8505_LDO_AUX2] = {
950 .ops = &ab8500_regulator_volt_mode_ops,
951 .type = REGULATOR_VOLTAGE,
952 .id = AB8505_LDO_AUX2,
953 .owner = THIS_MODULE,
954 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
955 .volt_table = ldo_vauxn_voltages,
962 .update_val_idle = 0x0c,
963 .update_val_normal = 0x04,
964 .voltage_bank = 0x04,
966 .voltage_mask = 0x0f,
968 [AB8505_LDO_AUX3] = {
971 .ops = &ab8500_regulator_volt_mode_ops,
972 .type = REGULATOR_VOLTAGE,
973 .id = AB8505_LDO_AUX3,
974 .owner = THIS_MODULE,
975 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
976 .volt_table = ldo_vaux3_voltages,
983 .update_val_idle = 0x03,
984 .update_val_normal = 0x01,
985 .voltage_bank = 0x04,
987 .voltage_mask = 0x07,
989 [AB8505_LDO_AUX4] = {
992 .ops = &ab8500_regulator_volt_mode_ops,
993 .type = REGULATOR_VOLTAGE,
994 .id = AB8505_LDO_AUX4,
995 .owner = THIS_MODULE,
996 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
997 .volt_table = ldo_vauxn_voltages,
1000 /* values for Vaux4Regu register */
1001 .update_bank = 0x04,
1003 .update_mask = 0x03,
1005 .update_val_idle = 0x03,
1006 .update_val_normal = 0x01,
1007 /* values for Vaux4SEL register */
1008 .voltage_bank = 0x04,
1009 .voltage_reg = 0x2f,
1010 .voltage_mask = 0x0f,
1012 [AB8505_LDO_AUX5] = {
1015 .ops = &ab8500_regulator_volt_mode_ops,
1016 .type = REGULATOR_VOLTAGE,
1017 .id = AB8505_LDO_AUX5,
1018 .owner = THIS_MODULE,
1019 .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
1020 .volt_table = ldo_vaux56_voltages,
1023 /* values for CtrlVaux5 register */
1024 .update_bank = 0x01,
1026 .update_mask = 0x18,
1028 .update_val_idle = 0x18,
1029 .update_val_normal = 0x10,
1030 .voltage_bank = 0x01,
1031 .voltage_reg = 0x55,
1032 .voltage_mask = 0x07,
1034 [AB8505_LDO_AUX6] = {
1037 .ops = &ab8500_regulator_volt_mode_ops,
1038 .type = REGULATOR_VOLTAGE,
1039 .id = AB8505_LDO_AUX6,
1040 .owner = THIS_MODULE,
1041 .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
1042 .volt_table = ldo_vaux56_voltages,
1045 /* values for CtrlVaux6 register */
1046 .update_bank = 0x01,
1048 .update_mask = 0x18,
1050 .update_val_idle = 0x18,
1051 .update_val_normal = 0x10,
1052 .voltage_bank = 0x01,
1053 .voltage_reg = 0x56,
1054 .voltage_mask = 0x07,
1056 [AB8505_LDO_INTCORE] = {
1058 .name = "LDO-INTCORE",
1059 .ops = &ab8500_regulator_volt_mode_ops,
1060 .type = REGULATOR_VOLTAGE,
1061 .id = AB8505_LDO_INTCORE,
1062 .owner = THIS_MODULE,
1063 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1064 .volt_table = ldo_vintcore_voltages,
1067 .update_bank = 0x03,
1069 .update_mask = 0x44,
1071 .update_val_idle = 0x44,
1072 .update_val_normal = 0x04,
1073 .voltage_bank = 0x03,
1074 .voltage_reg = 0x80,
1075 .voltage_mask = 0x38,
1079 * Fixed Voltage Regulators
1081 * update bank, reg, mask, enable val
1083 [AB8505_LDO_ADC] = {
1086 .ops = &ab8500_regulator_mode_ops,
1087 .type = REGULATOR_VOLTAGE,
1088 .id = AB8505_LDO_ADC,
1089 .owner = THIS_MODULE,
1091 .volt_table = fixed_2000000_voltage,
1092 .enable_time = 10000,
1095 .update_bank = 0x03,
1097 .update_mask = 0x82,
1099 .update_val_idle = 0x82,
1100 .update_val_normal = 0x02,
1102 [AB8505_LDO_USB] = {
1105 .ops = &ab8500_regulator_mode_ops,
1106 .type = REGULATOR_VOLTAGE,
1107 .id = AB8505_LDO_USB,
1108 .owner = THIS_MODULE,
1110 .volt_table = fixed_3300000_voltage,
1112 .update_bank = 0x03,
1114 .update_mask = 0x03,
1116 .update_val_idle = 0x03,
1117 .update_val_normal = 0x01,
1119 [AB8505_LDO_AUDIO] = {
1121 .name = "LDO-AUDIO",
1122 .ops = &ab8500_regulator_volt_ops,
1123 .type = REGULATOR_VOLTAGE,
1124 .id = AB8505_LDO_AUDIO,
1125 .owner = THIS_MODULE,
1126 .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages),
1127 .volt_table = ldo_vaudio_voltages,
1129 .update_bank = 0x03,
1131 .update_mask = 0x02,
1133 .voltage_bank = 0x01,
1134 .voltage_reg = 0x57,
1135 .voltage_mask = 0x70,
1137 [AB8505_LDO_ANAMIC1] = {
1139 .name = "LDO-ANAMIC1",
1140 .ops = &ab8500_regulator_anamic_mode_ops,
1141 .type = REGULATOR_VOLTAGE,
1142 .id = AB8505_LDO_ANAMIC1,
1143 .owner = THIS_MODULE,
1145 .volt_table = fixed_2050000_voltage,
1147 .shared_mode = &ldo_anamic1_shared,
1148 .update_bank = 0x03,
1150 .update_mask = 0x08,
1155 .mode_val_idle = 0x04,
1156 .mode_val_normal = 0x00,
1158 [AB8505_LDO_ANAMIC2] = {
1160 .name = "LDO-ANAMIC2",
1161 .ops = &ab8500_regulator_anamic_mode_ops,
1162 .type = REGULATOR_VOLTAGE,
1163 .id = AB8505_LDO_ANAMIC2,
1164 .owner = THIS_MODULE,
1166 .volt_table = fixed_2050000_voltage,
1168 .shared_mode = &ldo_anamic2_shared,
1169 .update_bank = 0x03,
1171 .update_mask = 0x10,
1176 .mode_val_idle = 0x04,
1177 .mode_val_normal = 0x00,
1179 [AB8505_LDO_AUX8] = {
1182 .ops = &ab8500_regulator_ops,
1183 .type = REGULATOR_VOLTAGE,
1184 .id = AB8505_LDO_AUX8,
1185 .owner = THIS_MODULE,
1187 .volt_table = fixed_1800000_voltage,
1189 .update_bank = 0x03,
1191 .update_mask = 0x04,
1195 * Regulators with fixed voltage and normal/idle modes
1197 [AB8505_LDO_ANA] = {
1200 .ops = &ab8500_regulator_volt_mode_ops,
1201 .type = REGULATOR_VOLTAGE,
1202 .id = AB8505_LDO_ANA,
1203 .owner = THIS_MODULE,
1204 .n_voltages = ARRAY_SIZE(ldo_vana_voltages),
1205 .volt_table = ldo_vana_voltages,
1208 .update_bank = 0x04,
1210 .update_mask = 0x0c,
1212 .update_val_idle = 0x0c,
1213 .update_val_normal = 0x04,
1214 .voltage_bank = 0x04,
1215 .voltage_reg = 0x29,
1216 .voltage_mask = 0x7,
1220 /* AB9540 regulator information */
1221 static struct ab8500_regulator_info
1222 ab9540_regulator_info[AB9540_NUM_REGULATORS] = {
1224 * Variable Voltage Regulators
1225 * name, min mV, max mV,
1226 * update bank, reg, mask, enable val
1227 * volt bank, reg, mask
1229 [AB9540_LDO_AUX1] = {
1232 .ops = &ab8500_regulator_volt_mode_ops,
1233 .type = REGULATOR_VOLTAGE,
1234 .id = AB9540_LDO_AUX1,
1235 .owner = THIS_MODULE,
1236 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1237 .volt_table = ldo_vauxn_voltages,
1240 .update_bank = 0x04,
1242 .update_mask = 0x03,
1244 .update_val_idle = 0x03,
1245 .update_val_normal = 0x01,
1246 .voltage_bank = 0x04,
1247 .voltage_reg = 0x1f,
1248 .voltage_mask = 0x0f,
1250 [AB9540_LDO_AUX2] = {
1253 .ops = &ab8500_regulator_volt_mode_ops,
1254 .type = REGULATOR_VOLTAGE,
1255 .id = AB9540_LDO_AUX2,
1256 .owner = THIS_MODULE,
1257 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1258 .volt_table = ldo_vauxn_voltages,
1261 .update_bank = 0x04,
1263 .update_mask = 0x0c,
1265 .update_val_idle = 0x0c,
1266 .update_val_normal = 0x04,
1267 .voltage_bank = 0x04,
1268 .voltage_reg = 0x20,
1269 .voltage_mask = 0x0f,
1271 [AB9540_LDO_AUX3] = {
1274 .ops = &ab8500_regulator_volt_mode_ops,
1275 .type = REGULATOR_VOLTAGE,
1276 .id = AB9540_LDO_AUX3,
1277 .owner = THIS_MODULE,
1278 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
1279 .volt_table = ldo_vaux3_voltages,
1282 .update_bank = 0x04,
1284 .update_mask = 0x03,
1286 .update_val_idle = 0x03,
1287 .update_val_normal = 0x01,
1288 .voltage_bank = 0x04,
1289 .voltage_reg = 0x21,
1290 .voltage_mask = 0x07,
1292 [AB9540_LDO_AUX4] = {
1295 .ops = &ab8500_regulator_volt_mode_ops,
1296 .type = REGULATOR_VOLTAGE,
1297 .id = AB9540_LDO_AUX4,
1298 .owner = THIS_MODULE,
1299 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1300 .volt_table = ldo_vauxn_voltages,
1303 /* values for Vaux4Regu register */
1304 .update_bank = 0x04,
1306 .update_mask = 0x03,
1308 .update_val_idle = 0x03,
1309 .update_val_normal = 0x01,
1310 /* values for Vaux4SEL register */
1311 .voltage_bank = 0x04,
1312 .voltage_reg = 0x2f,
1313 .voltage_mask = 0x0f,
1315 [AB9540_LDO_INTCORE] = {
1317 .name = "LDO-INTCORE",
1318 .ops = &ab8500_regulator_volt_mode_ops,
1319 .type = REGULATOR_VOLTAGE,
1320 .id = AB9540_LDO_INTCORE,
1321 .owner = THIS_MODULE,
1322 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1323 .volt_table = ldo_vintcore_voltages,
1326 .update_bank = 0x03,
1328 .update_mask = 0x44,
1330 .update_val_idle = 0x44,
1331 .update_val_normal = 0x04,
1332 .voltage_bank = 0x03,
1333 .voltage_reg = 0x80,
1334 .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,
1540 [AB8540_LDO_AUX4] = {
1543 .ops = &ab8500_regulator_volt_mode_ops,
1544 .type = REGULATOR_VOLTAGE,
1545 .id = AB8540_LDO_AUX4,
1546 .owner = THIS_MODULE,
1547 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1548 .volt_table = ldo_vauxn_voltages,
1551 /* values for Vaux4Regu register */
1552 .update_bank = 0x04,
1554 .update_mask = 0x03,
1556 .update_val_idle = 0x03,
1557 .update_val_normal = 0x01,
1558 /* values for Vaux4SEL register */
1559 .voltage_bank = 0x04,
1560 .voltage_reg = 0x2f,
1561 .voltage_mask = 0x0f,
1563 [AB8540_LDO_AUX5] = {
1566 .ops = &ab8500_regulator_volt_mode_ops,
1567 .type = REGULATOR_VOLTAGE,
1568 .id = AB8540_LDO_AUX5,
1569 .owner = THIS_MODULE,
1570 .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages),
1571 .volt_table = ldo_vaux56_ab8540_voltages,
1573 .load_lp_uA = 20000,
1574 /* values for Vaux5Regu register */
1575 .update_bank = 0x04,
1577 .update_mask = 0x03,
1579 .update_val_idle = 0x03,
1580 .update_val_normal = 0x01,
1581 /* values for Vaux5SEL register */
1582 .voltage_bank = 0x04,
1583 .voltage_reg = 0x33,
1584 .voltage_mask = 0x3f,
1586 [AB8540_LDO_AUX6] = {
1589 .ops = &ab8500_regulator_volt_mode_ops,
1590 .type = REGULATOR_VOLTAGE,
1591 .id = AB8540_LDO_AUX6,
1592 .owner = THIS_MODULE,
1593 .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages),
1594 .volt_table = ldo_vaux56_ab8540_voltages,
1596 .load_lp_uA = 20000,
1597 /* values for Vaux6Regu register */
1598 .update_bank = 0x04,
1600 .update_mask = 0x03,
1602 .update_val_idle = 0x03,
1603 .update_val_normal = 0x01,
1604 /* values for Vaux6SEL register */
1605 .voltage_bank = 0x04,
1606 .voltage_reg = 0x36,
1607 .voltage_mask = 0x3f,
1609 [AB8540_LDO_INTCORE] = {
1611 .name = "LDO-INTCORE",
1612 .ops = &ab8500_regulator_volt_mode_ops,
1613 .type = REGULATOR_VOLTAGE,
1614 .id = AB8540_LDO_INTCORE,
1615 .owner = THIS_MODULE,
1616 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1617 .volt_table = ldo_vintcore_voltages,
1620 .update_bank = 0x03,
1622 .update_mask = 0x44,
1624 .update_val_idle = 0x44,
1625 .update_val_normal = 0x04,
1626 .voltage_bank = 0x03,
1627 .voltage_reg = 0x80,
1628 .voltage_mask = 0x38,
1632 * Fixed Voltage Regulators
1634 * update bank, reg, mask, enable val
1636 [AB8540_LDO_TVOUT] = {
1638 .name = "LDO-TVOUT",
1639 .ops = &ab8500_regulator_mode_ops,
1640 .type = REGULATOR_VOLTAGE,
1641 .id = AB8540_LDO_TVOUT,
1642 .owner = THIS_MODULE,
1644 .volt_table = fixed_2000000_voltage,
1645 .enable_time = 10000,
1648 .update_bank = 0x03,
1650 .update_mask = 0x82,
1652 .update_val_idle = 0x82,
1653 .update_val_normal = 0x02,
1655 [AB8540_LDO_AUDIO] = {
1657 .name = "LDO-AUDIO",
1658 .ops = &ab8500_regulator_ops,
1659 .type = REGULATOR_VOLTAGE,
1660 .id = AB8540_LDO_AUDIO,
1661 .owner = THIS_MODULE,
1663 .volt_table = fixed_2000000_voltage,
1665 .update_bank = 0x03,
1667 .update_mask = 0x02,
1670 [AB8540_LDO_ANAMIC1] = {
1672 .name = "LDO-ANAMIC1",
1673 .ops = &ab8500_regulator_anamic_mode_ops,
1674 .type = REGULATOR_VOLTAGE,
1675 .id = AB8540_LDO_ANAMIC1,
1676 .owner = THIS_MODULE,
1678 .volt_table = fixed_2050000_voltage,
1680 .shared_mode = &ab8540_ldo_anamic1_shared,
1681 .update_bank = 0x03,
1683 .update_mask = 0x08,
1688 .mode_val_idle = 0x20,
1689 .mode_val_normal = 0x00,
1691 [AB8540_LDO_ANAMIC2] = {
1693 .name = "LDO-ANAMIC2",
1694 .ops = &ab8500_regulator_anamic_mode_ops,
1695 .type = REGULATOR_VOLTAGE,
1696 .id = AB8540_LDO_ANAMIC2,
1697 .owner = THIS_MODULE,
1699 .volt_table = fixed_2050000_voltage,
1701 .shared_mode = &ab8540_ldo_anamic2_shared,
1702 .update_bank = 0x03,
1704 .update_mask = 0x10,
1709 .mode_val_idle = 0x20,
1710 .mode_val_normal = 0x00,
1712 [AB8540_LDO_DMIC] = {
1715 .ops = &ab8500_regulator_volt_mode_ops,
1716 .type = REGULATOR_VOLTAGE,
1717 .id = AB8540_LDO_DMIC,
1718 .owner = THIS_MODULE,
1719 .n_voltages = ARRAY_SIZE(ldo_vdmic_voltages),
1720 .volt_table = ldo_vdmic_voltages,
1723 .update_bank = 0x03,
1725 .update_mask = 0x04,
1727 .voltage_bank = 0x03,
1728 .voltage_reg = 0x83,
1729 .voltage_mask = 0xc0,
1733 * Regulators with fixed voltage and normal/idle modes
1735 [AB8540_LDO_ANA] = {
1738 .ops = &ab8500_regulator_mode_ops,
1739 .type = REGULATOR_VOLTAGE,
1740 .id = AB8540_LDO_ANA,
1741 .owner = THIS_MODULE,
1743 .volt_table = fixed_1200000_voltage,
1746 .update_bank = 0x04,
1748 .update_mask = 0x0c,
1750 .update_val_idle = 0x0c,
1751 .update_val_normal = 0x04,
1753 [AB8540_LDO_SDIO] = {
1756 .ops = &ab8500_regulator_volt_mode_ops,
1757 .type = REGULATOR_VOLTAGE,
1758 .id = AB8540_LDO_SDIO,
1759 .owner = THIS_MODULE,
1760 .n_voltages = ARRAY_SIZE(ldo_sdio_voltages),
1761 .volt_table = ldo_sdio_voltages,
1764 .update_bank = 0x03,
1766 .update_mask = 0x30,
1768 .update_val_idle = 0x30,
1769 .update_val_normal = 0x10,
1770 .voltage_bank = 0x03,
1771 .voltage_reg = 0x88,
1772 .voltage_mask = 0x07,
1776 static struct ab8500_shared_mode ldo_anamic1_shared = {
1777 .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2],
1780 static struct ab8500_shared_mode ldo_anamic2_shared = {
1781 .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1],
1784 static struct ab8500_shared_mode ab8540_ldo_anamic1_shared = {
1785 .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC2],
1788 static struct ab8500_shared_mode ab8540_ldo_anamic2_shared = {
1789 .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC1],
1792 struct ab8500_reg_init {
1798 #define REG_INIT(_id, _bank, _addr, _mask) \
1805 /* AB8500 register init */
1806 static struct ab8500_reg_init ab8500_reg_init[] = {
1808 * 0x30, VanaRequestCtrl
1809 * 0xc0, VextSupply1RequestCtrl
1811 REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xf0),
1813 * 0x03, VextSupply2RequestCtrl
1814 * 0x0c, VextSupply3RequestCtrl
1815 * 0x30, Vaux1RequestCtrl
1816 * 0xc0, Vaux2RequestCtrl
1818 REG_INIT(AB8500_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
1820 * 0x03, Vaux3RequestCtrl
1823 REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
1825 * 0x08, VanaSysClkReq1HPValid
1826 * 0x20, Vaux1SysClkReq1HPValid
1827 * 0x40, Vaux2SysClkReq1HPValid
1828 * 0x80, Vaux3SysClkReq1HPValid
1830 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
1832 * 0x10, VextSupply1SysClkReq1HPValid
1833 * 0x20, VextSupply2SysClkReq1HPValid
1834 * 0x40, VextSupply3SysClkReq1HPValid
1836 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
1838 * 0x08, VanaHwHPReq1Valid
1839 * 0x20, Vaux1HwHPReq1Valid
1840 * 0x40, Vaux2HwHPReq1Valid
1841 * 0x80, Vaux3HwHPReq1Valid
1843 REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8),
1845 * 0x01, VextSupply1HwHPReq1Valid
1846 * 0x02, VextSupply2HwHPReq1Valid
1847 * 0x04, VextSupply3HwHPReq1Valid
1849 REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
1851 * 0x08, VanaHwHPReq2Valid
1852 * 0x20, Vaux1HwHPReq2Valid
1853 * 0x40, Vaux2HwHPReq2Valid
1854 * 0x80, Vaux3HwHPReq2Valid
1856 REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8),
1858 * 0x01, VextSupply1HwHPReq2Valid
1859 * 0x02, VextSupply2HwHPReq2Valid
1860 * 0x04, VextSupply3HwHPReq2Valid
1862 REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
1864 * 0x20, VanaSwHPReqValid
1865 * 0x80, Vaux1SwHPReqValid
1867 REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0),
1869 * 0x01, Vaux2SwHPReqValid
1870 * 0x02, Vaux3SwHPReqValid
1871 * 0x04, VextSupply1SwHPReqValid
1872 * 0x08, VextSupply2SwHPReqValid
1873 * 0x10, VextSupply3SwHPReqValid
1875 REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
1877 * 0x02, SysClkReq2Valid1
1878 * 0x04, SysClkReq3Valid1
1879 * 0x08, SysClkReq4Valid1
1880 * 0x10, SysClkReq5Valid1
1881 * 0x20, SysClkReq6Valid1
1882 * 0x40, SysClkReq7Valid1
1883 * 0x80, SysClkReq8Valid1
1885 REG_INIT(AB8500_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
1887 * 0x02, SysClkReq2Valid2
1888 * 0x04, SysClkReq3Valid2
1889 * 0x08, SysClkReq4Valid2
1890 * 0x10, SysClkReq5Valid2
1891 * 0x20, SysClkReq6Valid2
1892 * 0x40, SysClkReq7Valid2
1893 * 0x80, SysClkReq8Valid2
1895 REG_INIT(AB8500_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
1898 * 0x04, Vintcore12Ena
1899 * 0x38, Vintcore12Sel
1900 * 0x40, Vintcore12LP
1903 REG_INIT(AB8500_REGUMISC1, 0x03, 0x80, 0xfe),
1910 REG_INIT(AB8500_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
1912 * 0x01, Vamic1_dzout
1913 * 0x02, Vamic2_dzout
1915 REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
1917 * 0x03, VpllRegu (NOTE! PRCMU register bits)
1920 REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f),
1923 * 0x02, VrefDDRSleepMode
1925 REG_INIT(AB8500_VREFDDR, 0x04, 0x07, 0x03),
1927 * 0x03, VextSupply1Regu
1928 * 0x0c, VextSupply2Regu
1929 * 0x30, VextSupply3Regu
1930 * 0x40, ExtSupply2Bypass
1931 * 0x80, ExtSupply3Bypass
1933 REG_INIT(AB8500_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
1938 REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f),
1942 REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03),
1946 REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f),
1950 REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f),
1954 REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07),
1956 * 0x01, VextSupply12LP
1958 REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
1963 * 0x20, Vintcore12Disch
1967 REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
1970 * 0x04, VdmicPullDownEna
1973 REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
1976 /* AB8505 register init */
1977 static struct ab8500_reg_init ab8505_reg_init[] = {
1979 * 0x03, VarmRequestCtrl
1980 * 0x0c, VsmpsCRequestCtrl
1981 * 0x30, VsmpsARequestCtrl
1982 * 0xc0, VsmpsBRequestCtrl
1984 REG_INIT(AB8505_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
1986 * 0x03, VsafeRequestCtrl
1987 * 0x0c, VpllRequestCtrl
1988 * 0x30, VanaRequestCtrl
1990 REG_INIT(AB8505_REGUREQUESTCTRL2, 0x03, 0x04, 0x3f),
1992 * 0x30, Vaux1RequestCtrl
1993 * 0xc0, Vaux2RequestCtrl
1995 REG_INIT(AB8505_REGUREQUESTCTRL3, 0x03, 0x05, 0xf0),
1997 * 0x03, Vaux3RequestCtrl
2000 REG_INIT(AB8505_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2002 * 0x01, VsmpsASysClkReq1HPValid
2003 * 0x02, VsmpsBSysClkReq1HPValid
2004 * 0x04, VsafeSysClkReq1HPValid
2005 * 0x08, VanaSysClkReq1HPValid
2006 * 0x10, VpllSysClkReq1HPValid
2007 * 0x20, Vaux1SysClkReq1HPValid
2008 * 0x40, Vaux2SysClkReq1HPValid
2009 * 0x80, Vaux3SysClkReq1HPValid
2011 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2013 * 0x01, VsmpsCSysClkReq1HPValid
2014 * 0x02, VarmSysClkReq1HPValid
2015 * 0x04, VbbSysClkReq1HPValid
2016 * 0x08, VsmpsMSysClkReq1HPValid
2018 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x0f),
2020 * 0x01, VsmpsAHwHPReq1Valid
2021 * 0x02, VsmpsBHwHPReq1Valid
2022 * 0x04, VsafeHwHPReq1Valid
2023 * 0x08, VanaHwHPReq1Valid
2024 * 0x10, VpllHwHPReq1Valid
2025 * 0x20, Vaux1HwHPReq1Valid
2026 * 0x40, Vaux2HwHPReq1Valid
2027 * 0x80, Vaux3HwHPReq1Valid
2029 REG_INIT(AB8505_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2031 * 0x08, VsmpsMHwHPReq1Valid
2033 REG_INIT(AB8505_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x08),
2035 * 0x01, VsmpsAHwHPReq2Valid
2036 * 0x02, VsmpsBHwHPReq2Valid
2037 * 0x04, VsafeHwHPReq2Valid
2038 * 0x08, VanaHwHPReq2Valid
2039 * 0x10, VpllHwHPReq2Valid
2040 * 0x20, Vaux1HwHPReq2Valid
2041 * 0x40, Vaux2HwHPReq2Valid
2042 * 0x80, Vaux3HwHPReq2Valid
2044 REG_INIT(AB8505_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2046 * 0x08, VsmpsMHwHPReq2Valid
2048 REG_INIT(AB8505_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x08),
2050 * 0x01, VsmpsCSwHPReqValid
2051 * 0x02, VarmSwHPReqValid
2052 * 0x04, VsmpsASwHPReqValid
2053 * 0x08, VsmpsBSwHPReqValid
2054 * 0x10, VsafeSwHPReqValid
2055 * 0x20, VanaSwHPReqValid
2056 * 0x40, VpllSwHPReqValid
2057 * 0x80, Vaux1SwHPReqValid
2059 REG_INIT(AB8505_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2061 * 0x01, Vaux2SwHPReqValid
2062 * 0x02, Vaux3SwHPReqValid
2063 * 0x20, VsmpsMSwHPReqValid
2065 REG_INIT(AB8505_REGUSWHPREQVALID2, 0x03, 0x0e, 0x23),
2067 * 0x02, SysClkReq2Valid1
2068 * 0x04, SysClkReq3Valid1
2069 * 0x08, SysClkReq4Valid1
2071 REG_INIT(AB8505_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0x0e),
2073 * 0x02, SysClkReq2Valid2
2074 * 0x04, SysClkReq3Valid2
2075 * 0x08, SysClkReq4Valid2
2077 REG_INIT(AB8505_REGUSYSCLKREQVALID2, 0x03, 0x10, 0x0e),
2079 * 0x01, Vaux4SwHPReqValid
2080 * 0x02, Vaux4HwHPReq2Valid
2081 * 0x04, Vaux4HwHPReq1Valid
2082 * 0x08, Vaux4SysClkReq1HPValid
2084 REG_INIT(AB8505_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2087 * 0x04, VintCore12Ena
2088 * 0x38, VintCore12Sel
2089 * 0x40, VintCore12LP
2092 REG_INIT(AB8505_REGUMISC1, 0x03, 0x80, 0xfe),
2099 REG_INIT(AB8505_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
2101 * 0x01, Vamic1_dzout
2102 * 0x02, Vamic2_dzout
2104 REG_INIT(AB8505_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2107 * 0x0c, VsmpsASelCtrl
2108 * 0x10, VsmpsAAutoMode
2109 * 0x20, VsmpsAPWMMode
2111 REG_INIT(AB8505_VSMPSAREGU, 0x04, 0x03, 0x3f),
2114 * 0x0c, VsmpsBSelCtrl
2115 * 0x10, VsmpsBAutoMode
2116 * 0x20, VsmpsBPWMMode
2118 REG_INIT(AB8505_VSMPSBREGU, 0x04, 0x04, 0x3f),
2121 * 0x0c, VsafeSelCtrl
2122 * 0x10, VsafeAutoMode
2123 * 0x20, VsafePWMMode
2125 REG_INIT(AB8505_VSAFEREGU, 0x04, 0x05, 0x3f),
2127 * 0x03, VpllRegu (NOTE! PRCMU register bits)
2130 REG_INIT(AB8505_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2132 * 0x03, VextSupply1Regu
2133 * 0x0c, VextSupply2Regu
2134 * 0x30, VextSupply3Regu
2135 * 0x40, ExtSupply2Bypass
2136 * 0x80, ExtSupply3Bypass
2138 REG_INIT(AB8505_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2143 REG_INIT(AB8505_VAUX12REGU, 0x04, 0x09, 0x0f),
2147 REG_INIT(AB8505_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2151 REG_INIT(AB8505_VSMPSASEL1, 0x04, 0x13, 0x3f),
2155 REG_INIT(AB8505_VSMPSASEL2, 0x04, 0x14, 0x3f),
2159 REG_INIT(AB8505_VSMPSASEL3, 0x04, 0x15, 0x3f),
2163 REG_INIT(AB8505_VSMPSBSEL1, 0x04, 0x17, 0x3f),
2167 REG_INIT(AB8505_VSMPSBSEL2, 0x04, 0x18, 0x3f),
2171 REG_INIT(AB8505_VSMPSBSEL3, 0x04, 0x19, 0x3f),
2175 REG_INIT(AB8505_VSAFESEL1, 0x04, 0x1b, 0x7f),
2179 REG_INIT(AB8505_VSAFESEL2, 0x04, 0x1c, 0x7f),
2183 REG_INIT(AB8505_VSAFESEL3, 0x04, 0x1d, 0x7f),
2187 REG_INIT(AB8505_VAUX1SEL, 0x04, 0x1f, 0x0f),
2191 REG_INIT(AB8505_VAUX2SEL, 0x04, 0x20, 0x0f),
2196 REG_INIT(AB8505_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
2198 * 0x03, Vaux4RequestCtrl
2200 REG_INIT(AB8505_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2204 REG_INIT(AB8505_VAUX4REGU, 0x04, 0x2e, 0x03),
2208 REG_INIT(AB8505_VAUX4SEL, 0x04, 0x2f, 0x0f),
2213 * 0x20, Vintcore12Disch
2217 REG_INIT(AB8505_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
2220 * 0x04, VdmicPullDownEna
2223 REG_INIT(AB8505_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
2227 REG_INIT(AB8505_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2233 * 0x40, Vaux5DisSfst
2234 * 0x80, Vaux5DisPulld
2236 REG_INIT(AB8505_CTRLVAUX5, 0x01, 0x55, 0xff),
2241 * 0x80, Vaux6DisPulld
2243 REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f),
2246 /* AB9540 register init */
2247 static struct ab8500_reg_init ab9540_reg_init[] = {
2249 * 0x03, VarmRequestCtrl
2250 * 0x0c, VapeRequestCtrl
2251 * 0x30, Vsmps1RequestCtrl
2252 * 0xc0, Vsmps2RequestCtrl
2254 REG_INIT(AB9540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2256 * 0x03, Vsmps3RequestCtrl
2257 * 0x0c, VpllRequestCtrl
2258 * 0x30, VanaRequestCtrl
2259 * 0xc0, VextSupply1RequestCtrl
2261 REG_INIT(AB9540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
2263 * 0x03, VextSupply2RequestCtrl
2264 * 0x0c, VextSupply3RequestCtrl
2265 * 0x30, Vaux1RequestCtrl
2266 * 0xc0, Vaux2RequestCtrl
2268 REG_INIT(AB9540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
2270 * 0x03, Vaux3RequestCtrl
2273 REG_INIT(AB9540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2275 * 0x01, Vsmps1SysClkReq1HPValid
2276 * 0x02, Vsmps2SysClkReq1HPValid
2277 * 0x04, Vsmps3SysClkReq1HPValid
2278 * 0x08, VanaSysClkReq1HPValid
2279 * 0x10, VpllSysClkReq1HPValid
2280 * 0x20, Vaux1SysClkReq1HPValid
2281 * 0x40, Vaux2SysClkReq1HPValid
2282 * 0x80, Vaux3SysClkReq1HPValid
2284 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2286 * 0x01, VapeSysClkReq1HPValid
2287 * 0x02, VarmSysClkReq1HPValid
2288 * 0x04, VbbSysClkReq1HPValid
2289 * 0x08, VmodSysClkReq1HPValid
2290 * 0x10, VextSupply1SysClkReq1HPValid
2291 * 0x20, VextSupply2SysClkReq1HPValid
2292 * 0x40, VextSupply3SysClkReq1HPValid
2294 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f),
2296 * 0x01, Vsmps1HwHPReq1Valid
2297 * 0x02, Vsmps2HwHPReq1Valid
2298 * 0x04, Vsmps3HwHPReq1Valid
2299 * 0x08, VanaHwHPReq1Valid
2300 * 0x10, VpllHwHPReq1Valid
2301 * 0x20, Vaux1HwHPReq1Valid
2302 * 0x40, Vaux2HwHPReq1Valid
2303 * 0x80, Vaux3HwHPReq1Valid
2305 REG_INIT(AB9540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2307 * 0x01, VextSupply1HwHPReq1Valid
2308 * 0x02, VextSupply2HwHPReq1Valid
2309 * 0x04, VextSupply3HwHPReq1Valid
2310 * 0x08, VmodHwHPReq1Valid
2312 REG_INIT(AB9540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f),
2314 * 0x01, Vsmps1HwHPReq2Valid
2315 * 0x02, Vsmps2HwHPReq2Valid
2316 * 0x03, Vsmps3HwHPReq2Valid
2317 * 0x08, VanaHwHPReq2Valid
2318 * 0x10, VpllHwHPReq2Valid
2319 * 0x20, Vaux1HwHPReq2Valid
2320 * 0x40, Vaux2HwHPReq2Valid
2321 * 0x80, Vaux3HwHPReq2Valid
2323 REG_INIT(AB9540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2325 * 0x01, VextSupply1HwHPReq2Valid
2326 * 0x02, VextSupply2HwHPReq2Valid
2327 * 0x04, VextSupply3HwHPReq2Valid
2328 * 0x08, VmodHwHPReq2Valid
2330 REG_INIT(AB9540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f),
2332 * 0x01, VapeSwHPReqValid
2333 * 0x02, VarmSwHPReqValid
2334 * 0x04, Vsmps1SwHPReqValid
2335 * 0x08, Vsmps2SwHPReqValid
2336 * 0x10, Vsmps3SwHPReqValid
2337 * 0x20, VanaSwHPReqValid
2338 * 0x40, VpllSwHPReqValid
2339 * 0x80, Vaux1SwHPReqValid
2341 REG_INIT(AB9540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2343 * 0x01, Vaux2SwHPReqValid
2344 * 0x02, Vaux3SwHPReqValid
2345 * 0x04, VextSupply1SwHPReqValid
2346 * 0x08, VextSupply2SwHPReqValid
2347 * 0x10, VextSupply3SwHPReqValid
2348 * 0x20, VmodSwHPReqValid
2350 REG_INIT(AB9540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f),
2352 * 0x02, SysClkReq2Valid1
2354 * 0x80, SysClkReq8Valid1
2356 REG_INIT(AB9540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
2358 * 0x02, SysClkReq2Valid2
2360 * 0x80, SysClkReq8Valid2
2362 REG_INIT(AB9540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
2364 * 0x01, Vaux4SwHPReqValid
2365 * 0x02, Vaux4HwHPReq2Valid
2366 * 0x04, Vaux4HwHPReq1Valid
2367 * 0x08, Vaux4SysClkReq1HPValid
2369 REG_INIT(AB9540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2372 * 0x04, Vintcore12Ena
2373 * 0x38, Vintcore12Sel
2374 * 0x40, Vintcore12LP
2377 REG_INIT(AB9540_REGUMISC1, 0x03, 0x80, 0xfe),
2384 REG_INIT(AB9540_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
2386 * 0x01, Vamic1_dzout
2387 * 0x02, Vamic2_dzout
2389 REG_INIT(AB9540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2392 * 0x0c, Vsmps1SelCtrl
2393 * 0x10, Vsmps1AutoMode
2394 * 0x20, Vsmps1PWMMode
2396 REG_INIT(AB9540_VSMPS1REGU, 0x04, 0x03, 0x3f),
2399 * 0x0c, Vsmps2SelCtrl
2400 * 0x10, Vsmps2AutoMode
2401 * 0x20, Vsmps2PWMMode
2403 REG_INIT(AB9540_VSMPS2REGU, 0x04, 0x04, 0x3f),
2406 * 0x0c, Vsmps3SelCtrl
2407 * NOTE! PRCMU register
2409 REG_INIT(AB9540_VSMPS3REGU, 0x04, 0x05, 0x0f),
2414 REG_INIT(AB9540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2416 * 0x03, VextSupply1Regu
2417 * 0x0c, VextSupply2Regu
2418 * 0x30, VextSupply3Regu
2419 * 0x40, ExtSupply2Bypass
2420 * 0x80, ExtSupply3Bypass
2422 REG_INIT(AB9540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2427 REG_INIT(AB9540_VAUX12REGU, 0x04, 0x09, 0x0f),
2432 REG_INIT(AB9540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2436 REG_INIT(AB9540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
2440 REG_INIT(AB9540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
2444 REG_INIT(AB9540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
2448 REG_INIT(AB9540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
2452 REG_INIT(AB9540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
2456 REG_INIT(AB9540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
2459 * NOTE! PRCMU register
2461 REG_INIT(AB9540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
2464 * NOTE! PRCMU register
2466 REG_INIT(AB9540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
2470 REG_INIT(AB9540_VAUX1SEL, 0x04, 0x1f, 0x0f),
2474 REG_INIT(AB9540_VAUX2SEL, 0x04, 0x20, 0x0f),
2479 REG_INIT(AB9540_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
2481 * 0x01, VextSupply12LP
2483 REG_INIT(AB9540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
2485 * 0x03, Vaux4RequestCtrl
2487 REG_INIT(AB9540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2491 REG_INIT(AB9540_VAUX4REGU, 0x04, 0x2e, 0x03),
2495 REG_INIT(AB9540_VAUX4SEL, 0x04, 0x2f, 0x0f),
2502 * 0x20, Vintcore12Disch
2506 REG_INIT(AB9540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
2510 * 0x04, VdmicPullDownEna
2511 * 0x08, VpllPullDownEna
2514 REG_INIT(AB9540_REGUCTRLDISCH2, 0x04, 0x44, 0x1f),
2518 REG_INIT(AB9540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2521 /* AB8540 register init */
2522 static struct ab8500_reg_init ab8540_reg_init[] = {
2524 * 0x01, VSimSycClkReq1Valid
2525 * 0x02, VSimSycClkReq2Valid
2526 * 0x04, VSimSycClkReq3Valid
2527 * 0x08, VSimSycClkReq4Valid
2528 * 0x10, VSimSycClkReq5Valid
2529 * 0x20, VSimSycClkReq6Valid
2530 * 0x40, VSimSycClkReq7Valid
2531 * 0x80, VSimSycClkReq8Valid
2533 REG_INIT(AB8540_VSIMSYSCLKCTRL, 0x02, 0x33, 0xff),
2535 * 0x03, VarmRequestCtrl
2536 * 0x0c, VapeRequestCtrl
2537 * 0x30, Vsmps1RequestCtrl
2538 * 0xc0, Vsmps2RequestCtrl
2540 REG_INIT(AB8540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2542 * 0x03, Vsmps3RequestCtrl
2543 * 0x0c, VpllRequestCtrl
2544 * 0x30, VanaRequestCtrl
2545 * 0xc0, VextSupply1RequestCtrl
2547 REG_INIT(AB8540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
2549 * 0x03, VextSupply2RequestCtrl
2550 * 0x0c, VextSupply3RequestCtrl
2551 * 0x30, Vaux1RequestCtrl
2552 * 0xc0, Vaux2RequestCtrl
2554 REG_INIT(AB8540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
2556 * 0x03, Vaux3RequestCtrl
2559 REG_INIT(AB8540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2561 * 0x01, Vsmps1SysClkReq1HPValid
2562 * 0x02, Vsmps2SysClkReq1HPValid
2563 * 0x04, Vsmps3SysClkReq1HPValid
2564 * 0x08, VanaSysClkReq1HPValid
2565 * 0x10, VpllSysClkReq1HPValid
2566 * 0x20, Vaux1SysClkReq1HPValid
2567 * 0x40, Vaux2SysClkReq1HPValid
2568 * 0x80, Vaux3SysClkReq1HPValid
2570 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2572 * 0x01, VapeSysClkReq1HPValid
2573 * 0x02, VarmSysClkReq1HPValid
2574 * 0x04, VbbSysClkReq1HPValid
2575 * 0x10, VextSupply1SysClkReq1HPValid
2576 * 0x20, VextSupply2SysClkReq1HPValid
2577 * 0x40, VextSupply3SysClkReq1HPValid
2579 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x77),
2581 * 0x01, Vsmps1HwHPReq1Valid
2582 * 0x02, Vsmps2HwHPReq1Valid
2583 * 0x04, Vsmps3HwHPReq1Valid
2584 * 0x08, VanaHwHPReq1Valid
2585 * 0x10, VpllHwHPReq1Valid
2586 * 0x20, Vaux1HwHPReq1Valid
2587 * 0x40, Vaux2HwHPReq1Valid
2588 * 0x80, Vaux3HwHPReq1Valid
2590 REG_INIT(AB8540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2592 * 0x01, VextSupply1HwHPReq1Valid
2593 * 0x02, VextSupply2HwHPReq1Valid
2594 * 0x04, VextSupply3HwHPReq1Valid
2596 REG_INIT(AB8540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
2598 * 0x01, Vsmps1HwHPReq2Valid
2599 * 0x02, Vsmps2HwHPReq2Valid
2600 * 0x03, Vsmps3HwHPReq2Valid
2601 * 0x08, VanaHwHPReq2Valid
2602 * 0x10, VpllHwHPReq2Valid
2603 * 0x20, Vaux1HwHPReq2Valid
2604 * 0x40, Vaux2HwHPReq2Valid
2605 * 0x80, Vaux3HwHPReq2Valid
2607 REG_INIT(AB8540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2609 * 0x01, VextSupply1HwHPReq2Valid
2610 * 0x02, VextSupply2HwHPReq2Valid
2611 * 0x04, VextSupply3HwHPReq2Valid
2613 REG_INIT(AB8540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
2615 * 0x01, VapeSwHPReqValid
2616 * 0x02, VarmSwHPReqValid
2617 * 0x04, Vsmps1SwHPReqValid
2618 * 0x08, Vsmps2SwHPReqValid
2619 * 0x10, Vsmps3SwHPReqValid
2620 * 0x20, VanaSwHPReqValid
2621 * 0x40, VpllSwHPReqValid
2622 * 0x80, Vaux1SwHPReqValid
2624 REG_INIT(AB8540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2626 * 0x01, Vaux2SwHPReqValid
2627 * 0x02, Vaux3SwHPReqValid
2628 * 0x04, VextSupply1SwHPReqValid
2629 * 0x08, VextSupply2SwHPReqValid
2630 * 0x10, VextSupply3SwHPReqValid
2632 REG_INIT(AB8540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
2634 * 0x02, SysClkReq2Valid1
2636 * 0x80, SysClkReq8Valid1
2638 REG_INIT(AB8540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xff),
2640 * 0x02, SysClkReq2Valid2
2642 * 0x80, SysClkReq8Valid2
2644 REG_INIT(AB8540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xff),
2646 * 0x01, Vaux4SwHPReqValid
2647 * 0x02, Vaux4HwHPReq2Valid
2648 * 0x04, Vaux4HwHPReq1Valid
2649 * 0x08, Vaux4SysClkReq1HPValid
2651 REG_INIT(AB8540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2653 * 0x01, Vaux5SwHPReqValid
2654 * 0x02, Vaux5HwHPReq2Valid
2655 * 0x04, Vaux5HwHPReq1Valid
2656 * 0x08, Vaux5SysClkReq1HPValid
2658 REG_INIT(AB8540_REGUVAUX5REQVALID, 0x03, 0x12, 0x0f),
2660 * 0x01, Vaux6SwHPReqValid
2661 * 0x02, Vaux6HwHPReq2Valid
2662 * 0x04, Vaux6HwHPReq1Valid
2663 * 0x08, Vaux6SysClkReq1HPValid
2665 REG_INIT(AB8540_REGUVAUX6REQVALID, 0x03, 0x13, 0x0f),
2667 * 0x01, VclkbSwHPReqValid
2668 * 0x02, VclkbHwHPReq2Valid
2669 * 0x04, VclkbHwHPReq1Valid
2670 * 0x08, VclkbSysClkReq1HPValid
2672 REG_INIT(AB8540_REGUVCLKBREQVALID, 0x03, 0x14, 0x0f),
2674 * 0x01, Vrf1SwHPReqValid
2675 * 0x02, Vrf1HwHPReq2Valid
2676 * 0x04, Vrf1HwHPReq1Valid
2677 * 0x08, Vrf1SysClkReq1HPValid
2679 REG_INIT(AB8540_REGUVRF1REQVALID, 0x03, 0x15, 0x0f),
2682 * 0x04, Vintcore12Ena
2683 * 0x38, Vintcore12Sel
2684 * 0x40, Vintcore12LP
2687 REG_INIT(AB8540_REGUMISC1, 0x03, 0x80, 0xfe),
2696 REG_INIT(AB8540_VAUDIOSUPPLY, 0x03, 0x83, 0xfe),
2698 * 0x01, Vamic1_dzout
2699 * 0x02, Vamic2_dzout
2701 REG_INIT(AB8540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2704 * 0x08, VHSICOffState
2708 REG_INIT(AB8540_VHSIC, 0x03, 0x87, 0x3f),
2711 * 0x08, VSDIOOffState
2715 REG_INIT(AB8540_VSDIO, 0x03, 0x88, 0x3f),
2718 * 0x0c, Vsmps1SelCtrl
2719 * 0x10, Vsmps1AutoMode
2720 * 0x20, Vsmps1PWMMode
2722 REG_INIT(AB8540_VSMPS1REGU, 0x04, 0x03, 0x3f),
2725 * 0x0c, Vsmps2SelCtrl
2726 * 0x10, Vsmps2AutoMode
2727 * 0x20, Vsmps2PWMMode
2729 REG_INIT(AB8540_VSMPS2REGU, 0x04, 0x04, 0x3f),
2732 * 0x0c, Vsmps3SelCtrl
2733 * 0x10, Vsmps3AutoMode
2734 * 0x20, Vsmps3PWMMode
2735 * NOTE! PRCMU register
2737 REG_INIT(AB8540_VSMPS3REGU, 0x04, 0x05, 0x0f),
2742 REG_INIT(AB8540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2744 * 0x03, VextSupply1Regu
2745 * 0x0c, VextSupply2Regu
2746 * 0x30, VextSupply3Regu
2747 * 0x40, ExtSupply2Bypass
2748 * 0x80, ExtSupply3Bypass
2750 REG_INIT(AB8540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2755 REG_INIT(AB8540_VAUX12REGU, 0x04, 0x09, 0x0f),
2760 REG_INIT(AB8540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2764 REG_INIT(AB8540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
2768 REG_INIT(AB8540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
2772 REG_INIT(AB8540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
2776 REG_INIT(AB8540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
2780 REG_INIT(AB8540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
2784 REG_INIT(AB8540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
2787 * NOTE! PRCMU register
2789 REG_INIT(AB8540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
2792 * NOTE! PRCMU register
2794 REG_INIT(AB8540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
2798 REG_INIT(AB8540_VAUX1SEL, 0x04, 0x1f, 0x0f),
2802 REG_INIT(AB8540_VAUX2SEL, 0x04, 0x20, 0x0f),
2807 REG_INIT(AB8540_VRF1VAUX3SEL, 0x04, 0x21, 0x77),
2809 * 0x01, VextSupply12LP
2811 REG_INIT(AB8540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
2816 REG_INIT(AB8540_VANAVPLLSEL, 0x04, 0x29, 0x37),
2818 * 0x03, Vaux4RequestCtrl
2820 REG_INIT(AB8540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2824 REG_INIT(AB8540_VAUX4REGU, 0x04, 0x2e, 0x03),
2828 REG_INIT(AB8540_VAUX4SEL, 0x04, 0x2f, 0x0f),
2830 * 0x03, Vaux5RequestCtrl
2832 REG_INIT(AB8540_VAUX5REQCTRL, 0x04, 0x31, 0x03),
2836 REG_INIT(AB8540_VAUX5REGU, 0x04, 0x32, 0x03),
2840 REG_INIT(AB8540_VAUX5SEL, 0x04, 0x33, 0x3f),
2842 * 0x03, Vaux6RequestCtrl
2844 REG_INIT(AB8540_VAUX6REQCTRL, 0x04, 0x34, 0x03),
2848 REG_INIT(AB8540_VAUX6REGU, 0x04, 0x35, 0x03),
2852 REG_INIT(AB8540_VAUX6SEL, 0x04, 0x36, 0x3f),
2854 * 0x03, VCLKBRequestCtrl
2856 REG_INIT(AB8540_VCLKBREQCTRL, 0x04, 0x37, 0x03),
2860 REG_INIT(AB8540_VCLKBREGU, 0x04, 0x38, 0x03),
2864 REG_INIT(AB8540_VCLKBSEL, 0x04, 0x39, 0x07),
2866 * 0x03, Vrf1RequestCtrl
2868 REG_INIT(AB8540_VRF1REQCTRL, 0x04, 0x3a, 0x03),
2875 * 0x20, Vintcore12Disch
2879 REG_INIT(AB8540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
2882 * 0x04, VdmicPullDownEna
2883 * 0x08, VpllPullDownEna
2886 REG_INIT(AB8540_REGUCTRLDISCH2, 0x04, 0x44, 0x1e),
2890 REG_INIT(AB8540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2896 REG_INIT(AB8540_REGUCTRLDISCH4, 0x04, 0x49, 0x07),
2899 static struct of_regulator_match ab8500_regulator_match[] = {
2900 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, },
2901 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, },
2902 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, },
2903 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, },
2904 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, },
2905 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, },
2906 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, },
2907 { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, },
2908 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, },
2909 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
2912 static struct of_regulator_match ab8505_regulator_match[] = {
2913 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, },
2914 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, },
2915 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, },
2916 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, },
2917 { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, },
2918 { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, },
2919 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, },
2920 { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, },
2921 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, },
2922 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, },
2923 { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, },
2924 { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, },
2925 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, },
2928 static struct of_regulator_match ab8540_regulator_match[] = {
2929 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, },
2930 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, },
2931 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, },
2932 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, },
2933 { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8540_LDO_AUX5, },
2934 { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8540_LDO_AUX6, },
2935 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, },
2936 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, },
2937 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, },
2938 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, },
2939 { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, },
2940 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, },
2941 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, },
2942 { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, },
2945 static struct of_regulator_match ab9540_regulator_match[] = {
2946 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, },
2947 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, },
2948 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, },
2949 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB9540_LDO_AUX4, },
2950 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, },
2951 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, },
2952 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, },
2953 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, },
2954 { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, },
2955 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, },
2956 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, },
2960 struct ab8500_regulator_info *info;
2962 struct ab8500_reg_init *init;
2964 struct of_regulator_match *match;
2968 static void abx500_get_regulator_info(struct ab8500 *ab8500)
2970 if (is_ab9540(ab8500)) {
2971 abx500_regulator.info = ab9540_regulator_info;
2972 abx500_regulator.info_size = ARRAY_SIZE(ab9540_regulator_info);
2973 abx500_regulator.init = ab9540_reg_init;
2974 abx500_regulator.init_size = AB9540_NUM_REGULATOR_REGISTERS;
2975 abx500_regulator.match = ab9540_regulator_match;
2976 abx500_regulator.match_size = ARRAY_SIZE(ab9540_regulator_match);
2977 } else if (is_ab8505(ab8500)) {
2978 abx500_regulator.info = ab8505_regulator_info;
2979 abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info);
2980 abx500_regulator.init = ab8505_reg_init;
2981 abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS;
2982 abx500_regulator.match = ab8505_regulator_match;
2983 abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match);
2984 } else if (is_ab8540(ab8500)) {
2985 abx500_regulator.info = ab8540_regulator_info;
2986 abx500_regulator.info_size = ARRAY_SIZE(ab8540_regulator_info);
2987 abx500_regulator.init = ab8540_reg_init;
2988 abx500_regulator.init_size = AB8540_NUM_REGULATOR_REGISTERS;
2989 abx500_regulator.match = ab8540_regulator_match;
2990 abx500_regulator.match_size = ARRAY_SIZE(ab8540_regulator_match);
2992 abx500_regulator.info = ab8500_regulator_info;
2993 abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info);
2994 abx500_regulator.init = ab8500_reg_init;
2995 abx500_regulator.init_size = AB8500_NUM_REGULATOR_REGISTERS;
2996 abx500_regulator.match = ab8500_regulator_match;
2997 abx500_regulator.match_size = ARRAY_SIZE(ab8500_regulator_match);
3001 static int ab8500_regulator_register(struct platform_device *pdev,
3002 struct regulator_init_data *init_data,
3003 int id, struct device_node *np)
3005 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3006 struct ab8500_regulator_info *info = NULL;
3007 struct regulator_config config = { };
3009 /* assign per-regulator data */
3010 info = &abx500_regulator.info[id];
3011 info->dev = &pdev->dev;
3013 config.dev = &pdev->dev;
3014 config.init_data = init_data;
3015 config.driver_data = info;
3016 config.of_node = np;
3018 /* fix for hardware before ab8500v2.0 */
3019 if (is_ab8500_1p1_or_earlier(ab8500)) {
3020 if (info->desc.id == AB8500_LDO_AUX3) {
3021 info->desc.n_voltages =
3022 ARRAY_SIZE(ldo_vauxn_voltages);
3023 info->desc.volt_table = ldo_vauxn_voltages;
3024 info->voltage_mask = 0xf;
3028 /* register regulator with framework */
3029 info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
3031 if (IS_ERR(info->regulator)) {
3032 dev_err(&pdev->dev, "failed to register regulator %s\n",
3034 return PTR_ERR(info->regulator);
3041 ab8500_regulator_of_probe(struct platform_device *pdev,
3042 struct device_node *np)
3044 struct of_regulator_match *match = abx500_regulator.match;
3047 for (i = 0; i < abx500_regulator.info_size; i++) {
3048 err = ab8500_regulator_register(
3049 pdev, match[i].init_data, i, match[i].of_node);
3057 static int ab8500_regulator_probe(struct platform_device *pdev)
3059 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3060 struct device_node *np = pdev->dev.of_node;
3064 dev_err(&pdev->dev, "null mfd parent\n");
3068 abx500_get_regulator_info(ab8500);
3070 err = of_regulator_match(&pdev->dev, np,
3071 abx500_regulator.match,
3072 abx500_regulator.match_size);
3075 "Error parsing regulator init data: %d\n", err);
3078 return ab8500_regulator_of_probe(pdev, np);
3081 static int ab8500_regulator_remove(struct platform_device *pdev)
3085 /* remove regulator debug */
3086 err = ab8500_regulator_debug_exit(pdev);
3093 static struct platform_driver ab8500_regulator_driver = {
3094 .probe = ab8500_regulator_probe,
3095 .remove = ab8500_regulator_remove,
3097 .name = "ab8500-regulator",
3098 .owner = THIS_MODULE,
3102 static int __init ab8500_regulator_init(void)
3106 ret = platform_driver_register(&ab8500_regulator_driver);
3108 pr_err("Failed to register ab8500 regulator: %d\n", ret);
3112 subsys_initcall(ab8500_regulator_init);
3114 static void __exit ab8500_regulator_exit(void)
3116 platform_driver_unregister(&ab8500_regulator_driver);
3118 module_exit(ab8500_regulator_exit);
3120 MODULE_LICENSE("GPL v2");
3121 MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
3122 MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
3123 MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>");
3124 MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
3125 MODULE_ALIAS("platform:ab8500-regulator");