The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Daniel Gibson <daniel@gibson.sh>
Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	 Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function
Date: Mon, 11 May 2026 15:31:05 +0300 (EEST)	[thread overview]
Message-ID: <be336ea2-7d9c-2187-2f6c-d8841006e1dc@linux.intel.com> (raw)
In-Reply-To: <20260509013105.816339-2-daniel@gibson.sh>

On Sat, 9 May 2026, Daniel Gibson wrote:

> This slightly refactors code introduced by the

Avoid starting changelog with "This" or "This patch" but use imperative 
tone instead. You can start with "Refactor code ..."

> "pmc: Require at least 2.5 seconds between HW sleep cycles"

Please always use the canonical commit reference format (see 
Documentation/process/submitting-patches.rst for detail).

It's on the borderline if the origin of the code even matters that much 
but since you're adding the (nice) comment, I guess it is easier to figure 
out where that came from by having the reference in place.

> commit
> to allow adding different conditions for that delay later.

later -> in an upcoming change

> 
> References: 9f5595d5f03f ("platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles")

Drop this.

> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  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;
>  }
>  
> +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;
> @@ -632,11 +645,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 */
> 

-- 
 i.


  reply	other threads:[~2026-05-11 12:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-09  1:30 [PATCH v2 0/5] amd_pmc: Delay s2idle suspend for some devices Daniel Gibson
2026-05-09  1:31 ` [PATCH v2 1/5] platform/x86/amd/pmc: Check for intermediate wakeup in function Daniel Gibson
2026-05-11 12:31   ` Ilpo Järvinen [this message]
2026-05-09  1:31 ` [PATCH v2 2/5] platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops Daniel Gibson
2026-05-11 12:24   ` Ilpo Järvinen
2026-05-12  0:45     ` Daniel Gibson
2026-05-09  1:31 ` [PATCH v2 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter Daniel Gibson
2026-05-11 12:36   ` Ilpo Järvinen
2026-05-09  1:31 ` [PATCH v2 4/5] Documentation/arch/x86/amd-debugging: Add example for reset register Daniel Gibson
2026-05-10  0:21   ` Mario Limonciello
2026-05-11 12:45   ` Ilpo Järvinen
2026-05-09  1:31 ` [PATCH v2 5/5] Documentation/arch/x86/amd-debugging: Add section about delay_suspend Daniel Gibson
2026-05-11 12:49   ` Ilpo Järvinen
2026-05-12  0:50     ` Daniel Gibson
2026-05-12  9:06       ` Ilpo Järvinen

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=be336ea2-7d9c-2187-2f6c-d8841006e1dc@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=daniel@gibson.sh \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox