summaryrefslogtreecommitdiff
path: root/drivers/regulator/helpers.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-10-11 05:30:24 +0400
committerMark Brown <broonie@linaro.org>2013-10-11 15:49:12 +0400
commite277e656804c85a0729d4fd8cdd3c8ab3e6b3b86 (patch)
treea92f29fb7c735cb4cf918059d1773d5110a38bf3 /drivers/regulator/helpers.c
parent813de3c649d6c6ff14c930de9fcd161c0062fabd (diff)
downloadlinux-e277e656804c85a0729d4fd8cdd3c8ab3e6b3b86.tar.xz
regulator: Remove max_uV from struct regulator_linear_range
linear ranges means each range has linear voltage settings. So we can calculate max_uV for each linear range in regulator core rather than set the max_uV field in drivers. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/helpers.c')
-rw-r--r--drivers/regulator/helpers.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index 6e30df14714b..e221a271ba56 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -284,9 +284,13 @@ int regulator_map_voltage_linear_range(struct regulator_dev *rdev,
}
for (i = 0; i < rdev->desc->n_linear_ranges; i++) {
+ int linear_max_uV;
+
range = &rdev->desc->linear_ranges[i];
+ linear_max_uV = range->min_uV +
+ (range->max_sel - range->min_sel) * range->uV_step;
- if (!(min_uV <= range->max_uV && max_uV >= range->min_uV))
+ if (!(min_uV <= linear_max_uV && max_uV >= range->min_uV))
continue;
if (min_uV <= range->min_uV)