Commit 45aa908d authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: wm831x-isink: Select maximum current in specific range

.set_current_limit callback should select the current closest to max_uA.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8be64b6d
...@@ -99,7 +99,7 @@ static int wm831x_isink_set_current(struct regulator_dev *rdev, ...@@ -99,7 +99,7 @@ static int wm831x_isink_set_current(struct regulator_dev *rdev,
struct wm831x *wm831x = isink->wm831x; struct wm831x *wm831x = isink->wm831x;
int ret, i; int ret, i;
for (i = 0; i < ARRAY_SIZE(wm831x_isinkv_values); i++) { for (i = ARRAY_SIZE(wm831x_isinkv_values) - 1; i >= 0; i--) {
int val = wm831x_isinkv_values[i]; int val = wm831x_isinkv_values[i];
if (min_uA <= val && val <= max_uA) { if (min_uA <= val && val <= max_uA) {
ret = wm831x_set_bits(wm831x, isink->reg, ret = wm831x_set_bits(wm831x, isink->reg,
......
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