diff options
| -rw-r--r-- | drivers/regulator/tps65912-regulator.c | 39 |
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 | ||
| 121 | static 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 | |||
| 121 | static int tps65912_get_range(struct tps65912_reg *pmic, int id) | 130 | static 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 | ||
| 187 | static 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 | |||
| 201 | static int tps65912_get_ctrl_register(int id) | 196 | static 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 | ||
| 462 | static int tps65912_probe(struct platform_device *pdev) | 455 | static 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); |
