aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-11 21:44:17 +0900
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-11 21:44:17 +0900
commitb17fc86cc5e8fbfd1d18765f6463d1989c59f9c6 (patch)
tree8e0b967c8b63ecf085b762d9c9b1015f063e5759 /drivers/regulator/core.c
parentd1e7de3007c6e34c5e6d5e1b707b5aba4a1cd57f (diff)
parente1b0144f9997d3d52c46785143699d82dd525f1d (diff)
Merge branch 'topic/min' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-change
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 59e08633372..1c8ff8ce5c5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1919,6 +1919,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);
}
@@ -2142,6 +2146,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)