Skip to content

Commit

Permalink
regulator: core: Fix logic to determinate if regulator can change vol…
Browse files Browse the repository at this point in the history
…tage

Having a linear_min_sel setting means the first linear_min_sel selectors are
invalid. We need to subtract linear_min_sel when use n_voltages to determinate
if regulator can change voltage.

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 11, 2012
1 parent b17fc86 commit 8a23b4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,7 @@ int regulator_can_change_voltage(struct regulator *regulator)

if (rdev->constraints &&
rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
rdev->desc->n_voltages > 1)
(rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
return 1;

return 0;
Expand Down

0 comments on commit 8a23b4e

Please sign in to comment.