Skip to content

Commit

Permalink
regulator: max1586 - improve the logic of choosing selector
Browse files Browse the repository at this point in the history
A little bit improvement in the logic of choosing selector.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Axel Lin authored and Liam Girdwood committed Sep 1, 2010
1 parent d4876a3 commit 3e352f9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/regulator/max1586.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ static int max1586_v6_set(struct regulator_dev *rdev, int min_uV, int max_uV)
if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV)
return -EINVAL;

if (min_uV >= 3000000)
selector = 3;
if (min_uV < 3000000)
selector = 2;
if (min_uV < 2500000)
selector = 1;
if (min_uV < 1800000)
selector = 0;
else if (min_uV < 2500000)
selector = 1;
else if (min_uV < 3000000)
selector = 2;
else if (min_uV >= 3000000)
selector = 3;

if (max1586_v6_calc_voltage(selector) > max_uV)
return -EINVAL;
Expand Down

0 comments on commit 3e352f9

Please sign in to comment.