linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops
@ 2022-09-16 18:26 Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 1/7] acpi/x86: s2idle: Move _HID handling for AMD systems into structures Mario Limonciello
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi,
	linux-kernel

It was reported that an ASUS Rembrandt laptop has problems with seemingly
unrelated ACPI events after resuming from s2idle. Debugging the issue
proved it's because ASUS has ASL that is only called when using the
Microsoft GUID, not the AMD GUID.

This is a bug from ASUS firmware but this series reworks the s2idle
handling for AMD to allow accounting for this in a quirk.

Additionally as this is a problem that may pop up again on other models
add a module parameter that can be used to try the Microsoft GUID on a
given system.

This module parameter intentionally applies to both Intel and AMD systems
as the same problem could potentially exist on Intel systems that support
both the Intel GUID or the Microsoft GUID.

v2->v3:
 * Add more systems
v1->v2:
 * Add two more systems that are reported to be helped by this series.

Mario Limonciello (7):
  acpi/x86: s2idle: Move _HID handling for AMD systems into structures
  acpi/x86: s2idle: If a new AMD _HID is missing assume Rembrandt
  acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID
  acpi/x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE
  acpi/x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14
  acpi/x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7
  acpi/x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13

 drivers/acpi/x86/s2idle.c | 136 +++++++++++++++++++++++++++++++-------
 1 file changed, 112 insertions(+), 24 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/7] acpi/x86: s2idle: Move _HID handling for AMD systems into structures
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 2/7] acpi/x86: s2idle: If a new AMD _HID is missing assume Rembrandt Mario Limonciello
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

Right now the information about which cases to use for what are in a
comment, but this is error prone.  Instead move all information into
a dedicated structure.

Tested-by: catalin@antebit.com
Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com> # GA402RJ
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Add tags
 * Don't check for != NULL
---
 drivers/acpi/x86/s2idle.c | 63 ++++++++++++++++++++++++++++-----------
 1 file changed, 46 insertions(+), 17 deletions(-)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index f9ac12b778e6..28a3ef9a6bc1 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -363,6 +363,39 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d
 	return ret;
 }
 
+struct amd_lps0_hid_device_data {
+	const unsigned int rev_id;
+	const bool check_off_by_one;
+	const bool prefer_amd_guid;
+};
+
+static const struct amd_lps0_hid_device_data amd_picasso = {
+	.rev_id = 0,
+	.check_off_by_one = true,
+	.prefer_amd_guid = false,
+};
+
+static const struct amd_lps0_hid_device_data amd_cezanne = {
+	.rev_id = 0,
+	.check_off_by_one = false,
+	.prefer_amd_guid = false,
+};
+
+static const struct amd_lps0_hid_device_data amd_rembrandt = {
+	.rev_id = 2,
+	.check_off_by_one = false,
+	.prefer_amd_guid = true,
+};
+
+static const struct acpi_device_id amd_hid_ids[] = {
+	{"AMD0004",	(kernel_ulong_t)&amd_picasso,	},
+	{"AMD0005",	(kernel_ulong_t)&amd_picasso,	},
+	{"AMDI0005",	(kernel_ulong_t)&amd_picasso,	},
+	{"AMDI0006",	(kernel_ulong_t)&amd_cezanne,	},
+	{"AMDI0007",	(kernel_ulong_t)&amd_rembrandt,	},
+	{}
+};
+
 static int lps0_device_attach(struct acpi_device *adev,
 			      const struct acpi_device_id *not_used)
 {
@@ -370,31 +403,27 @@ static int lps0_device_attach(struct acpi_device *adev,
 		return 0;
 
 	if (acpi_s2idle_vendor_amd()) {
-		/* AMD0004, AMD0005, AMDI0005:
-		 * - Should use rev_id 0x0
-		 * - function mask > 0x3: Should use AMD method, but has off by one bug
-		 * - function mask = 0x3: Should use Microsoft method
-		 * AMDI0006:
-		 * - should use rev_id 0x0
-		 * - function mask = 0x3: Should use Microsoft method
-		 * AMDI0007:
-		 * - Should use rev_id 0x2
-		 * - Should only use AMD method
-		 */
-		const char *hid = acpi_device_hid(adev);
-		rev_id = strcmp(hid, "AMDI0007") ? 0 : 2;
+		static const struct acpi_device_id *dev_id;
+		const struct amd_lps0_hid_device_data *data;
+
+		for (dev_id = &amd_hid_ids[0]; dev_id->id[0]; dev_id++)
+			if (acpi_dev_hid_uid_match(adev, dev_id->id, NULL))
+				break;
+		if (dev_id)
+			data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data;
+		else
+			return 0;
+		rev_id = data->rev_id;
 		lps0_dsm_func_mask = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
 		lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
 					&lps0_dsm_guid_microsoft);
-		if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") ||
-						 !strcmp(hid, "AMD0005") ||
-						 !strcmp(hid, "AMDI0005"))) {
+		if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) {
 			lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
 			acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
 					  ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
-		} else if (lps0_dsm_func_mask_microsoft > 0 &&
+		} else if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid &&
 				(!strcmp(hid, "AMDI0007") ||
 				 !strcmp(hid, "AMDI0008"))) {
 			lps0_dsm_func_mask_microsoft = -EINVAL;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/7] acpi/x86: s2idle: If a new AMD _HID is missing assume Rembrandt
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 1/7] acpi/x86: s2idle: Move _HID handling for AMD systems into structures Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 3/7] acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID Mario Limonciello
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

