aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-09-01 08:50:23 -0400
committerMark Brown <broonie@linaro.org>2013-09-01 08:50:23 -0400
commita584862221426f461f56674d30fe0d712ee63d00 (patch)
tree6bc7c86a4205c5b4459e47f359f881fd6e88b15f
parent2d31b15b868b5369eb326464e6634ea5afba7a44 (diff)
parentfba6583be610dd83369ecba88d7ee84527d00cf1 (diff)
Merge remote-tracking branch 'regulator/topic/tps65912' into regulator-next
-rw-r--r--drivers/regulator/tps65912-regulator.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 17e994e47dc1..281e52ac64ba 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -118,6 +118,15 @@ struct tps65912_reg {
118 int eco_reg; 118 int eco_reg;
119}; 119};
120 120
121static const struct regulator_linear_range tps65912_ldo_ranges[] = {
122 { .min_uV = 800000, .max_uV = 1600000, .min_sel = 0, .max_sel = 32,
123 .uV_step = 25000 },
124 { .min_uV = 1650000, .max_uV = 3000000, .min_sel = 33, .max_sel = 60,
125 .uV_step = 50000 },
126 { .min_uV = 3100000, .max_uV = 3300000, .min_sel = 61, .max_sel = 63,
127 .uV_step = 100000 },
128};
129
121static int tps65912_get_range(struct tps65912_reg *pmic, int id) 130static int tps65912_get_range(struct tps65912_reg *pmic, int id)
122{ 131{
123 struct tps65912 *mfd = pmic->mfd; 132 struct tps65912 *mfd = pmic->mfd;
@@ -184,20 +193,6 @@ static unsigned long tps65912_vsel_to_uv_range3(u8 vsel)
184 return uv; 193 return uv;
185} 194}
186 195
187static unsigned long tps65912_vsel_to_uv_ldo(u8 vsel)
188{
189 unsigned long uv = 0;
190
191 if (vsel <= 32)
192 uv = ((vsel * 25000) + 800000);
193 else if (vsel > 32 && vsel <= 60)
194 uv = (((vsel - 32) * 50000) + 1600000);
195 else if (vsel > 60)
196 uv = (((vsel - 60) * 100000) + 3000000);
197
198 return uv;
199}
200
201static int tps65912_get_ctrl_register(int id) 196static int tps65912_get_ctrl_register(int id)
202{ 197{
203 if (id >= TPS65912_REG_DCDC1 && id <= TPS65912_REG_LDO4) 198 if (id >= TPS65912_REG_DCDC1 && id <= TPS65912_REG_LDO4)
@@ -376,9 +371,6 @@ static int tps65912_list_voltage(struct regulator_dev *dev, unsigned selector)
376 struct tps65912_reg *pmic = rdev_get_drvdata(dev); 371 struct tps65912_reg *pmic = rdev_get_drvdata(dev);
377 int range, voltage = 0, id = rdev_get_id(dev); 372 int range, voltage = 0, id = rdev_get_id(dev);
378 373
379 if (id >= TPS65912_REG_LDO1 && id <= TPS65912_REG_LDO10)
380 return tps65912_vsel_to_uv_ldo(selector);
381
382 if (id > TPS65912_REG_DCDC4) 374 if (id > TPS65912_REG_DCDC4)
383 return -EINVAL; 375 return -EINVAL;
384 376
@@ -456,7 +448,8 @@ static struct regulator_ops tps65912_ops_ldo = {
456 .disable = tps65912_reg_disable, 448 .disable = tps65912_reg_disable,
457 .get_voltage_sel = tps65912_get_voltage_sel, 449 .get_voltage_sel = tps65912_get_voltage_sel,
458 .set_voltage_sel = tps65912_set_voltage_sel, 450 .set_voltage_sel = tps65912_set_voltage_sel,
459 .list_voltage = tps65912_list_voltage, 451 .list_voltage = regulator_list_voltage_linear_range,
452 .map_voltage = regulator_map_voltage_linear_range,
460}; 453};
461 454
462static int tps65912_probe(struct platform_device *pdev) 455static int tps65912_probe(struct platform_device *pdev)
@@ -495,8 +488,14 @@ static int tps65912_probe(struct platform_device *pdev)
495 pmic->desc[i].name = info->name; 488 pmic->desc[i].name = info->name;
496 pmic->desc[i].id = i; 489 pmic->desc[i].id = i;
497 pmic->desc[i].n_voltages = 64; 490 pmic->desc[i].n_voltages = 64;
498 pmic->desc[i].ops = (i > TPS65912_REG_DCDC4 ? 491 if (i > TPS65912_REG_DCDC4) {
499 &tps65912_ops_ldo : &tps65912_ops_dcdc); 492 pmic->desc[i].ops = &tps65912_ops_ldo;
493 pmic->desc[i].linear_ranges = tps65912_ldo_ranges;
494 pmic->desc[i].n_linear_ranges =
495 ARRAY_SIZE(tps65912_ldo_ranges);
496 } else {
497 pmic->desc[i].ops = &tps65912_ops_dcdc;
498 }
500 pmic->desc[i].type = REGULATOR_VOLTAGE; 499 pmic->desc[i].type = REGULATOR_VOLTAGE;
501 pmic->desc[i].owner = THIS_MODULE; 500 pmic->desc[i].owner = THIS_MODULE;
502 range = tps65912_get_range(pmic, i); 501 range = tps65912_get_range(pmic, i);