diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-08-08 08:21:30 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-28 14:00:26 -0400 |
commit | 73f4f3d37604ff7084e6157745610c8fb07d27b6 (patch) | |
tree | 7e6e206c9b71e57b6c97c6ae873519314726d905 | |
parent | 422294deee5fd818527d68951a370a2119876e06 (diff) |
regulator: tps6524x: 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>
-rw-r--r-- | drivers/regulator/tps6524x-regulator.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index 947ece933d90..058d2f2675e9 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c | |||
@@ -502,15 +502,13 @@ static int set_current_limit(struct regulator_dev *rdev, int min_uA, | |||
502 | if (info->n_ilimsels == 1) | 502 | if (info->n_ilimsels == 1) |
503 | return -EINVAL; | 503 | return -EINVAL; |
504 | 504 | ||
505 | for (i = 0; i < info->n_ilimsels; i++) | 505 | for (i = info->n_ilimsels - 1; i >= 0; i--) { |
506 | if (min_uA <= info->ilimsels[i] && | 506 | if (min_uA <= info->ilimsels[i] && |
507 | max_uA >= info->ilimsels[i]) | 507 | max_uA >= info->ilimsels[i]) |
508 | break; | 508 | return write_field(hw, &info->ilimsel, i); |
509 | 509 | } | |
510 | if (i >= info->n_ilimsels) | ||
511 | return -EINVAL; | ||
512 | 510 | ||
513 | return write_field(hw, &info->ilimsel, i); | 511 | return -EINVAL; |
514 | } | 512 | } |
515 | 513 | ||
516 | static int get_current_limit(struct regulator_dev *rdev) | 514 | static int get_current_limit(struct regulator_dev *rdev) |