A mistake was made that only AMDI0007 was set to rev of "2", but
it should have been also set for AMDI008. If an ID is missing from
the _HID table, then assume it matches Rembrandt behavior.

This implicitly means that if any other behavior changes happen
in the future missing IDs must be added to that table.

Tested-by: catalin@antebit.com
Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com> # GA402RJ
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Add tags
---
 drivers/acpi/x86/s2idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 28a3ef9a6bc1..2c5931d247a2 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -412,7 +412,7 @@ static int lps0_device_attach(struct acpi_device *adev,
 		if (dev_id)
 			data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data;
 		else
-			return 0;
+			data = &amd_rembrandt;
 		rev_id = data->rev_id;
 		lps0_dsm_func_mask = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 3/7] acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 1/7] acpi/x86: s2idle: Move _HID handling for AMD systems into structures Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 2/7] acpi/x86: s2idle: If a new AMD _HID is missing assume Rembrandt Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  2022-09-21 18:40   ` Rafael J. Wysocki
  2022-09-16 18:26 ` [PATCH v3 4/7] acpi/x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE Mario Limonciello
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

OEMs have made some mistakes in the past for the AMD GUID support
and not populated the method properly.  To add an escape hatch for
this problem introduce a module parameter that can force using
the Microsoft GUID.

This is intentionally introduced to both Intel and AMD codepaths
to allow using the parameter as a debugging tactic on either.

Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com> # GA402RJ
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Add tags
---
 drivers/acpi/x86/s2idle.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 2c5931d247a2..127215150b84 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -27,6 +27,10 @@ static bool sleep_no_lps0 __read_mostly;
 module_param(sleep_no_lps0, bool, 0644);
 MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface");
 
+static bool prefer_microsoft_guid __read_mostly;
+module_param(prefer_microsoft_guid, bool, 0644);
+MODULE_PARM_DESC(prefer_microsoft_guid, "Prefer selecting Microsoft GUID for LPS0 device");
+
 static const struct acpi_device_id lps0_device_ids[] = {
 	{"PNP0D80", },
 	{"", },
@@ -402,6 +406,9 @@ static int lps0_device_attach(struct acpi_device *adev,
 	if (lps0_device_handle)
 		return 0;
 
+	lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
+						    ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
+						    &lps0_dsm_guid_microsoft);
 	if (acpi_s2idle_vendor_amd()) {
 		static const struct acpi_device_id *dev_id;
 		const struct amd_lps0_hid_device_data *data;
@@ -416,16 +423,12 @@ static int lps0_device_attach(struct acpi_device *adev,
 		rev_id = data->rev_id;
 		lps0_dsm_func_mask = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
-		lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
-					ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
-					&lps0_dsm_guid_microsoft);
 		if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) {
 			lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
 			acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
 					  ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
 		} else if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid &&
-				(!strcmp(hid, "AMDI0007") ||
-				 !strcmp(hid, "AMDI0008"))) {
+				!prefer_microsoft_guid) {
 			lps0_dsm_func_mask_microsoft = -EINVAL;
 			acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
 		}
@@ -433,7 +436,8 @@ static int lps0_device_attach(struct acpi_device *adev,
 		rev_id = 1;
 		lps0_dsm_func_mask = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
-		lps0_dsm_func_mask_microsoft = -EINVAL;
+		if (!prefer_microsoft_guid)
+			lps0_dsm_func_mask_microsoft = -EINVAL;
 	}
 
 	if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 4/7] acpi/x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
                   ` (2 preceding siblings ...)
  2022-09-16 18:26 ` [PATCH v3 3/7] acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 5/7] acpi/x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14 Mario Limonciello
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

ASUS TUF Gaming A17 FA707RE has problems with ACPI events after
s2idle resume.  It's from a missing call to an ASL method in AMD
the s2idle calling path. Force the system to use the Microsoft
Modern Standby calling path instead.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216101
Reported-and-tested-by: catalin@antebit.com
Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com> # GA402RJ
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Add tags
v1->v2:
 * Fixup for __init
---
 drivers/acpi/x86/s2idle.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 127215150b84..1b638bd30fcf 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -17,6 +17,7 @@
 
 #include <linux/acpi.h>
 #include <linux/device.h>
+#include <linux/dmi.h>
 #include <linux/suspend.h>
 
 #include "../sleep.h"
@@ -400,6 +401,28 @@ static const struct acpi_device_id amd_hid_ids[] = {
 	{}
 };
 
+static int lps0_prefer_microsoft(const struct dmi_system_id *id)
+{
+	pr_debug("Preferring Microsoft GUID.\n");
+	prefer_microsoft_guid = true;
+	return 0;
+}
+
+static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
+	{
+		/*
+		 * ASUS TUF Gaming A17 FA707RE
+		 * https://bugzilla.kernel.org/show_bug.cgi?id=216101
+		 */
+		.callback = lps0_prefer_microsoft,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming A17"),
+		},
+	},
+	{}
+};
+
 static int lps0_device_attach(struct acpi_device *adev,
 			      const struct acpi_device_id *not_used)
 {
@@ -566,8 +589,9 @@ static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
 	.end = acpi_s2idle_end,
 };
 
-void acpi_s2idle_setup(void)
+void __init acpi_s2idle_setup(void)
 {
+	dmi_check_system(s2idle_dmi_table);
 	acpi_scan_add_handler(&lps0_handler);
 	s2idle_set_ops(&acpi_s2idle_ops_lps0);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 5/7] acpi/x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
                   ` (3 preceding siblings ...)
  2022-09-16 18:26 ` [PATCH v3 4/7] acpi/x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 6/7] acpi/x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7 Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 7/7] acpi/x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13 Mario Limonciello
  6 siblings, 0 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

ASUS ROG Zephyrus G14 is affected by the same BIOS bug as ASUS TUF
Gaming A17 where important ASL is not called in the AMD code path.
Use the Microsoft codepath instead.

Reported-and-suggested-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Matthew Anderson <ruinairas1992@gmail.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Absorb tags
v1->v2:
 * New patch
---
 drivers/acpi/x86/s2idle.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 1b638bd30fcf..52f41119f296 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -420,6 +420,14 @@ static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming A17"),
 		},
 	},
+	{
+		/* ASUS ROG Zephyrus G14 (2022) */
+		.callback = lps0_prefer_microsoft,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14 GA402"),
+		},
+	},
 	{}
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 6/7] acpi/x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
                   ` (4 preceding siblings ...)
  2022-09-16 18:26 ` [PATCH v3 5/7] acpi/x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14 Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  2022-09-16 18:26 ` [PATCH v3 7/7] acpi/x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13 Mario Limonciello
  6 siblings, 0 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

Lenovo Slim 7 Pro 14ARH7 has a sporadically non-functional keyboard
when resuming from s2idle.  This is caused by some missing calls to the
EC that don't occur in the AMD codepath but only in the Microsoft codepath.

Add the system to the quirk list to force Microsoft codepath.

Reported-by: Travis Glenn Hansen <travisghansen@yahoo.com>
Reported-by: Sebastian S. <iam@decentr.al>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216473
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216438
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Adjust prefix to cover multiple systems
 * Add another Link tag
v1->v2:
 * New patch
---
 drivers/acpi/x86/s2idle.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 52f41119f296..9c84eb068e19 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -428,6 +428,18 @@ static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14 GA402"),
 		},
 	},
+	{
+		/*
+		 * Lenovo Yoga Slim 7 Pro X 14ARH7
+		 * https://bugzilla.kernel.org/show_bug.cgi?id=216438 : 82V2
+		 * https://bugzilla.kernel.org/show_bug.cgi?id=216438 : 82TL
+		 */
+		.callback = lps0_prefer_microsoft,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "82"),
+		},
+	},
 	{}
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 7/7] acpi/x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13
  2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
                   ` (5 preceding siblings ...)
  2022-09-16 18:26 ` [PATCH v3 6/7] acpi/x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7 Mario Limonciello
@ 2022-09-16 18:26 ` Mario Limonciello
  6 siblings, 0 replies; 9+ messages in thread
From: Mario Limonciello @ 2022-09-16 18:26 UTC (permalink / raw)
  To: rafael, linux-kernel
  Cc: travisghansen, catalin, Shyam-sundar.S-k, Matthew Anderson,
	philipp.zabel, Sebastian S .,
	Hans de Goede, Mario Limonciello, Len Brown, linux-acpi

ASUSTeK COMPUTER INC. ROG Flow X13 has a problem with fans upon wakeup from
s2idle. In examining the ASL, functions 3 and 4 are not called in the AMD
codepath but only in the Microsoft codepath.

Add the system to the quirk list to force Microsoft codepath.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2148
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * New patch
---
 drivers/acpi/x86/s2idle.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 9c84eb068e19..d6fab1eb6a83 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -440,6 +440,17 @@ static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "82"),
 		},
 	},
+	{
+		/*
+		 * ASUSTeK COMPUTER INC. ROG Flow X13 GV301RE_GV301RE
+		 * https://gitlab.freedesktop.org/drm/amd/-/issues/2148
+		 */
+		.callback = lps0_prefer_microsoft,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X13 GV301"),
+		},
+	},
 	{}
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/7] acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID
  2022-09-16 18:26 ` [PATCH v3 3/7] acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID Mario Limonciello
@ 2022-09-21 18:40   ` Rafael J. Wysocki
  0 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2022-09-21 18:40 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List, travisghansen,
	catalin, Shyam Sundar S K, Matthew Anderson, Philipp Zabel,
	Sebastian S .,
	Hans de Goede, Len Brown, ACPI Devel Maling List

