platform/surface: Add s2idle/hibernate fix for Surface Laptop 5#162
Open
wowitsjack wants to merge 2 commits intolinux-surface:v6.18-surface-develfrom
Open
platform/surface: Add s2idle/hibernate fix for Surface Laptop 5#162wowitsjack wants to merge 2 commits intolinux-surface:v6.18-surface-develfrom
wowitsjack wants to merge 2 commits intolinux-surface:v6.18-surface-develfrom
Conversation
Intel INTC1055 pinctrl power-gating during s2idle corrupts pin 213's PADCFG0 register. The corruption fires a spurious SCI on GPE 0x52, which promotes to a full resume via acpi_any_gpe_status_set(). The system either never wakes or wakes spuriously on every s2idle cycle. Fix by intercepting in the ACPI wakeup handler (which runs before acpi_ec_dispatch_gpe). The handler repairs PADCFG corruption, clears GPE 0x52 status, and returns false. The actual lid-open decision is deferred to an LPS0 check() callback which reads RXSTATE directly. GPE 0x52 is kept masked during s2idle to prevent VNN RXSTATE glitches from firing as SCI. Lid-open detection uses a 500ms poll timer reading RXSTATE directly. GPE unmask is delayed to PM_POST_SUSPEND to avoid stale GPE status causing false lid events during resume. Additional features: failsafe re-suspend with exponential backoff, RXSTATE polling for lid close detection, suspend-to-lock mode, hibernate support with RTC time sync, and full PADCFG0 corruption detection with 15s RXSTATE settling guard. Link: linux-surface/linux-surface#1782 Signed-off-by: Jack <wowitsjack@users.noreply.github.com>
Removed old suspected root cause explanation for s2idle issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes linux-surface/linux-surface#1782
Per request from @qzed in linux-surface/linux-surface#2011
Adds
surface_s2idle_fixmodule todrivers/platform/surface/.Problem
Intel INTC1055 pinctrl power-gating during s2idle corrupts pin 213's PADCFG0 register. The corruption fires a spurious SCI on GPE 0x52, which promotes to a full resume via
acpi_any_gpe_status_set(). The system either never wakes (wakeup framework poisoned bypm_system_cancel_wakeup()) or wakes spuriously on every s2idle cycle.Fix
The ACPI wakeup handler runs before
acpi_ec_dispatch_gpe()in the s2idle wake decision path. The handler:acpi_any_gpe_status_set()doesn't see itLid-open detection is deferred to an LPS0
check()callback which reads RXSTATE directly and only callspm_system_wakeup()if the lid is genuinely open.Key design decisions
resume_early, causing false lid events to logind.acpi_enable_gpe/acpi_disable_gpe(notacpi_set_gpe) to maintain proper ACPI reference counting.Additional layers
Testing
Tested on Surface Laptop 5 (i5-1245U), Ubuntu 25.10, kernel 6.18.7-surface-1. s2idle cycles, hibernate cycles, extended sleep (11h+), repeated lid open/close, rapid-wake VNN cycles with failsafe re-suspend.