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 3/5] platform/x86/amd/pmc: Add delay_suspend module parameter
Date: Mon, 11 May 2026 15:36:39 +0300 (EEST)	[thread overview]
Message-ID: <8de3f9e9-3de8-baf7-3aad-874bd286fd75@linux.intel.com> (raw)
In-Reply-To: <20260509013105.816339-4-daniel@gibson.sh>

On Sat, 9 May 2026, Daniel Gibson wrote:

> 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

Please fill in paragraphs to ~72 chars or clearly make another 
paragraph with a line in between, if that's what you want.

> 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=221383
> Signed-off-by: Daniel Gibson <daniel@gibson.sh>
> ---
>  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 <linux/bits.h>
>  #include <linux/debugfs.h>
>  #include <linux/delay.h>
> +#include <linux/dmi.h>
>  #include <linux/io.h>
>  #include <linux/iopoll.h>
>  #include <linux/limits.h>
> @@ -89,6 +90,11 @@ static bool disable_workarounds;
>  module_param(disable_workarounds, bool, 0644);
>  MODULE_PARM_DESC(disable_workarounds, "Disable workarounds for platform bugs");
>  
> +static int delay_suspend = -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 keyboard issues after suspend. 0: don't delay, 1: do delay, -1 (default): let amd_pmc decide. If you need this please report this to: platform-driver-x86@vger.kernel.org");
> +
>  static struct amd_pmc_dev pmc;
>  
>  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=221383
>  	 */
> -	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=1 force-enables this, otherwise it can be
> +		 * disabled with disable_workarounds or delay_suspend=0
> +		 */
> +		if (delay_suspend == 1 || (delay_suspend == -1 && !disable_workarounds)) {
> +			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, even though your device is assumed to need it!\n");
> +	} else if (delay_suspend == 1) {

At least the parameter interactions madness is a bit more contained now 
that it's in these smaller functions. :-/

Still not a big fan of it but I guess it's not worth fighting over 
something that normally shouldn't be needed (if we've all the needed 
quirk info in place).

> +		dev_info(pdev->dev, "Delaying suspend by 2.5s because delay_suspend=1. 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;
> 

-- 
 i.


  reply	other threads:[~2026-05-11 12:36 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
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 [this message]
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=8de3f9e9-3de8-baf7-3aad-874bd286fd75@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