diff options
author | David S. Miller <davem@davemloft.net> | 2009-03-19 02:53:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-19 02:53:57 -0400 |
commit | 0702b30dd821ac8a4103ddbe545518713fdca9be (patch) | |
tree | 8ce0c9f5e58c5ccb99870505eecd139986caa05e /drivers/power/ds2760_battery.c | |
parent | 192d7a4667c6d11d1a174ec4cad9a3c5d5f9043c (diff) | |
parent | a1e4ee22863d41a6fbb24310d7951836cb6dafe7 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'drivers/power/ds2760_battery.c')
-rw-r--r-- | drivers/power/ds2760_battery.c | 11 |
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; |