Skip to content

Commit

Permalink
regulator: core: Fix continuous_voltage_range case in regulator_can_c…
Browse files Browse the repository at this point in the history
…hange_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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Dec 24, 2012
1 parent a49f0d1 commit 19280e4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 19280e4

Please sign in to comment.