aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-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 e872c8be080..02a249b024b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1897,6 +1897,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
1897{ 1897{
1898 if (selector >= rdev->desc->n_voltages) 1898 if (selector >= rdev->desc->n_voltages)
1899 return -EINVAL; 1899 return -EINVAL;
1900 if (selector < rdev->desc->linear_min_sel)
1901 return 0;
1902
1903 selector -= rdev->desc->linear_min_sel;
1900 1904
1901 return rdev->desc->min_uV + (rdev->desc->uV_step * selector); 1905 return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
1902} 1906}
@@ -2120,6 +2124,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
2120 if (ret < 0) 2124 if (ret < 0)
2121 return ret; 2125 return ret;
2122 2126
2127 ret += rdev->desc->linear_min_sel;
2128
2123 /* Map back into a voltage to verify we're still in bounds */ 2129 /* Map back into a voltage to verify we're still in bounds */
2124 voltage = rdev->desc->ops->list_voltage(rdev, ret); 2130 voltage = rdev->desc->ops->list_voltage(rdev, ret);
2125 if (voltage < min_uV || voltage > max_uV) 2131 if (voltage < min_uV || voltage > max_uV)