summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAxel Lin2012-05-21 03:37:52 +0200
committerMark Brown2012-06-03 14:20:00 +0200
commit8b7485ef623b9171e5a58c67eef5912a27db5822 (patch)
tree2da73c449c197ea61177b63d2a0b81bc44c89d4a /drivers/regulator/core.c
parentregulator: core: Allow drivers to set voltage mapping table in regulator_desc (diff)
downloadkernel-qcow2-linux-8b7485ef623b9171e5a58c67eef5912a27db5822.tar.gz
kernel-qcow2-linux-8b7485ef623b9171e5a58c67eef5912a27db5822.tar.xz
kernel-qcow2-linux-8b7485ef623b9171e5a58c67eef5912a27db5822.zip
regulator: core: Call set_voltage_time_sel() only when the regulator is on
If the regulator is not on, it won't take time setting new voltage. So only call set_voltage_time_sel() to get the necessary delay when the regulator is on. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 333b7ebe7cae..58a4749c6347 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2106,7 +2106,8 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
* If we can't obtain the old selector there is not enough
* info to call set_voltage_time_sel().
*/
- if (rdev->desc->ops->set_voltage_time_sel &&
+ if (_regulator_is_enabled(rdev) &&
+ rdev->desc->ops->set_voltage_time_sel &&
rdev->desc->ops->get_voltage_sel) {
old_selector = rdev->desc->ops->get_voltage_sel(rdev);
if (old_selector < 0)
@@ -2138,7 +2139,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
best_val = -1;
/* Call set_voltage_time_sel if successfully obtained old_selector */
- if (ret == 0 && old_selector >= 0 &&
+ if (_regulator_is_enabled(rdev) && ret == 0 && old_selector >= 0 &&
rdev->desc->ops->set_voltage_time_sel) {
delay = rdev->desc->ops->set_voltage_time_sel(rdev,