aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-ldo.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-09 16:53:32 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-12 06:11:40 -0400
commitd31e954e07c838f44183addeecc7115d25e83266 (patch)
tree62a28b8aa96811b05caa7ce892f0aade02338c78 /drivers/regulator/wm831x-ldo.c
parentbca7bbfff37808d56355bbcf0ceec34f0cc6c85d (diff)
regulator: wm831x: Convert to regulator_list_voltage_linear()
Only the alive LDOs can actually use this as all the other regulators have two linear ranges. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r--drivers/regulator/wm831x-ldo.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 9fe71dc20c3f..aa1f8b3fbe16 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -626,15 +626,6 @@ static struct platform_driver wm831x_aldo_driver = {
626 626
627#define WM831X_ALIVE_LDO_MAX_SELECTOR 0xf 627#define WM831X_ALIVE_LDO_MAX_SELECTOR 0xf
628 628
629static int wm831x_alive_ldo_list_voltage(struct regulator_dev *rdev,
630 unsigned int selector)
631{
632 /* 0.8-1.55V in 50mV steps */
633 if (selector <= WM831X_ALIVE_LDO_MAX_SELECTOR)
634 return 800000 + (selector * 50000);
635 return -EINVAL;
636}
637
638static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev, 629static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev,
639 int reg, 630 int reg,
640 int min_uV, int max_uV, 631 int min_uV, int max_uV,
@@ -646,7 +637,7 @@ static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev,
646 637
647 vsel = (min_uV - 800000) / 50000; 638 vsel = (min_uV - 800000) / 50000;
648 639
649 ret = wm831x_alive_ldo_list_voltage(rdev, vsel); 640 ret = regulator_list_voltage_linear(rdev, vsel);
650 if (ret < 0) 641 if (ret < 0)
651 return ret; 642 return ret;
652 if (ret < min_uV || ret > max_uV) 643 if (ret < min_uV || ret > max_uV)
@@ -696,7 +687,7 @@ static int wm831x_alive_ldo_get_status(struct regulator_dev *rdev)
696} 687}
697 688
698static struct regulator_ops wm831x_alive_ldo_ops = { 689static struct regulator_ops wm831x_alive_ldo_ops = {
699 .list_voltage = wm831x_alive_ldo_list_voltage, 690 .list_voltage = regulator_list_voltage_linear,
700 .get_voltage_sel = regulator_get_voltage_sel_regmap, 691 .get_voltage_sel = regulator_get_voltage_sel_regmap,
701 .set_voltage = wm831x_alive_ldo_set_voltage, 692 .set_voltage = wm831x_alive_ldo_set_voltage,
702 .set_suspend_voltage = wm831x_alive_ldo_set_suspend_voltage, 693 .set_suspend_voltage = wm831x_alive_ldo_set_suspend_voltage,
@@ -758,6 +749,8 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
758 ldo->desc.vsel_mask = WM831X_LDO11_ON_VSEL_MASK; 749 ldo->desc.vsel_mask = WM831X_LDO11_ON_VSEL_MASK;
759 ldo->desc.enable_reg = WM831X_LDO_ENABLE; 750 ldo->desc.enable_reg = WM831X_LDO_ENABLE;
760 ldo->desc.enable_mask = 1 << id; 751 ldo->desc.enable_mask = 1 << id;
752 ldo->desc.min_uV = 800000;
753 ldo->desc.uV_step = 50000;
761 754
762 config.dev = pdev->dev.parent; 755 config.dev = pdev->dev.parent;
763 if (pdata) 756 if (pdata)