• Hans de Goede's avatar
    ACPICA: Also handle "orphan" _REG methods for GPIO OpRegions · 0306f035
    Hans de Goede authored
    ACPICA commit b9dc31e2fc67cf196fab5253a9a673bee68b2ef5
    
    Before this commit acpi_ev_execute_reg_methods() had special handling
    to handle "orphan" (no matching op_region declared) _REG methods for EC
    nodes.
    
    On Intel Cherry Trail devices there are 2 possible ACPI op_regions for
    accessing GPIOs. The standard general_purpose_io op_region and the Cherry
    Trail specific user_defined 0x9X op_regions.
    
    Having 2 different types of op_regions leads to potential issues with
    checks for op_region availability, or in other words checks if _REG has
    been called for the op_region which the ACPI code wants to use.
    
    Except for the "orphan" EC handling, ACPICA core does not call _REG on
    an ACPI node which does not define an op_region matching the type being
    registered; and the reference design DSDT, from which most Cherry Trail
    DSDTs are derived, does not define general_purpose_io, nor user_defined(0x93)
    op_regions for the GPO2 (UID 3) device, because no pins were assigned ACPI
    controlled functions in the reference design.
    
    Together this leads to the perfect storm, at least on the Cherry Trail
    based Medion Akayo E1239T. This design does use a GPO2 pin from its ACPI
    code and has added the Cherry Trail specific user_defined(0x93) opregion
    to its GPO2 ACPI node to access this pin.
    
    But it uses a has _REG been called availability check for the standard
    general_purpose_io op_region. This clearly is a bug in the DSDT, but this
    does work under Windows. This issue leads to the intel_vbtn driver
    reporting the device always being in tablet-mode at boot, even if it
    is in laptop mode. Which in turn causes userspace to ignore touchpad
    events. So iow this issues causes the touchpad to not work at boot.
    
    This commit fixes this by extending the "orphan" _REG method handling
    to also apply to GPIO address-space handlers.
    
    Note it seems that Windows always calls "orphan" _REG methods so me
    may want to consider dropping the space-id check and always do
    "orphan" _REG method handling.
    
    Link: https://github.com/acpica/acpica/commit/b9dc31e2Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarErik Kaneda <erik.kaneda@intel.com>
    Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    0306f035
evregion.c 24.1 KB