Skip to content

Commit

Permalink
regulator: twl: Convert twl4030ldo_ops to get_voltage_sel
Browse files Browse the repository at this point in the history
This fixes an inconsistent behavior between list_voltage() and get_voltage()
because current implementation of get_voltage() does not check the case
IS_UNSUP() is true.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 1, 2013
1 parent 2730fd8 commit 6949fbe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/regulator/twl-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,24 +471,23 @@ twl4030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
selector);
}

static int twl4030ldo_get_voltage(struct regulator_dev *rdev)
static int twl4030ldo_get_voltage_sel(struct regulator_dev *rdev)
{
struct twlreg_info *info = rdev_get_drvdata(rdev);
int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER,
VREG_VOLTAGE);
int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE);

if (vsel < 0)
return vsel;

vsel &= info->table_len - 1;
return LDO_MV(info->table[vsel]) * 1000;
return vsel;
}

static struct regulator_ops twl4030ldo_ops = {
.list_voltage = twl4030ldo_list_voltage,

.set_voltage_sel = twl4030ldo_set_voltage_sel,
.get_voltage = twl4030ldo_get_voltage,
.get_voltage_sel = twl4030ldo_get_voltage_sel,

.enable = twl4030reg_enable,
.disable = twl4030reg_disable,
Expand Down

0 comments on commit 6949fbe

Please sign in to comment.