From 91d8b0d6f81d2946962ee559090a34834dfd467b Mon Sep 17 00:00:00 2001 From: Philip Rakity Date: Fri, 12 Aug 2011 21:19:57 -0700 Subject: 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 Acked-by: MyungJoo Ham Signed-off-by: Anton Vorontsov --- drivers/power/max17042_battery.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/power/max17042_battery.c') diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 4628450..61fb6d7 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, val->intval++; val->intval *= -1; } - val->intval >>= 4; - val->intval *= 1000000 * 25 / chip->pdata->r_sns; + val->intval *= 1562500 / chip->pdata->r_sns; } else { return -EINVAL; } -- cgit v1.1