The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices
@ 2026-05-09  1:30 Daniel Gibson
  2026-05-09  1:31 ` [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Daniel Gibson
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Daniel Gibson @ 2026-05-09  1:30 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function
  2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
@ 2026-05-09  1:31 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Daniel Gibson @ 2026-05-09  1:31 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson

This slightly refactors code introduced by the
"pmc: Require at least 2.5 seconds between HW sleep cycles" commit
to allow adding different conditions for that delay later.

References: 9f5595d5f03f ("platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles")
Signed-off-by: Daniel Gibson <daniel@gibson.sh>
---
 drivers/platform/x86/amd/pmc/pmc.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index cae3fcafd4d7..2b9e5730170a 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -598,6 +598,19 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 	return rc;
 }
 
+static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
+{
+	/*
+	 * Starting a new HW sleep cycle right after waking from one
+	 * can cause electrical problems triggering the over voltage protection.
+	 * That is avoided by delaying the next suspend a bit, see also
+	 * https://lore.kernel.org/all/20250414162446.3853194-1-superm1@kernel.org/
+	 */
+	struct smu_metrics table;
+
+	return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
+}
+
 static void amd_pmc_s2idle_prepare(void)
 {
 	struct amd_pmc_dev *pdev = &pmc;
@@ -632,11 +645,9 @@ static void amd_pmc_s2idle_prepare(void)
 static void amd_pmc_s2idle_check(void)
 {
 	struct amd_pmc_dev *pdev = &pmc;
-	struct smu_metrics table;
 	int rc;
 
-	/* Avoid triggering OVP */
-	if (!get_metrics_table(pdev, &table) && table.s0i3_last_entry_status)
+	if (amd_pmc_intermediate_wakeup_need_delay(pdev))
 		msleep(2500);
 
 	/* Dump the IdleMask before we add to the STB */
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops
  2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
  2026-05-09  1:31 ` [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Daniel Gibson
@ 2026-05-09  1:31 ` Daniel Gibson
  2026-05-11 12:24   ` Ilpo Järvinen
  2026-05-09  1:31 ` [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Daniel Gibson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Daniel Gibson @ 2026-05-09  1:31 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson, Sindre Henriksen, Mario Limonciello (AMD)

Some IdeaPad Slim 3 devices and similar with AMD CPUs have a
nonfunctional keyboard and lid switch after s2idle.
It helps to delay suspend by 2.5 seconds so the EC has some time
to do whatever it needs to get done before suspend - unfortunately
at least on my 16ABR8 waking it with a timer (wakealarm) still
triggers the issue, but at least normal resume via keypress or
lid works fine.

This issue has been reported for many different devices, this patch
has been tested with the Zen3-based IdeaPad Slim 3 16ABR8 (82XR)
and the Zen3+-based IdeaPad Slim 3 14ARP10 (83K6).

Reported-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221383
Tested-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
Suggested-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Daniel Gibson <daniel@gibson.sh>
---
 drivers/platform/x86/amd/pmc/pmc-quirks.c | 31 +++++++++++++++++++++++
 drivers/platform/x86/amd/pmc/pmc.c        | 24 +++++++++++++++++-
 drivers/platform/x86/amd/pmc/pmc.h        |  1 +
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/amd/pmc/pmc-quirks.c b/drivers/platform/x86/amd/pmc/pmc-quirks.c
index 24506e342943..842a8f442fb5 100644
--- a/drivers/platform/x86/amd/pmc/pmc-quirks.c
+++ b/drivers/platform/x86/amd/pmc/pmc-quirks.c
@@ -18,6 +18,7 @@
 struct quirk_entry {
 	u32 s2idle_bug_mmio;
 	bool spurious_8042;
+	bool need_suspend_delay;
 };
 
 static struct quirk_entry quirk_s2idle_bug = {
@@ -33,6 +34,10 @@ static struct quirk_entry quirk_s2idle_spurious_8042 = {
 	.spurious_8042 = true,
 };
 
+static struct quirk_entry quirk_s2idle_need_suspend_delay = {
+	.need_suspend_delay = true,
+};
+
 static const struct dmi_system_id fwbug_list[] = {
 	{
 		.ident = "L14 Gen2 AMD",
@@ -203,6 +208,27 @@ static const struct dmi_system_id fwbug_list[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"),
 		}
 	},
+	/* https://bugzilla.kernel.org/show_bug.cgi?id=221383 */
+	{
+		.ident = "Zen3-based IdeaPad Slim and similar",
+		.driver_data = &quirk_s2idle_need_suspend_delay,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			/*
+			 * Note: there are also some Zen2-based 82X* devices that
+			 * need different quirks, they're already handled above
+			 */
+			DMI_MATCH(DMI_PRODUCT_NAME, "82X"),
+		}
+	},
+	{
+		.ident = "Zen3+-based IdeaPad Slim and similar",
+		.driver_data = &quirk_s2idle_need_suspend_delay,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "83K"),
+		}
+	},
 	/* https://bugzilla.kernel.org/show_bug.cgi?id=221273 */
 	{
 		.ident = "Thinkpad L14 Gen3",
@@ -356,6 +382,11 @@ void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev)
 		amd_pmc_skip_nvme_smi_handler(dev->quirks->s2idle_bug_mmio);
 }
 
+bool amd_pmc_quirk_need_suspend_delay(struct amd_pmc_dev *dev)
+{
+	return dev->quirks && dev->quirks->need_suspend_delay;
+}
+
 void amd_pmc_quirks_init(struct amd_pmc_dev *dev)
 {
 	const struct dmi_system_id *dmi_id;
diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index 2b9e5730170a..6bafd8661d68 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -611,6 +611,27 @@ static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
 	return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
 }
 
+static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev)
+{
+	/*
+	 * Some Lenovo Laptops (like different IdeaPad 3 Slims) need some
+	 * me-time before sleeping or they get uncooperative after waking
+	 * up and don't send events for keyboard and lid switch anymore.
+	 *
+	 * Unfortunately this doesn't entirely fix the problem: It can still
+	 * happen when resuming with a timer (wakealarm), but at least the
+	 * more common usecases (wakeup by opening lid or pressing a key)
+	 * work fine with this workaround.
+	 *
+	 * See https://bugzilla.kernel.org/show_bug.cgi?id=221383
+	 */
+	if (!disable_workarounds && amd_pmc_quirk_need_suspend_delay(pdev)) {
+		dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
+		return true;
+	}
+	return false;
+}
+
 static void amd_pmc_s2idle_prepare(void)
 {
 	struct amd_pmc_dev *pdev = &pmc;
@@ -647,7 +668,8 @@ static void amd_pmc_s2idle_check(void)
 	struct amd_pmc_dev *pdev = &pmc;
 	int rc;
 
-	if (amd_pmc_intermediate_wakeup_need_delay(pdev))
+	if (amd_pmc_intermediate_wakeup_need_delay(pdev) ||
+	    amd_pmc_want_suspend_delay(pdev))
 		msleep(2500);
 
 	/* Dump the IdleMask before we add to the STB */
diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/pmc/pmc.h
index fe3f53eb5955..f5257e47b8c4 100644
--- a/drivers/platform/x86/amd/pmc/pmc.h
+++ b/drivers/platform/x86/amd/pmc/pmc.h
@@ -147,6 +147,7 @@ enum amd_pmc_def {
 };
 
 void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev);
+bool amd_pmc_quirk_need_suspend_delay(struct amd_pmc_dev *dev);
 void amd_pmc_quirks_init(struct amd_pmc_dev *dev);
 void amd_mp2_stb_init(struct amd_pmc_dev *dev);
 void amd_mp2_stb_deinit(struct amd_pmc_dev *dev);
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter
  2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
  2026-05-09  1:31 ` [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Daniel Gibson
  2026-05-09  1:31 ` [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Daniel Gibson
@ 2026-05-09  1:31 ` 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-09  1:31 ` [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend Daniel Gibson
  4 siblings, 1 reply; 15+ messages in thread
From: Daniel Gibson @ 2026-05-09  1:31 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson

Enabling the new delay_suspend module parameter delays suspend for
2.5 seconds which is known to help for some AMD-based Lenovo Laptops
that otherwise failed to send/receive events for key presses or the
lid switch after s2idle.
Apparently the EC needs to do some things in the background before
suspend or it gets into a bad state.

There are many reports of AMD-based laptops (mostly but not exclusively
IdeaPads) about similar issues on the web; this parameter gives
affected users an easy way to try out if their issues have the same
root cause and to work around them until their specific device is added
to the quirks list.
I added a note to the parameter description encouraging users to report
their device so it can be added to the quirks list, inspired by a
similar request in parameter descriptions of the ideapad-laptop module.

The module parameter can be set to "1" to explicitly enable it,
"0" to disable it even on devices that are assumed to be affected,
or -1 (the default) to enable it if the device is assumed to be affected
(according to fwbug_list[])

Link: https://bugzilla.kernel.org/show_bug.cgi?id=221383
Signed-off-by: Daniel Gibson <daniel@gibson.sh>
---
 drivers/platform/x86/amd/pmc/pmc.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index 6bafd8661d68..2d3d180c15d2 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -16,6 +16,7 @@
 #include <linux/bits.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
+#include <linux/dmi.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/limits.h>
@@ -89,6 +90,11 @@ static bool disable_workarounds;
 module_param(disable_workarounds, bool, 0644);
 MODULE_PARM_DESC(disable_workarounds, "Disable workarounds for platform bugs");
 
+static int delay_suspend = -1;
+module_param(delay_suspend, int, 0644);
+MODULE_PARM_DESC(delay_suspend,
+		 "Delays s2idle by 2.5 seconds to work around buggy ECs, often causing keyboard issues after suspend. 0: don't delay, 1: do delay, -1 (default): let amd_pmc decide. If you need this please report this to: platform-driver-x86@vger.kernel.org");
+
 static struct amd_pmc_dev pmc;
 
 static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
@@ -625,8 +631,23 @@ static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev)
 	 *
 	 * See https://bugzilla.kernel.org/show_bug.cgi?id=221383
 	 */
-	if (!disable_workarounds && amd_pmc_quirk_need_suspend_delay(pdev)) {
-		dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
+	if (amd_pmc_quirk_need_suspend_delay(pdev)) {
+		/*
+		 * delay_suspend=1 force-enables this, otherwise it can be
+		 * disabled with disable_workarounds or delay_suspend=0
+		 */
+		if (delay_suspend == 1 || (delay_suspend == -1 && !disable_workarounds)) {
+			dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
+			return true;
+		}
+		dev_info(pdev->dev, "Not delaying suspend because of module parameter, even though your device is assumed to need it!\n");
+	} else if (delay_suspend == 1) {
+		dev_info(pdev->dev, "Delaying suspend by 2.5s because delay_suspend=1. If this solves problems on your machine, please report this whole line to: platform-driver-x86@vger.kernel.org so it can be automatically detected as affected in the future. System Vendor: \"%s\" Product Name: \"%s\" Product Family: \"%s\" Board Vendor: \"%s\" Board Name: \"%s\"\n",
+			 dmi_get_system_info(DMI_SYS_VENDOR),
+			 dmi_get_system_info(DMI_PRODUCT_NAME),
+			 dmi_get_system_info(DMI_PRODUCT_FAMILY),
+			 dmi_get_system_info(DMI_BOARD_VENDOR),
+			 dmi_get_system_info(DMI_BOARD_NAME));
 		return true;
 	}
 	return false;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register
  2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
                   ` (2 preceding siblings ...)
  2026-05-09  1:31 ` [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Daniel Gibson
@ 2026-05-09  1:31 ` 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
  4 siblings, 2 replies; 15+ messages in thread
From: Daniel Gibson @ 2026-05-09  1:31 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson

To me it wasn't clear how I get the information stored in the reset
register, or how to identify the messages in the syslog mentioned there.

Mario Limonciello sent me an example line which illustrates what to
look for and I added it to the AMD debugging documentation, with a short
explanation.

Signed-off-by: Daniel Gibson <daniel@gibson.sh>
---
 Documentation/arch/x86/amd-debugging.rst | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
index d92bf59d62c7..3176a1240fee 100644
--- a/Documentation/arch/x86/amd-debugging.rst
+++ b/Documentation/arch/x86/amd-debugging.rst
@@ -366,3 +366,8 @@ There are 6 classes of reasons for the reboot:
 This information is read by the kernel at bootup and printed into
 the syslog. When a random reboot occurs this message can be helpful
 to determine the next component to debug.
+
+For example, if bit 19 was set, you will get a message like this in the log on
+next bootup::
+
+  x86/amd: Previous system reset reason [0x00080000]: software wrote 0x6 to reset control register 0xCF9
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend
  2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
                   ` (3 preceding siblings ...)
  2026-05-09  1:31 ` [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register Daniel Gibson
@ 2026-05-09  1:31 ` Daniel Gibson
  2026-05-11 12:49   ` Ilpo Järvinen
  4 siblings, 1 reply; 15+ messages in thread
From: Daniel Gibson @ 2026-05-09  1:31 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson

must be updated with the actual commit IDs when they are merged

Signed-off-by: Daniel Gibson <daniel@gibson.sh>
---
 Documentation/arch/x86/amd-debugging.rst | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
index 3176a1240fee..3af7799cca1a 100644
--- a/Documentation/arch/x86/amd-debugging.rst
+++ b/Documentation/arch/x86/amd-debugging.rst
@@ -249,6 +249,31 @@ state entry.
 
 `commit 40b8c14936bd2 ("drm/amd/display: Disable unneeded hpd interrupts during dm_init") <https://git.kernel.org/torvalds/c/40b8c14936bd2>`_
 
+Keyboard and Lid Switch stop working after resume
+-------------------------------------------------
+On various variants of the Lenovo IdeaPad Slim 3 with Barcelo and Rembrandt CPUs
+the lid switch and keyboard, or at least the Fn/Multimedia keys, stopped working
+after resume, until the next reboot.
+
+This was caused by buggy firmware having timing problems, the EC needed some idle
+time right before the CPU cores are suspended, or it got into an inconsistent state.
+
+For laptops that are known to be affected this workaround is enabled
+automatically, to test this workaround on other machines you can set the
+``delay_suspend`` parameter of the ``amd_pmc`` module.
+
+If you need to set the ``delay_suspend`` parameter to fix your machine, please
+report this at platform-driver-x86@vger.kernel.org for it to be added to the
+list of devices that need this workaround, so in future kernel versions it's
+enabled automatically.
+
+Note that the current workaround isn't perfect: The problems can still happen
+if resume is triggered by a timer (wakealarm).
+
+`commit TODO ("platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops") <https://git.kernel.org/torvalds/c/TODO>`_
+
+`commit TODO ("platform/x86/amd/pmc: Add delay_suspend module parameter") <https://git.kernel.org/torvalds/c/TODO>`_
+
 Runtime power consumption issues
 ================================
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register
  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
  1 sibling, 0 replies; 15+ messages in thread
From: Mario Limonciello @ 2026-05-10  0:21 UTC (permalink / raw)
  To: Daniel Gibson, Shyam Sundar S K, Hans de Goede,
	Ilpo Järvinen, platform-driver-x86, linux-kernel



On 5/8/26 20:31, Daniel Gibson wrote:
> To me it wasn't clear how I get the information stored in the reset
> register, or how to identify the messages in the syslog mentioned there.
> 
> Mario Limonciello sent me an example line which illustrates what to
> look for and I added it to the AMD debugging documentation, with a short
> explanation.
You can drop this second paragraph and just add:

Suggested-by: Mario Limonciello (AMD) <superm1@kernel.org>
> 
> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>   Documentation/arch/x86/amd-debugging.rst | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
> index d92bf59d62c7..3176a1240fee 100644
> --- a/Documentation/arch/x86/amd-debugging.rst
> +++ b/Documentation/arch/x86/amd-debugging.rst
> @@ -366,3 +366,8 @@ There are 6 classes of reasons for the reboot:
>   This information is read by the kernel at bootup and printed into
>   the syslog. When a random reboot occurs this message can be helpful
>   to determine the next component to debug.
> +
> +For example, if bit 19 was set, you will get a message like this in the log on
> +next bootup::
> +
> +  x86/amd: Previous system reset reason [0x00080000]: software wrote 0x6 to reset control register 0xCF9


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops
  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
  0 siblings, 1 reply; 15+ messages in thread
From: Ilpo Järvinen @ 2026-05-11 12:24 UTC (permalink / raw)
  To: Daniel Gibson
  Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML,
	Sindre Henriksen, Mario Limonciello (AMD)

[-- Attachment #1: Type: text/plain, Size: 5831 bytes --]

On Sat, 9 May 2026, Daniel Gibson wrote:

> Some IdeaPad Slim 3 devices and similar with AMD CPUs have a
> nonfunctional keyboard and lid switch after s2idle.
> It helps to delay suspend by 2.5 seconds so the EC has some time
> to do whatever it needs to get done before suspend - unfortunately
> at least on my 16ABR8 waking it with a timer (wakealarm) still
> triggers the issue, but at least normal resume via keypress or
> lid works fine.
> 
> This issue has been reported for many different devices, this patch
> has been tested with the Zen3-based IdeaPad Slim 3 16ABR8 (82XR)
> and the Zen3+-based IdeaPad Slim 3 14ARP10 (83K6).
> 
> Reported-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221383

Cc: stable@vger.kernel.org

would be warranted for this.

> Tested-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
> Suggested-by: Mario Limonciello (AMD) <superm1@kernel.org>
> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  drivers/platform/x86/amd/pmc/pmc-quirks.c | 31 +++++++++++++++++++++++
>  drivers/platform/x86/amd/pmc/pmc.c        | 24 +++++++++++++++++-
>  drivers/platform/x86/amd/pmc/pmc.h        |  1 +
>  3 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/pmc-quirks.c b/drivers/platform/x86/amd/pmc/pmc-quirks.c
> index 24506e342943..842a8f442fb5 100644
> --- a/drivers/platform/x86/amd/pmc/pmc-quirks.c
> +++ b/drivers/platform/x86/amd/pmc/pmc-quirks.c
> @@ -18,6 +18,7 @@
>  struct quirk_entry {
>  	u32 s2idle_bug_mmio;
>  	bool spurious_8042;
> +	bool need_suspend_delay;
>  };
>  
>  static struct quirk_entry quirk_s2idle_bug = {
> @@ -33,6 +34,10 @@ static struct quirk_entry quirk_s2idle_spurious_8042 = {
>  	.spurious_8042 = true,
>  };
>  
> +static struct quirk_entry quirk_s2idle_need_suspend_delay = {
> +	.need_suspend_delay = true,
> +};
> +
>  static const struct dmi_system_id fwbug_list[] = {
>  	{
>  		.ident = "L14 Gen2 AMD",
> @@ -203,6 +208,27 @@ static const struct dmi_system_id fwbug_list[] = {
>  			DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"),
>  		}
>  	},
> +	/* https://bugzilla.kernel.org/show_bug.cgi?id=221383 */
> +	{
> +		.ident = "Zen3-based IdeaPad Slim and similar",
> +		.driver_data = &quirk_s2idle_need_suspend_delay,
> +		.matches = {
> +			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
> +			/*
> +			 * Note: there are also some Zen2-based 82X* devices that
> +			 * need different quirks, they're already handled above
> +			 */
> +			DMI_MATCH(DMI_PRODUCT_NAME, "82X"),
> +		}
> +	},
> +	{
> +		.ident = "Zen3+-based IdeaPad Slim and similar",
> +		.driver_data = &quirk_s2idle_need_suspend_delay,
> +		.matches = {
> +			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "83K"),
> +		}
> +	},
>  	/* https://bugzilla.kernel.org/show_bug.cgi?id=221273 */
>  	{
>  		.ident = "Thinkpad L14 Gen3",
> @@ -356,6 +382,11 @@ void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev)
>  		amd_pmc_skip_nvme_smi_handler(dev->quirks->s2idle_bug_mmio);
>  }
>  
> +bool amd_pmc_quirk_need_suspend_delay(struct amd_pmc_dev *dev)
> +{
> +	return dev->quirks && dev->quirks->need_suspend_delay;
> +}
> +
>  void amd_pmc_quirks_init(struct amd_pmc_dev *dev)
>  {
>  	const struct dmi_system_id *dmi_id;
> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
> index 2b9e5730170a..6bafd8661d68 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.c
> +++ b/drivers/platform/x86/amd/pmc/pmc.c
> @@ -611,6 +611,27 @@ static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
>  	return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
>  }
>  
> +static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev)
> +{
> +	/*
> +	 * Some Lenovo Laptops (like different IdeaPad 3 Slims) need some
> +	 * me-time before sleeping or they get uncooperative after waking
> +	 * up and don't send events for keyboard and lid switch anymore.
> +	 *
> +	 * Unfortunately this doesn't entirely fix the problem: It can still
> +	 * happen when resuming with a timer (wakealarm), but at least the
> +	 * more common usecases (wakeup by opening lid or pressing a key)
> +	 * work fine with this workaround.
> +	 *
> +	 * See https://bugzilla.kernel.org/show_bug.cgi?id=221383
> +	 */
> +	if (!disable_workarounds && amd_pmc_quirk_need_suspend_delay(pdev)) {
> +		dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
> +		return true;
> +	}
> +	return false;
> +}
> +
>  static void amd_pmc_s2idle_prepare(void)
>  {
>  	struct amd_pmc_dev *pdev = &pmc;
> @@ -647,7 +668,8 @@ static void amd_pmc_s2idle_check(void)
>  	struct amd_pmc_dev *pdev = &pmc;
>  	int rc;
>  
> -	if (amd_pmc_intermediate_wakeup_need_delay(pdev))
> +	if (amd_pmc_intermediate_wakeup_need_delay(pdev) ||
> +	    amd_pmc_want_suspend_delay(pdev))

Thanks, this looks much cleaner. :-)

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

>  		msleep(2500);
>  
>  	/* Dump the IdleMask before we add to the STB */
> diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/pmc/pmc.h
> index fe3f53eb5955..f5257e47b8c4 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.h
> +++ b/drivers/platform/x86/amd/pmc/pmc.h
> @@ -147,6 +147,7 @@ enum amd_pmc_def {
>  };
>  
>  void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev);
> +bool amd_pmc_quirk_need_suspend_delay(struct amd_pmc_dev *dev);
>  void amd_pmc_quirks_init(struct amd_pmc_dev *dev);
>  void amd_mp2_stb_init(struct amd_pmc_dev *dev);
>  void amd_mp2_stb_deinit(struct amd_pmc_dev *dev);
> 

-- 
 i.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function
  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
  0 siblings, 0 replies; 15+ messages in thread
From: Ilpo Järvinen @ 2026-05-11 12:31 UTC (permalink / raw)
  To: Daniel Gibson; +Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML

On Sat, 9 May 2026, Daniel Gibson wrote:

> This slightly refactors code introduced by the

Avoid starting changelog with "This" or "This patch" but use imperative 
tone instead. You can start with "Refactor code ..."

> "pmc: Require at least 2.5 seconds between HW sleep cycles"

Please always use the canonical commit reference format (see 
Documentation/process/submitting-patches.rst for detail).

It's on the borderline if the origin of the code even matters that much 
but since you're adding the (nice) comment, I guess it is easier to figure 
out where that came from by having the reference in place.

> commit
> to allow adding different conditions for that delay later.

later -> in an upcoming change

> 
> References: 9f5595d5f03f ("platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles")

Drop this.

> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  drivers/platform/x86/amd/pmc/pmc.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
> index cae3fcafd4d7..2b9e5730170a 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.c
> +++ b/drivers/platform/x86/amd/pmc/pmc.c
> @@ -598,6 +598,19 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
>  	return rc;
>  }
>  
> +static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
> +{
> +	/*
> +	 * Starting a new HW sleep cycle right after waking from one
> +	 * can cause electrical problems triggering the over voltage protection.
> +	 * That is avoided by delaying the next suspend a bit, see also
> +	 * https://lore.kernel.org/all/20250414162446.3853194-1-superm1@kernel.org/
> +	 */
> +	struct smu_metrics table;
> +
> +	return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
> +}
> +
>  static void amd_pmc_s2idle_prepare(void)
>  {
>  	struct amd_pmc_dev *pdev = &pmc;
> @@ -632,11 +645,9 @@ static void amd_pmc_s2idle_prepare(void)
>  static void amd_pmc_s2idle_check(void)
>  {
>  	struct amd_pmc_dev *pdev = &pmc;
> -	struct smu_metrics table;
>  	int rc;
>  
> -	/* Avoid triggering OVP */
> -	if (!get_metrics_table(pdev, &table) && table.s0i3_last_entry_status)
> +	if (amd_pmc_intermediate_wakeup_need_delay(pdev))
>  		msleep(2500);
>  
>  	/* Dump the IdleMask before we add to the STB */
> 

-- 
 i.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter
  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
  0 siblings, 0 replies; 15+ messages in thread
From: Ilpo Järvinen @ 2026-05-11 12:36 UTC (permalink / raw)
  To: Daniel Gibson; +Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML

On Sat, 9 May 2026, Daniel Gibson wrote:

> Enabling the new delay_suspend module parameter delays suspend for
> 2.5 seconds which is known to help for some AMD-based Lenovo Laptops
> that otherwise failed to send/receive events for key presses or the
> lid switch after s2idle.
> Apparently the EC needs to do some things in the background before

Please fill in paragraphs to ~72 chars or clearly make another 
paragraph with a line in between, if that's what you want.

> suspend or it gets into a bad state.
> 
> There are many reports of AMD-based laptops (mostly but not exclusively
> IdeaPads) about similar issues on the web; this parameter gives
> affected users an easy way to try out if their issues have the same
> root cause and to work around them until their specific device is added
> to the quirks list.
> I added a note to the parameter description encouraging users to report
> their device so it can be added to the quirks list, inspired by a
> similar request in parameter descriptions of the ideapad-laptop module.
> 
> The module parameter can be set to "1" to explicitly enable it,
> "0" to disable it even on devices that are assumed to be affected,
> or -1 (the default) to enable it if the device is assumed to be affected
> (according to fwbug_list[])
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=221383
> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  drivers/platform/x86/amd/pmc/pmc.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
> index 6bafd8661d68..2d3d180c15d2 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.c
> +++ b/drivers/platform/x86/amd/pmc/pmc.c
> @@ -16,6 +16,7 @@
>  #include <linux/bits.h>
>  #include <linux/debugfs.h>
>  #include <linux/delay.h>
> +#include <linux/dmi.h>
>  #include <linux/io.h>
>  #include <linux/iopoll.h>
>  #include <linux/limits.h>
> @@ -89,6 +90,11 @@ static bool disable_workarounds;
>  module_param(disable_workarounds, bool, 0644);
>  MODULE_PARM_DESC(disable_workarounds, "Disable workarounds for platform bugs");
>  
> +static int delay_suspend = -1;
> +module_param(delay_suspend, int, 0644);
> +MODULE_PARM_DESC(delay_suspend,
> +		 "Delays s2idle by 2.5 seconds to work around buggy ECs, often causing keyboard issues after suspend. 0: don't delay, 1: do delay, -1 (default): let amd_pmc decide. If you need this please report this to: platform-driver-x86@vger.kernel.org");
> +
>  static struct amd_pmc_dev pmc;
>  
>  static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
> @@ -625,8 +631,23 @@ static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev)
>  	 *
>  	 * See https://bugzilla.kernel.org/show_bug.cgi?id=221383
>  	 */
> -	if (!disable_workarounds && amd_pmc_quirk_need_suspend_delay(pdev)) {
> -		dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
> +	if (amd_pmc_quirk_need_suspend_delay(pdev)) {
> +		/*
> +		 * delay_suspend=1 force-enables this, otherwise it can be
> +		 * disabled with disable_workarounds or delay_suspend=0
> +		 */
> +		if (delay_suspend == 1 || (delay_suspend == -1 && !disable_workarounds)) {
> +			dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
> +			return true;
> +		}
> +		dev_info(pdev->dev, "Not delaying suspend because of module parameter, even though your device is assumed to need it!\n");
> +	} else if (delay_suspend == 1) {

At least the parameter interactions madness is a bit more contained now 
that it's in these smaller functions. :-/

Still not a big fan of it but I guess it's not worth fighting over 
something that normally shouldn't be needed (if we've all the needed 
quirk info in place).

> +		dev_info(pdev->dev, "Delaying suspend by 2.5s because delay_suspend=1. If this solves problems on your machine, please report this whole line to: platform-driver-x86@vger.kernel.org so it can be automatically detected as affected in the future. System Vendor: \"%s\" Product Name: \"%s\" Product Family: \"%s\" Board Vendor: \"%s\" Board Name: \"%s\"\n",
> +			 dmi_get_system_info(DMI_SYS_VENDOR),
> +			 dmi_get_system_info(DMI_PRODUCT_NAME),
> +			 dmi_get_system_info(DMI_PRODUCT_FAMILY),
> +			 dmi_get_system_info(DMI_BOARD_VENDOR),
> +			 dmi_get_system_info(DMI_BOARD_NAME));
>  		return true;
>  	}
>  	return false;
> 

-- 
 i.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register
  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
  1 sibling, 0 replies; 15+ messages in thread
From: Ilpo Järvinen @ 2026-05-11 12:45 UTC (permalink / raw)
  To: Daniel Gibson; +Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML

On Sat, 9 May 2026, Daniel Gibson wrote:

> To me it wasn't clear how I get the information stored in the reset
> register, or how to identify the messages in the syslog mentioned there.

Please rewrite the entire changelog text. Don't write it from your own 
perspective (no "I" / "We") but describe it as a problem/defiancy in the 
documentation.

> Mario Limonciello sent me an example line which illustrates what to
> look for and I added it to the AMD debugging documentation, with a short
> explanation.

Change e.g. to:

Add an example how the reset reason is presented into AMD debugging 
documentation.

As Mario mentioned, persons suggesting something can be put to 
Suggested-by tag.

> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  Documentation/arch/x86/amd-debugging.rst | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
> index d92bf59d62c7..3176a1240fee 100644
> --- a/Documentation/arch/x86/amd-debugging.rst
> +++ b/Documentation/arch/x86/amd-debugging.rst
> @@ -366,3 +366,8 @@ There are 6 classes of reasons for the reboot:
>  This information is read by the kernel at bootup and printed into
>  the syslog. When a random reboot occurs this message can be helpful
>  to determine the next component to debug.
> +
> +For example, if bit 19 was set, you will get a message like this in the log on
> +next bootup::
> +
> +  x86/amd: Previous system reset reason [0x00080000]: software wrote 0x6 to reset control register 0xCF9

The diff itself looks fine.

-- 
 i.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend
  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
  0 siblings, 1 reply; 15+ messages in thread
From: Ilpo Järvinen @ 2026-05-11 12:49 UTC (permalink / raw)
  To: Daniel Gibson; +Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML

On Sat, 9 May 2026, Daniel Gibson wrote:

> must be updated with the actual commit IDs when they are merged

Please write a proper changelog text.

Unfortunately, I cannot know the commit ID in advance as it depends on the 
commit content itself (git object hashing works that way).

> 
> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  Documentation/arch/x86/amd-debugging.rst | 25 ++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
> index 3176a1240fee..3af7799cca1a 100644
> --- a/Documentation/arch/x86/amd-debugging.rst
> +++ b/Documentation/arch/x86/amd-debugging.rst
> @@ -249,6 +249,31 @@ state entry.
>  
>  `commit 40b8c14936bd2 ("drm/amd/display: Disable unneeded hpd interrupts during dm_init") <https://git.kernel.org/torvalds/c/40b8c14936bd2>`_
>  
> +Keyboard and Lid Switch stop working after resume
> +-------------------------------------------------
> +On various variants of the Lenovo IdeaPad Slim 3 with Barcelo and Rembrandt CPUs
> +the lid switch and keyboard, or at least the Fn/Multimedia keys, stopped working
> +after resume, until the next reboot.
> +
> +This was caused by buggy firmware having timing problems, the EC needed some idle
> +time right before the CPU cores are suspended, or it got into an inconsistent state.
> +
> +For laptops that are known to be affected this workaround is enabled
> +automatically, to test this workaround on other machines you can set the
> +``delay_suspend`` parameter of the ``amd_pmc`` module.
> +
> +If you need to set the ``delay_suspend`` parameter to fix your machine, please
> +report this at platform-driver-x86@vger.kernel.org for it to be added to the
> +list of devices that need this workaround, so in future kernel versions it's
> +enabled automatically.
> +
> +Note that the current workaround isn't perfect: The problems can still happen
> +if resume is triggered by a timer (wakealarm).
> +
> +`commit TODO ("platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops") <https://git.kernel.org/torvalds/c/TODO>`_
> +
> +`commit TODO ("platform/x86/amd/pmc: Add delay_suspend module parameter") <https://git.kernel.org/torvalds/c/TODO>`_
> +
>  Runtime power consumption issues
>  ================================
>  
> 

-- 
 i.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops
  2026-05-11 12:24   ` Ilpo Järvinen
@ 2026-05-12  0:45     ` Daniel Gibson
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Gibson @ 2026-05-12  0:45 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML,
	Sindre Henriksen, Mario Limonciello (AMD)

On 11.05.26 14:24, Ilpo Järvinen wrote:
> On Sat, 9 May 2026, Daniel Gibson wrote:
> 
>> Some IdeaPad Slim 3 devices and similar with AMD CPUs have a
>> nonfunctional keyboard and lid switch after s2idle.
>> It helps to delay suspend by 2.5 seconds so the EC has some time
>> to do whatever it needs to get done before suspend - unfortunately
>> at least on my 16ABR8 waking it with a timer (wakealarm) still
>> triggers the issue, but at least normal resume via keypress or
>> lid works fine.
>>
>> This issue has been reported for many different devices, this patch
>> has been tested with the Zen3-based IdeaPad Slim 3 16ABR8 (82XR)
>> and the Zen3+-based IdeaPad Slim 3 14ARP10 (83K6).
>>
>> Reported-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
>> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221383
> 
> Cc: stable@vger.kernel.org
> 
> would be warranted for this.

Same for the next patch introducing the module parameter?

I already got one report from someone using the parameter that their
laptop is affected (will include it in the next version of patches).
I fear there are more - Lenovos naming schemes are wild...

So I think it would be quite useful to get it to people using stable
kernels as well


> 
>> Tested-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
>> Suggested-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
>> ---
>>  drivers/platform/x86/amd/pmc/pmc-quirks.c | 31 +++++++++++++++++++++++
>>  drivers/platform/x86/amd/pmc/pmc.c        | 24 +++++++++++++++++-
>>  drivers/platform/x86/amd/pmc/pmc.h        |  1 +
>>  3 files changed, 55 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/amd/pmc/pmc-quirks.c b/drivers/platform/x86/amd/pmc/pmc-quirks.c
>> index 24506e342943..842a8f442fb5 100644
>> --- a/drivers/platform/x86/amd/pmc/pmc-quirks.c
>> +++ b/drivers/platform/x86/amd/pmc/pmc-quirks.c
>> @@ -18,6 +18,7 @@
>>  struct quirk_entry {
>>  	u32 s2idle_bug_mmio;
>>  	bool spurious_8042;
>> +	bool need_suspend_delay;
>>  };
>>  
>>  static struct quirk_entry quirk_s2idle_bug = {
>> @@ -33,6 +34,10 @@ static struct quirk_entry quirk_s2idle_spurious_8042 = {
>>  	.spurious_8042 = true,
>>  };
>>  
>> +static struct quirk_entry quirk_s2idle_need_suspend_delay = {
>> +	.need_suspend_delay = true,
>> +};
>> +
>>  static const struct dmi_system_id fwbug_list[] = {
>>  	{
>>  		.ident = "L14 Gen2 AMD",
>> @@ -203,6 +208,27 @@ static const struct dmi_system_id fwbug_list[] = {
>>  			DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"),
>>  		}
>>  	},
>> +	/* https://bugzilla.kernel.org/show_bug.cgi?id=221383 */
>> +	{
>> +		.ident = "Zen3-based IdeaPad Slim and similar",
>> +		.driver_data = &quirk_s2idle_need_suspend_delay,
>> +		.matches = {
>> +			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
>> +			/*
>> +			 * Note: there are also some Zen2-based 82X* devices that
>> +			 * need different quirks, they're already handled above
>> +			 */
>> +			DMI_MATCH(DMI_PRODUCT_NAME, "82X"),
>> +		}
>> +	},
>> +	{
>> +		.ident = "Zen3+-based IdeaPad Slim and similar",
>> +		.driver_data = &quirk_s2idle_need_suspend_delay,
>> +		.matches = {
>> +			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
>> +			DMI_MATCH(DMI_PRODUCT_NAME, "83K"),
>> +		}
>> +	},
>>  	/* https://bugzilla.kernel.org/show_bug.cgi?id=221273 */
>>  	{
>>  		.ident = "Thinkpad L14 Gen3",
>> @@ -356,6 +382,11 @@ void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev)
>>  		amd_pmc_skip_nvme_smi_handler(dev->quirks->s2idle_bug_mmio);
>>  }
>>  
>> +bool amd_pmc_quirk_need_suspend_delay(struct amd_pmc_dev *dev)
>> +{
>> +	return dev->quirks && dev->quirks->need_suspend_delay;
>> +}
>> +
>>  void amd_pmc_quirks_init(struct amd_pmc_dev *dev)
>>  {
>>  	const struct dmi_system_id *dmi_id;
>> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
>> index 2b9e5730170a..6bafd8661d68 100644
>> --- a/drivers/platform/x86/amd/pmc/pmc.c
>> +++ b/drivers/platform/x86/amd/pmc/pmc.c
>> @@ -611,6 +611,27 @@ static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
>>  	return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
>>  }
>>  
>> +static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev)
>> +{
>> +	/*
>> +	 * Some Lenovo Laptops (like different IdeaPad 3 Slims) need some
>> +	 * me-time before sleeping or they get uncooperative after waking
>> +	 * up and don't send events for keyboard and lid switch anymore.
>> +	 *
>> +	 * Unfortunately this doesn't entirely fix the problem: It can still
>> +	 * happen when resuming with a timer (wakealarm), but at least the
>> +	 * more common usecases (wakeup by opening lid or pressing a key)
>> +	 * work fine with this workaround.
>> +	 *
>> +	 * See https://bugzilla.kernel.org/show_bug.cgi?id=221383
>> +	 */
>> +	if (!disable_workarounds && amd_pmc_quirk_need_suspend_delay(pdev)) {
>> +		dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n");
>> +		return true;
>> +	}
>> +	return false;
>> +}
>> +
>>  static void amd_pmc_s2idle_prepare(void)
>>  {
>>  	struct amd_pmc_dev *pdev = &pmc;
>> @@ -647,7 +668,8 @@ static void amd_pmc_s2idle_check(void)
>>  	struct amd_pmc_dev *pdev = &pmc;
>>  	int rc;
>>  
>> -	if (amd_pmc_intermediate_wakeup_need_delay(pdev))
>> +	if (amd_pmc_intermediate_wakeup_need_delay(pdev) ||
>> +	    amd_pmc_want_suspend_delay(pdev))
> 
> Thanks, this looks much cleaner. :-)
> 
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Thanks!

> 
>>  		msleep(2500);
>>  
>>  	/* Dump the IdleMask before we add to the STB */
>> diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/pmc/pmc.h
>> index fe3f53eb5955..f5257e47b8c4 100644
>> --- a/drivers/platform/x86/amd/pmc/pmc.h
>> +++ b/drivers/platform/x86/amd/pmc/pmc.h
>> @@ -147,6 +147,7 @@ enum amd_pmc_def {
>>  };
>>  
>>  void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev);
>> +bool amd_pmc_quirk_need_suspend_delay(struct amd_pmc_dev *dev);
>>  void amd_pmc_quirks_init(struct amd_pmc_dev *dev);
>>  void amd_mp2_stb_init(struct amd_pmc_dev *dev);
>>  void amd_mp2_stb_deinit(struct amd_pmc_dev *dev);
>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend
  2026-05-11 12:49   ` Ilpo Järvinen
@ 2026-05-12  0:50     ` Daniel Gibson
  2026-05-12  9:06       ` Ilpo Järvinen
  0 siblings, 1 reply; 15+ messages in thread
From: Daniel Gibson @ 2026-05-12  0:50 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML

On 11.05.26 14:49, Ilpo Järvinen wrote:
> On Sat, 9 May 2026, Daniel Gibson wrote:
> 
>> must be updated with the actual commit IDs when they are merged
> 
> Please write a proper changelog text.
> 
> Unfortunately, I cannot know the commit ID in advance as it depends on the 
> commit content itself (git object hashing works that way).

Yeah, I know - I already feared I'd have to submit this documentation
later when the other stuff is merged, but thought I'd post it here
anyway to maybe get feedback on the documentation text itself while its
context is in the same email thread.

 >>
>> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
>> ---
>>  Documentation/arch/x86/amd-debugging.rst | 25 ++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
>> index 3176a1240fee..3af7799cca1a 100644
>> --- a/Documentation/arch/x86/amd-debugging.rst
>> +++ b/Documentation/arch/x86/amd-debugging.rst
>> @@ -249,6 +249,31 @@ state entry.
>>  
>>  `commit 40b8c14936bd2 ("drm/amd/display: Disable unneeded hpd interrupts during dm_init") <https://git.kernel.org/torvalds/c/40b8c14936bd2>`_
>>  
>> +Keyboard and Lid Switch stop working after resume
>> +-------------------------------------------------
>> +On various variants of the Lenovo IdeaPad Slim 3 with Barcelo and Rembrandt CPUs
>> +the lid switch and keyboard, or at least the Fn/Multimedia keys, stopped working
>> +after resume, until the next reboot.
>> +
>> +This was caused by buggy firmware having timing problems, the EC needed some idle
>> +time right before the CPU cores are suspended, or it got into an inconsistent state.
>> +
>> +For laptops that are known to be affected this workaround is enabled
>> +automatically, to test this workaround on other machines you can set the
>> +``delay_suspend`` parameter of the ``amd_pmc`` module.
>> +
>> +If you need to set the ``delay_suspend`` parameter to fix your machine, please
>> +report this at platform-driver-x86@vger.kernel.org for it to be added to the
>> +list of devices that need this workaround, so in future kernel versions it's
>> +enabled automatically.
>> +
>> +Note that the current workaround isn't perfect: The problems can still happen
>> +if resume is triggered by a timer (wakealarm).
>> +
>> +`commit TODO ("platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops") <https://git.kernel.org/torvalds/c/TODO>`_
>> +
>> +`commit TODO ("platform/x86/amd/pmc: Add delay_suspend module parameter") <https://git.kernel.org/torvalds/c/TODO>`_
>> +
>>  Runtime power consumption issues
>>  ================================
>>  
>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend
  2026-05-12  0:50     ` Daniel Gibson
@ 2026-05-12  9:06       ` Ilpo Järvinen
  0 siblings, 0 replies; 15+ messages in thread
From: Ilpo Järvinen @ 2026-05-12  9:06 UTC (permalink / raw)
  To: Daniel Gibson; +Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML

[-- Attachment #1: Type: text/plain, Size: 3167 bytes --]

On Tue, 12 May 2026, Daniel Gibson wrote:

> On 11.05.26 14:49, Ilpo Järvinen wrote:
> > On Sat, 9 May 2026, Daniel Gibson wrote:
> > 
> >> must be updated with the actual commit IDs when they are merged
> > 
> > Please write a proper changelog text.
> > 
> > Unfortunately, I cannot know the commit ID in advance as it depends on the 
> > commit content itself (git object hashing works that way).
> 
> Yeah, I know - I already feared I'd have to submit this documentation
> later when the other stuff is merged, but thought I'd post it here
> anyway to maybe get feedback on the documentation text itself while its
> context is in the same email thread.

Lets do so you keep it part of the series, for now.

I try to remember to apply only the other patches and you resubmit the 
last one with the correct id once I've accepted the other patches (and I 
try to remember to not rebase past that point after that).

> >> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> >> ---
> >>  Documentation/arch/x86/amd-debugging.rst | 25 ++++++++++++++++++++++++
> >>  1 file changed, 25 insertions(+)
> >>
> >> diff --git a/Documentation/arch/x86/amd-debugging.rst b/Documentation/arch/x86/amd-debugging.rst
> >> index 3176a1240fee..3af7799cca1a 100644
> >> --- a/Documentation/arch/x86/amd-debugging.rst
> >> +++ b/Documentation/arch/x86/amd-debugging.rst
> >> @@ -249,6 +249,31 @@ state entry.
> >>  
> >>  `commit 40b8c14936bd2 ("drm/amd/display: Disable unneeded hpd interrupts during dm_init") <https://git.kernel.org/torvalds/c/40b8c14936bd2>`_
> >>  
> >> +Keyboard and Lid Switch stop working after resume
> >> +-------------------------------------------------
> >> +On various variants of the Lenovo IdeaPad Slim 3 with Barcelo and Rembrandt CPUs
> >> +the lid switch and keyboard, or at least the Fn/Multimedia keys, stopped working
> >> +after resume, until the next reboot.
> >> +
> >> +This was caused by buggy firmware having timing problems, the EC needed some idle
> >> +time right before the CPU cores are suspended, or it got into an inconsistent state.
> >> +
> >> +For laptops that are known to be affected this workaround is enabled
> >> +automatically, to test this workaround on other machines you can set the
> >> +``delay_suspend`` parameter of the ``amd_pmc`` module.
> >> +
> >> +If you need to set the ``delay_suspend`` parameter to fix your machine, please
> >> +report this at platform-driver-x86@vger.kernel.org for it to be added to the
> >> +list of devices that need this workaround, so in future kernel versions it's
> >> +enabled automatically.
> >> +
> >> +Note that the current workaround isn't perfect: The problems can still happen
> >> +if resume is triggered by a timer (wakealarm).
> >> +
> >> +`commit TODO ("platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops") <https://git.kernel.org/torvalds/c/TODO>`_
> >> +
> >> +`commit TODO ("platform/x86/amd/pmc: Add delay_suspend module parameter") <https://git.kernel.org/torvalds/c/TODO>`_
> >> +
> >>  Runtime power consumption issues
> >>  ================================
> >>  
> >>
> > 
> 

-- 
 i.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-05-12  9:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox