OSDN Git Service

ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken
authorHans de Goede <hdegoede@redhat.com>
Thu, 12 Apr 2018 10:02:00 +0000 (12:02 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 2 May 2018 11:06:59 +0000 (13:06 +0200)
commit1b799c5cf031c2b615f4b21150eafde3ff227788
treea05bbb287f63deaffabd8e9265c2352d8fd01e42
parent19fffc8450d4378580a8f019b195c4617083176f
ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken

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>
drivers/acpi/battery.c