Commit 09bf14b9 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: Fix set and get current limit for wm831x_buckv

WM831X_DC1_HC_THR_MASK is 0x0070.
We need to do proper shift for setting and getting current limit.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 51579137
...@@ -386,7 +386,8 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev, ...@@ -386,7 +386,8 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev,
if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) if (i == ARRAY_SIZE(wm831x_dcdc_ilim))
return -EINVAL; return -EINVAL;
return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, i); return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK,
i << WM831X_DC1_HC_THR_SHIFT);
} }
static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
...@@ -400,7 +401,8 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) ...@@ -400,7 +401,8 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
if (val < 0) if (val < 0)
return val; return val;
return wm831x_dcdc_ilim[val & WM831X_DC1_HC_THR_MASK]; val = (val & WM831X_DC1_HC_THR_MASK) >> WM831X_DC1_HC_THR_SHIFT;
return wm831x_dcdc_ilim[val];
} }
static struct regulator_ops wm831x_buckv_ops = { static struct regulator_ops wm831x_buckv_ops = {
......
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