Control: tags -1 +patch -help
Control: clone -1 -2
Control: retitle -2 Thinkpad AMD: amd_pmc module is required for correct s0ix 
(Windows mode) suspend
Control: severity -2 important

Hello there, 

My understanding is that there are two distinct bugs here; hereby splitting 
to make this clearer.

* Original bug, as retitled by Salvatore; S3 suspend is broken on some AMD
  Ryzens. This is fixed by this patch queue, also attached.
https://gitlab.freedesktop.org/superm1/linux/-/commits/mlimonci/rhbz-2162013-gitlab-2357-v4/

  In the BIOS, "S3" is "Linux mode" for suspend.

* While investigating this; it turns out modern kernels can also suspend
  on s0ix "Windows mode", but this _requires_ the `amd_pmc` module, which
  is not loaded automatically, but it really should. This doesn't look
  like an upstream bug, but rather a Debian one.

  As this only shows on Laptops with a "Windows mode" BIOS configuration
  (in a box that also shows "Linux mode"), I think it's reasonable to see
  this as a bug of only "important" level (even though not resuming from
  suspend is _bad_).

  I don't think we have seen a patch to fix this one yet though.

Best,

OdyX
Index: linux/drivers/gpio/gpiolib-acpi.c
===================================================================
--- linux.orig/drivers/gpio/gpiolib-acpi.c
+++ linux/drivers/gpio/gpiolib-acpi.c
@@ -361,7 +361,7 @@ err:
 }
 
 static bool acpi_gpio_irq_is_wake(struct device *parent,
-				  struct acpi_resource_gpio *agpio)
+				  const struct acpi_resource_gpio *agpio)
 {
 	unsigned int pin = agpio->pin_table[0];
 
@@ -754,7 +754,7 @@ static int acpi_populate_gpio_lookup(str
 		lookup->info.pin_config = agpio->pin_config;
 		lookup->info.debounce = agpio->debounce_timeout;
 		lookup->info.gpioint = gpioint;
-		lookup->info.wake_capable = agpio->wake_capable == ACPI_WAKE_CAPABLE;
+		lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio);
 
 		/*
 		 * Polarity and triggering are only specified for GpioInt
@@ -1080,7 +1080,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct
 				dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
 			}
 
-			if (wake_capable)
+			if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
 				*wake_capable = info.wake_capable;
 
 			return irq;
@@ -1599,6 +1599,19 @@ static const struct dmi_system_id gpioli
 			.ignore_interrupt = "AMDI0030:00@18",
 		},
 	},
+	{
+		/*
+		 * Spurious wakeups from TP_ATTN# pin
+		 * Found in BIOS 1.7.8
+		 * https://gitlab.freedesktop.org/drm/amd/-/issues/1722#note_1720627
+		 */
+		.matches = {
+			DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"),
+		},
+		.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
+			.ignore_wake = "ELAN0415:00@9",
+		},
+	},
 	{} /* Terminating entry */
 };
 
Index: linux/drivers/pinctrl/pinctrl-amd.c
===================================================================
--- linux.orig/drivers/pinctrl/pinctrl-amd.c
+++ linux/drivers/pinctrl/pinctrl-amd.c
@@ -365,6 +365,7 @@ static void amd_gpio_dbg_show(struct seq
 
 			} else {
 				debounce_enable = "  ∅";
+				time = 0;
 			}
 			snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit);
 			seq_printf(s, "debounce %s (🕑 %sus)| ", debounce_enable, debounce_value);

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to