]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
regulator: wm831x-isink: Fix the logic to choose best current limit setting
authorAxel Lin <axel.lin@gmail.com>
Tue, 27 Mar 2012 07:18:53 +0000 (15:18 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 28 Mar 2012 11:44:07 +0000 (12:44 +0100)
Current code in wm831x_isink_set_current actually set the current limit setting
smaller than specified range.

Fix the logic in wm831x_isink_set_current to choose the smallest current limit
setting falls within the specified range.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/wm831x-isink.c

index 634aac3f2d5f86c511bc4390777437997b369f87..b414e09c56200c16aa5b191bf1fa10b93ad7426f 100644 (file)
@@ -101,7 +101,7 @@ static int wm831x_isink_set_current(struct regulator_dev *rdev,
 
        for (i = 0; i < ARRAY_SIZE(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,
                                              WM831X_CS1_ISEL_MASK, i);
                        return ret;