From nobody Sat Jun 13 07:14:21 2026 Received: from smtp-1909.mail.infomaniak.ch (smtp-1909.mail.infomaniak.ch [185.125.25.9]) (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 D9C4D278156 for ; Sat, 9 May 2026 01:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290750; cv=none; b=rQYEYAJ5Ydp2bvCXRhxoPxMqxucXWwiKZscghum2MwqqR0F/696KxBzh+7cY/UttfM81OyVqMkmiNWv257rMX4brg0KUyIY/CFezbeU10xLUGYSXDzjD4BNSZhIPKga69jSKaMz4rBBRoAySK2WS6AXNEQ/EUJxIcdT5h1DmsiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290750; c=relaxed/simple; bh=D9UXndHF/UwVLuiI0rKpnyiwtptt5MZ/YvPeMoXLZZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SgJAeqOcL0fi3SMfBWGT1PETeYBy/RaXMFq0HgpmZ4E5Cf12UeRxHhiIEY1OzKTs8rO6585mxv2c4YXZDbJ4FIuRzISRc6bnWctXoNQF5K1URYfeycfL9q+RD+dgx57EjQD1AW8O8tbcmOAg6UGJZov38hF1UdP1dsjX8t0OOfo= 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=PsxAZAHf; arc=none smtp.client-ip=185.125.25.9 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="PsxAZAHf" 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 4gC7jn2rDpzZTG for ; Sat, 9 May 2026 03:31:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778290269; bh=WZfkKrkFfW2y6joVDAkKUKO6s0ptkI5sHCXMJuL/gN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsxAZAHfi8nlnfSRuTe2czfuHTXTAj2wjAzZVtVHB+RNYeF6CAZM31EacobvNukU7 2SiIWx7VOIFWjFVBwoucGK2YVnCJCo94RxE0znfyJlR+013TbRQp88ie3i5/bcCZLv GL+TqIbywZYIdBICa+pI3b8UTILNhsJvGwr28JVkN5DtKxEfa7WBEU9KgFHRvmWiZN WSG/kiP5S5RL6zNlPj+6dv3gNy8b5rVVXpAPmEoW6Fje10P33TPbCZBpmQZ3jQs1jA j9MVJ6+g3nsqtH/uy9ZAttYmnXq8U4wK/MdQfymQ59RfElW6SPhL2cFz12JbFu2sO1 2WN7b3SvRNQ4Q== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gC7jn08Rzz7jv for ; Sat, 9 May 2026 03:31:08 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 09 May 2026 03:31:08 +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: Daniel Gibson Subject: [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Date: Sat, 9 May 2026 03:31:00 +0200 Message-ID: <20260509013105.816339-2-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260509013105.816339-1-daniel@gibson.sh> References: <20260509013105.816339-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" This slightly refactors code introduced by the "pmc: Require at least 2.5 seconds between HW sleep cycles" commit to allow adding different conditions for that delay later. References: 9f5595d5f03f ("platform/x86/amd: pmc: Require at least 2.5 seco= nds between HW sleep cycles") Signed-off-by: Daniel Gibson --- 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 Sat Jun 13 07:14:21 2026 Received: from smtp-bc0b.mail.infomaniak.ch (smtp-bc0b.mail.infomaniak.ch [45.157.188.11]) (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 7C9DD26E142 for ; Sat, 9 May 2026 01:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290750; cv=none; b=NR0cor+T14KU62XNHUm+6ko1Mc5iwdDDWVh+nW6r4WsPvi0uYYhcfHWOkL9PrGmwnrtBuE1iUdOLjZ7I/J1JFo6HjKOOnc9JY19ylgzve8zgEvd/x20kEGUsHPqIW5/o4i7/e0zzldncYqBIuyUNjThggj5gaLtn1T2ywzGPiFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290750; c=relaxed/simple; bh=ZrANJBkr+rcNB+Gb91FfJpYEND5BP94eIuK4qfQoJJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EU78A+cuDWhNDByO8wywmTWG27MUDuWotFuR90RUW/4QF9aN/qrDjN2gB9WRHQJuTZ/pFJjF/OSwzSEn2ZvvUXsOLeOHvg2q+RwY0QyXXh19m8exXDcwqY+mzcGE8KB1QOkgR/qWrqYh/EXxiIhK5gPZpdj0IphT0bxxA6pddx8= 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=TAxIqZkU; arc=none smtp.client-ip=45.157.188.11 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="TAxIqZkU" 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 4gC7jn39ypzG2g for ; Sat, 9 May 2026 03:31:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778290269; bh=c/G8wXKdqvZt2BvDxdDNE6fPK0sGOnLUK+rMvI8azMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TAxIqZkUhCh03cwXGpvfmt00tAlPFIkkTZqtxTy/WrxK6MAP756GnDBJzDLE0h5aG obLC7vRnjt6LuacgeKhSaUiC/Qqj2bu1xMaZ5layX68UOcFzIU5lMSBOBONt6LOCGP /hVhWDCr4T1BBazEw2QWqYfc5xr+PQn/1HzhBBgaiDxZ6vXsg3aQjTLbunb0o0f1vt VpLwzOI4NwqAEo7L02sSt+nUU9iWvtYBqRTE3HkrK1WkeV2lI131yy3VnZht0bB4hP bb7Jl0FhZJDralWgodMxLllJg0+IK4bd1F5qzEgXvVKD9FpxPbOJJbOavJrr0nxrDL Cjqs12d8vfCVg== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gC7jn0HgFz6QB for ; Sat, 9 May 2026 03:31:08 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 09 May 2026 03:31:08 +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: Daniel Gibson , Sindre Henriksen , "Mario Limonciello (AMD)" Subject: [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Date: Sat, 9 May 2026 03:31:01 +0200 Message-ID: <20260509013105.816339-3-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260509013105.816339-1-daniel@gibson.sh> References: <20260509013105.816339-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 - unfortunately at least on my 16ABR8 waking it with a timer (wakealarm) still triggers the issue, but at least normal resume via keypress or lid works fine. This issue has been reported for many different devices, this patch has been tested with the Zen3-based IdeaPad Slim 3 16ABR8 (82XR) and the Zen3+-based IdeaPad Slim 3 14ARP10 (83K6). Reported-by: Sindre Henriksen Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 Tested-by: Sindre Henriksen Suggested-by: Mario Limonciello (AMD) Reviewed-by: Mario Limonciello (AMD) Signed-off-by: Daniel Gibson Reviewed-by: Ilpo J=C3=A4rvinen --- drivers/platform/x86/amd/pmc/pmc-quirks.c | 31 +++++++++++++++++++++++ drivers/platform/x86/amd/pmc/pmc.c | 24 +++++++++++++++++- drivers/platform/x86/amd/pmc/pmc.h | 1 + 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/pmc/pmc-quirks.c b/drivers/platform/x= 86/amd/pmc/pmc-quirks.c index 24506e342943..842a8f442fb5 100644 --- a/drivers/platform/x86/amd/pmc/pmc-quirks.c +++ b/drivers/platform/x86/amd/pmc/pmc-quirks.c @@ -18,6 +18,7 @@ struct quirk_entry { u32 s2idle_bug_mmio; bool spurious_8042; + bool need_suspend_delay; }; =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,27 @@ 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"), + } + }, /* https://bugzilla.kernel.org/show_bug.cgi?id=3D221273 */ { .ident =3D "Thinkpad L14 Gen3", @@ -356,6 +382,11 @@ void amd_pmc_process_restore_quirks(struct amd_pmc_dev= *dev) amd_pmc_skip_nvme_smi_handler(dev->quirks->s2idle_bug_mmio); } =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 Sat Jun 13 07:14:21 2026 Received: from smtp-1909.mail.infomaniak.ch (smtp-1909.mail.infomaniak.ch [185.125.25.9]) (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 EF1E226A1AC for ; Sat, 9 May 2026 01:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290748; cv=none; b=TMkoAuwCRsB+rc7yRjXKgpUeb87xyfnqVmB2VcFBuwUawUpnXNzNrUYkMV8GmvQHp2EQt7U0gyxauwr0pZtz5dQ9PlTAu8G+D+y+QNRixPhM4AooQ+zu9F1sd0q72C49m5C2usXvJg9Jq/aiEw4zbHCTk+sK8F1sMxDr1NVBXzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290748; c=relaxed/simple; bh=acFu2Xjpg4pZSrD6LRRLywAPJZEwO4kgZbcrQJvbu1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nj9I6mYsmqx099Ngxvt3mMdUxr9stcOQn/25Rtp1F3yT0/1Iss24dyHRQ5oxHzx6Vz2yisHAT7HC7Z+m8zwg45Nfmb1d3WLRYSJrdcOXxhj7Ef/ysd8xQLsViu+wfH6S4a534VzuYLBKNftOAHa3dRpv0rILGZlGyhrsasLNzwA= 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=F9Cp6ehs; arc=none smtp.client-ip=185.125.25.9 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="F9Cp6ehs" 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 4gC7jn2q0czG2f for ; Sat, 9 May 2026 03:31:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778290269; bh=L27OgPutkmm8ASZUOGdctMKSqc+pMmXtRa5EtMnmzzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9Cp6ehsq40CXCE1/dz0rwNtm9J14saFFcbwFQa8anfR9YZNF1qFJgddEW3kyzTp8 cj/1IDgvdChoJSL44xFWNvTOQ2QRUAYF0lZ91/MoViYy+qsAgQxsyrpqtbLiRHHG3u G1PQLZkehWBPT0/WwqQTVdw12uywZGwNO3+0lzi59HHpn/98126wslJZMJMTk/txGe mOBlOg65Ep1s/yNgmcTCuHB8+IB3Kn2oioVIS6oG703hpmlL4FIBZwEQ1+fNr6cyHH Bnx7K/nHExMjIY3OmlB3c1LjQVN+ikgJSCf+P7xsglZlF/VJqfnslizRM4gmnjxcMq RJ4MxqPrAAjVw== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4gC7jn00lfz7yQ for ; Sat, 9 May 2026 03:31:08 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 09 May 2026 03:31:08 +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: Daniel Gibson Subject: [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Date: Sat, 9 May 2026 03:31:02 +0200 Message-ID: <20260509013105.816339-4-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260509013105.816339-1-daniel@gibson.sh> References: <20260509013105.816339-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. I added a note to the parameter description encouraging users to report their device so it can be added to the quirks list, inspired by a similar request in parameter descriptions of the ideapad-laptop module. The module parameter can be set to "1" to explicitly enable it, "0" to disable it even on devices that are assumed to be affected, or -1 (the default) to enable it if the device is assumed to be affected (according to fwbug_list[]) Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D221383 Signed-off-by: Daniel Gibson --- 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 Sat Jun 13 07:14:21 2026 Received: from smtp-8fa9.mail.infomaniak.ch (smtp-8fa9.mail.infomaniak.ch [83.166.143.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 A322D27281E for ; Sat, 9 May 2026 01:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.166.143.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290278; cv=none; b=XEgm/jg+qQ3WRKahTWYTB0/ldYD/7iIeM3ZzlKLB58f/CqeDGAQ96BIVQusBMTgTFrsVDxs32vKjo1C8nf/x/V4HYVk9N6GZABZIQPEUDoQZ39P8kinRdAT29UQJuhJd5CBqw4N18Y9aFnVkKDrd2bqHDevXiZvU15xf2V0HABg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290278; c=relaxed/simple; bh=1yu+/UM6Y0GoI7lTTWpwIsOj8noQkvZeDhVOAffQz28=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D29TlZFPzr6rU9ErDG1TPUDBizk0eVj9/Q9uQdt1EQy33hmY5gK7RrwD+GISd+uu2WNMQfXhG55JaVHzvs0oyn6ZywksrZxCZENA07Uc+garbgQ1A4KPmdx+U13QLEFlTxHp1JHrNYEeaPGpwbtLfS6vGp+GVo6wKCWeRzhWUYA= 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=Kum6yGWT; arc=none smtp.client-ip=83.166.143.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="Kum6yGWT" 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 4gC7jn3SqczY3M for ; Sat, 9 May 2026 03:31:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778290269; bh=a+WRQSJV9hBwuS2Du1AmZQPBdJRpx+moR5xxxAEURRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kum6yGWTUD6izp5cmKheJ7ciQZMN75B3AA5RX751ekqep6o2b1KJcO6ZCdKdsUVv/ mE9oYKF9KO6fQRONlaoNaO/a8OTjMn7TNBFXA6AaHqe9Q0kTUJAvjSpM9nufRPK5x/ zp8bK6ZoXQJ7UaTNNUmXphMh9tEZ7RqoEeQUijM494X8GVzauIyKlLYwjn9p/JdXtv 5Ra74mD3CCtTwEmHz/Z1V7Z86vREVV41MBDSXnOFxuCmjRn9rP6Oz9ZM1Qwoat4f+M OX5WoTcE21liUkZiEd+aALgIx/ACEzbpi4kRo5Pa8pTPQ4hFZZC7LrO3navdghR7b/ GUsfQ72TRA2kg== Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gC7jn0MD4zg3L for ; Sat, 9 May 2026 03:31:09 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 09 May 2026 03:31:08 +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: Daniel Gibson Subject: [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register Date: Sat, 9 May 2026 03:31:03 +0200 Message-ID: <20260509013105.816339-5-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260509013105.816339-1-daniel@gibson.sh> References: <20260509013105.816339-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" To me it wasn't clear how I get the information stored in the reset register, or how to identify the messages in the syslog mentioned there. Mario Limonciello sent me an example line which illustrates what to look for and I added it to the AMD debugging documentation, with a short explanation. Signed-off-by: Daniel Gibson Suggested-by tag. Suggested-by: Mario Limonciello (AMD) --- 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 Sat Jun 13 07:14:21 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 A32A1274B3B for ; Sat, 9 May 2026 01:31:16 +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=1778290279; cv=none; b=N6pwwlQYu+htkL56wPqlKQzvPz/auOETkxrUEqwnh+okzxROpdYGx22wqN0t1fR4rJBBuwqcI0Un3M8QMl+bgiZGAyBuuOkn+v90ySFACHZTMNK5hUinVH1zucOH0QBtBK7itdklKC+ZCZoDnJAY1L4V/SOApBD8/Zxf/EsCd80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778290279; c=relaxed/simple; bh=dZBzxIAy7lF2ul65Go/tb0xNb8XJB86LNAGd9kZFD8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W55ZNNxsATUAjLhwDYCrOlJ2AId4oEe5p3Jzp0naeC4CF5JcWnr9Tqdn7dZI3VCo/HUJG+4uhXtxtiZpay9s4D7nTj64H5HwGCW8NikwmPhl1q9Y+jYgOz3JqbWK8HRSX8V2sHcpDluMX6+scNIyM30ijtKg3qIxiISPVxWNZmM= 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=BVudDNo5; 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="BVudDNo5" 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 4gC7jn3qcjzMqq for ; Sat, 9 May 2026 03:31:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.sh; s=20260228; t=1778290269; bh=ihbvjxvr97zedo1FQaExWZwtDYT441IOd4ui/OieJps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVudDNo5AIeCeGukudy6rJqwT33l+Ql4fP6X3sY+q/3F9jL3vFNNGvU+ElrRiUplF 8lWeKv11qCbzwNF2zbpfcwDNouIKS1/fa1UFry5M2nHoGO8ErKdXux7ri7y+n9LbND nqWnkz6gHJiHyfpnAHks98tECCgygsJBFhJJk2IHBNP23rrPKsa2iwzGIx9ADpyt1G J/sptzdle3YQWDj9aPZQ/eNfYmyWMjVqKqbz8jzMoEhCx+vZX10c/oMDnFzZF9aIta NBT6kpCl0pfhF3e/0baRQjbxSoTkFud+5PeHdG8mqmYUn5mp/3/mPYTDmfin+FVPk2 72q4mZwged5iw== Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4gC7jn0D0JzWRy for ; Sat, 9 May 2026 03:31:08 +0200 (CEST) Received: from unknown by spiderdemon.horst.lan (DragonFly Mail Agent v0.13); Sat, 09 May 2026 03:31:08 +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: Daniel Gibson Subject: [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend Date: Sat, 9 May 2026 03:31:04 +0200 Message-ID: <20260509013105.816339-6-daniel@gibson.sh> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260509013105.816339-1-daniel@gibson.sh> References: <20260509013105.816339-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" 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..3af7799cca1a 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 problems, the EC needed so= me 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: The problems can still hap= pen +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