diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-08-17 23:37:21 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-09-01 07:59:33 -0400 |
commit | 3e352f9e02a37c11df695aabfe49faebf507971b (patch) | |
tree | f48f179e52992dc22707171c93ef4d2b9df39929 /drivers/regulator | |
parent | d4876a3bc041e8e40af20b8addbec6d0a42e3842 (diff) |
regulator: max1586 - improve the logic of choosing selector
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max1586.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 8867c2710a6d..559cfa271a44 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c | |||
@@ -121,14 +121,14 @@ static int max1586_v6_set(struct regulator_dev *rdev, int min_uV, int max_uV) | |||
121 | if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV) | 121 | if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV) |
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | 123 | ||
124 | if (min_uV >= 3000000) | ||
125 | selector = 3; | ||
126 | if (min_uV < 3000000) | ||
127 | selector = 2; | ||
128 | if (min_uV < 2500000) | ||
129 | selector = 1; | ||
130 | if (min_uV < 1800000) | 124 | if (min_uV < 1800000) |
131 | selector = 0; | 125 | selector = 0; |
126 | else if (min_uV < 2500000) | ||
127 | selector = 1; | ||
128 | else if (min_uV < 3000000) | ||
129 | selector = 2; | ||
130 | else if (min_uV >= 3000000) | ||
131 | selector = 3; | ||
132 | 132 | ||
133 | if (max1586_v6_calc_voltage(selector) > max_uV) | 133 | if (max1586_v6_calc_voltage(selector) > max_uV) |
134 | return -EINVAL; | 134 | return -EINVAL; |