aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps6507x-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-05-19 22:39:12 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-03 08:25:02 -0400
commit055917ac560a4185b75511b512f2db941b984672 (patch)
treebb155515aecc99041f473935c7c10a3b47ff16d0 /drivers/regulator/tps6507x-regulator.c
parentc55979b7bd78b8ee7999bcf5211bf0243260c675 (diff)
regulator: tps6507x: Use regulator_list_voltage_table()
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps6507x-regulator.c')
-rw-r--r--drivers/regulator/tps6507x-regulator.c100
1 files changed, 43 insertions, 57 deletions
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index da38be1016aa..c771e1077cc1 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -43,50 +43,50 @@
43/* Number of total regulators available */ 43/* Number of total regulators available */
44#define TPS6507X_NUM_REGULATOR (TPS6507X_NUM_DCDC + TPS6507X_NUM_LDO) 44#define TPS6507X_NUM_REGULATOR (TPS6507X_NUM_DCDC + TPS6507X_NUM_LDO)
45 45
46/* Supported voltage values for regulators (in milliVolts) */ 46/* Supported voltage values for regulators (in microVolts) */
47static const u16 VDCDCx_VSEL_table[] = { 47static const unsigned int VDCDCx_VSEL_table[] = {
48 725, 750, 775, 800, 48 725000, 750000, 775000, 800000,
49 825, 850, 875, 900, 49 825000, 850000, 875000, 900000,
50 925, 950, 975, 1000, 50 925000, 950000, 975000, 1000000,
51 1025, 1050, 1075, 1100, 51 1025000, 1050000, 1075000, 1100000,
52 1125, 1150, 1175, 1200, 52 1125000, 1150000, 1175000, 1200000,
53 1225, 1250, 1275, 1300, 53 1225000, 1250000, 1275000, 1300000,
54 1325, 1350, 1375, 1400, 54 1325000, 1350000, 1375000, 1400000,
55 1425, 1450, 1475, 1500, 55 1425000, 1450000, 1475000, 1500000,
56 1550, 1600, 1650, 1700, 56 1550000, 1600000, 1650000, 1700000,
57 1750, 1800, 1850, 1900, 57 1750000, 1800000, 1850000, 1900000,
58 1950, 2000, 2050, 2100, 58 1950000, 2000000, 2050000, 2100000,
59 2150, 2200, 2250, 2300, 59 2150000, 2200000, 2250000, 2300000,
60 2350, 2400, 2450, 2500, 60 2350000, 2400000, 2450000, 2500000,
61 2550, 2600, 2650, 2700, 61 2550000, 2600000, 2650000, 2700000,
62 2750, 2800, 2850, 2900, 62 2750000, 2800000, 2850000, 2900000,
63 3000, 3100, 3200, 3300, 63 3000000, 3100000, 3200000, 3300000,
64}; 64};
65 65
66static const u16 LDO1_VSEL_table[] = { 66static const unsigned int LDO1_VSEL_table[] = {
67 1000, 1100, 1200, 1250, 67 1000000, 1100000, 1200000, 1250000,
68 1300, 1350, 1400, 1500, 68 1300000, 1350000, 1400000, 1500000,
69 1600, 1800, 2500, 2750, 69 1600000, 1800000, 2500000, 2750000,
70 2800, 3000, 3100, 3300, 70 2800000, 3000000, 3100000, 3300000,
71}; 71};
72 72
73static const u16 LDO2_VSEL_table[] = { 73static const unsigned int LDO2_VSEL_table[] = {
74 725, 750, 775, 800, 74 725000, 750000, 775000, 800000,
75 825, 850, 875, 900, 75 825000, 850000, 875000, 900000,
76 925, 950, 975, 1000, 76 925000, 950000, 975000, 1000000,
77 1025, 1050, 1075, 1100, 77 1025000, 1050000, 1075000, 1100000,
78 1125, 1150, 1175, 1200, 78 1125000, 1150000, 1175000, 1200000,
79 1225, 1250, 1275, 1300, 79 1225000, 1250000, 1275000, 1300000,
80 1325, 1350, 1375, 1400, 80 1325000, 1350000, 1375000, 1400000,
81 1425, 1450, 1475, 1500, 81 1425000, 1450000, 1475000, 1500000,
82 1550, 1600, 1650, 1700, 82 1550000, 1600000, 1650000, 1700000,
83 1750, 1800, 1850, 1900, 83 1750000, 1800000, 1850000, 1900000,
84 1950, 2000, 2050, 2100, 84 1950000, 2000000, 2050000, 2100000,
85 2150, 2200, 2250, 2300, 85 2150000, 2200000, 2250000, 2300000,
86 2350, 2400, 2450, 2500, 86 2350000, 2400000, 2450000, 2500000,
87 2550, 2600, 2650, 2700, 87 2550000, 2600000, 2650000, 2700000,
88 2750, 2800, 2850, 2900, 88 2750000, 2800000, 2850000, 2900000,
89 3000, 3100, 3200, 3300, 89 3000000, 3100000, 3200000, 3300000,
90}; 90};
91 91
92struct tps_info { 92struct tps_info {
@@ -94,7 +94,7 @@ struct tps_info {
94 unsigned min_uV; 94 unsigned min_uV;
95 unsigned max_uV; 95 unsigned max_uV;
96 u8 table_len; 96 u8 table_len;
97 const u16 *table; 97 const unsigned int *table;
98 98
99 /* Does DCDC high or the low register defines output voltage? */ 99 /* Does DCDC high or the low register defines output voltage? */
100 bool defdcdc_default; 100 bool defdcdc_default;
@@ -375,28 +375,13 @@ static int tps6507x_pmic_set_voltage_sel(struct regulator_dev *dev,
375 return tps6507x_pmic_reg_write(tps, reg, data); 375 return tps6507x_pmic_reg_write(tps, reg, data);
376} 376}
377 377
378static int tps6507x_pmic_list_voltage(struct regulator_dev *dev,
379 unsigned selector)
380{
381 struct tps6507x_pmic *tps = rdev_get_drvdata(dev);
382 int rid = rdev_get_id(dev);
383
384 if (rid < TPS6507X_DCDC_1 || rid > TPS6507X_LDO_2)
385 return -EINVAL;
386
387 if (selector >= tps->info[rid]->table_len)
388 return -EINVAL;
389 else
390 return tps->info[rid]->table[selector] * 1000;
391}
392
393static struct regulator_ops tps6507x_pmic_ops = { 378static struct regulator_ops tps6507x_pmic_ops = {
394 .is_enabled = tps6507x_pmic_is_enabled, 379 .is_enabled = tps6507x_pmic_is_enabled,
395 .enable = tps6507x_pmic_enable, 380 .enable = tps6507x_pmic_enable,
396 .disable = tps6507x_pmic_disable, 381 .disable = tps6507x_pmic_disable,
397 .get_voltage_sel = tps6507x_pmic_get_voltage_sel, 382 .get_voltage_sel = tps6507x_pmic_get_voltage_sel,
398 .set_voltage_sel = tps6507x_pmic_set_voltage_sel, 383 .set_voltage_sel = tps6507x_pmic_set_voltage_sel,
399 .list_voltage = tps6507x_pmic_list_voltage, 384 .list_voltage = regulator_list_voltage_table,
400}; 385};
401 386
402static __devinit int tps6507x_pmic_probe(struct platform_device *pdev) 387static __devinit int tps6507x_pmic_probe(struct platform_device *pdev)
@@ -449,6 +434,7 @@ static __devinit int tps6507x_pmic_probe(struct platform_device *pdev)
449 tps->desc[i].name = info->name; 434 tps->desc[i].name = info->name;
450 tps->desc[i].id = i; 435 tps->desc[i].id = i;
451 tps->desc[i].n_voltages = info->table_len; 436 tps->desc[i].n_voltages = info->table_len;
437 tps->desc[i].volt_table = info->table;
452 tps->desc[i].ops = &tps6507x_pmic_ops; 438 tps->desc[i].ops = &tps6507x_pmic_ops;
453 tps->desc[i].type = REGULATOR_VOLTAGE; 439 tps->desc[i].type = REGULATOR_VOLTAGE;
454 tps->desc[i].owner = THIS_MODULE; 440 tps->desc[i].owner = THIS_MODULE;