aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 22:43:00 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 22:43:00 -0500
commitadca48f7c61c53708a1f1ed567e0447ccb2b3b96 (patch)
treed1860df280202eb86a625bd3400eab02b819100a /drivers/regulator/core.c
parent9e218670737e01ef37bd1ac400482462049dfeff (diff)
parente1b0144f9997d3d52c46785143699d82dd525f1d (diff)
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,
1924{ 1924{
1925 if (selector >= rdev->desc->n_voltages) 1925 if (selector >= rdev->desc->n_voltages)
1926 return -EINVAL; 1926 return -EINVAL;
1927 if (selector < rdev->desc->linear_min_sel)
1928 return 0;
1929
1930 selector -= rdev->desc->linear_min_sel;
1927 1931
1928 return rdev->desc->min_uV + (rdev->desc->uV_step * selector); 1932 return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
1929} 1933}
@@ -2152,6 +2156,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
2152 if (ret < 0) 2156 if (ret < 0)
2153 return ret; 2157 return ret;
2154 2158
2159 ret += rdev->desc->linear_min_sel;
2160
2155 /* Map back into a voltage to verify we're still in bounds */ 2161 /* Map back into a voltage to verify we're still in bounds */
2156 voltage = rdev->desc->ops->list_voltage(rdev, ret); 2162 voltage = rdev->desc->ops->list_voltage(rdev, ret);
2157 if (voltage < min_uV || voltage > max_uV) 2163 if (voltage < min_uV || voltage > max_uV)