Skip to content

Commit

Permalink
max17042_battery: Do not lose accuracy calculating current_now
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Philip Rakity authored and Anton Vorontsov committed Aug 19, 2011
1 parent 4cfa892 commit 91d8b0d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/power/max17042_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 91d8b0d

Please sign in to comment.