From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1AE90433BCA; Tue, 21 Jul 2026 19:57:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663841; cv=none; b=G+59ODOI+1rT7YpJNMJvPikfKSHNj5TGAf4TOHK4jnPIBLe6f4lb5cBjbBjGSsRHJ3OUNvJKVcLrZYxsdChwaeWTo/Vbx+9CC6nyJ1+xYsNm68EV0ggoR1CUki67vTzXuOetTYiXcv0noDK7x3ld8CxXJcRsxueyUIZGfgpFYdA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663841; c=relaxed/simple; bh=sT2dZsBNkWC7+qICCfdGMZ80CMpEqZb2ca8RhRkH+Qg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I68S0GulwOCOBQOcYj9aVS5CV2ubOA/zBwYvL/FEmn6/0iURzVBN9ya9mK4bptLYcxbcSAXzQKUesrZM3AfhkGrCEEcU8UX8wJn+2to7XeSz+Cv5lNvsDvFw1xDrFGWtrP5cFFzeYoz5+9LtmQ2TBc22DVslff6yTJeg+MTzRX8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kCCzVkki; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kCCzVkki" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 809E81F000E9; Tue, 21 Jul 2026 19:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784663840; bh=GR6T17XqE5dmBPmA6X9CPzlt9w66uZygYb+haDVWGuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kCCzVkkiQxhJqBrvYzaMt8i5WWowLZYcGbmU6LWAMsQ2kmXRR62TgpkZW8vQKMaUY mD1LDEZx/NB/OzGiBKeNfPy9XLnYhal3JKszZLeErhqnZrDCiiO8rWO02YJaMsOkxZ YMDy8JnvR53kGjzZpynnc6FXjf1/cBxzOb8CDA6A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniel Gibson , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 6.12 0968/1276] platform/x86/amd/pmc: Check for intermediate wakeup in function Date: Tue, 21 Jul 2026 17:23:31 +0200 Message-ID: <20260721152507.685525462@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Gibson commit 3bdd6fc11fbfa8249483f4b716ead51e43e3a0cd upstream. 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 Link: https://patch.msgid.link/20260611150426.3683372-2-daniel@gibson.sh Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/amd/pmc/pmc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -859,6 +859,19 @@ static int amd_pmc_verify_czn_rtc(struct 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; @@ -893,11 +906,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 */