aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-12 09:22:46 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-24 16:30:44 +0000
commit19280e40714c9a3c55ab47f76df110072f6cde5e (patch)
treebf08bbcb46cad5a071c9ec81e975c730a3ba1468 /drivers/regulator/core.c
parentLinux 3.8-rc1 (diff)
downloadlinux-dev-19280e40714c9a3c55ab47f76df110072f6cde5e.tar.xz
linux-dev-19280e40714c9a3c55ab47f76df110072f6cde5e.zip
regulator: core: Fix continuous_voltage_range case in regulator_can_change_voltage
Regulator drivers with continuous_voltage_range flag set allows not setting n_voltages. Thus if continuous_voltage_range is set, check the constraint range instead. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0f65b246cc0c..d7448adc7a2c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1885,9 +1885,15 @@ int regulator_can_change_voltage(struct regulator *regulator)
struct regulator_dev *rdev = regulator->rdev;
if (rdev->constraints &&
- rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
- (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
- return 1;
+ (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
+ if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
+ return 1;
+
+ if (rdev->desc->continuous_voltage_range &&
+ rdev->constraints->min_uV && rdev->constraints->max_uV &&
+ rdev->constraints->min_uV != rdev->constraints->max_uV)
+ return 1;
+ }
return 0;
}