diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-06-21 06:48:00 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-22 05:13:31 -0400 |
commit | d9fe28f9621be70514aeacd2b4b3640e986d4cb1 (patch) | |
tree | 7c907cd78ec1b44281eb66d635779045f0126f41 /drivers | |
parent | f6442aa0b503f944907b869659dd27756c809488 (diff) |
regulator: tps65910: Convert to regulator_list_voltage_table
Convert tps65910_ops and tps65910_ops_vdd3 to regulator_list_voltage_table.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/tps65910-regulator.c | 94 |
1 files changed, 40 insertions, 54 deletions
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index edeaa2c770b9..66da87cc0879 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -31,62 +31,62 @@ | |||
31 | TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 | \ | 31 | TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 | \ |
32 | TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP) | 32 | TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP) |
33 | 33 | ||
34 | /* supported VIO voltages in millivolts */ | 34 | /* supported VIO voltages in microvolts */ |
35 | static const u16 VIO_VSEL_table[] = { | 35 | static const unsigned int VIO_VSEL_table[] = { |
36 | 1500, 1800, 2500, 3300, | 36 | 1500000, 1800000, 2500000, 3300000, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | /* VSEL tables for TPS65910 specific LDOs and dcdc's */ | 39 | /* VSEL tables for TPS65910 specific LDOs and dcdc's */ |
40 | 40 | ||
41 | /* supported VDD3 voltages in millivolts */ | 41 | /* supported VDD3 voltages in microvolts */ |
42 | static const u16 VDD3_VSEL_table[] = { | 42 | static const unsigned int VDD3_VSEL_table[] = { |
43 | 5000, | 43 | 5000000, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /* supported VDIG1 voltages in millivolts */ | 46 | /* supported VDIG1 voltages in microvolts */ |
47 | static const u16 VDIG1_VSEL_table[] = { | 47 | static const unsigned int VDIG1_VSEL_table[] = { |
48 | 1200, 1500, 1800, 2700, | 48 | 1200000, 1500000, 1800000, 2700000, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /* supported VDIG2 voltages in millivolts */ | 51 | /* supported VDIG2 voltages in microvolts */ |
52 | static const u16 VDIG2_VSEL_table[] = { | 52 | static const unsigned int VDIG2_VSEL_table[] = { |
53 | 1000, 1100, 1200, 1800, | 53 | 1000000, 1100000, 1200000, 1800000, |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /* supported VPLL voltages in millivolts */ | 56 | /* supported VPLL voltages in microvolts */ |
57 | static const u16 VPLL_VSEL_table[] = { | 57 | static const unsigned int VPLL_VSEL_table[] = { |
58 | 1000, 1100, 1800, 2500, | 58 | 1000000, 1100000, 1800000, 2500000, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | /* supported VDAC voltages in millivolts */ | 61 | /* supported VDAC voltages in microvolts */ |
62 | static const u16 VDAC_VSEL_table[] = { | 62 | static const unsigned int VDAC_VSEL_table[] = { |
63 | 1800, 2600, 2800, 2850, | 63 | 1800000, 2600000, 2800000, 2850000, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | /* supported VAUX1 voltages in millivolts */ | 66 | /* supported VAUX1 voltages in microvolts */ |
67 | static const u16 VAUX1_VSEL_table[] = { | 67 | static const unsigned int VAUX1_VSEL_table[] = { |
68 | 1800, 2500, 2800, 2850, | 68 | 1800000, 2500000, 2800000, 2850000, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* supported VAUX2 voltages in millivolts */ | 71 | /* supported VAUX2 voltages in microvolts */ |
72 | static const u16 VAUX2_VSEL_table[] = { | 72 | static const unsigned int VAUX2_VSEL_table[] = { |
73 | 1800, 2800, 2900, 3300, | 73 | 1800000, 2800000, 2900000, 3300000, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* supported VAUX33 voltages in millivolts */ | 76 | /* supported VAUX33 voltages in microvolts */ |
77 | static const u16 VAUX33_VSEL_table[] = { | 77 | static const unsigned int VAUX33_VSEL_table[] = { |
78 | 1800, 2000, 2800, 3300, | 78 | 1800000, 2000000, 2800000, 3300000, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /* supported VMMC voltages in millivolts */ | 81 | /* supported VMMC voltages in microvolts */ |
82 | static const u16 VMMC_VSEL_table[] = { | 82 | static const unsigned int VMMC_VSEL_table[] = { |
83 | 1800, 2800, 3000, 3300, | 83 | 1800000, 2800000, 3000000, 3300000, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct tps_info { | 86 | struct tps_info { |
87 | const char *name; | 87 | const char *name; |
88 | u8 n_voltages; | 88 | u8 n_voltages; |
89 | const u16 *voltage_table; | 89 | const unsigned int *voltage_table; |
90 | int enable_time_us; | 90 | int enable_time_us; |
91 | }; | 91 | }; |
92 | 92 | ||
@@ -559,7 +559,7 @@ static int tps65910_get_voltage_sel(struct regulator_dev *dev) | |||
559 | 559 | ||
560 | static int tps65910_get_voltage_vdd3(struct regulator_dev *dev) | 560 | static int tps65910_get_voltage_vdd3(struct regulator_dev *dev) |
561 | { | 561 | { |
562 | return 5 * 1000 * 1000; | 562 | return dev->desc->volt_table[0]; |
563 | } | 563 | } |
564 | 564 | ||
565 | static int tps65911_get_voltage_sel(struct regulator_dev *dev) | 565 | static int tps65911_get_voltage_sel(struct regulator_dev *dev) |
@@ -718,23 +718,6 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev, | |||
718 | return volt * 100 * mult; | 718 | return volt * 100 * mult; |
719 | } | 719 | } |
720 | 720 | ||
721 | static int tps65910_list_voltage(struct regulator_dev *dev, | ||
722 | unsigned selector) | ||
723 | { | ||
724 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); | ||
725 | int id = rdev_get_id(dev), voltage; | ||
726 | |||
727 | if (id < TPS65910_REG_VIO || id > TPS65910_REG_VMMC) | ||
728 | return -EINVAL; | ||
729 | |||
730 | if (selector >= pmic->info[id]->n_voltages) | ||
731 | return -EINVAL; | ||
732 | else | ||
733 | voltage = pmic->info[id]->voltage_table[selector] * 1000; | ||
734 | |||
735 | return voltage; | ||
736 | } | ||
737 | |||
738 | static int tps65911_list_voltage(struct regulator_dev *dev, unsigned selector) | 721 | static int tps65911_list_voltage(struct regulator_dev *dev, unsigned selector) |
739 | { | 722 | { |
740 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); | 723 | struct tps65910_reg *pmic = rdev_get_drvdata(dev); |
@@ -766,7 +749,7 @@ static int tps65911_list_voltage(struct regulator_dev *dev, unsigned selector) | |||
766 | step_mv = 100; | 749 | step_mv = 100; |
767 | break; | 750 | break; |
768 | case TPS65910_REG_VIO: | 751 | case TPS65910_REG_VIO: |
769 | return pmic->info[id]->voltage_table[selector] * 1000; | 752 | return pmic->info[id]->voltage_table[selector]; |
770 | default: | 753 | default: |
771 | return -EINVAL; | 754 | return -EINVAL; |
772 | } | 755 | } |
@@ -796,7 +779,7 @@ static struct regulator_ops tps65910_ops_vdd3 = { | |||
796 | .set_mode = tps65910_set_mode, | 779 | .set_mode = tps65910_set_mode, |
797 | .get_mode = tps65910_get_mode, | 780 | .get_mode = tps65910_get_mode, |
798 | .get_voltage = tps65910_get_voltage_vdd3, | 781 | .get_voltage = tps65910_get_voltage_vdd3, |
799 | .list_voltage = tps65910_list_voltage, | 782 | .list_voltage = regulator_list_voltage_table, |
800 | }; | 783 | }; |
801 | 784 | ||
802 | static struct regulator_ops tps65910_ops = { | 785 | static struct regulator_ops tps65910_ops = { |
@@ -808,7 +791,7 @@ static struct regulator_ops tps65910_ops = { | |||
808 | .get_mode = tps65910_get_mode, | 791 | .get_mode = tps65910_get_mode, |
809 | .get_voltage_sel = tps65910_get_voltage_sel, | 792 | .get_voltage_sel = tps65910_get_voltage_sel, |
810 | .set_voltage_sel = tps65910_set_voltage_sel, | 793 | .set_voltage_sel = tps65910_set_voltage_sel, |
811 | .list_voltage = tps65910_list_voltage, | 794 | .list_voltage = regulator_list_voltage_table, |
812 | }; | 795 | }; |
813 | 796 | ||
814 | static struct regulator_ops tps65911_ops = { | 797 | static struct regulator_ops tps65911_ops = { |
@@ -1165,15 +1148,18 @@ static __devinit int tps65910_probe(struct platform_device *pdev) | |||
1165 | } else if (i == TPS65910_REG_VDD3) { | 1148 | } else if (i == TPS65910_REG_VDD3) { |
1166 | if (tps65910_chip_id(tps65910) == TPS65910) { | 1149 | if (tps65910_chip_id(tps65910) == TPS65910) { |
1167 | pmic->desc[i].ops = &tps65910_ops_vdd3; | 1150 | pmic->desc[i].ops = &tps65910_ops_vdd3; |
1151 | pmic->desc[i].volt_table = info->voltage_table; | ||
1168 | } else { | 1152 | } else { |
1169 | pmic->desc[i].ops = &tps65910_ops_dcdc; | 1153 | pmic->desc[i].ops = &tps65910_ops_dcdc; |
1170 | pmic->desc[i].ramp_delay = 5000; | 1154 | pmic->desc[i].ramp_delay = 5000; |
1171 | } | 1155 | } |
1172 | } else { | 1156 | } else { |
1173 | if (tps65910_chip_id(tps65910) == TPS65910) | 1157 | if (tps65910_chip_id(tps65910) == TPS65910) { |
1174 | pmic->desc[i].ops = &tps65910_ops; | 1158 | pmic->desc[i].ops = &tps65910_ops; |
1175 | else | 1159 | pmic->desc[i].volt_table = info->voltage_table; |
1160 | } else { | ||
1176 | pmic->desc[i].ops = &tps65911_ops; | 1161 | pmic->desc[i].ops = &tps65911_ops; |
1162 | } | ||
1177 | } | 1163 | } |
1178 | 1164 | ||
1179 | err = tps65910_set_ext_sleep_config(pmic, i, | 1165 | err = tps65910_set_ext_sleep_config(pmic, i, |