summaryrefslogtreecommitdiff
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 07:43:00 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 07:43:00 +0400
commitadca48f7c61c53708a1f1ed567e0447ccb2b3b96 (patch)
treed1860df280202eb86a625bd3400eab02b819100a /drivers/regulator/core.c
parent9e218670737e01ef37bd1ac400482462049dfeff (diff)
parente1b0144f9997d3d52c46785143699d82dd525f1d (diff)
downloadlinux-adca48f7c61c53708a1f1ed567e0447ccb2b3b96.tar.xz
Merge remote-tracking branch 'regulator/topic/min' into regulator-next
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 35c149bb2ad3..cd1b201c91e2 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1924,6 +1924,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
{
if (selector >= rdev->desc->n_voltages)
return -EINVAL;
+ if (selector < rdev->desc->linear_min_sel)
+ return 0;
+
+ selector -= rdev->desc->linear_min_sel;
return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
}
@@ -2152,6 +2156,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
if (ret < 0)
return ret;
+ ret += rdev->desc->linear_min_sel;
+
/* Map back into a voltage to verify we're still in bounds */
voltage = rdev->desc->ops->list_voltage(rdev, ret);
if (voltage < min_uV || voltage > max_uV)