From: Daniel Gibson <daniel@gibson.sh>
To: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Mario Limonciello" <superm1@kernel.org>
Cc: Daniel Gibson <daniel@gibson.sh>, stable@vger.kernel.org
Subject: [PATCH v6 1/4] platform/x86/amd/pmc: Check for intermediate wakeup in function
Date: Thu, 11 Jun 2026 17:04:23 +0200 [thread overview]
Message-ID: <20260611150426.3683372-2-daniel@gibson.sh> (raw)
In-Reply-To: <20260611150426.3683372-1-daniel@gibson.sh>
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 <daniel@gibson.sh>
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 ccb37383b337..25509099a958 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -670,6 +670,19 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
return rc;
}
+static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
+{
+ /*
+ * 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.org/
+ */
+ struct smu_metrics table;
+
+ return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
+}
+
static void amd_pmc_s2idle_prepare(void)
{
struct amd_pmc_dev *pdev = &pmc;
@@ -702,11 +715,9 @@ static void amd_pmc_s2idle_prepare(void)
static void amd_pmc_s2idle_check(void)
{
struct amd_pmc_dev *pdev = &pmc;
- struct smu_metrics table;
int rc;
- /* Avoid triggering OVP */
- if (!get_metrics_table(pdev, &table) && table.s0i3_last_entry_status)
+ if (amd_pmc_intermediate_wakeup_need_delay(pdev))
msleep(2500);
/* Dump the IdleMask before we add to the STB */
--
2.48.1
next prev parent reply other threads:[~2026-06-11 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 15:04 [PATCH v6 0/4] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
2026-06-11 15:04 ` Daniel Gibson [this message]
2026-06-11 15:04 ` [PATCH v6 2/4] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Daniel Gibson
2026-06-11 15:04 ` [PATCH v6 3/4] platform/x86/amd/pmc: Add delay_suspend module parameter Daniel Gibson
2026-06-11 15:04 ` [PATCH v6 4/4] platform/x86/amd/pmc: Don't log during intermediate wakeups Daniel Gibson
2026-06-11 17:27 ` [PATCH v6 0/4] amd_pmc: Delay s2idle suspend for some devices Ilpo Järvinen
2026-06-11 17:30 ` Daniel Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611150426.3683372-2-daniel@gibson.sh \
--to=daniel@gibson.sh \
--cc=Shyam-sundar.S-k@amd.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=superm1@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.