platform/surface: Add Driver to set up lid GPEs on MS Surface device
Subsystems (4)
Maximilian Luz
maintainerPATCH v4 1/1 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.
---
Note: This patch depends and is based on
[PATCH v4] platform/surface: Create a platform subdirectory for
Microsoft Surface devices
which can be found at
https://lore.kernel.org/platform-driver-x86/[email protected]/
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.
Changes in v4:
- Rebase onto platform/surface patch-set
- Add copyright line
- Fix typo in comment
--- MAINTAINERS | 6 + drivers/platform/surface/Kconfig | 10 + drivers/platform/surface/Makefile | 1 + drivers/platform/surface/surface_gpe.c | 309 +++++++++++++++++++++++++ 4 files changed, 326 insertions(+) create mode 100644 drivers/platform/surface/surface_gpe.c
MAINTAINERS +6 -0
@@ -11532,6 +11532,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 HARDWARE PLATFORM SUPPORT M: Hans de Goede <[email protected]> M: Mark Gross <[email protected]>
drivers/platform/surface/Kconfig +10 -0
@@ -40,6 +40,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/surface/Makefile +1 -0
@@ -7,4 +7,5 @@ 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
drivers/platform/surface/surface_gpe.c new file +309 -0
309 lines not on this page · raw message
Signature · 1 line
2.28.0
Maximilian Luz
maintainerMAINTAINERS F: drivers/scsi/smartpqi/smartpqi*.[ch] · line 11539
Quoted 13 lines · Maximilian Luz
MAINTAINERS +5
-0@@ -11532,6 +11532,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
This should of course read
F: drivers/platform/surface/surface_gpe.c
Sorry for that rookie mistake. Will fix asap.
Regards,
Max