summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-03-26 16:57:44 +0000
committerMark Brown <broonie@linaro.org>2014-03-26 16:57:44 +0000
commit29dbdcf3163bc05aad758e978abb66cf161e6d0e (patch)
tree9f017b0482de728a1b1b8205485b087b94a2b7f0 /drivers/regulator/core.c
parentb098d6726bbfb94c06d6e1097466187afddae61f (diff)
parent8669544a788a2d9de14cdbb3069b71ddc326e66f (diff)
downloadlinux-29dbdcf3163bc05aad758e978abb66cf161e6d0e.tar.gz
linux-29dbdcf3163bc05aad758e978abb66cf161e6d0e.tar.bz2
linux-29dbdcf3163bc05aad758e978abb66cf161e6d0e.zip
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index afca1bc24f26..bac485acc7f3 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2399,6 +2399,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
struct regulator_dev *rdev = regulator->rdev;
int ret = 0;
int old_min_uV, old_max_uV;
+ int current_uV;
mutex_lock(&rdev->mutex);
@@ -2409,6 +2410,19 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
if (regulator->min_uV == min_uV && regulator->max_uV == max_uV)
goto out;
+ /* If we're trying to set a range that overlaps the current voltage,
+ * return succesfully even though the regulator does not support
+ * changing the voltage.
+ */
+ if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
+ current_uV = _regulator_get_voltage(rdev);
+ if (min_uV <= current_uV && current_uV <= max_uV) {
+ regulator->min_uV = min_uV;
+ regulator->max_uV = max_uV;
+ goto out;
+ }
+ }
+
/* sanity check */
if (!rdev->desc->ops->set_voltage &&
!rdev->desc->ops->set_voltage_sel) {