diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-07-03 09:19:33 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-07-03 21:18:34 +0200 |
commit | 844e6901df45d2021d1f81b25e61159b5af2687f (patch) | |
tree | b63d4ec57222a331eb21cd052a24063312636004 /drivers/regulator/tps65217-regulator.c | |
parent | regulator: tps62360: Convert to regulator_set_voltage_time_sel() (diff) | |
download | linux-844e6901df45d2021d1f81b25e61159b5af2687f.tar.xz linux-844e6901df45d2021d1f81b25e61159b5af2687f.zip |
regulator: tps65217: Fix voltage boundary checking in tps65217_pmic_map_voltage
It is ok to request voltage with min_uV < tps->info[rid]->min_uV and
max_uV > tps->info[rid]->max_uV.
The equation we used in uv_to_vsel() does not allow
min_uV < tps->info[rid]->min_uV, otherwise it returns negative selector.
So we need to set min_uV = tps->info[rid]->min_uV if
min_uV < tps->info[rid]->min_uV.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps65217-regulator.c')
-rw-r--r-- | drivers/regulator/tps65217-regulator.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index 0a3df5b7c904..f7d0495b003e 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c @@ -206,10 +206,10 @@ static int tps65217_pmic_map_voltage(struct regulator_dev *dev, if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4) return -EINVAL; - if (min_uV < tps->info[rid]->min_uV || min_uV > tps->info[rid]->max_uV) - return -EINVAL; + if (min_uV < tps->info[rid]->min_uV) + min_uV = tps->info[rid]->min_uV; - if (max_uV < tps->info[rid]->min_uV || max_uV > tps->info[rid]->max_uV) + if (max_uV < tps->info[rid]->min_uV || min_uV > tps->info[rid]->max_uV) return -EINVAL; ret = tps->info[rid]->uv_to_vsel(min_uV, &sel); |