Skip to content

Commit

Permalink
regulator: arizona-micsupp: Fix choosing selector in arizona_micsupp_…
Browse files Browse the repository at this point in the history
…map_voltage

If min_uV is in the range of: 3250001~3269999,
current code uses the equation:
        selector = DIV_ROUND_UP(min_uV - 1700000, 50000);
Then selector will be 32.
Then arizona_micsupp_list_voltage returns -EINVAL for this case which is wrong.

This patch fixes this issue:
If min_uV > 3200000, selector should be ARIZONA_MICSUPP_MAX_SELECTOR.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 26, 2012
1 parent 1910efa commit 7f217d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/arizona-micsupp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int arizona_micsupp_map_voltage(struct regulator_dev *rdev,
if (min_uV < 1700000)
min_uV = 1700000;

if (min_uV >= 3300000)
if (min_uV > 3200000)
selector = ARIZONA_MICSUPP_MAX_SELECTOR;
else
selector = DIV_ROUND_UP(min_uV - 1700000, 50000);
Expand Down

0 comments on commit 7f217d3

Please sign in to comment.