]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken
authorHans de Goede <hdegoede@redhat.com>
Sat, 2 Feb 2019 15:37:00 +0000 (16:37 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 22 Feb 2019 09:10:22 +0000 (10:10 +0100)
commit94b89079b909b5a2d8bc8518c909b8c827c57a20
tree5663294b12fd65afdc66044c6a521432f3204aee
parent1163d081d9b72ec3970bb647608e272118fb357b
ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken

BugLink: https://bugs.launchpad.net/bugs/1745032
On some devices the "AC" interface ACPI AML code uses the exact same broken
logic which is causing the battery code to wrongly report discharging to
determine the "AC" state. Specifically the ACPI AML code is checking the
charging status bits of the charger-IC rather then the vbus present or
power-good status bits.

This makes our workaround for devices which wrongly report discharging when
plugged into AC while the charge is above the start charging threshold not
work on these devices.

This commit adds a battery_ac_is_broken flag and when that is set it skips
the power_supply_is_system_supplied() check in the workaround fixing this.

This flag gets set by a DMI quirk selected by systems where we know the AC
AML code is broken in this way *and* the rate_now value can be trusted.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 1b799c5cf031c2b615f4b21150eafde3ff227788)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/acpi/battery.c