]> Git Repo - linux.git/commitdiff
ACPI: battery: Accept charges over the design capacity as full
authorAndré Almeida <[email protected]>
Fri, 8 Oct 2021 03:05:29 +0000 (00:05 -0300)
committerRafael J. Wysocki <[email protected]>
Wed, 13 Oct 2021 17:53:16 +0000 (19:53 +0200)
Some buggy firmware and/or brand new batteries can support a charge that's
slightly over the reported design capacity. In such cases, the kernel will
report to userspace that the charging state of the battery is "Unknown",
when in reality the battery charge is "Full", at least from the design
capacity point of view. Make the fallback condition accepts capacities
over the designed capacity so userspace knows that is full.

Signed-off-by: André Almeida <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Sebastian Reichel <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
drivers/acpi/battery.c

index dae91f906cea97059790ea8c23f63e8d5372cd7d..8afa85d6eb6a798e785956a96a25a1ad5742c1a3 100644 (file)
@@ -169,7 +169,7 @@ static int acpi_battery_is_charged(struct acpi_battery *battery)
                return 1;
 
        /* fallback to using design values for broken batteries */
-       if (battery->design_capacity == battery->capacity_now)
+       if (battery->design_capacity <= battery->capacity_now)
                return 1;
 
        /* we don't do any sort of metric based on percentages */
This page took 0.058609 seconds and 4 git commands to generate.