From nobody Mon Jun 8 06:36:57 2026 Received: from smtp-42ad.mail.infomaniak.ch (smtp-42ad.mail.infomaniak.ch [84.16.66.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A7523DCDB2 for ; Wed, 3 Jun 2026 03:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456290; cv=none; b=tF5vYpHb8Pm/GoBU4dSYKOzJrUN9ILqeQ7uAAzYytdhOc+bBiH1gJXQkLxoidtVemHiSDbMPDgIAkF1pu4RDSD8+dMUqIVBxKVufmyO6HvM53r9EZ8wpqHX+OT1RGDa7FGOgPliMt0UtWm7cA/FLu9Dd0s18pgfe/KNxV3detyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456290; c=relaxed/simple; bh=iEjA2MjKSCB7UYuBfpm7ZoN6u/xw2LXb42wJfvgR3/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YP1+5+MFKqBGPSV5Ppe4LZGF+vEQQtF2JsjS5MNu1fOmnISehXjEZaOXsA05P9yGxn91jdYMz0tcnGJRLULnhGVrGOqhyRwgawxP2gOxd9OAmfJuNg4HDWyt1/EvxJi1IxsYU7QNYogPrAO52XJxxElvX3l/CSkGgriRkXcPddQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh; spf=pass smtp.mailfrom=gibson.sh; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b=B2kGzEDh; arc=none smtp.client-ip=84.16.66.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gibson.sh Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b="B2kGzEDh" Received: from smtp-4-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6b]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gVXlr5WDsz14c6 for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780456280; bh=Mx0oPR9bcP29fTc5WI0tJYSbBL/td4L1Mh46SbEbR5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2kGzEDh/HIRFLpf+X19zTY7k3m3sQfei3dMulLLhaiqXNpfaZ+3uFGJHnYw/hUr3 i7wIM7f2Dq4lS9zr1kVhDkSAv9nB40WM2YmLgxOX9IJuHY4LPBplUxSl9WSA/QvG/W 13ApwIH5iz2pdLOncpId2LLelBSZtChoZrH5GQjUsZBjQZbbe/2lMe0KfSIv9dlKmE XEsOjF6uqgRc2kW3uMInIirqm6yklVzO63/Ujkp92yk0gG0qgDzMRWEDJXLha2vyjF lT785sDM0PS7i293uJbHMSOIfcsqgdGIBLIiADFTbq+B2qSRFT8cta7c5Efzqe1bQD fQELIDHixWCPQ== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gVXlr2CMRzNZk for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Wed, 03 Jun 2026 05:11:19 +0200 From: Daniel Gibson To: Shyam Sundar S K , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello Cc: Daniel Gibson , stable@vger.kernel.org Subject: [PATCH v3 RESEND 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Date: Wed, 3 Jun 2026 05:11:06 +0200 Message-ID: <20260603031110.345815-2-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260603031110.345815-1-daniel@gibson.sh> References: <20260603031110.345815-1-daniel@gibson.sh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" Refactor code introduced by commit 9f5595d5f03f ("pmc: Require at least 2.5 seconds between HW sleep cycles") to allow adding different conditions for that delay in an upcoming change. Signed-off-by: Daniel Gibson Cc: stable@vger.kernel.org --- 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; } =20 +static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pde= v) +{ + /* + * 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.or= g/ + */ + struct smu_metrics table; + + return get_metrics_table(pdev, &table) =3D=3D 0 && table.s0i3_last_entry_= status; +} + static void amd_pmc_s2idle_prepare(void) { struct amd_pmc_dev *pdev =3D &pmc; @@ -632,11 +645,9 @@ static void amd_pmc_s2idle_prepare(void) static void amd_pmc_s2idle_check(void) { struct amd_pmc_dev *pdev =3D &pmc; - struct smu_metrics table; int rc; =20 - /* Avoid triggering OVP */ - if (!get_metrics_table(pdev, &table) && table.s0i3_last_entry_status) + if (amd_pmc_intermediate_wakeup_need_delay(pdev)) msleep(2500); =20 /* Dump the IdleMask before we add to the STB */ --=20 2.48.1 From nobody Mon Jun 8 06:36:57 2026 Received: from smtp-190d.mail.infomaniak.ch (smtp-190d.mail.infomaniak.ch [185.125.25.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B54EA3911DC for ; Wed, 3 Jun 2026 03:16:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456605; cv=none; b=F7V94qOEf2G+q9dj5y+B4mqMD5tACd5Jf5G5qUnzGGBOe5/mrEbaypdfHILXxFP883n7fPGOgdazsMchkaKeJcutkNOgQgVu6jN8KeavMutc779zqGD0dETkam1BwjJZIUK5s6Mcjx4Q+yHMn9gmQQdhEyyGN2HcQGgRPmZemRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456605; c=relaxed/simple; bh=QkcUs+wGNzMPmILUBTYVBn+gnjg0v75ATYO2wka1ZNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y0TF1pxnzJohOAsCGrUSfqSN9Mt3tF5jsfhXJpBvpnpErxMJma6gsXTqW9jze9OYPoqKwO9Rg+tqRznsxLalXtm6c/+BdD4AoqF6s4OwUw01i7fC2TYWDzf3TmaBKV9fOBWuJmEtgLlUm5YadEqBX+Dp1rpknl01vBil6XEvRJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh; spf=pass smtp.mailfrom=gibson.sh; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b=HbLxczcL; arc=none smtp.client-ip=185.125.25.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gibson.sh Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b="HbLxczcL" Received: from smtp-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gVXlr59jcz13n4 for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780456280; bh=GhgHPh6OdEWWqZa5b625m/84/bhZzQGSCVt/V9gCfsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbLxczcLOYePcVPfnYrTf0hA2NQPvwVUchY99CxBlsZ3Q5TA2X06BHyKWOXMjsyhN WcmREJk9T3vygZ6ku9v6ovN1758JMbJVnGGf64t0V2utNHBItlWZr0JsbF3AReXveG dz+Muog2plmQCmFpAh8Ze8cw1w67BHykVflwshqFkEs2O8nRqrH9E/NfTA+SiJq5F/ 9qIM20uXKNaz7GsufMQQxb6BaiPZ/xqxlYSL0IVz2Cjd3UtagwmaAhoGh0cr98SC+4 1ZNl6+jUSHMM7H/3F6pUAaII5XyihHO9wxF/8Q+fFntLzZ2uT6GqH55TQhiFdFkiFo GfQvr6ECN+1Ow== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gVXlr2VzJzQ5M for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Wed, 03 Jun 2026 05:11:19 +0200 From: Daniel Gibson To: Shyam Sundar S K , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello Cc: Daniel Gibson , Sindre Henriksen , stable@vger.kernel.org Subject: [PATCH v3 RESEND 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Date: Wed, 3 Jun 2026 05:11:07 +0200 Message-ID: <20260603031110.345815-3-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260603031110.345815-1-daniel@gibson.sh> References: <20260603031110.345815-1-daniel@gibson.sh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha 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. On the 14ARP10 wakealarm has been reported to also work fine with this patch. 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) and 15ARP10 (83MM). Reported-by: Sindre Henriksen Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 Tested-by: Sindre Henriksen Suggested-by: Mario Limonciello (AMD) Reviewed-by: Mario Limonciello (AMD) Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Daniel Gibson Cc: stable@vger.kernel.org --- drivers/platform/x86/amd/pmc/pmc-quirks.c | 39 +++++++++++++++++++++++ drivers/platform/x86/amd/pmc/pmc.c | 24 +++++++++++++- drivers/platform/x86/amd/pmc/pmc.h | 1 + 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/pmc/pmc-quirks.c b/drivers/platform/x= 86/amd/pmc/pmc-quirks.c index 24506e342943..74ddf1d8289a 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; }; =20 static struct quirk_entry quirk_s2idle_bug =3D { @@ -33,6 +34,10 @@ static struct quirk_entry quirk_s2idle_spurious_8042 =3D= { .spurious_8042 =3D true, }; =20 +static struct quirk_entry quirk_s2idle_need_suspend_delay =3D { + .need_suspend_delay =3D true, +}; + static const struct dmi_system_id fwbug_list[] =3D { { .ident =3D "L14 Gen2 AMD", @@ -203,6 +208,35 @@ static const struct dmi_system_id fwbug_list[] =3D { DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"), } }, + /* https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 */ + { + .ident =3D "Zen3-based IdeaPad Slim and similar", + .driver_data =3D &quirk_s2idle_need_suspend_delay, + .matches =3D { + 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 =3D "Zen3+-based IdeaPad Slim and similar", + .driver_data =3D &quirk_s2idle_need_suspend_delay, + .matches =3D { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83K"), + } + }, + { + .ident =3D "IdeaPad Slim 3 15ARP10 (83MM)", + .driver_data =3D &quirk_s2idle_need_suspend_delay, + .matches =3D { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83MM"), + } + }, /* https://bugzilla.kernel.org/show_bug.cgi?id=3D221273 */ { .ident =3D "Thinkpad L14 Gen3", @@ -356,6 +390,11 @@ void amd_pmc_process_restore_quirks(struct amd_pmc_dev= *dev) amd_pmc_skip_nvme_smi_handler(dev->quirks->s2idle_bug_mmio); } =20 +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(str= uct amd_pmc_dev *pdev) return get_metrics_table(pdev, &table) =3D=3D 0 && table.s0i3_last_entry_= status; } =20 +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=3D221383 + */ + 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 =3D &pmc; @@ -647,7 +668,8 @@ static void amd_pmc_s2idle_check(void) struct amd_pmc_dev *pdev =3D &pmc; int rc; =20 - if (amd_pmc_intermediate_wakeup_need_delay(pdev)) + if (amd_pmc_intermediate_wakeup_need_delay(pdev) || + amd_pmc_want_suspend_delay(pdev)) msleep(2500); =20 /* 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 { }; =20 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); --=20 2.48.1 From nobody Mon Jun 8 06:36:57 2026 Received: from smtp-42ab.mail.infomaniak.ch (smtp-42ab.mail.infomaniak.ch [84.16.66.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B79AA3E1718 for ; Wed, 3 Jun 2026 03:16:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456604; cv=none; b=tnxWRXVP1BwWWV1cFefQdRBB7Rb2xKagudtcT9fqn+Z2FSorxQN52Nx6SgeEts0NVozNUPBTkvP2km+cYD5hCu1PF4L03G5otHGcaGDXZFrT5yv+CiTYT5fcforbc84HRpC3WjtALqj8WFtrma6Tr4+3gjR1eK9TLuTX6t2b1xo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456604; c=relaxed/simple; bh=isRXKxL0q1oc209W6uQUczP4eb2xyKf6+5fC3UTV5Hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QUuHocmHPlzA/xljR6xv4Ff/YIxiJmALlp1AM1USOutyDlUPD7N+Ukh3Q1vUWxphW5hXeD90wbvVvXVXP5TYAxIxy4iEKlUuFmabZvZMwlhGY+0pjjgrBkVq69c/P6NRztZLF2jXmICmrtXeIZl7aXKEKG2yIZtZoKwuFqcOe6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh; spf=pass smtp.mailfrom=gibson.sh; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b=i3jLcF0i; arc=none smtp.client-ip=84.16.66.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gibson.sh Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b="i3jLcF0i" Received: from smtp-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gVXlr59lHz14pC for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780456280; bh=s7u6TuEJ24aqktW/yoYHaCvxZsxRD1OEAJRsO0CmXcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i3jLcF0iTH2a7P1TRmCOBTiw2kGSgsbrVAkw7JqH29jubGDBcsqLei1iITD1Z+VVn VvkNqSdtYNGqtW8DiMBBBPBPeoWSp58gQqr34GlrtkkQCaMi/uxFU16K5wgFmD72mU 3lWm96U+rtGtPj8ujPMveCVo0+MJAfWjoJVpe71tFrbOFYMe4SfLLhm+94NOX8KzT/ N/3kDX3u2yy/DxwDmqbIUcXn61GRWgXx2i6Yg8chHKo07yDiEPvJd3FRMsN4LQJdmw wZ2y9xIfweDH3jrIRZmx2YidA1UlJxk8AkKhfIzZI9GTh/vH1M6nvHwKWyO0GhVWm0 SqtYJzAzVzxcQ== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gVXlr2S9mzHvm for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Wed, 03 Jun 2026 05:11:19 +0200 From: Daniel Gibson To: Shyam Sundar S K , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello Cc: Daniel Gibson , stable@vger.kernel.org Subject: [PATCH v3 RESEND 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Date: Wed, 3 Jun 2026 05:11:08 +0200 Message-ID: <20260603031110.345815-4-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260603031110.345815-1-daniel@gibson.sh> References: <20260603031110.345815-1-daniel@gibson.sh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" 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. The parameter description has a note 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=3D221383 Signed-off-by: Daniel Gibson Cc: stable@vger.kernel.org --- 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 #include #include +#include #include #include #include @@ -89,6 +90,11 @@ static bool disable_workarounds; module_param(disable_workarounds, bool, 0644); MODULE_PARM_DESC(disable_workarounds, "Disable workarounds for platform bu= gs"); =20 +static int delay_suspend =3D -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 k= eyboard issues after suspend. 0: don't delay, 1: do delay, -1 (default): le= t amd_pmc decide. If you need this please report this to: platform-driver-x= 86@vger.kernel.org"); + static struct amd_pmc_dev pmc; =20 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=3D221383 */ - 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=3D1 force-enables this, otherwise it can be + * disabled with disable_workarounds or delay_suspend=3D0 + */ + if (delay_suspend =3D=3D 1 || (delay_suspend =3D=3D -1 && !disable_worka= rounds)) { + 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, e= ven though your device is assumed to need it!\n"); + } else if (delay_suspend =3D=3D 1) { + dev_info(pdev->dev, "Delaying suspend by 2.5s because delay_suspend=3D1.= 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; --=20 2.48.1 From nobody Mon Jun 8 06:36:57 2026 Received: from smtp-42ab.mail.infomaniak.ch (smtp-42ab.mail.infomaniak.ch [84.16.66.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA50E3DC4CC for ; Wed, 3 Jun 2026 03:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456290; cv=none; b=LCjk37alXHbaZ4NVenUjYGX45k2Tou0TPwGT4tPGnWQZPp5cXrCNRILU7FJUpjzWvgiZqp4Q9dcnZ204CsUuhEKfayXZ3vm1v2Albj3UuztiT9xlFgD9Jeqs1LTZPFlY75aVtNva6d6BJJu828DeSUSeitgWNvgXM+YaEM8tWx4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456290; c=relaxed/simple; bh=wHEP3T0JCOGOfR8/mhG8DF0emMo+OpOS1XpQXj0JKsg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EgZC6z0h6q2oO4VEODS3Mvi165xg8iKX7YvcW2wWOg6V3uCt11CELHGpQCaLzZ/jvqrGRN3ZomGnbbxdFvSIRPPJ5U5NLfjM/nyzAHUY8fS51hrO4d3tkZbOJaqBa1BDEu0iyNnOm+7lDkon6XEKRffyI1zrr2ycvkjcaqWSj5Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh; spf=pass smtp.mailfrom=gibson.sh; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b=MuYim8uu; arc=none smtp.client-ip=84.16.66.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gibson.sh Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b="MuYim8uu" Received: from smtp-4-0001.mail.infomaniak.ch (smtp-4-0001.mail.infomaniak.ch [10.7.10.108]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gVXlr5dSNz13sl for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780456280; bh=N2jcZfkZx8sHU1eydr66vjE0TAGI3mXPIcJNMYu/yg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MuYim8uuBcNA3ExEQ+czq+vTrMahw3QhC9eWy8xB1d7CwKSmqe9lLhD3RCynsw+3b gSS59uGDMak/dykxwb+IH+9IsNUL/nN8CRV2tTPWvlOJ8h3gJjvFnYdQSOhO0Jr1Ey ZCcD5ZvExbdNKJOSaiXYP5mDVo3KZWEW4+o9vxh0D6D7r9D+/aT2TCNLx6rLu42yey TJrGURbAJDKQZmQ7wgrmmvps5OeW9Ouse9J21IpRAU0SqvQphzjmM0OdqsJ7ohY/Yn jmln6wVR4atMRycn/JawCS0Y03aejeP6v4WocuDCU+5rwSlkBKskRfuwylbzIL+ts7 R7VXL9ClgrGCQ== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gVXlr2g1GzWrl for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Wed, 03 Jun 2026 05:11:19 +0200 From: Daniel Gibson To: Shyam Sundar S K , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello Cc: Daniel Gibson Subject: [PATCH v3 RESEND 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register Date: Wed, 3 Jun 2026 05:11:09 +0200 Message-ID: <20260603031110.345815-5-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260603031110.345815-1-daniel@gibson.sh> References: <20260603031110.345815-1-daniel@gibson.sh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" The amd debugging documentation didn't state how to identify kernel log lines with information from the reset register about the cause of a previous random reboot. The added example rectifies this. Suggested-by: Mario Limonciello (AMD) Signed-off-by: Daniel Gibson --- 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 lo= g on +next bootup:: + + x86/amd: Previous system reset reason [0x00080000]: software wrote 0x6 t= o reset control register 0xCF9 --=20 2.48.1 From nobody Mon Jun 8 06:36:57 2026 Received: from smtp-bc08.mail.infomaniak.ch (smtp-bc08.mail.infomaniak.ch [45.157.188.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 878B73ED12C for ; Wed, 3 Jun 2026 03:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456593; cv=none; b=SDuqe28htICHy0GrcmOYeyBen/r+UFvR9cil3DTK0AW/yj2HZH874stOIfQrXIOIxeCgRhrqtlAM4SHlIj3FGvO+3v/Nte1UE+SYCA3RM1emktcgJPoxLBCozCdkwo13X6LWAFCGQLSGh08TQ/Mvq6JYRVvpsTXeBhOfsJoqPSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780456593; c=relaxed/simple; bh=sLYdoH+ikBPek1Y9oRdPKY5vIXj9bR+aaoJWLwG6i3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bcdYJTZbrXhDSJA2b0hUO/PrZf3mMp/vyjbLf6vOiQpqIFTgEJz3djadFfrtT6Z6GAQBreM1zUgL6tH11ebW6RJAlVJdUGoEiTG6pMCrhZt0ya86OKb9jtGiy4lYPGCEzSRFpSPhxmHM1JDRBAJo1RKxAKm6XUKNG3Fhfckf2cU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh; spf=pass smtp.mailfrom=gibson.sh; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b=BcyxOqw8; arc=none smtp.client-ip=45.157.188.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.sh Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gibson.sh Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gibson.sh header.i=@gibson.sh header.b="BcyxOqw8" Received: from smtp-3-0001.mail.infomaniak.ch (unknown [IPv6:2001:1600:4:17::246c]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gVXlr5xFPzD3S for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780456280; bh=qFLQ/rk97nAJZYTRi4bf//PzjPAjFJ9fB1dzb/z/WQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BcyxOqw8PHmU3fQLwzhqQ5YZBy6WMWPHsmYZ6VYo7V4fPz354wEhmZCU+pxGQsxmL u79d5a9qXdn8t1OLjQEiT3ittwmmNO1ln4ZYOnbReP0YKF7UoBKXybwIPbioY/P0ZW Kjdp3DfWannbh0p7wBSEAnCMe/My/8diLADGg6htDNPvPfM59HtFUIwZq5U+QlysUZ RppmaKNEaOx1DrcDuhvMOoEftPbtq1NMONskb0r9SP6F42MFWvKDlEuUbjkQaglior aD0He8S/qnusEO8V5fRokrqgnX87gA4/cBeZi3tGT7yTqxAOwHp93ca1ueu6eVPWW/ sxdK8fK9ezN1A== Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gVXlr2gztzwpf for ; Wed, 3 Jun 2026 05:11:20 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Wed, 03 Jun 2026 05:11:19 +0200 From: Daniel Gibson To: Shyam Sundar S K , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello Cc: Daniel Gibson Subject: [PATCH v3 RESEND 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend Date: Wed, 3 Jun 2026 05:11:10 +0200 Message-ID: <20260603031110.345815-6-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260603031110.345815-1-daniel@gibson.sh> References: <20260603031110.345815-1-daniel@gibson.sh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Infomaniak-Routing: alpha Content-Type: text/plain; charset="utf-8" Some Lenovo IdeaPad Slim 3 devices and similar with AMD CPUs (so far observed with Zen3 and Zen3+ 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. Devices known to be affected are matched automatically, others can enforce the delay with a amd_pmc module parameter. This is now documented in amd-debugging.rst FIXME: must be updated with the actual commit IDs when they are merged Signed-off-by: Daniel Gibson --- 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..6aca4e993f12 100644 --- a/Documentation/arch/x86/amd-debugging.rst +++ b/Documentation/arch/x86/amd-debugging.rst @@ -249,6 +249,31 @@ state entry. =20 `commit 40b8c14936bd2 ("drm/amd/display: Disable unneeded hpd interrupts d= uring dm_init") `_ =20 +Keyboard and Lid Switch stop working after resume +------------------------------------------------- +On various variants of the Lenovo IdeaPad Slim 3 with Barcelo and Rembrand= t CPUs +the lid switch and keyboard, or at least the Fn/Multimedia keys, stopped w= orking +after resume, until the next reboot. + +This was caused by buggy firmware having timing probles, the EC needed som= e idle +time right before the CPU cores are suspended, or it got into an inconsist= ent 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, pl= ease +report this at platform-driver-x86@vger.kernel.org for it to be added to t= he +list of devices that need this workaround, so in future kernel versions it= 's +enabled automatically. + +Note that the current workaround isn't perfect: On some devices the proble= ms +still happen if resume is triggered by a timer (wakealarm). + +`commit TODO ("platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops= ") `_ + +`commit TODO ("platform/x86/amd/pmc: Add delay_suspend module parameter") = `_ + Runtime power consumption issues =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.48.1