From nobody Fri Jun 12 20:19:41 2026 Received: from smtp-42a9.mail.infomaniak.ch (smtp-42a9.mail.infomaniak.ch [84.16.66.169]) (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 F1B303C8C49 for ; Tue, 12 May 2026 20:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778617618; cv=none; b=mA6cqcfLA2FWZ7hK5IUPmhzvvDjPtKiuWJV/vUXOqPS3lFUhATM/bJgiEdbFBS2SEOV8KuUJRuxChZAlQ2wnnVFFH8RDW2U5k3tXsH0EUfs7U17vqwAxqvXYQoxGlRznOlebQj1byDgwQNlTayCYhONerNORlh07j/SzPQEMIgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778617618; c=relaxed/simple; bh=iEjA2MjKSCB7UYuBfpm7ZoN6u/xw2LXb42wJfvgR3/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HrCB4EvRKgftoxXqRS5GlIfQOJ4rrbvyQSo18rkmPAS7JOgCBT21flkzD8eVU/TVfZCygW8SOMM1d3hXCfMMpl6yWU9yPgrUGCgiqhgW12WRPMdg9N1sg3WBr8ywujVETa8KX9aWoTLzIWmsv4b+SYoAHojkND7Qv8ksc9D8N3g= 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=lJCrzEdg; arc=none smtp.client-ip=84.16.66.169 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="lJCrzEdg" Received: from smtp-4-0001.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6c]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4gFSms24LkzxKs for ; Tue, 12 May 2026 22:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778617613; bh=Mx0oPR9bcP29fTc5WI0tJYSbBL/td4L1Mh46SbEbR5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJCrzEdgQPyZdUWRps8OTIY67Zt172i7jQ0PSxidr/Z3czm8ErrLLbB21ycH2Y0SN 5RJQk2CMcFNVpPStsDyuW7idg2JHtZvADi25v/3YsdwnRFiXyefx4XQwg0MGwdDl7M iQOmuex7USyyDYL6zxF3EkWSLkh3ZYbkHlXF/bzVaI90T1icoHtOCvFywqYFTe/AWD MegrBMhRAc5OI2e8ez4tI/bE5EjoCuFfsO2UTFpXrv9908xZBuN3tooNl17DRxgGtd 8HDGO1zjfnXsXikK2psQwFDSHlHl88deBUtrgM4KfGc3F9YXlml3fa1vdkWpMiUrla x0sDFo8wrPOYQ== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gFSmr62ZbzqcR for ; Tue, 12 May 2026 22:26:52 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Tue, 12 May 2026 22:26:52 +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 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Date: Tue, 12 May 2026 22:26:41 +0200 Message-ID: <20260512202645.1549111-2-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260512202645.1549111-1-daniel@gibson.sh> References: <20260512202645.1549111-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 Fri Jun 12 20:19:41 2026 Received: from smtp-8fac.mail.infomaniak.ch (smtp-8fac.mail.infomaniak.ch [83.166.143.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 9D27E3CD8AC for ; Tue, 12 May 2026 20:27:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778617622; cv=none; b=YWOs0D/mqGJj5rPqid7AtFPkT8+oXREH1u0HuLDQou04wzjs0IL22GnQThEh8WQSSUgw8OY2T8RWDDhi4Z7zZRckT+G+QoMlM6EG3t2vuUkANvU5ZivK63f2uoD/SJv5fnywvGhTosfgj/W4yQjZpOoSw2df975bLahUacAIvrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778617622; c=relaxed/simple; bh=QkcUs+wGNzMPmILUBTYVBn+gnjg0v75ATYO2wka1ZNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dIk9mJMO879HEN+o5sL0zC37qfaWKO4BNg7aCGkhzZ0jisYz/8Y3Jm31LxJBn7ZP9i7tqGhhuZlMewwMV1Fsrgrw5QKiJwXCU73Ari+CDW3pOTmh00bawDZIAHgQgeO4fSn48/SD4SACJw+wuxNCN9kFJToqwvBGV1/LaYma7Hs= 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=gP+ur4lc; arc=none smtp.client-ip=83.166.143.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="gP+ur4lc" 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 4gFSms2c4NzLbl for ; Tue, 12 May 2026 22:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778617613; bh=GhgHPh6OdEWWqZa5b625m/84/bhZzQGSCVt/V9gCfsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gP+ur4lcwdZXIfM9jZWcZ7aytxrTSdMiUxClgyo4raedjINDKxYvpTCi4U2p4kBOh TD39QxhvFgTDhvINTeelwLojgdLZEfpTq2tIffE/qbSW882+LEHBWiAynLI7PKw/Hm SPEhf+hZAs/l8pLJc06utURh6LrS0znJfv6iVC0UBkWyYGu2WuKBhcUS+jOAaKw4SY 97N6H7Vyb3ZjyHVYsI7G2haSbbwGaRTiLMt3Uss1OtvpjFr/BzLhMZMxvW+F2V9ZiU Ud/gfyeKOKiXyvDlrDCKVdpRk4O4cclRJEiiWoQRFeQS5W522axO7uUlRhbuyCMx5L dFEhenyKaEb4Q== Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gFSmr65dqzXRc for ; Tue, 12 May 2026 22:26:52 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Tue, 12 May 2026 22:26:52 +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 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Date: Tue, 12 May 2026 22:26:42 +0200 Message-ID: <20260512202645.1549111-3-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260512202645.1549111-1-daniel@gibson.sh> References: <20260512202645.1549111-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 Fri Jun 12 20:19:41 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 EA5E315E5BB for ; Tue, 12 May 2026 20:42:32 +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=1778618556; cv=none; b=i2ogBblDE1Wc0BGi0jYZLF4q9ucWrflJtlXjQoeYXtrvX5KNABZMr9DnE1AsAqIZJv2qeI5X5MA6RI/7ey1u81sXiwsB4AAkcB52YYsGttkTNaCSSocF76tFDH6G36eFx7AsGTgtHQ95B3H6OCk8C/Byhp/mhQt9I9loE/aisq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778618556; c=relaxed/simple; bh=isRXKxL0q1oc209W6uQUczP4eb2xyKf6+5fC3UTV5Hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a9d9U4djWoh5SHSR2AUSr3K50Ys4kd+y6eik+mkOzkSP0UfgCocZgNS4niev5jYQLKHRkPFo6OesctBNckmY2qvzwdW7itY3j68jyTZ/pblCsWAkTSVkmqFdrZjmUje3a/5huKahdeEZXL7sGu0NBPbU5pfwEYY6wtEE2eHsyAM= 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=NSzlILHS; 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="NSzlILHS" 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 4gFSms2jzKzJGM for ; Tue, 12 May 2026 22:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778617613; bh=s7u6TuEJ24aqktW/yoYHaCvxZsxRD1OEAJRsO0CmXcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NSzlILHS5VoRHpfj52hnMm+xJ2P3t1YNj6JLGgWvGB2MY6QoHQEx8eQ5qyZfYpz9Z brDdqCQb+sx9DVGyEAhBU2mGfusBqGrPQ8OWDZfT7fvwwZ9BdhAOohYQuBj3UpKLtT 0jzXI6Jbd1bZMUf4sG/+eXpkO47IMCpAVxRTVZsUXXG3HipJBEPP7sj0t5njHyzlh2 qmI+A7+UpxLlYBL8aIaJ8MzCigJXBkcHiWfF6EhM+eQsapfAW0JQNJcpf+5zno1gg0 hAfA9nQhicX6x/e1WUz2tZuchs5JY70n0HaUu2aCp5QhQpkA4PAWjwDjMFbqwSRCMD L+fWUwURMy3Fw== Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gFSmr66Ksz68S for ; Tue, 12 May 2026 22:26:52 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Tue, 12 May 2026 22:26:52 +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 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Date: Tue, 12 May 2026 22:26:43 +0200 Message-ID: <20260512202645.1549111-4-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260512202645.1549111-1-daniel@gibson.sh> References: <20260512202645.1549111-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 Fri Jun 12 20:19:41 2026 Received: from smtp-42af.mail.infomaniak.ch (smtp-42af.mail.infomaniak.ch [84.16.66.175]) (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 9B67E372051 for ; Tue, 12 May 2026 20:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778618049; cv=none; b=tj70wKAIAsP00O0Z2EKuEeWfaCaCe/mFBJJ8tGQ1FbZIR0yyCdFPSciVroYpDa/eyiA+S+UotLFkAsJ/DnvB9TzdI3EOx/8YsHmKnmPaD1VLK+7Sl7O51GRmkvkLOrgA2flRyXm6EeXLhKWHRWTLObWpDhpREEWUSL4EZI9f5OE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778618049; c=relaxed/simple; bh=wHEP3T0JCOGOfR8/mhG8DF0emMo+OpOS1XpQXj0JKsg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z62p3MSVELYAs0e4l9rwpPewVAepMXaG0DqFAPdNkC5uo1jEJXBaj8+hOuUr1UIPCo2KckjGupJRzDJ3LNy/WNwX2eCjPK8wh1Yda2FIMhZ1OL7VRWjoEqJM1ldOG+QRO4vO9GtoJGvzueIIKQMJJVdhMZa5Lftivewt2wwO7h0= 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=aPaA/4Br; arc=none smtp.client-ip=84.16.66.175 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="aPaA/4Br" 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 4gFSms2ZzKzxpq for ; Tue, 12 May 2026 22:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778617613; bh=N2jcZfkZx8sHU1eydr66vjE0TAGI3mXPIcJNMYu/yg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPaA/4BrxhBgbEPd74cWKGCnv9tau6fIId9ov8QYCh2ErCDfOlymEhgXLKSspS17P KnhQd+2U3NUNbGteBziVGtgHJCHT9ViPZWuQruVD5B8GwsJp/dG29fOWPoN0dRzgKa iNuSwz5hpTLJq0ceysnPFN5aOEqCmpOlVjp8ODHOUJuf0uW67fAsYZtaUXeyCkQUpS URtcUoAlFHPI7ymXvG8q0Mw3PbtdBz1ZPwskJpEE8CUmLPBSypn9imr5rF1YtzN//w tk/6pdu1xRkznCqBTUq6nGRhvLm6AQTLosiq92ppbkNl/2PScZ9vjbQRiAgH9oM3aE covKFmoAguTzw== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gFSmr6gw5zxC1 for ; Tue, 12 May 2026 22:26:52 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Tue, 12 May 2026 22:26:52 +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 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register Date: Tue, 12 May 2026 22:26:44 +0200 Message-ID: <20260512202645.1549111-5-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260512202645.1549111-1-daniel@gibson.sh> References: <20260512202645.1549111-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 Fri Jun 12 20:19:41 2026 Received: from smtp-42a9.mail.infomaniak.ch (smtp-42a9.mail.infomaniak.ch [84.16.66.169]) (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 F1BE73C9EEC for ; Tue, 12 May 2026 20:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778617618; cv=none; b=itwI+noebCrtYKhT3cWB7KPHuvOsWMcStA6/D3iVRyvX00C7WH+0gzTwh4GjgoV7h6Y3XHEbuvK1iqZzk8dwHxN+/wWEGDHCA/gcIvdSD15CKS6JGW64Ru7K1cJLO51glhAgQhrqV5QzLmWKQ1reFGWO20U/vJxJye5g0zufv5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778617618; c=relaxed/simple; bh=sLYdoH+ikBPek1Y9oRdPKY5vIXj9bR+aaoJWLwG6i3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dd3UmmBwrTexGiIPiCdON/R+kA5J3G7YqQWyWaPpxTlxYN3qGk+nCX4fDugJoRkm14w99xTLF87pLjK67mNN2/c6ZdYm8feAx25Q9hHfvH2nxpmdQeotSbgFp+1TdQhaPxXZgWmeYArMS6LqRHtzHSdwQPgQY9H7qFU81BUSoek= 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=QnyaG/Kf; arc=none smtp.client-ip=84.16.66.169 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="QnyaG/Kf" 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 4gFSms2VRMz1K3 for ; Tue, 12 May 2026 22:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778617613; bh=qFLQ/rk97nAJZYTRi4bf//PzjPAjFJ9fB1dzb/z/WQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnyaG/Kfg0twGZ1y/fecaSCjaashZWhyeZ0kmQ9JWdzQt49IT4PUKDy3Kt9nE2y6A Gd87kkP9Q3Y1cUrPgTmaDjQNUELPyIrNMJplDW7XYjXkRlkiC2pmguIEQyCmcEEy4w dtsdJzrwskRzs/gCSpqfVFjs3YFVGD2Rjf950OuIFgCksu4YrVXmMc7VmzRtYBMWEN eU2yG6sS4+qLn3VNr7wSSAfoh/qrH1RWrjwp67lhBt+eWAl3GaHmhwVFkwxZ3wzIht nxtJm4wZwiNj0S2UxltDKKcgu8e1DnzFGqIZ8HVGlZkxvw2O/sErOAMNWDp6zsUSJO dQssC1VVY8iNg== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gFSmr6DKHzsY6 for ; Tue, 12 May 2026 22:26:52 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Tue, 12 May 2026 22:26:52 +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 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend Date: Tue, 12 May 2026 22:26:45 +0200 Message-ID: <20260512202645.1549111-6-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260512202645.1549111-1-daniel@gibson.sh> References: <20260512202645.1549111-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