From nobody Thu Jun 18 08:01:03 2026 Received: from smtp-42ac.mail.infomaniak.ch (smtp-42ac.mail.infomaniak.ch [84.16.66.172]) (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 6FF742DCC04 for ; Fri, 1 May 2026 03:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777606047; cv=none; b=UV0Fim2MzdglVEIL5pOE0A9Ri+VPF3qfZgTpQdYNkVUeiQItg1Hm+/jGR1ONt0i9Tq+D5figHGg2NBvEh5cnR0TTNFQz8cIZgn6HfoeVvVF2esyt6N93oYhhPW+X/ISLY63RFk6EENUfVgp3cDZxvtrlWXIHjqE4ai+7Q6YEO1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777606047; c=relaxed/simple; bh=n/NmCXpi4W3Gwnft4DFeECuo/XzZUMn3qdmCGP3Z+o0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OSdom8fEeJEbL8foHJE/y6tJ1PtmDplwMtlAWqtYTbQOyG6YTCmUgL6XmdJ2KcR+r440kfFYoHQU5ZbnG433F3ypbzrGSk6j3RSLlnM5Wskcaq6ATdYTe1Efp39i7egsugnBpNYnPQAODB3epTJqBC5ZU1RRdInnp1878D5LnLI= 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=dioFEZiR; arc=none smtp.client-ip=84.16.66.172 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="dioFEZiR" Received: from smtp-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4g6GgY5jFKzLth for ; Fri, 1 May 2026 05:27:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1777606041; bh=fYRyRFkQMEkAqHabar/FCyf0QrY6d1LISKOv19r61D0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dioFEZiRiN0/vY4o8XIkhfkEzJpbYHZFs5tkvwoPeXaXgxBmBvdzr+SnWZM0hNT/g 2qg1skBMCasSWEkRnBxZuQVKOuVz8hQgnb6kFeXZ6vHRUp/60Vsq2u9sFMT/8wQjn5 g21uTFwR+oPgKI3n2b+llllvwSriY8GHF8NhaOWDRE8uRJ6ARKmHA41HrcUY5SduNU nx180fHVF22wZJszvwqSe3fk4eMOhRB/ItYaMat5uY+RTbvGOvQqxfB3Vw1kan6A3t jymrMjxaoQ/K0nb8gSzktscMvdxi3l5nwSlrjZPDLyGcplhF8JU22mTP8eyHlzDtLf rk5rEci6LnVqQ== Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4g6GgY2btRz9hd for ; Fri, 1 May 2026 05:27:21 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Fri, 01 May 2026 05:27:20 +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 Cc: Mario Limonciello , Daniel Gibson , Sindre Henriksen Subject: [PATCH 1/2] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Date: Fri, 1 May 2026 05:26:54 +0200 Message-ID: <20260501032655.283789-2-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260501032655.283789-1-daniel@gibson.sh> References: <20260501032655.283789-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 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. 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), see https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 Reported-by: Sindre Henriksen Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 Tested-by: Sindre Henriksen Tested-by: Daniel Gibson Suggested-by: Mario Limonciello (AMD) Reviewed-by: Mario Limonciello (AMD) Signed-off-by: Daniel Gibson --- drivers/platform/x86/amd/pmc/pmc-quirks.c | 36 +++++++++++++++++++++++ drivers/platform/x86/amd/pmc/pmc.c | 5 +++- drivers/platform/x86/amd/pmc/pmc.h | 1 + 3 files changed, 41 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..cea30f68f8dc 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,32 @@ static const struct dmi_system_id fwbug_list[] =3D { DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"), } }, + /* + * 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. + * See 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") + } + }, /* https://bugzilla.kernel.org/show_bug.cgi?id=3D221273 */ { .ident =3D "Thinkpad L14 Gen3", @@ -356,6 +387,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->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 cae3fcafd4d7..c604dc7207ed 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -634,10 +634,13 @@ static void amd_pmc_s2idle_check(void) struct amd_pmc_dev *pdev =3D &pmc; struct smu_metrics table; int rc; + bool ec_needs_sleep =3D !disable_workarounds && amd_pmc_quirk_need_suspen= d_delay(pdev); =20 /* Avoid triggering OVP */ - if (!get_metrics_table(pdev, &table) && table.s0i3_last_entry_status) + if (ec_needs_sleep || (!get_metrics_table(pdev, &table) && table.s0i3_las= t_entry_status)) { + dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n"); msleep(2500); + } =20 /* Dump the IdleMask before we add to the STB */ amd_pmc_idlemask_read(pdev, pdev->dev, NULL); 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 Thu Jun 18 08:01:03 2026 Received: from smtp-8fae.mail.infomaniak.ch (smtp-8fae.mail.infomaniak.ch [83.166.143.174]) (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 753833033D8 for ; Fri, 1 May 2026 03:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777606049; cv=none; b=HUrqF1CvMsKJudeaD5Jt3Hip8IQrl49ZgTRzaHBLXsouTV9nAawiR9sQRufGAn6OxXRz+ZqJHweK8iGrBCcuCvP2RnIDgLTfTmW2FbmLaipa/R1RyB9SlaDiaK1pyGIiTuhar4e4XzA9aAtyEW9EuuP2EDYLKocLlhT5MIU1Qog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777606049; c=relaxed/simple; bh=x8asYKlDkKAxWg2QNUkptK3yCeWzgXt6KCoFkomrGm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=or3uQJYC7EJFEQTLqCIhWCQMXq5xCxowqRb+J1xsGQgkoV/WR1oxrCE2Pse1DYvBCQw0DL+jJAURmxLZj03ek1AAP8ss5jvOWI+ESSFB8ExfZ5KVF0nbJm9iQih0my/9DIESJkpWYhE/gGiMgo3/XgZFc39y26bHWJpT+i+Ddz4= 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=c2Tm0rKo; arc=none smtp.client-ip=83.166.143.174 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="c2Tm0rKo" Received: from smtp-3-0000.mail.infomaniak.ch (unknown [IPv6:2001:1600:4:17::246b]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4g6Ggd49SFzM7d for ; Fri, 1 May 2026 05:27:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1777606045; bh=NklM/KwBTPxhvyBRaWDKiyTyqId3OEze7ro/DoA32tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c2Tm0rKozZONRrubxfZCGwUs27JS2e90/driORAqotFGu7nmMT9KzL11/g3l/8QzP Jp2ODbbNUKU7F1Qngmigb/RuQkwPaWHKEvDHXk1wwC4LqCdDE6X9IK+FZQIiv/dAqN Dx9oIp3xrckg4kYOnB/PX0lvYYVm2IvmIHtsYj7aR1kpU7y9D7jYDGCBML/o2wnDrE FBXWzE7PuKsU6hnKIJhJc03IACGHG8IzNfeF7hvZ3TadznfHHBx6zEPfVPVj8NpdbE 2RfFU6sisGImLm+b55yBQV92haGeeTfasniTN515TovMNGeKOrjImeZ7g+sEfquJnH LJfBdkojmDC0g== Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4g6Ggd0w3Cz8Zh for ; Fri, 1 May 2026 05:27:25 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Fri, 01 May 2026 05:27:24 +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 Cc: Mario Limonciello , Daniel Gibson Subject: [PATCH 2/2] platform/x86/amd/pmc: Add delay_suspend module argument Date: Fri, 1 May 2026 05:26:55 +0200 Message-ID: <20260501032655.283789-3-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260501032655.283789-1-daniel@gibson.sh> References: <20260501032655.283789-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 it 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[]) This is related to https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 Signed-off-by: Daniel Gibson Tested-by: Daniel Gibson --- drivers/platform/x86/amd/pmc/pmc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/= pmc/pmc.c index c604dc7207ed..f76936036d1f 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -89,6 +89,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) @@ -634,11 +639,19 @@ static void amd_pmc_s2idle_check(void) struct amd_pmc_dev *pdev =3D &pmc; struct smu_metrics table; int rc; - bool ec_needs_sleep =3D !disable_workarounds && amd_pmc_quirk_need_suspen= d_delay(pdev); + bool ec_needs_sleep; + + if (delay_suspend < 0) + ec_needs_sleep =3D !disable_workarounds && amd_pmc_quirk_need_suspend_de= lay(pdev); + else + ec_needs_sleep =3D delay_suspend !=3D 0; =20 /* Avoid triggering OVP */ if (ec_needs_sleep || (!get_metrics_table(pdev, &table) && table.s0i3_las= t_entry_status)) { - dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n"); + if (delay_suspend > 0) + dev_info(pdev->dev, "Delaying suspend by 2.5s because delay_suspend=3D1= \n"); + else + dev_info(pdev->dev, "Delaying suspend by 2.5s to avoid platform bug\n"); msleep(2500); } =20 --=20 2.48.1