2012-06-26 10:38:08

by Axel Lin

[permalink] [raw]
Subject: [PATCH] regulator: arizona-micsupp: Fix choosing selector in arizona_micsupp_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 <[email protected]>
---
drivers/regulator/arizona-micsupp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index 97d85b0..fdd7473 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -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);
--
1.7.9.5



2012-06-26 10:48:27

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] regulator: arizona-micsupp: Fix choosing selector in arizona_micsupp_map_voltage

On Tue, Jun 26, 2012 at 06:37:58PM +0800, Axel Lin wrote:
> If min_uV is in the range of: 3250001~3269999,
> current code uses the equation:

Applied, thanks.


Attachments:
(No filename) (159.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments