diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-08-08 08:20:29 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-28 14:00:26 -0400 |
commit | 422294deee5fd818527d68951a370a2119876e06 (patch) | |
tree | bd28a61e12146d8fc751ce53e788775df141c83c /drivers/regulator | |
parent | cb44cdeacd693ca964deab9d9f698920bb73529d (diff) |
regulator: wm831x-dcdc: 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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/wm831x-dcdc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 7413885be01b..90cbcc683704 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -339,16 +339,15 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev, | |||
339 | u16 reg = dcdc->base + WM831X_DCDC_CONTROL_2; | 339 | u16 reg = dcdc->base + WM831X_DCDC_CONTROL_2; |
340 | int i; | 340 | int i; |
341 | 341 | ||
342 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { | 342 | for (i = ARRAY_SIZE(wm831x_dcdc_ilim) - 1; i >= 0; i--) { |
343 | if ((min_uA <= wm831x_dcdc_ilim[i]) && | 343 | if ((min_uA <= wm831x_dcdc_ilim[i]) && |
344 | (wm831x_dcdc_ilim[i] <= max_uA)) | 344 | (wm831x_dcdc_ilim[i] <= max_uA)) |
345 | break; | 345 | return wm831x_set_bits(wm831x, reg, |
346 | WM831X_DC1_HC_THR_MASK, | ||
347 | i << WM831X_DC1_HC_THR_SHIFT); | ||
346 | } | 348 | } |
347 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) | ||
348 | return -EINVAL; | ||
349 | 349 | ||
350 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, | 350 | return -EINVAL; |
351 | i << WM831X_DC1_HC_THR_SHIFT); | ||
352 | } | 351 | } |
353 | 352 | ||
354 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | 353 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) |