Commit 91d8b0d6 authored by Philip Rakity's avatar Philip Rakity Committed by Anton Vorontsov

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: default avatarPhilip Rakity <prakity@marvell.com>
Acked-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
parent 4cfa892c
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment