platform/surface: Add Driver to set up lid GPEs on MS Surface device
authorMaximilian Luz <luzmaximilian@gmail.com>
Wed, 28 Oct 2020 10:54:27 +0000 (11:54 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 9 Nov 2020 10:41:30 +0000 (11:41 +0100)
commit274335f1c557fe6f714b0b3369f6c466b38485c8
tree9c222f643a9f63803ac13f1d17c1bd43c318105e
parent91de32fe6d7aeb80ae7dd5c50bebeb2b92b3a0df
platform/surface: Add Driver to set up lid GPEs on MS Surface device

Conventionally, wake-up events for a specific device, in our case the
lid device, are managed via the ACPI _PRW field. While this does not
seem strictly necessary based on ACPI spec, the kernel disables GPE
wakeups to avoid non-wakeup interrupts preventing suspend by default and
only enables GPEs associated via the _PRW field with a wake-up capable
device. This behavior has been introduced in commit f941d3e41da7 ("ACPI:
EC / PM: Disable non-wakeup GPEs for suspend-to-idle") and is described
in more detail in its commit message.

Unfortunately, on MS Surface devices, there is no _PRW field present on
the lid device, thus no GPE is associated with it, and therefore the GPE
responsible for sending the status-change notification to the lid gets
disabled during suspend, making it impossible to wake the device via the
lid.

This patch introduces a pseudo-device and respective driver which, based
on some DMI matching, marks the corresponding GPE of the lid device for
wake and enables it during suspend. The behavior of this driver models
the behavior of the ACPI/PM core for normal wakeup GPEs, properly
declared via the _PRW field.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201028105427.1593764-1-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
MAINTAINERS
drivers/platform/surface/Kconfig
drivers/platform/surface/Makefile
drivers/platform/surface/surface_gpe.c [new file with mode: 0644]