summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin2012-06-07 03:52:12 +0200
committerMark Brown2012-06-08 01:15:55 +0200
commit0bdc81e4e944781a2bcc971f9e3cf24ac7030939 (patch)
treedb226fc302866c2d24d8c0df02e02607cf8f31b4 /drivers/regulator
parentregulator: max8649: fix missing regmap in rdev (diff)
downloadkernel-qcow2-linux-0bdc81e4e944781a2bcc971f9e3cf24ac7030939.tar.gz
kernel-qcow2-linux-0bdc81e4e944781a2bcc971f9e3cf24ac7030939.tar.xz
kernel-qcow2-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;