aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/ds2760_battery.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index 1d768928e0bb..a52d4a11652d 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -180,10 +180,13 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)
180 di->empty_uAh = battery_interpolate(scale, di->temp_C / 10); 180 di->empty_uAh = battery_interpolate(scale, di->temp_C / 10);
181 di->empty_uAh *= 1000; /* convert to µAh */ 181 di->empty_uAh *= 1000; /* convert to µAh */
182 182
183 /* From Maxim Application Note 131: remaining capacity = 183 if (di->full_active_uAh == di->empty_uAh)
184 * ((ICA - Empty Value) / (Full Value - Empty Value)) x 100% */ 184 di->rem_capacity = 0;
185 di->rem_capacity = ((di->accum_current_uAh - di->empty_uAh) * 100L) / 185 else
186 (di->full_active_uAh - di->empty_uAh); 186 /* From Maxim Application Note 131: remaining capacity =
187 * ((ICA - Empty Value) / (Full Value - Empty Value)) x 100% */
188 di->rem_capacity = ((di->accum_current_uAh - di->empty_uAh) * 100L) /
189 (di->full_active_uAh - di->empty_uAh);
187 190
188 if (di->rem_capacity < 0) 191 if (di->rem_capacity < 0)
189 di->rem_capacity = 0; 192 di->rem_capacity = 0;