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

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Axel Lin 2012-08-08 20:23:54 +08:00 committed by Mark Brown
parent 4e1d67eddf
commit 19d23c21a6

View File

@ -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])
return -EINVAL;
for (i = 0; i < DA9052_CURRENT_RANGE; i++) {
if (min_uA <= da9052_current_limits[row][i]) {
for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) {
if (da9052_current_limits[row][i] <= max_uA) {
reg_val = i;
break;
}