From nobody Mon Jun 8 06:36:42 2026 Received: from smtp-42a8.mail.infomaniak.ch (smtp-42a8.mail.infomaniak.ch [84.16.66.168]) (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 3F5B21A724C for ; Sat, 6 Jun 2026 04:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.168 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780721287; cv=none; b=ruass8X+PSXYdxc2RVxs5g0oCILjn9cHSA1tQO3ecwutwi6GMClhKK7BWC3+RNB/7VVDdBxmkWhe51Vyqivn6YUye8X5ZMfUKNYmlLFn/49n09Non7MJPXryfIkDe5IFd+XPTjhuPVNP1l58DNT+kUKkZuaTQhmGt9Kgm+fv8pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780721287; c=relaxed/simple; bh=Ei+J1JQ+OQDRTYvxZ34inBIiZ97Iv+p9QAUQzY88dQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Vj98zP5r1sh892ZVIwdfWFZTV69aPXCcFzGdPInUCHeZSCXq/7BlYA/36WoIFJ3kUdFD90eecPl4XwsPnnzvJwzhnmcA2CYZPXA5WPrRxt1gpe4a0UjYnXk9BIgyjZSAIfAvc4tl2e80ZPyCn84Sw00Nfmuhmj1mefMEjQQ6gTw= 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=Oux5ZJTJ; arc=none smtp.client-ip=84.16.66.168 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="Oux5ZJTJ" Received: from smtp-4-0001.mail.infomaniak.ch (smtp-4-0001.mail.infomaniak.ch [10.7.10.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gXQm21jNtzXlC for ; Sat, 6 Jun 2026 06:48:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780721282; bh=vHfo3+n/XMteJ5vHoQ7kA9U/Iy7x5RrsTtiy751rGnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oux5ZJTJNQx5Hs+j9bKNhhpEdpydbN/opFlQvTYJ8SFy690E6WA7WZsQgb/3ImySM YHVj0nlQ7tebnsvvbtDfP1xUlc+FmQQ8mWFiaTJeKHrGiO46jyaewiXfjwhnvwKgwn EW6ciWANiYVNSjgRoEu4daxnTdlDECNQCMQeAXwCa1jGvEAMHlOuykQggRzkZywuLm s6emcJBzZmaSMJuQUK8RU3xWsRWDxGzalrXC5G61qlDoNKprwIVJ6sMmPZMgRrzAUR lIkDWZsyb2DHHiIXnGBRE9YL6mHH4iL56Th9bFkN+wA+uzuw+6qY7Ju0UpD9xfGm2m Gt1WnW9eXwrNw== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gXQm15C5Rz3dW for ; Sat, 6 Jun 2026 06:48:01 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 06 Jun 2026 06:48:00 +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 v4 1/3] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Date: Sat, 6 Jun 2026 06:47:56 +0200 Message-ID: <20260606044758.2213401-2-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260606044758.2213401-1-daniel@gibson.sh> References: <20260606044758.2213401-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 IdeaPad Slim 3 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:42 2026 Received: from smtp-42a8.mail.infomaniak.ch (smtp-42a8.mail.infomaniak.ch [84.16.66.168]) (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 4AC892F8E8E for ; Sat, 6 Jun 2026 05:05:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.168 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780722354; cv=none; b=oG4wIjtH5FCwR+DUNtyHkkqkmjjJo0iQX0I/PsQEXZTBOXqUoMm65AWxmlv+wUg7NQ/A3TkHR23vBADUM63vOinH81xzYWZbInD0Djcb0MJn/Tj1G7wh8MWif5LMAK8tOV7AUtqWzvksiwssp+JvodaiUv4mVGqt4kdNgStsXI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780722354; c=relaxed/simple; bh=isRXKxL0q1oc209W6uQUczP4eb2xyKf6+5fC3UTV5Hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iDS0hcxswEI64ZKPcSQc5KAt3498ZtMb3G8c5GidiaPTzwhzinbHjSjPswzexS5Vev2e6B73JqUYE0A/0ZpB7o3IcF6DtvDAt/W085jejIi1UtzH5MhIPQy/mxzOs4OQtH1nW+AGGrhHazI2zsdTIzZ1Z/HZisTHUNWvRlF7JYk= 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=hHjSvvx2; arc=none smtp.client-ip=84.16.66.168 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="hHjSvvx2" Received: from smtp-4-0001.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6c]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gXQm2243rzWpf for ; Sat, 6 Jun 2026 06:48:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780721282; bh=s7u6TuEJ24aqktW/yoYHaCvxZsxRD1OEAJRsO0CmXcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hHjSvvx2fCGS5oc0ZnaXZ88IBptILbVEFhJ/81GvnTwaevMjvW1kJGgypTzxNW9Rx tpQ97xWiY+ax5Zm867u1fGKPWOMIY5WRNXJ6rAtvPyE6pfX7Oc7AEKzNK5bZCmU8Eo 88ZxxAMIVpRL7cKdz17jGWFVxenB97eZACnWGjafrQuirB7RnqlqLQmbGI9iMMdmPI 85VSMcmK7VjUCSYiH0iR82A+3kGYwQuylACrxI4k0ZLXQv4iGhOCPpgzx1BQGZObtL /lIqFPKdxzcNpjLK/ytImYDA8SQ/0zPqSZZPFRr8wA8sIEW9CjGlCquJQvJJJJ6k4q ScdzHEhX7Iuow== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gXQm154d8zx0h for ; Sat, 6 Jun 2026 06:48:01 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 06 Jun 2026 06:48:00 +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 v4 2/3] platform/x86/amd/pmc: Add delay_suspend module parameter Date: Sat, 6 Jun 2026 06:47:57 +0200 Message-ID: <20260606044758.2213401-3-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260606044758.2213401-1-daniel@gibson.sh> References: <20260606044758.2213401-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:42 2026 Received: from smtp-42a8.mail.infomaniak.ch (smtp-42a8.mail.infomaniak.ch [84.16.66.168]) (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 4AC082F7F13 for ; Sat, 6 Jun 2026 05:05:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.168 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780722354; cv=none; b=mRfECPcCYSd4BZG3GO1TnNljj6UuaZoWcz2Jfhy9DcXJPi0yIucAcQsS1dFK/B0B1aYdKrzhBN7APsCwrYj4HNeuF0zzrG1Ql7VNyK2+j5BEJ3/VNJvuxYVvyXGzONMF0XbZQvBzVv0dhSazwCNt7qTqWs92LFTqSFLu2Fztcbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780722354; c=relaxed/simple; bh=Najpki1ZcHOMyLm6nlLJYDdfo+4pegQmAATFZ1fPdJA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aIntIf0KeElkPXU53P/Zvpd4TaBDINVDqw8v2IhpYLvg58BwlWNju86dfOOSonf7EApUlqoeAUepLn9kxLOAnyhvaLvDhWhlwDr3y3FhC/gnR612kPVwnpKTz6WS2FlB7CpJvKtUs0WMRHeno68G7ntd/pE6uaGkvmVYDkw1sr8= 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=JKCxGiU0; arc=none smtp.client-ip=84.16.66.168 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="JKCxGiU0" Received: from smtp-4-0001.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6c]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gXQm222qLz8sL for ; Sat, 6 Jun 2026 06:48:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1780721282; bh=4JgcUrF1sbZczkpfNhX8xMy73Iep2kkb6jW8W1MiLyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JKCxGiU0N6YcnIIe8NOTvLKSAA6CikMhXCfnh3fDLtQT+GrMsBvzB95JGs4N9seHd cOncvZcb3WxOXAYvOzd8y4/pHEosuP5B5T2iEjMgXaFnvxPt1wavnZK5liWHyM9CED SvRjRgcsYH6i7+5+4bFgOTGtfxgEUDsDtVwBFBp36Jd5S9R1WjCkOazOKrJO7/DjWc yHwF6gBnoMuCdmXEZ+lLGxQGK8nUZRiyl4UHSt11yIKl86vMLFOiXtola2VAhXjmfl 9g9OL4Us3PuctTdYy+6xGuVWaJBcEzAIgn+GrLXQPer4QKVpjoKN92LOczD0fm8Sc1 ZQejknObqHx7g== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gXQm159hSz3XC for ; Sat, 6 Jun 2026 06:48:01 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 06 Jun 2026 06:48:00 +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 v4 3/3] platform/x86/amd/pmc: Don't log during intermediate wakeups Date: Sat, 6 Jun 2026 06:47:58 +0200 Message-ID: <20260606044758.2213401-4-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260606044758.2213401-1-daniel@gibson.sh> References: <20260606044758.2213401-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 ECs in the IdeaPads that need the delay_suspend quirk send lots of messages when charging, which not only causes intermediate wakeups when suspended, but also prevents the device from reaching the deepest suspend state. Because of this amd_pmc_intermediate_wakeup_need_delay() returns false during intermediate wakeups and amd_pmc_want_suspend_delay() is called. So far it always logged its "Delaying suspend by 2.5s ..." messages then, which spams dmesg. This commit makes sure that those messages are only logged once per suspend. 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 | 39 ++++++++++++++++++++++++------ drivers/platform/x86/amd/pmc/pmc.h | 1 + 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/= pmc/pmc.c index 2d3d180c15d2..7d772ccd17a6 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -619,6 +619,20 @@ static bool amd_pmc_intermediate_wakeup_need_delay(str= uct amd_pmc_dev *pdev) =20 static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev) { + /* + * intermediate_wakeup implies that the machine didn't get to deepest sle= ep + * state before - otherwise this function isn't called in amd_pmc_s2idle_= check() + * because amd_pmc_intermediate_wakeup_need_delay() returns true first. + * On some IdeaPads that happens when charging, because the EC seems + * to send lots of messages then that wake the machine. + * + * But even in that case, the sleep here is necessary (on those IdeaPads), + * otherwise they wake up completely (resume) after a few seconds. + * So this variable is only used to avoid spamming dmesg on each + * intermediate wakeup. + */ + bool intermediate_wakeup =3D !pdev->is_first_check_after_suspend; + /* * Some Lenovo Laptops (like different IdeaPad 3 Slims) need some * me-time before sleeping or they get uncooperative after waking @@ -637,17 +651,20 @@ static bool amd_pmc_want_suspend_delay(struct amd_pmc= _dev *pdev) * 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"); + if (!intermediate_wakeup) + 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"); + if (!intermediate_wakeup) + 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 =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)); + if (!intermediate_wakeup) + 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 a= s affected in the future. System Vendor: \"%s\" Product Name: \"%s\" Produc= t 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; @@ -660,6 +677,9 @@ static void amd_pmc_s2idle_prepare(void) u8 msg; u32 arg =3D 1; =20 + /* Reset this variable because this is a fresh suspend */ + pdev->is_first_check_after_suspend =3D true; + /* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging(pdev); =20 @@ -699,6 +719,9 @@ static void amd_pmc_s2idle_check(void) rc =3D amd_stb_write(pdev, AMD_PMC_STB_S2IDLE_CHECK); if (rc) dev_err(pdev->dev, "error writing to STB: %d\n", rc); + + /* remember that first check after suspend is done (until next prepare) */ + pdev->is_first_check_after_suspend =3D false; } =20 static int amd_pmc_dump_data(struct amd_pmc_dev *pdev) diff --git a/drivers/platform/x86/amd/pmc/pmc.h b/drivers/platform/x86/amd/= pmc/pmc.h index f5257e47b8c4..8aa7073ed09f 100644 --- a/drivers/platform/x86/amd/pmc/pmc.h +++ b/drivers/platform/x86/amd/pmc/pmc.h @@ -114,6 +114,7 @@ struct amd_pmc_dev { struct dentry *dbgfs_dir; struct quirk_entry *quirks; bool disable_8042_wakeup; + bool is_first_check_after_suspend; struct amd_mp2_dev *mp2; struct stb_arg stb_arg; }; --=20 2.48.1