Skip to content

Commit

Permalink
regulator: core: Call set_voltage_time_sel() only when the regulator …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 3, 2012
1 parent cffc959 commit 8b7485e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8b7485e

Please sign in to comment.