• H
    ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper · 57a18322
    Hans de Goede 提交于
    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: NHans de Goede <hdegoede@redhat.com>
    Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    57a18322
battery.c 36.5 KB