Skip to content

Commit

Permalink
regulator: wm8350: Fix the logic to choose best current limit setting
Browse files Browse the repository at this point in the history
Current implementation in get_isink_val actually choose the biggest current
limit setting falls within the specified range.
What we want is to choose the smallest current limit setting falls within the
specified range. Fix it.

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
AxelLin authored and broonie committed Mar 28, 2012
1 parent ed3be9a commit 3a74403
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/wm8350-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int get_isink_val(int min_uA, int max_uA, u16 *setting)
{
int i;

for (i = ARRAY_SIZE(isink_cur) - 1; i >= 0; i--) {
for (i = 0; i < ARRAY_SIZE(isink_cur); i++) {
if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) {
*setting = i;
return 0;
Expand Down

0 comments on commit 3a74403

Please sign in to comment.