diff options
author | Philip Rakity <prakity@marvell.com> | 2011-08-13 00:19:57 -0400 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2011-08-19 13:03:34 -0400 |
commit | 91d8b0d6f81d2946962ee559090a34834dfd467b (patch) | |
tree | 3cbfca6e1eca3b857976116c4c96f54e2e62a6a5 /drivers/power/max17042_battery.c | |
parent | 4cfa892c03b35f3c61d93e0d8d97ff8db074818f (diff) |
max17042_battery: Do not lose accuracy calculating current_now
PROP_CURRENT_NOW value is first divided then multiplied up
causing a lose of accuracy. Use the same method as
PROP_CURRENT_AVG to do the calculation.
Signed-off-by: Philip Rakity <prakity@marvell.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power/max17042_battery.c')
-rw-r--r-- | drivers/power/max17042_battery.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 462845025ca1..61fb6d7dfe7a 100644 --- a/drivers/power/max17042_battery.c +++ b/drivers/power/max17042_battery.c | |||
@@ -152,8 +152,7 @@ static int max17042_get_property(struct power_supply *psy, | |||
152 | val->intval++; | 152 | val->intval++; |
153 | val->intval *= -1; | 153 | val->intval *= -1; |
154 | } | 154 | } |
155 | val->intval >>= 4; | 155 | val->intval *= 1562500 / chip->pdata->r_sns; |
156 | val->intval *= 1000000 * 25 / chip->pdata->r_sns; | ||
157 | } else { | 156 | } else { |
158 | return -EINVAL; | 157 | return -EINVAL; |
159 | } | 158 | } |