From: Daniel Gibson <daniel@gibson.sh>
To: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Daniel Gibson <daniel@gibson.sh>
Subject: [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices
Date: Sat, 9 May 2026 03:30:59 +0200 [thread overview]
Message-ID: <20260509013105.816339-1-daniel@gibson.sh> (raw)
On some AMD Zen3 and Zen3+-based Lenovo IdeaPad laptops the keyboard and
the lid switch stop working after the first suspend, until rebooted.
More specifically, they stop sending events when pressing a key or
closing the lid - it's still possible to toggle the capslock- and
numlock-LEDs with an external keyboard or read the lid state at
/proc/acpi/button/lid/LID/state.
See also https://bugzilla.kernel.org/show_bug.cgi?id=221383
It appears that suspending and/or resuming gets the EC into a broken
state. This problem doesn't happen on Windows and Mario Limonciello
mentioned that the Windows kernel gives hardware and software some time
before actually suspending (before activating HW DRIPS), while Linux
(or the amd_pmc module) does that immediately, so it may be worth trying
if calling msleep() in amd_pmc_s2idle_check() helps.
It turned out that sleeping for 2.5 seconds at that point indeed makes
the problems mostly disappear. Sleeping for 1.5 seconds wasn't enough.
"Mostly" because it turned out that they still occur (at least on my
device) when using a wakeup timer (wakealarm).
I could build on an existing quirk[1] that also sleeps for 2.5 seconds
under other circumstances; my first commit refactors that a bit so I
can integrate my further changes in a cleaner way.
I found several reports of these or similar issues on the web, for
different devices, so in a second commit I added a parameter to the
kernel module that allows enabling or disabling this, which will make
it easy for people whose devices aren't matched yet to test this quirk.
Thanks to Mario Limonciello for his support and to Sindre Henriksen
for testing my patch and to Ilpo Järvinen for reviewing v1!
[1] https://lore.kernel.org/platform-driver-x86/20250414162446.3853194-1-superm1@kernel.org/
Changes in v2:
- Documented this in Documentation/arch/x86/amd-debugging.rst
- Added example for reset register kernel message in same file
- In amd_pmc_quirk_need_suspend_delay(), avoid dereferencing a NULL
pointer of devices not detected for any quirk - oops!
- Mention that timed resumes may still cause those keyboard/lid issues
- Various code changes requested or suggested in reviews of v1:
- Some formatting changes (commas behind non-terminating entries)
- Moved check for existing quirk (that OVP thing) into its own function
amd_pmc_intermediate_wakeup_need_delay() in pmc.c, so the checks of
the different quirks are separated more clearly.
- Added function amd_pmc_want_suspend_delay() in pmc.c handling
amd_pmc_quirk_need_suspend_delay() together with disable_workarounds
and delay_suspend and also logging about the reason for the delay,
also for cleaner separation.
- If delay_suspend=1 is used to force-enable the fix on hardware that
is not automatically detected as needing this fix, log message
encouraging the user to report their device, including the most
relevant DMI values that could be used for matching
v1: https://lore.kernel.org/platform-driver-x86/20260501032655.283789-1-daniel@gibson.sh/t/#u
Daniel Gibson (5):
platform/x86/amd/pmc: Check for intermediate wakeup in function
platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops
platform/x86/amd/pmc: Add delay_suspend module parameter
Documentation/arch/x86/amd-debugging: Add example for reset register
Documentation/arch/x86/amd-debugging: Add section about delay_suspend
Documentation/arch/x86/amd-debugging.rst | 30 ++++++++++++
drivers/platform/x86/amd/pmc/pmc-quirks.c | 31 ++++++++++++
drivers/platform/x86/amd/pmc/pmc.c | 60 +++++++++++++++++++++--
drivers/platform/x86/amd/pmc/pmc.h | 1 +
4 files changed, 119 insertions(+), 3 deletions(-)
--
2.48.1
next reply other threads:[~2026-05-09 1:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 1:30 Daniel Gibson [this message]
2026-05-09 1:31 ` [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Daniel Gibson
2026-05-11 12:31 ` Ilpo Järvinen
2026-05-09 1:31 ` [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Daniel Gibson
2026-05-11 12:24 ` Ilpo Järvinen
2026-05-12 0:45 ` Daniel Gibson
2026-05-09 1:31 ` [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Daniel Gibson
2026-05-11 12:36 ` Ilpo Järvinen
2026-05-09 1:31 ` [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register Daniel Gibson
2026-05-10 0:21 ` Mario Limonciello
2026-05-11 12:45 ` Ilpo Järvinen
2026-05-09 1:31 ` [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend Daniel Gibson
2026-05-11 12:49 ` Ilpo Järvinen
2026-05-12 0:50 ` Daniel Gibson
2026-05-12 9:06 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260509013105.816339-1-daniel@gibson.sh \
--to=daniel@gibson.sh \
--cc=Shyam-sundar.S-k@amd.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox