summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-07 09:52:12 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-08 07:15:55 +0800
commit0bdc81e4e944781a2bcc971f9e3cf24ac7030939 (patch)
treedb226fc302866c2d24d8c0df02e02607cf8f31b4 /drivers/regulator
parent61663171bea0ccb499f0818234c5be7ea6c4c791 (diff)
downloadblackbird-op-linux-0bdc81e4e944781a2bcc971f9e3cf24ac7030939.tar.gz
blackbird-op-linux-0bdc81e4e944781a2bcc971f9e3cf24ac7030939.zip
regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_linear
Properly handle the case if the specified min_uV is less than the voltage given by the lowest selector. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7584a74eec8a..09a737c868b5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2050,6 +2050,9 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
return -EINVAL;
}
+ if (min_uV < rdev->desc->min_uV)
+ min_uV = rdev->desc->min_uV;
+
ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step);
if (ret < 0)
return ret;
OpenPOWER on IntegriCloud