On Fri, Sep 16, 2022 at 8:26 PM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
> OEMs have made some mistakes in the past for the AMD GUID support
> and not populated the method properly.  To add an escape hatch for
> this problem introduce a module parameter that can force using
> the Microsoft GUID.
>
> This is intentionally introduced to both Intel and AMD codepaths
> to allow using the parameter as a debugging tactic on either.
>
> Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
> Tested-by: Philipp Zabel <philipp.zabel@gmail.com> # GA402RJ
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v2->v3:
>  * Add tags
> ---
>  drivers/acpi/x86/s2idle.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index 2c5931d247a2..127215150b84 100644
> --- a/drivers/acpi/x86/s2idle.c
> +++ b/drivers/acpi/x86/s2idle.c
> @@ -27,6 +27,10 @@ static bool sleep_no_lps0 __read_mostly;
>  module_param(sleep_no_lps0, bool, 0644);
>  MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface");
>
> +static bool prefer_microsoft_guid __read_mostly;

I would call this prefer_microsoft_dsm_guid and make changes below analogously.

> +module_param(prefer_microsoft_guid, bool, 0644);
> +MODULE_PARM_DESC(prefer_microsoft_guid, "Prefer selecting Microsoft GUID for LPS0 device");

And here: "Prefer using Microsoft GUID in LPS0 device _DSM evaluation".

> +
>  static const struct acpi_device_id lps0_device_ids[] = {
>         {"PNP0D80", },
>         {"", },
> @@ -402,6 +406,9 @@ static int lps0_device_attach(struct acpi_device *adev,
>         if (lps0_device_handle)
>                 return 0;
>
> +       lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
> +                                                   ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
> +                                                   &lps0_dsm_guid_microsoft);
>         if (acpi_s2idle_vendor_amd()) {
>                 static const struct acpi_device_id *dev_id;
>                 const struct amd_lps0_hid_device_data *data;
> @@ -416,16 +423,12 @@ static int lps0_device_attach(struct acpi_device *adev,
>                 rev_id = data->rev_id;
>                 lps0_dsm_func_mask = validate_dsm(adev->handle,
>                                         ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
> -               lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
> -                                       ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
> -                                       &lps0_dsm_guid_microsoft);
>                 if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) {
>                         lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
>                         acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
>                                           ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
>                 } else if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid &&
> -                               (!strcmp(hid, "AMDI0007") ||
> -                                !strcmp(hid, "AMDI0008"))) {
> +                               !prefer_microsoft_guid) {
>                         lps0_dsm_func_mask_microsoft = -EINVAL;
>                         acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
>                 }
> @@ -433,7 +436,8 @@ static int lps0_device_attach(struct acpi_device *adev,
>                 rev_id = 1;
>                 lps0_dsm_func_mask = validate_dsm(adev->handle,
>                                         ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
> -               lps0_dsm_func_mask_microsoft = -EINVAL;
> +               if (!prefer_microsoft_guid)
> +                       lps0_dsm_func_mask_microsoft = -EINVAL;
>         }
>
>         if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-09-21 18:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 18:26 [PATCH v3 0/7] Fixups for s2idle on various Rembrandt laptops Mario Limonciello
2022-09-16 18:26 ` [PATCH v3 1/7] acpi/x86: s2idle: Move _HID handling for AMD systems into structures Mario Limonciello
2022-09-16 18:26 ` [PATCH v3 2/7] acpi/x86: s2idle: If a new AMD _HID is missing assume Rembrandt Mario Limonciello
2022-09-16 18:26 ` [PATCH v3 3/7] acpi/x86: s2idle: Add module parameter to prefer Microsoft GUID Mario Limonciello
2022-09-21 18:40   ` Rafael J. Wysocki
2022-09-16 18:26 ` [PATCH v3 4/7] acpi/x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE Mario Limonciello
2022-09-16 18:26 ` [PATCH v3 5/7] acpi/x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14 Mario Limonciello
2022-09-16 18:26 ` [PATCH v3 6/7] acpi/x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7 Mario Limonciello
2022-09-16 18:26 ` [PATCH v3 7/7] acpi/x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13 Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).