Skip to content

Commit

Permalink
regulator: wm831x-dcdc: Fix the logic to choose best current limit se…
Browse files Browse the repository at this point in the history
…tting

Current code in wm831x_buckv_set_current_limit actually set the current limit
setting greater than specified range.

Fix the logic in wm831x_buckv_set_current_limit to choose the
smallest current limit setting falls within the specified range.

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 Mar 28, 2012
1 parent 2f2cc27 commit a171e78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/regulator/wm831x-dcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev,
int i;

for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) {
if (max_uA <= wm831x_dcdc_ilim[i])
if ((min_uA <= wm831x_dcdc_ilim[i]) &&
(wm831x_dcdc_ilim[i] <= max_uA))
break;
}
if (i == ARRAY_SIZE(wm831x_dcdc_ilim))
Expand Down

0 comments on commit a171e78

Please sign in to comment.