platform/x86: Add Driver to set up lid GPEs on MS Surface devices
Subsystems (2)
PATCH v3 1/1 platform/x86: Add Driver to set up lid GPEs on MS Surface devices
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.
---
Changes in v2:
- Use software nodes and device properties instead of platform data.
- Simplify module alias.
- Add comment regarding origin of GPE numbers.
- Fix style issues.
Changes in v3:
- Rebase onto v5.9-rc5
- Fix and restructure error handling and module cleanup.
- Remove unnecessary platform_set_drvdata(..., NULL) calls.
- Add pr_fmt definition
- Return -ENODEV if no compatible device is found in module init.
--- MAINTAINERS | 6 + drivers/platform/x86/Kconfig | 10 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/surface_gpe.c | 307 +++++++++++++++++++++++++++++ 4 files changed, 324 insertions(+) create mode 100644 drivers/platform/x86/surface_gpe.c
MAINTAINERS +6 -0
@@ -11557,6 +11557,12 @@ F: drivers/scsi/smartpqi/smartpqi*.[ch] F: include/linux/cciss*.h F: include/uapi/linux/cciss*.h +MICROSOFT SURFACE GPE LID SUPPORT DRIVER +M: Maximilian Luz <[email protected]> +L: [email protected] +S: Maintained +F: drivers/platform/x86/surface_gpe.c + MICROSOFT SURFACE PRO 3 BUTTON DRIVER M: Chen Yu <[email protected]> L: [email protected]
drivers/platform/x86/Kconfig +10 -0
@@ -894,6 +894,16 @@ config SURFACE_3_POWER_OPREGION This driver provides support for ACPI operation region of the Surface 3 battery platform driver. +config SURFACE_GPE + tristate "Surface GPE/Lid Support Driver" + depends on ACPI + depends on DMI + help + This driver marks the GPEs related to the ACPI lid device found on + Microsoft Surface devices as wakeup sources and prepares them + accordingly. It is required on those devices to allow wake-ups from + suspend by opening the lid. + config SURFACE_PRO3_BUTTON tristate "Power/home/volume buttons driver for Microsoft Surface Pro 3/4 tablet" depends on ACPI && INPUT
drivers/platform/x86/Makefile +1 -0
@@ -85,6 +85,7 @@ obj-$(CONFIG_INTEL_VBTN) += intel-vbtn.o obj-$(CONFIG_SURFACE3_WMI) += surface3-wmi.o obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o +obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o # MSI
drivers/platform/x86/surface_gpe.c new file +307 -0
307 lines not on this page · raw message
Signature · 1 line
2.28.0
I suggest delaying this patch until
[PATCH] platform/surface: Create a platform subdirectory for Microsoft Surface devices
has been resolved. If accepted, I would then submit a v4 directly against the new platform/surface subdirectory.
Regards,
Max