diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-03-26 22:08:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-01 06:59:35 -0400 |
commit | 935c14a216c1afa855678e200607e98cc8cc2c51 (patch) | |
tree | dc7573e66b5b928b28ad7095f809bba17e3efb45 | |
parent | 36a2afd88482843e59f506fb0c85c85e53d3bd2f (diff) |
regulator: ad5398: show changing current in uA
Integer division may truncate the result.
Current code shows changing current is 0mA when selector is 1 ... 8.
For example:
selector = 1
ad5398_calc_current returns 117, debug message shows 117/1000 = 0mA
selector = 2
ad5398_calc_current returns 234, debug message shows 234/1000 = 0mA
selector = 3
ad5398_calc_current returns 351, debug message shows 351/1000 = 0mA
............
selector = 8
ad5398_calc_current returns 937, debug message shows 937/1000 = 0mA
Show the changing current in uA makes it easier for debugging.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/regulator/ad5398.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index 26d23adfc66f..ed587987f445 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c | |||
@@ -99,8 +99,8 @@ static int ad5398_set_current_limit(struct regulator_dev *rdev, int min_uA, int | |||
99 | if (ad5398_calc_current(chip, selector) > max_uA) | 99 | if (ad5398_calc_current(chip, selector) > max_uA) |
100 | return -EINVAL; | 100 | return -EINVAL; |
101 | 101 | ||
102 | dev_dbg(&client->dev, "changing current %dmA\n", | 102 | dev_dbg(&client->dev, "changing current %duA\n", |
103 | ad5398_calc_current(chip, selector) / 1000); | 103 | ad5398_calc_current(chip, selector)); |
104 | 104 | ||
105 | /* read chip enable bit */ | 105 | /* read chip enable bit */ |
106 | ret = ad5398_read_reg(client, &data); | 106 | ret = ad5398_read_reg(client, &data); |