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 * @is_enabled: status of regulator (on/off)
50 * @load_lp_uA: maximum load in idle (low power) mode
51 * @update_bank: bank to control on/off
52 * @update_reg: register to control on/off
53 * @update_mask: mask to enable/disable and set mode of regulator
54 * @update_val: bits holding the regulator current mode
55 * @update_val_idle: bits to enable the regulator in idle (low power) mode
56 * @update_val_normal: bits to enable the regulator in normal (high power) mode
57 * @mode_bank: bank with location of mode register
58 * @mode_reg: mode register
59 * @mode_mask: mask for setting mode
60 * @mode_val_idle: mode setting for low power
61 * @mode_val_normal: mode setting for normal power
62 * @voltage_bank: bank to control regulator voltage
63 * @voltage_reg: register to control regulator voltage
64 * @voltage_mask: mask to control regulator voltage
65 * @voltage_shift: shift to control regulator voltage
67 struct ab8500_regulator_info {
69 struct regulator_desc desc;
70 struct regulator_dev *regulator;
71 struct ab8500_shared_mode *shared_mode;
98 /* voltage tables for the vauxn/vintcore supplies */
99 static const unsigned int ldo_vauxn_voltages[] = {
118 static const unsigned int ldo_vaux3_voltages[] = {
129 static const unsigned int ldo_vaux56_voltages[] = {
140 static const unsigned int ldo_vaux3_ab8540_voltages[] = {
152 static const unsigned int ldo_vaux56_ab8540_voltages[] = {
153 750000, 760000, 770000, 780000, 790000, 800000,
154 810000, 820000, 830000, 840000, 850000, 860000,
155 870000, 880000, 890000, 900000, 910000, 920000,
156 930000, 940000, 950000, 960000, 970000, 980000,
157 990000, 1000000, 1010000, 1020000, 1030000,
158 1040000, 1050000, 1060000, 1070000, 1080000,
159 1090000, 1100000, 1110000, 1120000, 1130000,
160 1140000, 1150000, 1160000, 1170000, 1180000,
161 1190000, 1200000, 1210000, 1220000, 1230000,
162 1240000, 1250000, 1260000, 1270000, 1280000,
163 1290000, 1300000, 1310000, 1320000, 1330000,
164 1340000, 1350000, 1360000, 1800000, 2790000,
167 static const unsigned int ldo_vintcore_voltages[] = {
177 static const unsigned int ldo_sdio_voltages[] = {
188 static const unsigned int fixed_1200000_voltage[] = {
192 static const unsigned int fixed_1800000_voltage[] = {
196 static const unsigned int fixed_2000000_voltage[] = {
200 static const unsigned int fixed_2050000_voltage[] = {
204 static const unsigned int fixed_3300000_voltage[] = {
208 static const unsigned int ldo_vana_voltages[] = {
219 static const unsigned int ldo_vaudio_voltages[] = {
227 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */
230 static const unsigned int ldo_vdmic_voltages[] = {
237 static DEFINE_MUTEX(shared_mode_mutex);
238 static struct ab8500_shared_mode ldo_anamic1_shared;
239 static struct ab8500_shared_mode ldo_anamic2_shared;
240 static struct ab8500_shared_mode ab8540_ldo_anamic1_shared;
241 static struct ab8500_shared_mode ab8540_ldo_anamic2_shared;
243 static int ab8500_regulator_enable(struct regulator_dev *rdev)
246 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
249 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
253 ret = abx500_mask_and_set_register_interruptible(info->dev,
254 info->update_bank, info->update_reg,
255 info->update_mask, info->update_val);
257 dev_err(rdev_get_dev(rdev),
258 "couldn't set enable bits for regulator\n");
262 info->is_enabled = true;
264 dev_vdbg(rdev_get_dev(rdev),
265 "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
266 info->desc.name, info->update_bank, info->update_reg,
267 info->update_mask, info->update_val);
272 static int ab8500_regulator_disable(struct regulator_dev *rdev)
275 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
278 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
282 ret = abx500_mask_and_set_register_interruptible(info->dev,
283 info->update_bank, info->update_reg,
284 info->update_mask, 0x0);
286 dev_err(rdev_get_dev(rdev),
287 "couldn't set disable bits for regulator\n");
291 info->is_enabled = false;
293 dev_vdbg(rdev_get_dev(rdev),
294 "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
295 info->desc.name, info->update_bank, info->update_reg,
296 info->update_mask, 0x0);
301 static unsigned int ab8500_regulator_get_optimum_mode(
302 struct regulator_dev *rdev, int input_uV,
303 int output_uV, int load_uA)
307 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
310 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
314 if (load_uA <= info->load_lp_uA)
315 mode = REGULATOR_MODE_IDLE;
317 mode = REGULATOR_MODE_NORMAL;
322 static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
330 bool dmr = false; /* Dedicated mode register */
331 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
334 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
338 if (info->shared_mode) {
340 * Special case where mode is shared between two regulators.
342 struct ab8500_shared_mode *sm = info->shared_mode;
343 mutex_lock(&shared_mode_mutex);
345 if (mode == REGULATOR_MODE_IDLE) {
346 sm->lp_mode_req = true; /* Low power mode requested */
347 if (!((sm->shared_regulator)->
348 shared_mode->lp_mode_req)) {
349 mutex_unlock(&shared_mode_mutex);
350 return 0; /* Other regulator prevent LP mode */
353 sm->lp_mode_req = false;
357 if (info->mode_mask) {
358 /* Dedicated register for handling mode */
363 case REGULATOR_MODE_NORMAL:
364 val = info->mode_val_normal;
366 case REGULATOR_MODE_IDLE:
367 val = info->mode_val_idle;
370 if (info->shared_mode)
371 mutex_unlock(&shared_mode_mutex);
375 bank = info->mode_bank;
376 reg = info->mode_reg;
377 mask = info->mode_mask;
379 /* Mode register same as enable register */
382 case REGULATOR_MODE_NORMAL:
383 info->update_val = info->update_val_normal;
384 val = info->update_val_normal;
386 case REGULATOR_MODE_IDLE:
387 info->update_val = info->update_val_idle;
388 val = info->update_val_idle;
391 if (info->shared_mode)
392 mutex_unlock(&shared_mode_mutex);
396 bank = info->update_bank;
397 reg = info->update_reg;
398 mask = info->update_mask;
401 if (info->is_enabled || dmr) {
402 ret = abx500_mask_and_set_register_interruptible(info->dev,
403 bank, reg, mask, val);
405 dev_err(rdev_get_dev(rdev),
406 "couldn't set regulator mode\n");
408 dev_vdbg(rdev_get_dev(rdev),
409 "%s-set_mode (bank, reg, mask, value): "
410 "0x%x, 0x%x, 0x%x, 0x%x\n",
411 info->desc.name, bank, reg,
415 if (info->shared_mode)
416 mutex_unlock(&shared_mode_mutex);
421 static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
423 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
430 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
434 /* Need special handling for shared mode */
435 if (info->shared_mode) {
436 if (info->shared_mode->lp_mode_req)
437 return REGULATOR_MODE_IDLE;
439 return REGULATOR_MODE_NORMAL;
442 if (info->mode_mask) {
443 /* Dedicated register for handling mode */
444 ret = abx500_get_register_interruptible(info->dev,
445 info->mode_bank, info->mode_reg, &val);
446 val = val & info->mode_mask;
448 val_normal = info->mode_val_normal;
449 val_idle = info->mode_val_idle;
451 /* Mode register same as enable register */
452 val = info->update_val;
453 val_normal = info->update_val_normal;
454 val_idle = info->update_val_idle;
457 if (val == val_normal)
458 ret = REGULATOR_MODE_NORMAL;
459 else if (val == val_idle)
460 ret = REGULATOR_MODE_IDLE;
467 static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
470 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
474 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
478 ret = abx500_get_register_interruptible(info->dev,
479 info->update_bank, info->update_reg, ®val);
481 dev_err(rdev_get_dev(rdev),
482 "couldn't read 0x%x register\n", info->update_reg);
486 dev_vdbg(rdev_get_dev(rdev),
487 "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
489 info->desc.name, info->update_bank, info->update_reg,
490 info->update_mask, regval);
492 if (regval & info->update_mask)
493 info->is_enabled = true;
495 info->is_enabled = false;
497 return info->is_enabled;
500 static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
503 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
507 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
511 ret = abx500_get_register_interruptible(info->dev,
512 info->voltage_bank, info->voltage_reg, ®val);
514 dev_err(rdev_get_dev(rdev),
515 "couldn't read voltage reg for regulator\n");
519 dev_vdbg(rdev_get_dev(rdev),
520 "%s-get_voltage (bank, reg, mask, shift, value): "
521 "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
522 info->desc.name, info->voltage_bank,
523 info->voltage_reg, info->voltage_mask,
524 info->voltage_shift, regval);
526 val = regval & info->voltage_mask;
527 return val >> info->voltage_shift;
530 static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
533 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
534 u8 regval, regval_expand;
537 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
541 ret = abx500_get_register_interruptible(info->dev,
542 info->voltage_bank, info->voltage_reg, ®val);
545 dev_err(rdev_get_dev(rdev),
546 "couldn't read voltage reg for regulator\n");
550 ret = abx500_get_register_interruptible(info->dev,
551 info->expand_register.voltage_bank,
552 info->expand_register.voltage_reg, ®val_expand);
555 dev_err(rdev_get_dev(rdev),
556 "couldn't read voltage reg for regulator\n");
560 dev_vdbg(rdev_get_dev(rdev),
561 "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
563 info->desc.name, info->voltage_bank, info->voltage_reg,
564 info->voltage_mask, regval);
565 dev_vdbg(rdev_get_dev(rdev),
566 "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
568 info->desc.name, info->expand_register.voltage_bank,
569 info->expand_register.voltage_reg,
570 info->expand_register.voltage_mask, regval_expand);
572 if (regval_expand&(info->expand_register.voltage_mask))
573 /* Vaux3 has a different layout */
574 val = info->expand_register.voltage_limit;
576 val = (regval & info->voltage_mask) >> info->voltage_shift;
581 static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,
585 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
589 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
593 /* set the registers for the request */
594 regval = (u8)selector << info->voltage_shift;
595 ret = abx500_mask_and_set_register_interruptible(info->dev,
596 info->voltage_bank, info->voltage_reg,
597 info->voltage_mask, regval);
599 dev_err(rdev_get_dev(rdev),
600 "couldn't set voltage reg for regulator\n");
602 dev_vdbg(rdev_get_dev(rdev),
603 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
605 info->desc.name, info->voltage_bank, info->voltage_reg,
606 info->voltage_mask, regval);
611 static int ab8540_aux3_regulator_set_voltage_sel(struct regulator_dev *rdev,
615 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
619 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
623 if (selector >= info->expand_register.voltage_limit) {
624 /* Vaux3 bit4 has different layout */
625 regval = (u8)selector << info->expand_register.voltage_shift;
626 ret = abx500_mask_and_set_register_interruptible(info->dev,
627 info->expand_register.voltage_bank,
628 info->expand_register.voltage_reg,
629 info->expand_register.voltage_mask,
632 /* set the registers for the request */
633 regval = (u8)selector << info->voltage_shift;
634 ret = abx500_mask_and_set_register_interruptible(info->dev,
635 info->voltage_bank, info->voltage_reg,
636 info->voltage_mask, regval);
639 dev_err(rdev_get_dev(rdev),
640 "couldn't set voltage reg for regulator\n");
642 dev_vdbg(rdev_get_dev(rdev),
643 "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
645 info->desc.name, info->voltage_bank, info->voltage_reg,
646 info->voltage_mask, regval);
651 static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
652 unsigned int old_sel,
653 unsigned int new_sel)
655 struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
657 return info->desc.enable_time;
660 static struct regulator_ops ab8500_regulator_volt_mode_ops = {
661 .enable = ab8500_regulator_enable,
662 .disable = ab8500_regulator_disable,
663 .is_enabled = ab8500_regulator_is_enabled,
664 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
665 .set_mode = ab8500_regulator_set_mode,
666 .get_mode = ab8500_regulator_get_mode,
667 .get_voltage_sel = ab8500_regulator_get_voltage_sel,
668 .set_voltage_sel = ab8500_regulator_set_voltage_sel,
669 .list_voltage = regulator_list_voltage_table,
672 static struct regulator_ops ab8540_aux3_regulator_volt_mode_ops = {
673 .enable = ab8500_regulator_enable,
674 .disable = ab8500_regulator_disable,
675 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
676 .set_mode = ab8500_regulator_set_mode,
677 .get_mode = ab8500_regulator_get_mode,
678 .is_enabled = ab8500_regulator_is_enabled,
679 .get_voltage_sel = ab8540_aux3_regulator_get_voltage_sel,
680 .set_voltage_sel = ab8540_aux3_regulator_set_voltage_sel,
681 .list_voltage = regulator_list_voltage_table,
682 .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
685 static struct regulator_ops ab8500_regulator_volt_ops = {
686 .enable = ab8500_regulator_enable,
687 .disable = ab8500_regulator_disable,
688 .is_enabled = ab8500_regulator_is_enabled,
689 .get_voltage_sel = ab8500_regulator_get_voltage_sel,
690 .set_voltage_sel = ab8500_regulator_set_voltage_sel,
691 .list_voltage = regulator_list_voltage_table,
692 .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
695 static struct regulator_ops ab8500_regulator_mode_ops = {
696 .enable = ab8500_regulator_enable,
697 .disable = ab8500_regulator_disable,
698 .is_enabled = ab8500_regulator_is_enabled,
699 .get_optimum_mode = ab8500_regulator_get_optimum_mode,
700 .set_mode = ab8500_regulator_set_mode,
701 .get_mode = ab8500_regulator_get_mode,
702 .list_voltage = regulator_list_voltage_table,
705 static struct regulator_ops ab8500_regulator_ops = {
706 .enable = ab8500_regulator_enable,
707 .disable = ab8500_regulator_disable,
708 .is_enabled = ab8500_regulator_is_enabled,
709 .list_voltage = regulator_list_voltage_table,
712 static struct regulator_ops ab8500_regulator_anamic_mode_ops = {
713 .enable = ab8500_regulator_enable,
714 .disable = ab8500_regulator_disable,
715 .is_enabled = ab8500_regulator_is_enabled,
716 .set_mode = ab8500_regulator_set_mode,
717 .get_mode = ab8500_regulator_get_mode,
718 .list_voltage = regulator_list_voltage_table,
721 /* AB8500 regulator information */
722 static struct ab8500_regulator_info
723 ab8500_regulator_info[AB8500_NUM_REGULATORS] = {
725 * Variable Voltage Regulators
726 * name, min mV, max mV,
727 * update bank, reg, mask, enable val
728 * volt bank, reg, mask
730 [AB8500_LDO_AUX1] = {
733 .ops = &ab8500_regulator_volt_mode_ops,
734 .type = REGULATOR_VOLTAGE,
735 .id = AB8500_LDO_AUX1,
736 .owner = THIS_MODULE,
737 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
738 .volt_table = ldo_vauxn_voltages,
746 .update_val_idle = 0x03,
747 .update_val_normal = 0x01,
748 .voltage_bank = 0x04,
750 .voltage_mask = 0x0f,
752 [AB8500_LDO_AUX2] = {
755 .ops = &ab8500_regulator_volt_mode_ops,
756 .type = REGULATOR_VOLTAGE,
757 .id = AB8500_LDO_AUX2,
758 .owner = THIS_MODULE,
759 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
760 .volt_table = ldo_vauxn_voltages,
768 .update_val_idle = 0x0c,
769 .update_val_normal = 0x04,
770 .voltage_bank = 0x04,
772 .voltage_mask = 0x0f,
774 [AB8500_LDO_AUX3] = {
777 .ops = &ab8500_regulator_volt_mode_ops,
778 .type = REGULATOR_VOLTAGE,
779 .id = AB8500_LDO_AUX3,
780 .owner = THIS_MODULE,
781 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
782 .volt_table = ldo_vaux3_voltages,
790 .update_val_idle = 0x03,
791 .update_val_normal = 0x01,
792 .voltage_bank = 0x04,
794 .voltage_mask = 0x07,
796 [AB8500_LDO_INTCORE] = {
798 .name = "LDO-INTCORE",
799 .ops = &ab8500_regulator_volt_mode_ops,
800 .type = REGULATOR_VOLTAGE,
801 .id = AB8500_LDO_INTCORE,
802 .owner = THIS_MODULE,
803 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
804 .volt_table = ldo_vintcore_voltages,
812 .update_val_idle = 0x44,
813 .update_val_normal = 0x04,
814 .voltage_bank = 0x03,
816 .voltage_mask = 0x38,
821 * Fixed Voltage Regulators
823 * update bank, reg, mask, enable val
825 [AB8500_LDO_TVOUT] = {
828 .ops = &ab8500_regulator_mode_ops,
829 .type = REGULATOR_VOLTAGE,
830 .id = AB8500_LDO_TVOUT,
831 .owner = THIS_MODULE,
833 .volt_table = fixed_2000000_voltage,
841 .update_val_idle = 0x82,
842 .update_val_normal = 0x02,
844 [AB8500_LDO_AUDIO] = {
847 .ops = &ab8500_regulator_ops,
848 .type = REGULATOR_VOLTAGE,
849 .id = AB8500_LDO_AUDIO,
850 .owner = THIS_MODULE,
853 .volt_table = fixed_2000000_voltage,
860 [AB8500_LDO_ANAMIC1] = {
862 .name = "LDO-ANAMIC1",
863 .ops = &ab8500_regulator_ops,
864 .type = REGULATOR_VOLTAGE,
865 .id = AB8500_LDO_ANAMIC1,
866 .owner = THIS_MODULE,
869 .volt_table = fixed_2050000_voltage,
876 [AB8500_LDO_ANAMIC2] = {
878 .name = "LDO-ANAMIC2",
879 .ops = &ab8500_regulator_ops,
880 .type = REGULATOR_VOLTAGE,
881 .id = AB8500_LDO_ANAMIC2,
882 .owner = THIS_MODULE,
885 .volt_table = fixed_2050000_voltage,
892 [AB8500_LDO_DMIC] = {
895 .ops = &ab8500_regulator_ops,
896 .type = REGULATOR_VOLTAGE,
897 .id = AB8500_LDO_DMIC,
898 .owner = THIS_MODULE,
901 .volt_table = fixed_1800000_voltage,
910 * Regulators with fixed voltage and normal/idle modes
915 .ops = &ab8500_regulator_mode_ops,
916 .type = REGULATOR_VOLTAGE,
917 .id = AB8500_LDO_ANA,
918 .owner = THIS_MODULE,
921 .volt_table = fixed_1200000_voltage,
928 .update_val_idle = 0x0c,
929 .update_val_normal = 0x04,
933 /* AB8505 regulator information */
934 static struct ab8500_regulator_info
935 ab8505_regulator_info[AB8505_NUM_REGULATORS] = {
937 * Variable Voltage Regulators
938 * name, min mV, max mV,
939 * update bank, reg, mask, enable val
940 * volt bank, reg, mask
942 [AB8505_LDO_AUX1] = {
945 .ops = &ab8500_regulator_volt_mode_ops,
946 .type = REGULATOR_VOLTAGE,
947 .id = AB8505_LDO_AUX1,
948 .owner = THIS_MODULE,
949 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
950 .volt_table = ldo_vauxn_voltages,
957 .update_val_idle = 0x03,
958 .update_val_normal = 0x01,
959 .voltage_bank = 0x04,
961 .voltage_mask = 0x0f,
963 [AB8505_LDO_AUX2] = {
966 .ops = &ab8500_regulator_volt_mode_ops,
967 .type = REGULATOR_VOLTAGE,
968 .id = AB8505_LDO_AUX2,
969 .owner = THIS_MODULE,
970 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
971 .volt_table = ldo_vauxn_voltages,
978 .update_val_idle = 0x0c,
979 .update_val_normal = 0x04,
980 .voltage_bank = 0x04,
982 .voltage_mask = 0x0f,
984 [AB8505_LDO_AUX3] = {
987 .ops = &ab8500_regulator_volt_mode_ops,
988 .type = REGULATOR_VOLTAGE,
989 .id = AB8505_LDO_AUX3,
990 .owner = THIS_MODULE,
991 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
992 .volt_table = ldo_vaux3_voltages,
999 .update_val_idle = 0x03,
1000 .update_val_normal = 0x01,
1001 .voltage_bank = 0x04,
1002 .voltage_reg = 0x21,
1003 .voltage_mask = 0x07,
1005 [AB8505_LDO_AUX4] = {
1008 .ops = &ab8500_regulator_volt_mode_ops,
1009 .type = REGULATOR_VOLTAGE,
1010 .id = AB8505_LDO_AUX4,
1011 .owner = THIS_MODULE,
1012 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1013 .volt_table = ldo_vauxn_voltages,
1016 /* values for Vaux4Regu register */
1017 .update_bank = 0x04,
1019 .update_mask = 0x03,
1021 .update_val_idle = 0x03,
1022 .update_val_normal = 0x01,
1023 /* values for Vaux4SEL register */
1024 .voltage_bank = 0x04,
1025 .voltage_reg = 0x2f,
1026 .voltage_mask = 0x0f,
1028 [AB8505_LDO_AUX5] = {
1031 .ops = &ab8500_regulator_volt_mode_ops,
1032 .type = REGULATOR_VOLTAGE,
1033 .id = AB8505_LDO_AUX5,
1034 .owner = THIS_MODULE,
1035 .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
1036 .volt_table = ldo_vaux56_voltages,
1039 /* values for CtrlVaux5 register */
1040 .update_bank = 0x01,
1042 .update_mask = 0x18,
1044 .update_val_idle = 0x18,
1045 .update_val_normal = 0x10,
1046 .voltage_bank = 0x01,
1047 .voltage_reg = 0x55,
1048 .voltage_mask = 0x07,
1050 [AB8505_LDO_AUX6] = {
1053 .ops = &ab8500_regulator_volt_mode_ops,
1054 .type = REGULATOR_VOLTAGE,
1055 .id = AB8505_LDO_AUX6,
1056 .owner = THIS_MODULE,
1057 .n_voltages = ARRAY_SIZE(ldo_vaux56_voltages),
1058 .volt_table = ldo_vaux56_voltages,
1061 /* values for CtrlVaux6 register */
1062 .update_bank = 0x01,
1064 .update_mask = 0x18,
1066 .update_val_idle = 0x18,
1067 .update_val_normal = 0x10,
1068 .voltage_bank = 0x01,
1069 .voltage_reg = 0x56,
1070 .voltage_mask = 0x07,
1072 [AB8505_LDO_INTCORE] = {
1074 .name = "LDO-INTCORE",
1075 .ops = &ab8500_regulator_volt_mode_ops,
1076 .type = REGULATOR_VOLTAGE,
1077 .id = AB8505_LDO_INTCORE,
1078 .owner = THIS_MODULE,
1079 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1080 .volt_table = ldo_vintcore_voltages,
1083 .update_bank = 0x03,
1085 .update_mask = 0x44,
1087 .update_val_idle = 0x44,
1088 .update_val_normal = 0x04,
1089 .voltage_bank = 0x03,
1090 .voltage_reg = 0x80,
1091 .voltage_mask = 0x38,
1096 * Fixed Voltage Regulators
1098 * update bank, reg, mask, enable val
1100 [AB8505_LDO_ADC] = {
1103 .ops = &ab8500_regulator_mode_ops,
1104 .type = REGULATOR_VOLTAGE,
1105 .id = AB8505_LDO_ADC,
1106 .owner = THIS_MODULE,
1108 .volt_table = fixed_2000000_voltage,
1109 .enable_time = 10000,
1112 .update_bank = 0x03,
1114 .update_mask = 0x82,
1116 .update_val_idle = 0x82,
1117 .update_val_normal = 0x02,
1119 [AB8505_LDO_USB] = {
1122 .ops = &ab8500_regulator_mode_ops,
1123 .type = REGULATOR_VOLTAGE,
1124 .id = AB8505_LDO_USB,
1125 .owner = THIS_MODULE,
1127 .volt_table = fixed_3300000_voltage,
1129 .update_bank = 0x03,
1131 .update_mask = 0x03,
1133 .update_val_idle = 0x03,
1134 .update_val_normal = 0x01,
1136 [AB8505_LDO_AUDIO] = {
1138 .name = "LDO-AUDIO",
1139 .ops = &ab8500_regulator_volt_ops,
1140 .type = REGULATOR_VOLTAGE,
1141 .id = AB8505_LDO_AUDIO,
1142 .owner = THIS_MODULE,
1143 .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages),
1144 .volt_table = ldo_vaudio_voltages,
1146 .update_bank = 0x03,
1148 .update_mask = 0x02,
1150 .voltage_bank = 0x01,
1151 .voltage_reg = 0x57,
1152 .voltage_mask = 0x7,
1155 [AB8505_LDO_ANAMIC1] = {
1157 .name = "LDO-ANAMIC1",
1158 .ops = &ab8500_regulator_anamic_mode_ops,
1159 .type = REGULATOR_VOLTAGE,
1160 .id = AB8505_LDO_ANAMIC1,
1161 .owner = THIS_MODULE,
1163 .volt_table = fixed_2050000_voltage,
1165 .shared_mode = &ldo_anamic1_shared,
1166 .update_bank = 0x03,
1168 .update_mask = 0x08,
1173 .mode_val_idle = 0x04,
1174 .mode_val_normal = 0x00,
1176 [AB8505_LDO_ANAMIC2] = {
1178 .name = "LDO-ANAMIC2",
1179 .ops = &ab8500_regulator_anamic_mode_ops,
1180 .type = REGULATOR_VOLTAGE,
1181 .id = AB8505_LDO_ANAMIC2,
1182 .owner = THIS_MODULE,
1184 .volt_table = fixed_2050000_voltage,
1186 .shared_mode = &ldo_anamic2_shared,
1187 .update_bank = 0x03,
1189 .update_mask = 0x10,
1194 .mode_val_idle = 0x04,
1195 .mode_val_normal = 0x00,
1197 [AB8505_LDO_AUX8] = {
1200 .ops = &ab8500_regulator_ops,
1201 .type = REGULATOR_VOLTAGE,
1202 .id = AB8505_LDO_AUX8,
1203 .owner = THIS_MODULE,
1205 .volt_table = fixed_1800000_voltage,
1207 .update_bank = 0x03,
1209 .update_mask = 0x04,
1213 * Regulators with fixed voltage and normal/idle modes
1215 [AB8505_LDO_ANA] = {
1218 .ops = &ab8500_regulator_volt_mode_ops,
1219 .type = REGULATOR_VOLTAGE,
1220 .id = AB8505_LDO_ANA,
1221 .owner = THIS_MODULE,
1222 .n_voltages = ARRAY_SIZE(ldo_vana_voltages),
1223 .volt_table = ldo_vana_voltages,
1226 .update_bank = 0x04,
1228 .update_mask = 0x0c,
1230 .update_val_idle = 0x0c,
1231 .update_val_normal = 0x04,
1232 .voltage_bank = 0x04,
1233 .voltage_reg = 0x29,
1234 .voltage_mask = 0x7,
1238 /* AB9540 regulator information */
1239 static struct ab8500_regulator_info
1240 ab9540_regulator_info[AB9540_NUM_REGULATORS] = {
1242 * Variable Voltage Regulators
1243 * name, min mV, max mV,
1244 * update bank, reg, mask, enable val
1245 * volt bank, reg, mask
1247 [AB9540_LDO_AUX1] = {
1250 .ops = &ab8500_regulator_volt_mode_ops,
1251 .type = REGULATOR_VOLTAGE,
1252 .id = AB9540_LDO_AUX1,
1253 .owner = THIS_MODULE,
1254 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1255 .volt_table = ldo_vauxn_voltages,
1258 .update_bank = 0x04,
1260 .update_mask = 0x03,
1262 .update_val_idle = 0x03,
1263 .update_val_normal = 0x01,
1264 .voltage_bank = 0x04,
1265 .voltage_reg = 0x1f,
1266 .voltage_mask = 0x0f,
1268 [AB9540_LDO_AUX2] = {
1271 .ops = &ab8500_regulator_volt_mode_ops,
1272 .type = REGULATOR_VOLTAGE,
1273 .id = AB9540_LDO_AUX2,
1274 .owner = THIS_MODULE,
1275 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1276 .volt_table = ldo_vauxn_voltages,
1279 .update_bank = 0x04,
1281 .update_mask = 0x0c,
1283 .update_val_idle = 0x0c,
1284 .update_val_normal = 0x04,
1285 .voltage_bank = 0x04,
1286 .voltage_reg = 0x20,
1287 .voltage_mask = 0x0f,
1289 [AB9540_LDO_AUX3] = {
1292 .ops = &ab8500_regulator_volt_mode_ops,
1293 .type = REGULATOR_VOLTAGE,
1294 .id = AB9540_LDO_AUX3,
1295 .owner = THIS_MODULE,
1296 .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages),
1297 .volt_table = ldo_vaux3_voltages,
1300 .update_bank = 0x04,
1302 .update_mask = 0x03,
1304 .update_val_idle = 0x03,
1305 .update_val_normal = 0x01,
1306 .voltage_bank = 0x04,
1307 .voltage_reg = 0x21,
1308 .voltage_mask = 0x07,
1310 [AB9540_LDO_AUX4] = {
1313 .ops = &ab8500_regulator_volt_mode_ops,
1314 .type = REGULATOR_VOLTAGE,
1315 .id = AB9540_LDO_AUX4,
1316 .owner = THIS_MODULE,
1317 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1318 .volt_table = ldo_vauxn_voltages,
1321 /* values for Vaux4Regu register */
1322 .update_bank = 0x04,
1324 .update_mask = 0x03,
1326 .update_val_idle = 0x03,
1327 .update_val_normal = 0x01,
1328 /* values for Vaux4SEL register */
1329 .voltage_bank = 0x04,
1330 .voltage_reg = 0x2f,
1331 .voltage_mask = 0x0f,
1333 [AB9540_LDO_INTCORE] = {
1335 .name = "LDO-INTCORE",
1336 .ops = &ab8500_regulator_volt_mode_ops,
1337 .type = REGULATOR_VOLTAGE,
1338 .id = AB9540_LDO_INTCORE,
1339 .owner = THIS_MODULE,
1340 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1341 .volt_table = ldo_vintcore_voltages,
1344 .update_bank = 0x03,
1346 .update_mask = 0x44,
1348 .update_val_idle = 0x44,
1349 .update_val_normal = 0x04,
1350 .voltage_bank = 0x03,
1351 .voltage_reg = 0x80,
1352 .voltage_mask = 0x38,
1357 * Fixed Voltage Regulators
1359 * update bank, reg, mask, enable val
1361 [AB9540_LDO_TVOUT] = {
1363 .name = "LDO-TVOUT",
1364 .ops = &ab8500_regulator_mode_ops,
1365 .type = REGULATOR_VOLTAGE,
1366 .id = AB9540_LDO_TVOUT,
1367 .owner = THIS_MODULE,
1369 .volt_table = fixed_2000000_voltage,
1370 .enable_time = 10000,
1373 .update_bank = 0x03,
1375 .update_mask = 0x82,
1377 .update_val_idle = 0x82,
1378 .update_val_normal = 0x02,
1380 [AB9540_LDO_USB] = {
1383 .ops = &ab8500_regulator_ops,
1384 .type = REGULATOR_VOLTAGE,
1385 .id = AB9540_LDO_USB,
1386 .owner = THIS_MODULE,
1388 .volt_table = fixed_3300000_voltage,
1390 .update_bank = 0x03,
1392 .update_mask = 0x03,
1394 .update_val_idle = 0x03,
1395 .update_val_normal = 0x01,
1397 [AB9540_LDO_AUDIO] = {
1399 .name = "LDO-AUDIO",
1400 .ops = &ab8500_regulator_ops,
1401 .type = REGULATOR_VOLTAGE,
1402 .id = AB9540_LDO_AUDIO,
1403 .owner = THIS_MODULE,
1405 .volt_table = fixed_2000000_voltage,
1407 .update_bank = 0x03,
1409 .update_mask = 0x02,
1412 [AB9540_LDO_ANAMIC1] = {
1414 .name = "LDO-ANAMIC1",
1415 .ops = &ab8500_regulator_ops,
1416 .type = REGULATOR_VOLTAGE,
1417 .id = AB9540_LDO_ANAMIC1,
1418 .owner = THIS_MODULE,
1420 .volt_table = fixed_2050000_voltage,
1422 .update_bank = 0x03,
1424 .update_mask = 0x08,
1427 [AB9540_LDO_ANAMIC2] = {
1429 .name = "LDO-ANAMIC2",
1430 .ops = &ab8500_regulator_ops,
1431 .type = REGULATOR_VOLTAGE,
1432 .id = AB9540_LDO_ANAMIC2,
1433 .owner = THIS_MODULE,
1435 .volt_table = fixed_2050000_voltage,
1437 .update_bank = 0x03,
1439 .update_mask = 0x10,
1442 [AB9540_LDO_DMIC] = {
1445 .ops = &ab8500_regulator_ops,
1446 .type = REGULATOR_VOLTAGE,
1447 .id = AB9540_LDO_DMIC,
1448 .owner = THIS_MODULE,
1450 .volt_table = fixed_1800000_voltage,
1452 .update_bank = 0x03,
1454 .update_mask = 0x04,
1459 * Regulators with fixed voltage and normal/idle modes
1461 [AB9540_LDO_ANA] = {
1464 .ops = &ab8500_regulator_mode_ops,
1465 .type = REGULATOR_VOLTAGE,
1466 .id = AB9540_LDO_ANA,
1467 .owner = THIS_MODULE,
1469 .volt_table = fixed_1200000_voltage,
1472 .update_bank = 0x04,
1474 .update_mask = 0x0c,
1476 .update_val_idle = 0x0c,
1477 .update_val_normal = 0x08,
1481 /* AB8540 regulator information */
1482 static struct ab8500_regulator_info
1483 ab8540_regulator_info[AB8540_NUM_REGULATORS] = {
1485 * Variable Voltage Regulators
1486 * name, min mV, max mV,
1487 * update bank, reg, mask, enable val
1488 * volt bank, reg, mask
1490 [AB8540_LDO_AUX1] = {
1493 .ops = &ab8500_regulator_volt_mode_ops,
1494 .type = REGULATOR_VOLTAGE,
1495 .id = AB8540_LDO_AUX1,
1496 .owner = THIS_MODULE,
1497 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1498 .volt_table = ldo_vauxn_voltages,
1501 .update_bank = 0x04,
1503 .update_mask = 0x03,
1505 .update_val_idle = 0x03,
1506 .update_val_normal = 0x01,
1507 .voltage_bank = 0x04,
1508 .voltage_reg = 0x1f,
1509 .voltage_mask = 0x0f,
1511 [AB8540_LDO_AUX2] = {
1514 .ops = &ab8500_regulator_volt_mode_ops,
1515 .type = REGULATOR_VOLTAGE,
1516 .id = AB8540_LDO_AUX2,
1517 .owner = THIS_MODULE,
1518 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1519 .volt_table = ldo_vauxn_voltages,
1522 .update_bank = 0x04,
1524 .update_mask = 0x0c,
1526 .update_val_idle = 0x0c,
1527 .update_val_normal = 0x04,
1528 .voltage_bank = 0x04,
1529 .voltage_reg = 0x20,
1530 .voltage_mask = 0x0f,
1532 [AB8540_LDO_AUX3] = {
1535 .ops = &ab8540_aux3_regulator_volt_mode_ops,
1536 .type = REGULATOR_VOLTAGE,
1537 .id = AB8540_LDO_AUX3,
1538 .owner = THIS_MODULE,
1539 .n_voltages = ARRAY_SIZE(ldo_vaux3_ab8540_voltages),
1540 .volt_table = ldo_vaux3_ab8540_voltages,
1543 .update_bank = 0x04,
1545 .update_mask = 0x03,
1547 .update_val_idle = 0x03,
1548 .update_val_normal = 0x01,
1549 .voltage_bank = 0x04,
1550 .voltage_reg = 0x21,
1551 .voltage_mask = 0x07,
1552 .expand_register = {
1554 .voltage_bank = 0x04,
1555 .voltage_reg = 0x01,
1556 .voltage_mask = 0x10,
1560 [AB8540_LDO_AUX4] = {
1563 .ops = &ab8500_regulator_volt_mode_ops,
1564 .type = REGULATOR_VOLTAGE,
1565 .id = AB8540_LDO_AUX4,
1566 .owner = THIS_MODULE,
1567 .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages),
1568 .volt_table = ldo_vauxn_voltages,
1571 /* values for Vaux4Regu register */
1572 .update_bank = 0x04,
1574 .update_mask = 0x03,
1576 .update_val_idle = 0x03,
1577 .update_val_normal = 0x01,
1578 /* values for Vaux4SEL register */
1579 .voltage_bank = 0x04,
1580 .voltage_reg = 0x2f,
1581 .voltage_mask = 0x0f,
1583 [AB8540_LDO_AUX5] = {
1586 .ops = &ab8500_regulator_volt_mode_ops,
1587 .type = REGULATOR_VOLTAGE,
1588 .id = AB8540_LDO_AUX5,
1589 .owner = THIS_MODULE,
1590 .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages),
1591 .volt_table = ldo_vaux56_ab8540_voltages,
1593 .load_lp_uA = 20000,
1594 /* values for Vaux5Regu register */
1595 .update_bank = 0x04,
1597 .update_mask = 0x03,
1599 .update_val_idle = 0x03,
1600 .update_val_normal = 0x01,
1601 /* values for Vaux5SEL register */
1602 .voltage_bank = 0x04,
1603 .voltage_reg = 0x33,
1604 .voltage_mask = 0x3f,
1606 [AB8540_LDO_AUX6] = {
1609 .ops = &ab8500_regulator_volt_mode_ops,
1610 .type = REGULATOR_VOLTAGE,
1611 .id = AB8540_LDO_AUX6,
1612 .owner = THIS_MODULE,
1613 .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages),
1614 .volt_table = ldo_vaux56_ab8540_voltages,
1616 .load_lp_uA = 20000,
1617 /* values for Vaux6Regu register */
1618 .update_bank = 0x04,
1620 .update_mask = 0x03,
1622 .update_val_idle = 0x03,
1623 .update_val_normal = 0x01,
1624 /* values for Vaux6SEL register */
1625 .voltage_bank = 0x04,
1626 .voltage_reg = 0x36,
1627 .voltage_mask = 0x3f,
1629 [AB8540_LDO_INTCORE] = {
1631 .name = "LDO-INTCORE",
1632 .ops = &ab8500_regulator_volt_mode_ops,
1633 .type = REGULATOR_VOLTAGE,
1634 .id = AB8540_LDO_INTCORE,
1635 .owner = THIS_MODULE,
1636 .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages),
1637 .volt_table = ldo_vintcore_voltages,
1640 .update_bank = 0x03,
1642 .update_mask = 0x44,
1644 .update_val_idle = 0x44,
1645 .update_val_normal = 0x04,
1646 .voltage_bank = 0x03,
1647 .voltage_reg = 0x80,
1648 .voltage_mask = 0x38,
1653 * Fixed Voltage Regulators
1655 * update bank, reg, mask, enable val
1657 [AB8540_LDO_TVOUT] = {
1659 .name = "LDO-TVOUT",
1660 .ops = &ab8500_regulator_mode_ops,
1661 .type = REGULATOR_VOLTAGE,
1662 .id = AB8540_LDO_TVOUT,
1663 .owner = THIS_MODULE,
1665 .volt_table = fixed_2000000_voltage,
1666 .enable_time = 10000,
1669 .update_bank = 0x03,
1671 .update_mask = 0x82,
1673 .update_val_idle = 0x82,
1674 .update_val_normal = 0x02,
1676 [AB8540_LDO_AUDIO] = {
1678 .name = "LDO-AUDIO",
1679 .ops = &ab8500_regulator_ops,
1680 .type = REGULATOR_VOLTAGE,
1681 .id = AB8540_LDO_AUDIO,
1682 .owner = THIS_MODULE,
1684 .volt_table = fixed_2000000_voltage,
1686 .update_bank = 0x03,
1688 .update_mask = 0x02,
1691 [AB8540_LDO_ANAMIC1] = {
1693 .name = "LDO-ANAMIC1",
1694 .ops = &ab8500_regulator_anamic_mode_ops,
1695 .type = REGULATOR_VOLTAGE,
1696 .id = AB8540_LDO_ANAMIC1,
1697 .owner = THIS_MODULE,
1699 .volt_table = fixed_2050000_voltage,
1701 .shared_mode = &ab8540_ldo_anamic1_shared,
1702 .update_bank = 0x03,
1704 .update_mask = 0x08,
1709 .mode_val_idle = 0x20,
1710 .mode_val_normal = 0x00,
1712 [AB8540_LDO_ANAMIC2] = {
1714 .name = "LDO-ANAMIC2",
1715 .ops = &ab8500_regulator_anamic_mode_ops,
1716 .type = REGULATOR_VOLTAGE,
1717 .id = AB8540_LDO_ANAMIC2,
1718 .owner = THIS_MODULE,
1720 .volt_table = fixed_2050000_voltage,
1722 .shared_mode = &ab8540_ldo_anamic2_shared,
1723 .update_bank = 0x03,
1725 .update_mask = 0x10,
1730 .mode_val_idle = 0x20,
1731 .mode_val_normal = 0x00,
1733 [AB8540_LDO_DMIC] = {
1736 .ops = &ab8500_regulator_volt_mode_ops,
1737 .type = REGULATOR_VOLTAGE,
1738 .id = AB8540_LDO_DMIC,
1739 .owner = THIS_MODULE,
1740 .n_voltages = ARRAY_SIZE(ldo_vdmic_voltages),
1741 .volt_table = ldo_vdmic_voltages,
1744 .update_bank = 0x03,
1746 .update_mask = 0x04,
1748 .voltage_bank = 0x03,
1749 .voltage_reg = 0x83,
1750 .voltage_mask = 0xc0,
1754 * Regulators with fixed voltage and normal/idle modes
1756 [AB8540_LDO_ANA] = {
1759 .ops = &ab8500_regulator_mode_ops,
1760 .type = REGULATOR_VOLTAGE,
1761 .id = AB8540_LDO_ANA,
1762 .owner = THIS_MODULE,
1764 .volt_table = fixed_1200000_voltage,
1767 .update_bank = 0x04,
1769 .update_mask = 0x0c,
1771 .update_val_idle = 0x0c,
1772 .update_val_normal = 0x04,
1774 [AB8540_LDO_SDIO] = {
1777 .ops = &ab8500_regulator_volt_mode_ops,
1778 .type = REGULATOR_VOLTAGE,
1779 .id = AB8540_LDO_SDIO,
1780 .owner = THIS_MODULE,
1781 .n_voltages = ARRAY_SIZE(ldo_sdio_voltages),
1782 .volt_table = ldo_sdio_voltages,
1785 .update_bank = 0x03,
1787 .update_mask = 0x30,
1789 .update_val_idle = 0x30,
1790 .update_val_normal = 0x10,
1791 .voltage_bank = 0x03,
1792 .voltage_reg = 0x88,
1793 .voltage_mask = 0x07,
1797 static struct ab8500_shared_mode ldo_anamic1_shared = {
1798 .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2],
1801 static struct ab8500_shared_mode ldo_anamic2_shared = {
1802 .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1],
1805 static struct ab8500_shared_mode ab8540_ldo_anamic1_shared = {
1806 .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC2],
1809 static struct ab8500_shared_mode ab8540_ldo_anamic2_shared = {
1810 .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC1],
1813 struct ab8500_reg_init {
1819 #define REG_INIT(_id, _bank, _addr, _mask) \
1826 /* AB8500 register init */
1827 static struct ab8500_reg_init ab8500_reg_init[] = {
1829 * 0x30, VanaRequestCtrl
1830 * 0xc0, VextSupply1RequestCtrl
1832 REG_INIT(AB8500_REGUREQUESTCTRL2, 0x03, 0x04, 0xf0),
1834 * 0x03, VextSupply2RequestCtrl
1835 * 0x0c, VextSupply3RequestCtrl
1836 * 0x30, Vaux1RequestCtrl
1837 * 0xc0, Vaux2RequestCtrl
1839 REG_INIT(AB8500_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
1841 * 0x03, Vaux3RequestCtrl
1844 REG_INIT(AB8500_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
1846 * 0x08, VanaSysClkReq1HPValid
1847 * 0x20, Vaux1SysClkReq1HPValid
1848 * 0x40, Vaux2SysClkReq1HPValid
1849 * 0x80, Vaux3SysClkReq1HPValid
1851 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
1853 * 0x10, VextSupply1SysClkReq1HPValid
1854 * 0x20, VextSupply2SysClkReq1HPValid
1855 * 0x40, VextSupply3SysClkReq1HPValid
1857 REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
1859 * 0x08, VanaHwHPReq1Valid
1860 * 0x20, Vaux1HwHPReq1Valid
1861 * 0x40, Vaux2HwHPReq1Valid
1862 * 0x80, Vaux3HwHPReq1Valid
1864 REG_INIT(AB8500_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xe8),
1866 * 0x01, VextSupply1HwHPReq1Valid
1867 * 0x02, VextSupply2HwHPReq1Valid
1868 * 0x04, VextSupply3HwHPReq1Valid
1870 REG_INIT(AB8500_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
1872 * 0x08, VanaHwHPReq2Valid
1873 * 0x20, Vaux1HwHPReq2Valid
1874 * 0x40, Vaux2HwHPReq2Valid
1875 * 0x80, Vaux3HwHPReq2Valid
1877 REG_INIT(AB8500_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xe8),
1879 * 0x01, VextSupply1HwHPReq2Valid
1880 * 0x02, VextSupply2HwHPReq2Valid
1881 * 0x04, VextSupply3HwHPReq2Valid
1883 REG_INIT(AB8500_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
1885 * 0x20, VanaSwHPReqValid
1886 * 0x80, Vaux1SwHPReqValid
1888 REG_INIT(AB8500_REGUSWHPREQVALID1, 0x03, 0x0d, 0xa0),
1890 * 0x01, Vaux2SwHPReqValid
1891 * 0x02, Vaux3SwHPReqValid
1892 * 0x04, VextSupply1SwHPReqValid
1893 * 0x08, VextSupply2SwHPReqValid
1894 * 0x10, VextSupply3SwHPReqValid
1896 REG_INIT(AB8500_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
1898 * 0x02, SysClkReq2Valid1
1899 * 0x04, SysClkReq3Valid1
1900 * 0x08, SysClkReq4Valid1
1901 * 0x10, SysClkReq5Valid1
1902 * 0x20, SysClkReq6Valid1
1903 * 0x40, SysClkReq7Valid1
1904 * 0x80, SysClkReq8Valid1
1906 REG_INIT(AB8500_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
1908 * 0x02, SysClkReq2Valid2
1909 * 0x04, SysClkReq3Valid2
1910 * 0x08, SysClkReq4Valid2
1911 * 0x10, SysClkReq5Valid2
1912 * 0x20, SysClkReq6Valid2
1913 * 0x40, SysClkReq7Valid2
1914 * 0x80, SysClkReq8Valid2
1916 REG_INIT(AB8500_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
1919 * 0x04, Vintcore12Ena
1920 * 0x38, Vintcore12Sel
1921 * 0x40, Vintcore12LP
1924 REG_INIT(AB8500_REGUMISC1, 0x03, 0x80, 0xfe),
1931 REG_INIT(AB8500_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
1933 * 0x01, Vamic1_dzout
1934 * 0x02, Vamic2_dzout
1936 REG_INIT(AB8500_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
1938 * 0x03, VpllRegu (NOTE! PRCMU register bits)
1941 REG_INIT(AB8500_VPLLVANAREGU, 0x04, 0x06, 0x0f),
1944 * 0x02, VrefDDRSleepMode
1946 REG_INIT(AB8500_VREFDDR, 0x04, 0x07, 0x03),
1948 * 0x03, VextSupply1Regu
1949 * 0x0c, VextSupply2Regu
1950 * 0x30, VextSupply3Regu
1951 * 0x40, ExtSupply2Bypass
1952 * 0x80, ExtSupply3Bypass
1954 REG_INIT(AB8500_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
1959 REG_INIT(AB8500_VAUX12REGU, 0x04, 0x09, 0x0f),
1963 REG_INIT(AB8500_VRF1VAUX3REGU, 0x04, 0x0a, 0x03),
1967 REG_INIT(AB8500_VAUX1SEL, 0x04, 0x1f, 0x0f),
1971 REG_INIT(AB8500_VAUX2SEL, 0x04, 0x20, 0x0f),
1975 REG_INIT(AB8500_VRF1VAUX3SEL, 0x04, 0x21, 0x07),
1977 * 0x01, VextSupply12LP
1979 REG_INIT(AB8500_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
1984 * 0x20, Vintcore12Disch
1988 REG_INIT(AB8500_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
1991 * 0x04, VdmicPullDownEna
1994 REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
1997 /* AB8505 register init */
1998 static struct ab8500_reg_init ab8505_reg_init[] = {
2000 * 0x03, VarmRequestCtrl
2001 * 0x0c, VsmpsCRequestCtrl
2002 * 0x30, VsmpsARequestCtrl
2003 * 0xc0, VsmpsBRequestCtrl
2005 REG_INIT(AB8505_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2007 * 0x03, VsafeRequestCtrl
2008 * 0x0c, VpllRequestCtrl
2009 * 0x30, VanaRequestCtrl
2011 REG_INIT(AB8505_REGUREQUESTCTRL2, 0x03, 0x04, 0x3f),
2013 * 0x30, Vaux1RequestCtrl
2014 * 0xc0, Vaux2RequestCtrl
2016 REG_INIT(AB8505_REGUREQUESTCTRL3, 0x03, 0x05, 0xf0),
2018 * 0x03, Vaux3RequestCtrl
2021 REG_INIT(AB8505_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2023 * 0x01, VsmpsASysClkReq1HPValid
2024 * 0x02, VsmpsBSysClkReq1HPValid
2025 * 0x04, VsafeSysClkReq1HPValid
2026 * 0x08, VanaSysClkReq1HPValid
2027 * 0x10, VpllSysClkReq1HPValid
2028 * 0x20, Vaux1SysClkReq1HPValid
2029 * 0x40, Vaux2SysClkReq1HPValid
2030 * 0x80, Vaux3SysClkReq1HPValid
2032 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2034 * 0x01, VsmpsCSysClkReq1HPValid
2035 * 0x02, VarmSysClkReq1HPValid
2036 * 0x04, VbbSysClkReq1HPValid
2037 * 0x08, VsmpsMSysClkReq1HPValid
2039 REG_INIT(AB8505_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x0f),
2041 * 0x01, VsmpsAHwHPReq1Valid
2042 * 0x02, VsmpsBHwHPReq1Valid
2043 * 0x04, VsafeHwHPReq1Valid
2044 * 0x08, VanaHwHPReq1Valid
2045 * 0x10, VpllHwHPReq1Valid
2046 * 0x20, Vaux1HwHPReq1Valid
2047 * 0x40, Vaux2HwHPReq1Valid
2048 * 0x80, Vaux3HwHPReq1Valid
2050 REG_INIT(AB8505_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2052 * 0x08, VsmpsMHwHPReq1Valid
2054 REG_INIT(AB8505_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x08),
2056 * 0x01, VsmpsAHwHPReq2Valid
2057 * 0x02, VsmpsBHwHPReq2Valid
2058 * 0x04, VsafeHwHPReq2Valid
2059 * 0x08, VanaHwHPReq2Valid
2060 * 0x10, VpllHwHPReq2Valid
2061 * 0x20, Vaux1HwHPReq2Valid
2062 * 0x40, Vaux2HwHPReq2Valid
2063 * 0x80, Vaux3HwHPReq2Valid
2065 REG_INIT(AB8505_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2067 * 0x08, VsmpsMHwHPReq2Valid
2069 REG_INIT(AB8505_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x08),
2071 * 0x01, VsmpsCSwHPReqValid
2072 * 0x02, VarmSwHPReqValid
2073 * 0x04, VsmpsASwHPReqValid
2074 * 0x08, VsmpsBSwHPReqValid
2075 * 0x10, VsafeSwHPReqValid
2076 * 0x20, VanaSwHPReqValid
2077 * 0x40, VpllSwHPReqValid
2078 * 0x80, Vaux1SwHPReqValid
2080 REG_INIT(AB8505_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2082 * 0x01, Vaux2SwHPReqValid
2083 * 0x02, Vaux3SwHPReqValid
2084 * 0x20, VsmpsMSwHPReqValid
2086 REG_INIT(AB8505_REGUSWHPREQVALID2, 0x03, 0x0e, 0x23),
2088 * 0x02, SysClkReq2Valid1
2089 * 0x04, SysClkReq3Valid1
2090 * 0x08, SysClkReq4Valid1
2092 REG_INIT(AB8505_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0x0e),
2094 * 0x02, SysClkReq2Valid2
2095 * 0x04, SysClkReq3Valid2
2096 * 0x08, SysClkReq4Valid2
2098 REG_INIT(AB8505_REGUSYSCLKREQVALID2, 0x03, 0x10, 0x0e),
2100 * 0x01, Vaux4SwHPReqValid
2101 * 0x02, Vaux4HwHPReq2Valid
2102 * 0x04, Vaux4HwHPReq1Valid
2103 * 0x08, Vaux4SysClkReq1HPValid
2105 REG_INIT(AB8505_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2108 * 0x04, VintCore12Ena
2109 * 0x38, VintCore12Sel
2110 * 0x40, VintCore12LP
2113 REG_INIT(AB8505_REGUMISC1, 0x03, 0x80, 0xfe),
2120 REG_INIT(AB8505_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
2122 * 0x01, Vamic1_dzout
2123 * 0x02, Vamic2_dzout
2125 REG_INIT(AB8505_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2128 * 0x0c, VsmpsASelCtrl
2129 * 0x10, VsmpsAAutoMode
2130 * 0x20, VsmpsAPWMMode
2132 REG_INIT(AB8505_VSMPSAREGU, 0x04, 0x03, 0x3f),
2135 * 0x0c, VsmpsBSelCtrl
2136 * 0x10, VsmpsBAutoMode
2137 * 0x20, VsmpsBPWMMode
2139 REG_INIT(AB8505_VSMPSBREGU, 0x04, 0x04, 0x3f),
2142 * 0x0c, VsafeSelCtrl
2143 * 0x10, VsafeAutoMode
2144 * 0x20, VsafePWMMode
2146 REG_INIT(AB8505_VSAFEREGU, 0x04, 0x05, 0x3f),
2148 * 0x03, VpllRegu (NOTE! PRCMU register bits)
2151 REG_INIT(AB8505_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2153 * 0x03, VextSupply1Regu
2154 * 0x0c, VextSupply2Regu
2155 * 0x30, VextSupply3Regu
2156 * 0x40, ExtSupply2Bypass
2157 * 0x80, ExtSupply3Bypass
2159 REG_INIT(AB8505_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2164 REG_INIT(AB8505_VAUX12REGU, 0x04, 0x09, 0x0f),
2168 REG_INIT(AB8505_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2172 REG_INIT(AB8505_VSMPSASEL1, 0x04, 0x13, 0x3f),
2176 REG_INIT(AB8505_VSMPSASEL2, 0x04, 0x14, 0x3f),
2180 REG_INIT(AB8505_VSMPSASEL3, 0x04, 0x15, 0x3f),
2184 REG_INIT(AB8505_VSMPSBSEL1, 0x04, 0x17, 0x3f),
2188 REG_INIT(AB8505_VSMPSBSEL2, 0x04, 0x18, 0x3f),
2192 REG_INIT(AB8505_VSMPSBSEL3, 0x04, 0x19, 0x3f),
2196 REG_INIT(AB8505_VSAFESEL1, 0x04, 0x1b, 0x7f),
2200 REG_INIT(AB8505_VSAFESEL2, 0x04, 0x1c, 0x7f),
2204 REG_INIT(AB8505_VSAFESEL3, 0x04, 0x1d, 0x7f),
2208 REG_INIT(AB8505_VAUX1SEL, 0x04, 0x1f, 0x0f),
2212 REG_INIT(AB8505_VAUX2SEL, 0x04, 0x20, 0x0f),
2217 REG_INIT(AB8505_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
2219 * 0x03, Vaux4RequestCtrl
2221 REG_INIT(AB8505_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2225 REG_INIT(AB8505_VAUX4REGU, 0x04, 0x2e, 0x03),
2229 REG_INIT(AB8505_VAUX4SEL, 0x04, 0x2f, 0x0f),
2234 * 0x20, Vintcore12Disch
2238 REG_INIT(AB8505_REGUCTRLDISCH, 0x04, 0x43, 0xfc),
2241 * 0x04, VdmicPullDownEna
2244 REG_INIT(AB8505_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
2248 REG_INIT(AB8505_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2254 * 0x40, Vaux5DisSfst
2255 * 0x80, Vaux5DisPulld
2257 REG_INIT(AB8505_CTRLVAUX5, 0x01, 0x55, 0xff),
2262 * 0x80, Vaux6DisPulld
2264 REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f),
2267 /* AB9540 register init */
2268 static struct ab8500_reg_init ab9540_reg_init[] = {
2270 * 0x03, VarmRequestCtrl
2271 * 0x0c, VapeRequestCtrl
2272 * 0x30, Vsmps1RequestCtrl
2273 * 0xc0, Vsmps2RequestCtrl
2275 REG_INIT(AB9540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2277 * 0x03, Vsmps3RequestCtrl
2278 * 0x0c, VpllRequestCtrl
2279 * 0x30, VanaRequestCtrl
2280 * 0xc0, VextSupply1RequestCtrl
2282 REG_INIT(AB9540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
2284 * 0x03, VextSupply2RequestCtrl
2285 * 0x0c, VextSupply3RequestCtrl
2286 * 0x30, Vaux1RequestCtrl
2287 * 0xc0, Vaux2RequestCtrl
2289 REG_INIT(AB9540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
2291 * 0x03, Vaux3RequestCtrl
2294 REG_INIT(AB9540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2296 * 0x01, Vsmps1SysClkReq1HPValid
2297 * 0x02, Vsmps2SysClkReq1HPValid
2298 * 0x04, Vsmps3SysClkReq1HPValid
2299 * 0x08, VanaSysClkReq1HPValid
2300 * 0x10, VpllSysClkReq1HPValid
2301 * 0x20, Vaux1SysClkReq1HPValid
2302 * 0x40, Vaux2SysClkReq1HPValid
2303 * 0x80, Vaux3SysClkReq1HPValid
2305 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2307 * 0x01, VapeSysClkReq1HPValid
2308 * 0x02, VarmSysClkReq1HPValid
2309 * 0x04, VbbSysClkReq1HPValid
2310 * 0x08, VmodSysClkReq1HPValid
2311 * 0x10, VextSupply1SysClkReq1HPValid
2312 * 0x20, VextSupply2SysClkReq1HPValid
2313 * 0x40, VextSupply3SysClkReq1HPValid
2315 REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f),
2317 * 0x01, Vsmps1HwHPReq1Valid
2318 * 0x02, Vsmps2HwHPReq1Valid
2319 * 0x04, Vsmps3HwHPReq1Valid
2320 * 0x08, VanaHwHPReq1Valid
2321 * 0x10, VpllHwHPReq1Valid
2322 * 0x20, Vaux1HwHPReq1Valid
2323 * 0x40, Vaux2HwHPReq1Valid
2324 * 0x80, Vaux3HwHPReq1Valid
2326 REG_INIT(AB9540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2328 * 0x01, VextSupply1HwHPReq1Valid
2329 * 0x02, VextSupply2HwHPReq1Valid
2330 * 0x04, VextSupply3HwHPReq1Valid
2331 * 0x08, VmodHwHPReq1Valid
2333 REG_INIT(AB9540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f),
2335 * 0x01, Vsmps1HwHPReq2Valid
2336 * 0x02, Vsmps2HwHPReq2Valid
2337 * 0x03, Vsmps3HwHPReq2Valid
2338 * 0x08, VanaHwHPReq2Valid
2339 * 0x10, VpllHwHPReq2Valid
2340 * 0x20, Vaux1HwHPReq2Valid
2341 * 0x40, Vaux2HwHPReq2Valid
2342 * 0x80, Vaux3HwHPReq2Valid
2344 REG_INIT(AB9540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2346 * 0x01, VextSupply1HwHPReq2Valid
2347 * 0x02, VextSupply2HwHPReq2Valid
2348 * 0x04, VextSupply3HwHPReq2Valid
2349 * 0x08, VmodHwHPReq2Valid
2351 REG_INIT(AB9540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f),
2353 * 0x01, VapeSwHPReqValid
2354 * 0x02, VarmSwHPReqValid
2355 * 0x04, Vsmps1SwHPReqValid
2356 * 0x08, Vsmps2SwHPReqValid
2357 * 0x10, Vsmps3SwHPReqValid
2358 * 0x20, VanaSwHPReqValid
2359 * 0x40, VpllSwHPReqValid
2360 * 0x80, Vaux1SwHPReqValid
2362 REG_INIT(AB9540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2364 * 0x01, Vaux2SwHPReqValid
2365 * 0x02, Vaux3SwHPReqValid
2366 * 0x04, VextSupply1SwHPReqValid
2367 * 0x08, VextSupply2SwHPReqValid
2368 * 0x10, VextSupply3SwHPReqValid
2369 * 0x20, VmodSwHPReqValid
2371 REG_INIT(AB9540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f),
2373 * 0x02, SysClkReq2Valid1
2375 * 0x80, SysClkReq8Valid1
2377 REG_INIT(AB9540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe),
2379 * 0x02, SysClkReq2Valid2
2381 * 0x80, SysClkReq8Valid2
2383 REG_INIT(AB9540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe),
2385 * 0x01, Vaux4SwHPReqValid
2386 * 0x02, Vaux4HwHPReq2Valid
2387 * 0x04, Vaux4HwHPReq1Valid
2388 * 0x08, Vaux4SysClkReq1HPValid
2390 REG_INIT(AB9540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2393 * 0x04, Vintcore12Ena
2394 * 0x38, Vintcore12Sel
2395 * 0x40, Vintcore12LP
2398 REG_INIT(AB9540_REGUMISC1, 0x03, 0x80, 0xfe),
2405 REG_INIT(AB9540_VAUDIOSUPPLY, 0x03, 0x83, 0x1e),
2407 * 0x01, Vamic1_dzout
2408 * 0x02, Vamic2_dzout
2410 REG_INIT(AB9540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2413 * 0x0c, Vsmps1SelCtrl
2414 * 0x10, Vsmps1AutoMode
2415 * 0x20, Vsmps1PWMMode
2417 REG_INIT(AB9540_VSMPS1REGU, 0x04, 0x03, 0x3f),
2420 * 0x0c, Vsmps2SelCtrl
2421 * 0x10, Vsmps2AutoMode
2422 * 0x20, Vsmps2PWMMode
2424 REG_INIT(AB9540_VSMPS2REGU, 0x04, 0x04, 0x3f),
2427 * 0x0c, Vsmps3SelCtrl
2428 * NOTE! PRCMU register
2430 REG_INIT(AB9540_VSMPS3REGU, 0x04, 0x05, 0x0f),
2435 REG_INIT(AB9540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2437 * 0x03, VextSupply1Regu
2438 * 0x0c, VextSupply2Regu
2439 * 0x30, VextSupply3Regu
2440 * 0x40, ExtSupply2Bypass
2441 * 0x80, ExtSupply3Bypass
2443 REG_INIT(AB9540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2448 REG_INIT(AB9540_VAUX12REGU, 0x04, 0x09, 0x0f),
2453 REG_INIT(AB9540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2457 REG_INIT(AB9540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
2461 REG_INIT(AB9540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
2465 REG_INIT(AB9540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
2469 REG_INIT(AB9540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
2473 REG_INIT(AB9540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
2477 REG_INIT(AB9540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
2480 * NOTE! PRCMU register
2482 REG_INIT(AB9540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
2485 * NOTE! PRCMU register
2487 REG_INIT(AB9540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
2491 REG_INIT(AB9540_VAUX1SEL, 0x04, 0x1f, 0x0f),
2495 REG_INIT(AB9540_VAUX2SEL, 0x04, 0x20, 0x0f),
2500 REG_INIT(AB9540_VRF1VAUX3SEL, 0x04, 0x21, 0x37),
2502 * 0x01, VextSupply12LP
2504 REG_INIT(AB9540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
2506 * 0x03, Vaux4RequestCtrl
2508 REG_INIT(AB9540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2512 REG_INIT(AB9540_VAUX4REGU, 0x04, 0x2e, 0x03),
2516 REG_INIT(AB9540_VAUX4SEL, 0x04, 0x2f, 0x0f),
2523 * 0x20, Vintcore12Disch
2527 REG_INIT(AB9540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
2531 * 0x04, VdmicPullDownEna
2532 * 0x08, VpllPullDownEna
2535 REG_INIT(AB9540_REGUCTRLDISCH2, 0x04, 0x44, 0x1f),
2539 REG_INIT(AB9540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2542 /* AB8540 register init */
2543 static struct ab8500_reg_init ab8540_reg_init[] = {
2545 * 0x01, VSimSycClkReq1Valid
2546 * 0x02, VSimSycClkReq2Valid
2547 * 0x04, VSimSycClkReq3Valid
2548 * 0x08, VSimSycClkReq4Valid
2549 * 0x10, VSimSycClkReq5Valid
2550 * 0x20, VSimSycClkReq6Valid
2551 * 0x40, VSimSycClkReq7Valid
2552 * 0x80, VSimSycClkReq8Valid
2554 REG_INIT(AB8540_VSIMSYSCLKCTRL, 0x02, 0x33, 0xff),
2556 * 0x03, VarmRequestCtrl
2557 * 0x0c, VapeRequestCtrl
2558 * 0x30, Vsmps1RequestCtrl
2559 * 0xc0, Vsmps2RequestCtrl
2561 REG_INIT(AB8540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff),
2563 * 0x03, Vsmps3RequestCtrl
2564 * 0x0c, VpllRequestCtrl
2565 * 0x30, VanaRequestCtrl
2566 * 0xc0, VextSupply1RequestCtrl
2568 REG_INIT(AB8540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff),
2570 * 0x03, VextSupply2RequestCtrl
2571 * 0x0c, VextSupply3RequestCtrl
2572 * 0x30, Vaux1RequestCtrl
2573 * 0xc0, Vaux2RequestCtrl
2575 REG_INIT(AB8540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff),
2577 * 0x03, Vaux3RequestCtrl
2580 REG_INIT(AB8540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07),
2582 * 0x01, Vsmps1SysClkReq1HPValid
2583 * 0x02, Vsmps2SysClkReq1HPValid
2584 * 0x04, Vsmps3SysClkReq1HPValid
2585 * 0x08, VanaSysClkReq1HPValid
2586 * 0x10, VpllSysClkReq1HPValid
2587 * 0x20, Vaux1SysClkReq1HPValid
2588 * 0x40, Vaux2SysClkReq1HPValid
2589 * 0x80, Vaux3SysClkReq1HPValid
2591 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
2593 * 0x01, VapeSysClkReq1HPValid
2594 * 0x02, VarmSysClkReq1HPValid
2595 * 0x04, VbbSysClkReq1HPValid
2596 * 0x10, VextSupply1SysClkReq1HPValid
2597 * 0x20, VextSupply2SysClkReq1HPValid
2598 * 0x40, VextSupply3SysClkReq1HPValid
2600 REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x77),
2602 * 0x01, Vsmps1HwHPReq1Valid
2603 * 0x02, Vsmps2HwHPReq1Valid
2604 * 0x04, Vsmps3HwHPReq1Valid
2605 * 0x08, VanaHwHPReq1Valid
2606 * 0x10, VpllHwHPReq1Valid
2607 * 0x20, Vaux1HwHPReq1Valid
2608 * 0x40, Vaux2HwHPReq1Valid
2609 * 0x80, Vaux3HwHPReq1Valid
2611 REG_INIT(AB8540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff),
2613 * 0x01, VextSupply1HwHPReq1Valid
2614 * 0x02, VextSupply2HwHPReq1Valid
2615 * 0x04, VextSupply3HwHPReq1Valid
2617 REG_INIT(AB8540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07),
2619 * 0x01, Vsmps1HwHPReq2Valid
2620 * 0x02, Vsmps2HwHPReq2Valid
2621 * 0x03, Vsmps3HwHPReq2Valid
2622 * 0x08, VanaHwHPReq2Valid
2623 * 0x10, VpllHwHPReq2Valid
2624 * 0x20, Vaux1HwHPReq2Valid
2625 * 0x40, Vaux2HwHPReq2Valid
2626 * 0x80, Vaux3HwHPReq2Valid
2628 REG_INIT(AB8540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff),
2630 * 0x01, VextSupply1HwHPReq2Valid
2631 * 0x02, VextSupply2HwHPReq2Valid
2632 * 0x04, VextSupply3HwHPReq2Valid
2634 REG_INIT(AB8540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07),
2636 * 0x01, VapeSwHPReqValid
2637 * 0x02, VarmSwHPReqValid
2638 * 0x04, Vsmps1SwHPReqValid
2639 * 0x08, Vsmps2SwHPReqValid
2640 * 0x10, Vsmps3SwHPReqValid
2641 * 0x20, VanaSwHPReqValid
2642 * 0x40, VpllSwHPReqValid
2643 * 0x80, Vaux1SwHPReqValid
2645 REG_INIT(AB8540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff),
2647 * 0x01, Vaux2SwHPReqValid
2648 * 0x02, Vaux3SwHPReqValid
2649 * 0x04, VextSupply1SwHPReqValid
2650 * 0x08, VextSupply2SwHPReqValid
2651 * 0x10, VextSupply3SwHPReqValid
2653 REG_INIT(AB8540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f),
2655 * 0x02, SysClkReq2Valid1
2657 * 0x80, SysClkReq8Valid1
2659 REG_INIT(AB8540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xff),
2661 * 0x02, SysClkReq2Valid2
2663 * 0x80, SysClkReq8Valid2
2665 REG_INIT(AB8540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xff),
2667 * 0x01, Vaux4SwHPReqValid
2668 * 0x02, Vaux4HwHPReq2Valid
2669 * 0x04, Vaux4HwHPReq1Valid
2670 * 0x08, Vaux4SysClkReq1HPValid
2672 REG_INIT(AB8540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f),
2674 * 0x01, Vaux5SwHPReqValid
2675 * 0x02, Vaux5HwHPReq2Valid
2676 * 0x04, Vaux5HwHPReq1Valid
2677 * 0x08, Vaux5SysClkReq1HPValid
2679 REG_INIT(AB8540_REGUVAUX5REQVALID, 0x03, 0x12, 0x0f),
2681 * 0x01, Vaux6SwHPReqValid
2682 * 0x02, Vaux6HwHPReq2Valid
2683 * 0x04, Vaux6HwHPReq1Valid
2684 * 0x08, Vaux6SysClkReq1HPValid
2686 REG_INIT(AB8540_REGUVAUX6REQVALID, 0x03, 0x13, 0x0f),
2688 * 0x01, VclkbSwHPReqValid
2689 * 0x02, VclkbHwHPReq2Valid
2690 * 0x04, VclkbHwHPReq1Valid
2691 * 0x08, VclkbSysClkReq1HPValid
2693 REG_INIT(AB8540_REGUVCLKBREQVALID, 0x03, 0x14, 0x0f),
2695 * 0x01, Vrf1SwHPReqValid
2696 * 0x02, Vrf1HwHPReq2Valid
2697 * 0x04, Vrf1HwHPReq1Valid
2698 * 0x08, Vrf1SysClkReq1HPValid
2700 REG_INIT(AB8540_REGUVRF1REQVALID, 0x03, 0x15, 0x0f),
2703 * 0x04, Vintcore12Ena
2704 * 0x38, Vintcore12Sel
2705 * 0x40, Vintcore12LP
2708 REG_INIT(AB8540_REGUMISC1, 0x03, 0x80, 0xfe),
2717 REG_INIT(AB8540_VAUDIOSUPPLY, 0x03, 0x83, 0xfe),
2719 * 0x01, Vamic1_dzout
2720 * 0x02, Vamic2_dzout
2722 REG_INIT(AB8540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03),
2725 * 0x08, VHSICOffState
2729 REG_INIT(AB8540_VHSIC, 0x03, 0x87, 0x3f),
2732 * 0x08, VSDIOOffState
2736 REG_INIT(AB8540_VSDIO, 0x03, 0x88, 0x3f),
2739 * 0x0c, Vsmps1SelCtrl
2740 * 0x10, Vsmps1AutoMode
2741 * 0x20, Vsmps1PWMMode
2743 REG_INIT(AB8540_VSMPS1REGU, 0x04, 0x03, 0x3f),
2746 * 0x0c, Vsmps2SelCtrl
2747 * 0x10, Vsmps2AutoMode
2748 * 0x20, Vsmps2PWMMode
2750 REG_INIT(AB8540_VSMPS2REGU, 0x04, 0x04, 0x3f),
2753 * 0x0c, Vsmps3SelCtrl
2754 * 0x10, Vsmps3AutoMode
2755 * 0x20, Vsmps3PWMMode
2756 * NOTE! PRCMU register
2758 REG_INIT(AB8540_VSMPS3REGU, 0x04, 0x05, 0x0f),
2763 REG_INIT(AB8540_VPLLVANAREGU, 0x04, 0x06, 0x0f),
2765 * 0x03, VextSupply1Regu
2766 * 0x0c, VextSupply2Regu
2767 * 0x30, VextSupply3Regu
2768 * 0x40, ExtSupply2Bypass
2769 * 0x80, ExtSupply3Bypass
2771 REG_INIT(AB8540_EXTSUPPLYREGU, 0x04, 0x08, 0xff),
2776 REG_INIT(AB8540_VAUX12REGU, 0x04, 0x09, 0x0f),
2781 REG_INIT(AB8540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f),
2785 REG_INIT(AB8540_VSMPS1SEL1, 0x04, 0x13, 0x3f),
2789 REG_INIT(AB8540_VSMPS1SEL2, 0x04, 0x14, 0x3f),
2793 REG_INIT(AB8540_VSMPS1SEL3, 0x04, 0x15, 0x3f),
2797 REG_INIT(AB8540_VSMPS2SEL1, 0x04, 0x17, 0x3f),
2801 REG_INIT(AB8540_VSMPS2SEL2, 0x04, 0x18, 0x3f),
2805 REG_INIT(AB8540_VSMPS2SEL3, 0x04, 0x19, 0x3f),
2808 * NOTE! PRCMU register
2810 REG_INIT(AB8540_VSMPS3SEL1, 0x04, 0x1b, 0x7f),
2813 * NOTE! PRCMU register
2815 REG_INIT(AB8540_VSMPS3SEL2, 0x04, 0x1c, 0x7f),
2819 REG_INIT(AB8540_VAUX1SEL, 0x04, 0x1f, 0x0f),
2823 REG_INIT(AB8540_VAUX2SEL, 0x04, 0x20, 0x0f),
2828 REG_INIT(AB8540_VRF1VAUX3SEL, 0x04, 0x21, 0x77),
2830 * 0x01, VextSupply12LP
2832 REG_INIT(AB8540_REGUCTRL2SPARE, 0x04, 0x22, 0x01),
2837 REG_INIT(AB8540_VANAVPLLSEL, 0x04, 0x29, 0x37),
2839 * 0x03, Vaux4RequestCtrl
2841 REG_INIT(AB8540_VAUX4REQCTRL, 0x04, 0x2d, 0x03),
2845 REG_INIT(AB8540_VAUX4REGU, 0x04, 0x2e, 0x03),
2849 REG_INIT(AB8540_VAUX4SEL, 0x04, 0x2f, 0x0f),
2851 * 0x03, Vaux5RequestCtrl
2853 REG_INIT(AB8540_VAUX5REQCTRL, 0x04, 0x31, 0x03),
2857 REG_INIT(AB8540_VAUX5REGU, 0x04, 0x32, 0x03),
2861 REG_INIT(AB8540_VAUX5SEL, 0x04, 0x33, 0x3f),
2863 * 0x03, Vaux6RequestCtrl
2865 REG_INIT(AB8540_VAUX6REQCTRL, 0x04, 0x34, 0x03),
2869 REG_INIT(AB8540_VAUX6REGU, 0x04, 0x35, 0x03),
2873 REG_INIT(AB8540_VAUX6SEL, 0x04, 0x36, 0x3f),
2875 * 0x03, VCLKBRequestCtrl
2877 REG_INIT(AB8540_VCLKBREQCTRL, 0x04, 0x37, 0x03),
2881 REG_INIT(AB8540_VCLKBREGU, 0x04, 0x38, 0x03),
2885 REG_INIT(AB8540_VCLKBSEL, 0x04, 0x39, 0x07),
2887 * 0x03, Vrf1RequestCtrl
2889 REG_INIT(AB8540_VRF1REQCTRL, 0x04, 0x3a, 0x03),
2896 * 0x20, Vintcore12Disch
2900 REG_INIT(AB8540_REGUCTRLDISCH, 0x04, 0x43, 0xff),
2903 * 0x04, VdmicPullDownEna
2904 * 0x08, VpllPullDownEna
2907 REG_INIT(AB8540_REGUCTRLDISCH2, 0x04, 0x44, 0x1e),
2911 REG_INIT(AB8540_REGUCTRLDISCH3, 0x04, 0x48, 0x01),
2917 REG_INIT(AB8540_REGUCTRLDISCH4, 0x04, 0x49, 0x07),
2920 static struct of_regulator_match ab8500_regulator_match[] = {
2921 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, },
2922 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, },
2923 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, },
2924 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, },
2925 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, },
2926 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, },
2927 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, },
2928 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, },
2929 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, },
2930 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
2933 static struct of_regulator_match ab8505_regulator_match[] = {
2934 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, },
2935 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, },
2936 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, },
2937 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, },
2938 { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, },
2939 { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, },
2940 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, },
2941 { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, },
2942 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, },
2943 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, },
2944 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, },
2945 { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, },
2946 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, },
2949 static struct of_regulator_match ab8540_regulator_match[] = {
2950 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, },
2951 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, },
2952 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, },
2953 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, },
2954 { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8540_LDO_AUX5, },
2955 { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8540_LDO_AUX6, },
2956 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, },
2957 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, },
2958 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, },
2959 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, },
2960 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, },
2961 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, },
2962 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, },
2963 { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, },
2966 static struct of_regulator_match ab9540_regulator_match[] = {
2967 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, },
2968 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, },
2969 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, },
2970 { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB9540_LDO_AUX4, },
2971 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, },
2972 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, },
2973 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, },
2974 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, },
2975 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, },
2976 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, },
2977 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, },
2981 struct ab8500_regulator_info *info;
2983 struct ab8500_reg_init *init;
2985 struct of_regulator_match *match;
2989 static void abx500_get_regulator_info(struct ab8500 *ab8500)
2991 if (is_ab9540(ab8500)) {
2992 abx500_regulator.info = ab9540_regulator_info;
2993 abx500_regulator.info_size = ARRAY_SIZE(ab9540_regulator_info);
2994 abx500_regulator.init = ab9540_reg_init;
2995 abx500_regulator.init_size = AB9540_NUM_REGULATOR_REGISTERS;
2996 abx500_regulator.match = ab9540_regulator_match;
2997 abx500_regulator.match_size = ARRAY_SIZE(ab9540_regulator_match);
2998 } else if (is_ab8505(ab8500)) {
2999 abx500_regulator.info = ab8505_regulator_info;
3000 abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info);
3001 abx500_regulator.init = ab8505_reg_init;
3002 abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS;
3003 abx500_regulator.match = ab8505_regulator_match;
3004 abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match);
3005 } else if (is_ab8540(ab8500)) {
3006 abx500_regulator.info = ab8540_regulator_info;
3007 abx500_regulator.info_size = ARRAY_SIZE(ab8540_regulator_info);
3008 abx500_regulator.init = ab8540_reg_init;
3009 abx500_regulator.init_size = AB8540_NUM_REGULATOR_REGISTERS;
3010 abx500_regulator.match = ab8540_regulator_match;
3011 abx500_regulator.match_size = ARRAY_SIZE(ab8540_regulator_match);
3013 abx500_regulator.info = ab8500_regulator_info;
3014 abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info);
3015 abx500_regulator.init = ab8500_reg_init;
3016 abx500_regulator.init_size = AB8500_NUM_REGULATOR_REGISTERS;
3017 abx500_regulator.match = ab8500_regulator_match;
3018 abx500_regulator.match_size = ARRAY_SIZE(ab8500_regulator_match);
3022 static int ab8500_regulator_init_registers(struct platform_device *pdev,
3023 int id, int mask, int value)
3025 struct ab8500_reg_init *reg_init = abx500_regulator.init;
3028 BUG_ON(value & ~mask);
3029 BUG_ON(mask & ~reg_init[id].mask);
3031 /* initialize register */
3032 err = abx500_mask_and_set_register_interruptible(
3039 "Failed to initialize 0x%02x, 0x%02x.\n",
3044 dev_vdbg(&pdev->dev,
3045 " init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
3053 static int ab8500_regulator_register(struct platform_device *pdev,
3054 struct regulator_init_data *init_data,
3055 int id, struct device_node *np)
3057 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3058 struct ab8500_regulator_info *info = NULL;
3059 struct regulator_config config = { };
3062 /* assign per-regulator data */
3063 info = &abx500_regulator.info[id];
3064 info->dev = &pdev->dev;
3066 config.dev = &pdev->dev;
3067 config.init_data = init_data;
3068 config.driver_data = info;
3069 config.of_node = np;
3071 /* fix for hardware before ab8500v2.0 */
3072 if (is_ab8500_1p1_or_earlier(ab8500)) {
3073 if (info->desc.id == AB8500_LDO_AUX3) {
3074 info->desc.n_voltages =
3075 ARRAY_SIZE(ldo_vauxn_voltages);
3076 info->desc.volt_table = ldo_vauxn_voltages;
3077 info->voltage_mask = 0xf;
3081 /* register regulator with framework */
3082 info->regulator = regulator_register(&info->desc, &config);
3083 if (IS_ERR(info->regulator)) {
3084 err = PTR_ERR(info->regulator);
3085 dev_err(&pdev->dev, "failed to register regulator %s\n",
3087 /* when we fail, un-register all earlier regulators */
3089 info = &abx500_regulator.info[id];
3090 regulator_unregister(info->regulator);
3099 ab8500_regulator_of_probe(struct platform_device *pdev,
3100 struct device_node *np)
3102 struct of_regulator_match *match = abx500_regulator.match;
3105 for (i = 0; i < abx500_regulator.info_size; i++) {
3106 err = ab8500_regulator_register(
3107 pdev, match[i].init_data, i, match[i].of_node);
3115 static int ab8500_regulator_probe(struct platform_device *pdev)
3117 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3118 struct device_node *np = pdev->dev.of_node;
3119 struct ab8500_platform_data *ppdata;
3120 struct ab8500_regulator_platform_data *pdata;
3124 dev_err(&pdev->dev, "null mfd parent\n");
3128 abx500_get_regulator_info(ab8500);
3131 err = of_regulator_match(&pdev->dev, np,
3132 abx500_regulator.match,
3133 abx500_regulator.match_size);
3136 "Error parsing regulator init data: %d\n", err);
3140 err = ab8500_regulator_of_probe(pdev, np);
3144 ppdata = dev_get_platdata(ab8500->dev);
3146 dev_err(&pdev->dev, "null parent pdata\n");
3150 pdata = ppdata->regulator;
3152 dev_err(&pdev->dev, "null pdata\n");
3156 /* make sure the platform data has the correct size */
3157 if (pdata->num_regulator != abx500_regulator.info_size) {
3158 dev_err(&pdev->dev, "Configuration error: size mismatch.\n");
3162 /* initialize debug (initial state is recorded with this call) */
3163 err = ab8500_regulator_debug_init(pdev);
3167 /* initialize registers */
3168 for (i = 0; i < pdata->num_reg_init; i++) {
3169 int id, mask, value;
3171 id = pdata->reg_init[i].id;
3172 mask = pdata->reg_init[i].mask;
3173 value = pdata->reg_init[i].value;
3175 /* check for configuration errors */
3176 BUG_ON(id >= abx500_regulator.init_size);
3178 err = ab8500_regulator_init_registers(pdev, id, mask, value);
3183 if (!is_ab8505(ab8500)) {
3184 /* register external regulators (before Vaux1, 2 and 3) */
3185 err = ab8500_ext_regulator_init(pdev);
3190 /* register all regulators */
3191 for (i = 0; i < abx500_regulator.info_size; i++) {
3192 err = ab8500_regulator_register(pdev, &pdata->regulator[i],
3201 static int ab8500_regulator_remove(struct platform_device *pdev)
3204 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3206 for (i = 0; i < abx500_regulator.info_size; i++) {
3207 struct ab8500_regulator_info *info = NULL;
3208 info = &abx500_regulator.info[i];
3210 dev_vdbg(rdev_get_dev(info->regulator),
3211 "%s-remove\n", info->desc.name);
3213 regulator_unregister(info->regulator);
3216 if (!is_ab8505(ab8500)) {
3217 /* remove external regulators (after Vaux1, 2 and 3) */
3218 err = ab8500_ext_regulator_exit(pdev);
3223 /* remove regulator debug */
3224 err = ab8500_regulator_debug_exit(pdev);
3231 static struct platform_driver ab8500_regulator_driver = {
3232 .probe = ab8500_regulator_probe,
3233 .remove = ab8500_regulator_remove,
3235 .name = "ab8500-regulator",
3236 .owner = THIS_MODULE,
3240 static int __init ab8500_regulator_init(void)
3244 ret = platform_driver_register(&ab8500_regulator_driver);
3246 pr_err("Failed to register ab8500 regulator: %d\n", ret);
3250 subsys_initcall(ab8500_regulator_init);
3252 static void __exit ab8500_regulator_exit(void)
3254 platform_driver_unregister(&ab8500_regulator_driver);
3256 module_exit(ab8500_regulator_exit);
3258 MODULE_LICENSE("GPL v2");
3259 MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
3260 MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
3261 MODULE_AUTHOR("Daniel Willerud <daniel.willerud@stericsson.com>");
3262 MODULE_DESCRIPTION("Regulator Driver for ST-Ericsson AB8500 Mixed-Sig PMIC");
3263 MODULE_ALIAS("platform:ab8500-regulator");