Some laptops report the "design-capacity" instead of the "real-capacity"
when the battery is fully charged. That breaks some of the arithmetic in calculating the remaining capacity (ends up with more than 100%). This commit makes sure the max is 100. Approved by: njl
This commit is contained in:
parent
7b09b25ecb
commit
7e3605cbad
@ -519,6 +519,15 @@ acpi_cmbat_get_total_battinfo(struct acpi_battinfo *battinfo)
|
||||
|
||||
valid_units++;
|
||||
bat[i]->cap = 100 * bat[i]->bst.cap / bat[i]->bif.lfcap;
|
||||
|
||||
/*
|
||||
* Some laptops report the "design-capacity" instead of the
|
||||
* "real-capacity" when the battery is fully charged.
|
||||
* That breaks the above arithmetic as it needs to be 100% maximum.
|
||||
*/
|
||||
if (bat[i]->cap > 100)
|
||||
bat[i]->cap = 100;
|
||||
|
||||
batt_stat |= bat[i]->bst.state;
|
||||
|
||||
if (bat[i]->bst.rate > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user