]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86/amd/pmc: Delay suspend for some Lenovo Laptops
authorDaniel Gibson <daniel@gibson.sh>
Thu, 11 Jun 2026 15:04:24 +0000 (17:04 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 11 Jun 2026 16:53:54 +0000 (19:53 +0300)
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. On the 14ARP10 wakealarm has been reported to also
work fine with this patch.

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) and IdeaPad Slim 3
15ARP10 (83MM).

Reported-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221383
Tested-by: Sindre Henriksen <sindrehenriksen93@gmail.com>
Suggested-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Daniel Gibson <daniel@gibson.sh>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260611150426.3683372-3-daniel@gibson.sh
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmc/pmc-quirks.c
drivers/platform/x86/amd/pmc/pmc.c
drivers/platform/x86/amd/pmc/pmc.h

index 24506e3429430fdc79b44515e7d823ac7bd58b7e..74ddf1d8289a90c1af8cb7c44230a93237d1e66e 100644 (file)
@@ -18,6 +18,7 @@
 struct quirk_entry {
        u32 s2idle_bug_mmio;
        bool spurious_8042;
+       bool need_suspend_delay;
 };
 
 static struct quirk_entry quirk_s2idle_bug = {
@@ -33,6 +34,10 @@ static struct quirk_entry quirk_s2idle_spurious_8042 = {
        .spurious_8042 = true,
 };
 
+static struct quirk_entry quirk_s2idle_need_suspend_delay = {
+       .need_suspend_delay = true,
+};
+
 static const struct dmi_system_id fwbug_list[] = {
        {
                .ident = "L14 Gen2 AMD",
@@ -203,6 +208,35 @@ static const struct dmi_system_id fwbug_list[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"),
                }
        },
+       /* https://bugzilla.kernel.org/show_bug.cgi?id=221383 */
+       {
+               .ident = "Zen3-based IdeaPad Slim and similar",
+               .driver_data = &quirk_s2idle_need_suspend_delay,
+               .matches = {
+                       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 = "Zen3+-based IdeaPad Slim and similar",
+               .driver_data = &quirk_s2idle_need_suspend_delay,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "83K"),
+               }
+       },
+       {
+               .ident = "IdeaPad Slim 3 15ARP10 (83MM)",
+               .driver_data = &quirk_s2idle_need_suspend_delay,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "83MM"),
+               }
+       },
        /* https://bugzilla.kernel.org/show_bug.cgi?id=221273 */
        {
                .ident = "Thinkpad L14 Gen3",
@@ -356,6 +390,11 @@ void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev)
                amd_pmc_skip_nvme_smi_handler(dev->quirks->s2idle_bug_mmio);
 }
 
+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;
index 25509099a958846e408b63b3eeac802867cec06e..758abcf9f0949c01e775b4d462cb983f7e997ba3 100644 (file)
@@ -683,6 +683,27 @@ static bool amd_pmc_intermediate_wakeup_need_delay(struct amd_pmc_dev *pdev)
        return get_metrics_table(pdev, &table) == 0 && table.s0i3_last_entry_status;
 }
 
+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=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");
+               return true;
+       }
+       return false;
+}
+
 static void amd_pmc_s2idle_prepare(void)
 {
        struct amd_pmc_dev *pdev = &pmc;
@@ -717,7 +738,8 @@ static void amd_pmc_s2idle_check(void)
        struct amd_pmc_dev *pdev = &pmc;
        int rc;
 
-       if (amd_pmc_intermediate_wakeup_need_delay(pdev))
+       if (amd_pmc_intermediate_wakeup_need_delay(pdev) ||
+           amd_pmc_want_suspend_delay(pdev))
                msleep(2500);
 
        /* Dump the IdleMask before we add to the STB */
index 36756e25b4bd1342da2780a28924ec6000c3289e..1ef182bb240da976802a9f595543192e91b4b5f3 100644 (file)
@@ -165,6 +165,7 @@ enum amd_pmc_def {
 };
 
 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);