diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-10 04:52:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-10 04:52:59 -0400 |
commit | b920eb41a8241c54efbbd4f2ed6d074f497b0d9e (patch) | |
tree | 5941091817e932add192f8e58dc88d483322e214 /drivers/regulator/wm831x-dcdc.c | |
parent | a9d5801041eecc7baceff49a28e82f91f207a961 (diff) | |
parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) |
Merge tag 'v3.4-rc2' into regulator-drivers
Linux 3.4-rc2 contains some fixes that further patches depend upon.
Diffstat (limited to 'drivers/regulator/wm831x-dcdc.c')
-rw-r--r-- | drivers/regulator/wm831x-dcdc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index c754eae18c4a..f0da23c5826f 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -380,13 +380,15 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev, | |||
380 | int i; | 380 | int i; |
381 | 381 | ||
382 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { | 382 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { |
383 | if (max_uA <= wm831x_dcdc_ilim[i]) | 383 | if ((min_uA <= wm831x_dcdc_ilim[i]) && |
384 | (wm831x_dcdc_ilim[i] <= max_uA)) | ||
384 | break; | 385 | break; |
385 | } | 386 | } |
386 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) | 387 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) |
387 | return -EINVAL; | 388 | return -EINVAL; |
388 | 389 | ||
389 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, i); | 390 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, |
391 | i << WM831X_DC1_HC_THR_SHIFT); | ||
390 | } | 392 | } |
391 | 393 | ||
392 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | 394 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) |
@@ -400,7 +402,8 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | |||
400 | if (val < 0) | 402 | if (val < 0) |
401 | return val; | 403 | return val; |
402 | 404 | ||
403 | return wm831x_dcdc_ilim[val & WM831X_DC1_HC_THR_MASK]; | 405 | val = (val & WM831X_DC1_HC_THR_MASK) >> WM831X_DC1_HC_THR_SHIFT; |
406 | return wm831x_dcdc_ilim[val]; | ||
404 | } | 407 | } |
405 | 408 | ||
406 | static struct regulator_ops wm831x_buckv_ops = { | 409 | static struct regulator_ops wm831x_buckv_ops = { |