summaryrefslogtreecommitdiff
path: root/drivers/regulator/tps51632-regulator.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 12:43:00 +0900
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 12:43:00 +0900
commitadca48f7c61c53708a1f1ed567e0447ccb2b3b96 (patch)
treed1860df280202eb86a625bd3400eab02b819100a /drivers/regulator/tps51632-regulator.c
parent9e218670737e01ef37bd1ac400482462049dfeff (diff)
parente1b0144f9997d3d52c46785143699d82dd525f1d (diff)
Merge remote-tracking branch 'regulator/topic/min' into regulator-next
Diffstat (limited to 'drivers/regulator/tps51632-regulator.c')
-rw-r--r--drivers/regulator/tps51632-regulator.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index a9c3a4a6cca0..523b1e5e0b4c 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -106,29 +106,23 @@ static int tps51632_dcdc_get_voltage_sel(struct regulator_dev *rdev)
}
vsel = data & TPS51632_VOUT_MASK;
-
- if (vsel < TPS51632_MIN_VSEL)
- return 0;
- else
- return vsel - TPS51632_MIN_VSEL;
+ return vsel;
}
static int tps51632_dcdc_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
struct tps51632_chip *tps = rdev_get_drvdata(rdev);
- int vsel;
int ret;
unsigned int reg = TPS51632_VOLTAGE_SELECT_REG;
if (tps->enable_pwm_dvfs)
reg = TPS51632_VOLTAGE_BASE_REG;
- vsel = selector + TPS51632_MIN_VSEL;
- if (vsel > TPS51632_MAX_VSEL)
+ if (selector > TPS51632_MAX_VSEL)
return -EINVAL;
- ret = regmap_write(tps->regmap, TPS51632_VOLTAGE_SELECT_REG, vsel);
+ ret = regmap_write(tps->regmap, reg, selector);
if (ret < 0)
dev_err(tps->dev, "reg write failed, err %d\n", ret);
return ret;
@@ -254,7 +248,8 @@ static int tps51632_probe(struct i2c_client *client,
tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;
tps->desc.min_uV = TPS51632_MIN_VOLATGE;
tps->desc.uV_step = TPS51632_VOLATGE_STEP_10mV;
- tps->desc.n_voltages = (TPS51632_MAX_VSEL - TPS51632_MIN_VSEL) + 1;
+ tps->desc.linear_min_sel = TPS51632_MIN_VSEL;
+ tps->desc.n_voltages = TPS51632_MAX_VSEL + 1;
tps->desc.ops = &tps51632_dcdc_ops;
tps->desc.type = REGULATOR_VOLTAGE;
tps->desc.owner = THIS_MODULE;