diff options
author | Hans de Goede <hdegoede@redhat.com> | 2021-12-30 20:31:19 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-01-04 15:40:48 +0100 |
commit | 57a18322227134e37b693ef8ef216ed7ce7ba7d6 (patch) | |
tree | f4ac9b0fdd8e673a4670178c4ba4a0aed095f4c9 /include/acpi | |
parent | 8e0feb25172b51978b9240aea1f0628c5b45b5b1 (diff) | |
download | linux-stable-57a18322227134e37b693ef8ef216ed7ce7ba7d6.tar.gz linux-stable-57a18322227134e37b693ef8ef216ed7ce7ba7d6.tar.bz2 linux-stable-57a18322227134e37b693ef8ef216ed7ce7ba7d6.zip |
ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
Some x86 ACPI boards have broken AC and battery ACPI devices in their ACPI
tables. This is often tied to these devices using certain PMICs where the
factory OS image seems to be using native charger and fuel-gauge drivers
instead.
So far both the AC and battery drivers have almost identical checks for
these PMICs including both of them having a DMI based mechanism to force
usage of the ACPI AC and battery drivers on some boards even though one
of these PMICs is present, with the same 2 boards listed in both driver's
DMI tables for this.
The only difference is that the AC driver checks for 2 PMICs and the
battery driver only for one. This has grown this way because the other
(Whiskey Cove) PMIC is only used on a few boards (3 known boards) and
although some of these do have non working ACPI battery devices, their
_STA method always returns 0, but that really should not be relied on.
This patch factors out the shared checks into a new
acpi_quirk_skip_acpi_ac_and_battery() helper and moves the AC and
battery drivers over to this new helper.
Note the DMI table is shared with acpi_quirk_skip_i2c_client_enumeration()
and acpi_quirk_skip_serdev_enumeration(), because boards needing DMI quirks
for either of these typically also have broken AC and battery ACPI devices.
The ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY quirk is not set yet on boards
already in this DMI table, to avoid introducing any functional changes
in this refactoring patch.
Besided sharing the code between the AC and battery drivers this
refactoring also moves this quirk handling to under #ifdef CONFIG_X86,
removing this x86 specific code from non x86 ACPI builds.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/acpi_bus.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 80c425bc98a7..04b9ace9689b 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -615,12 +615,17 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev); #ifdef CONFIG_X86 bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status); +bool acpi_quirk_skip_acpi_ac_and_battery(void); #else static inline bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status) { return false; } +static inline bool acpi_quirk_skip_acpi_ac_and_battery(void) +{ + return false; +} #endif #if IS_ENABLED(CONFIG_X86_ANDROID_TABLETS) |