Commit 19d23c21 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: da9052: set_current_limit should select the maximum current in specific range

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 4e1d67ed
...@@ -133,8 +133,8 @@ static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA, ...@@ -133,8 +133,8 @@ static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA,
max_uA < da9052_current_limits[row][DA9052_MIN_UA]) max_uA < da9052_current_limits[row][DA9052_MIN_UA])
return -EINVAL; return -EINVAL;
for (i = 0; i < DA9052_CURRENT_RANGE; i++) { for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) {
if (min_uA <= da9052_current_limits[row][i]) { if (da9052_current_limits[row][i] <= max_uA) {
reg_val = i; reg_val = i;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment