aboutsummaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorBaolin Wang2019-01-15 18:32:36 +0800
committerSebastian Reichel2019-01-23 21:26:56 +0100
commit3a28f203c57944ac98a3adcbfacdbfa385966972 (patch)
treecc7a82eb25b6137622a4a342e53df9a7e4190fe7 /drivers/power
parent0a4f97a171888594435a019711b719b32233b7c9 (diff)
power: supply: sc27xx: Fix the incorrect formula when converting capacity to coulomb counter
We should multiply the calibrated current data (cur_1000ma_adc) when converting current capacity (mAh) to coulomb counter, which can get an accurate coulomb counter from the fuel gauge controller. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/sc27xx_fuel_gauge.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
index 4926b8a7459a..ea1349fe55a5 100644
--- a/drivers/power/supply/sc27xx_fuel_gauge.c
+++ b/drivers/power/supply/sc27xx_fuel_gauge.c
@@ -731,7 +731,7 @@ static int sc27xx_fgu_cap_to_clbcnt(struct sc27xx_fgu_data *data, int capacity)
* Convert current capacity (mAh) to coulomb counter according to the
* formula: 1 mAh =3.6 coulomb.
*/
- return DIV_ROUND_CLOSEST(cur_cap * 36, 10);
+ return DIV_ROUND_CLOSEST(cur_cap * 36 * data->cur_1000ma_adc, 10);
}
static int sc27xx_fgu_calibration(struct sc27xx_fgu_data *data)