summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi_cmbat.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index ec6730e..bf859e8 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -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) {
OpenPOWER on IntegriCloud