diff mbox series

[4/4] acpi/x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE

Message ID 20220909180509.638-5-mario.limonciello@amd.com
State Superseded
Headers show
Series Fixups for s2idle on ASUS Rembrandt laptop | expand

Commit Message

Mario Limonciello Sept. 9, 2022, 6:05 p.m. UTC
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
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/acpi/x86/s2idle.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Philipp Zabel Sept. 12, 2022, 2:59 p.m. UTC | #1
Am Fri, Sep 09, 2022 at 01:05:09PM -0500 schrieb Mario Limonciello:
> 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
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/acpi/x86/s2idle.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index a9b0f2b54a1c..6a2c94fdbeae 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 = {

This caused a build warning ...

[...]
> @@ -568,6 +591,7 @@ static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
>  
>  void acpi_s2idle_setup(void)
>  {
> +	dmi_check_system(s2idle_dmi_table);

... since it is used from a non-__init function:

  WARNING: modpost: vmlinux.o: section mismatch in reference: acpi_s2idle_setup (section: .text) -> s2idle_dmi_table (section: .init.rodata)

regards
Philipp
Luke D. Jones Sept. 17, 2022, 7:35 a.m. UTC | #2
Hi Mario,

On Fri, 2022-09-09 at 13:05 -0500, Mario Limonciello wrote:
> 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
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/acpi/x86/s2idle.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index a9b0f2b54a1c..6a2c94fdbeae 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)
>  {
> @@ -568,6 +591,7 @@ static const struct platform_s2idle_ops
> acpi_s2idle_ops_lps0 = {
>  
>  void acpi_s2idle_setup(void)
>  {
> +       dmi_check_system(s2idle_dmi_table);
>         acpi_scan_add_handler(&lps0_handler);
>         s2idle_set_ops(&acpi_s2idle_ops_lps0);
>  }

I'm confirming that this works for another laptop with the same issue -
the GA402R series.

The diff as follows (I'm unsure of how best to submit this as it is
dependant on your work - I don't need attribution for this):


 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 e2b73809ab50..0c8348de5cbc 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -420,6 +420,17 @@ static const struct dmi_system_id
s2idle_dmi_table[] __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming
A17"),
 		},
 	},
+	{
+		/*
+		 * ASUS ROG Zephyrus G14 GA402R<variant> series
+		 * These laptops have a similar issue to the FA707RE
+		 */
+		.callback = lps0_prefer_microsoft,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER
INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14
GA402R"),
+		},
+	},
 	{}
 };
Mario Limonciello Sept. 17, 2022, 1:26 p.m. UTC | #3
On 9/17/22 02:35, Luke Jones wrote:
> Hi Mario,
> 
> On Fri, 2022-09-09 at 13:05 -0500, Mario Limonciello wrote:
>> 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D216101&amp;data=05%7C01%7Cmario.limonciello%40amd.com%7Cc89466a0fc1b40d2dfd808da987f390b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637989969450224307%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=hFj1HnKnG9HPiQDc0fDFs07flY9N2KiOpY2g61bIdyE%3D&amp;reserved=0
>> Reported-and-tested-by: catalin@antebit.com
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>>   drivers/acpi/x86/s2idle.c | 24 ++++++++++++++++++++++++
>>   1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
>> index a9b0f2b54a1c..6a2c94fdbeae 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D216101&amp;data=05%7C01%7Cmario.limonciello%40amd.com%7Cc89466a0fc1b40d2dfd808da987f390b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637989969450224307%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=hFj1HnKnG9HPiQDc0fDFs07flY9N2KiOpY2g61bIdyE%3D&amp;reserved=0
>> +                */
>> +               .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)
>>   {
>> @@ -568,6 +591,7 @@ static const struct platform_s2idle_ops
>> acpi_s2idle_ops_lps0 = {
>>   
>>   void acpi_s2idle_setup(void)
>>   {
>> +       dmi_check_system(s2idle_dmi_table);
>>          acpi_scan_add_handler(&lps0_handler);
>>          s2idle_set_ops(&acpi_s2idle_ops_lps0);
>>   }
> 
> I'm confirming that this works for another laptop with the same issue -
> the GA402R series.
> 
> The diff as follows (I'm unsure of how best to submit this as it is
> dependant on your work - I don't need attribution for this):
> 
> 
>   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 e2b73809ab50..0c8348de5cbc 100644
> --- a/drivers/acpi/x86/s2idle.c
> +++ b/drivers/acpi/x86/s2idle.c
> @@ -420,6 +420,17 @@ static const struct dmi_system_id
> s2idle_dmi_table[] __initconst = {
>   			DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming
> A17"),
>   		},
>   	},
> +	{
> +		/*
> +		 * ASUS ROG Zephyrus G14 GA402R<variant> series
> +		 * These laptops have a similar issue to the FA707RE
> +		 */
> +		.callback = lps0_prefer_microsoft,
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER
> INC."),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14
> GA402R"),
> +		},
> +	},
>   	{}
>   };
>   

Hi Luke,

Thanks!

Your model is actually already rolled into v2 and v3 of the series, 
reported by Phillip Zabel.

https://lore.kernel.org/linux-acpi/20220916182609.3039-1-mario.limonciello@amd.com/T/#mc37fd351eb5460a36c9e3da12c408fd3acb9f515

Thanks,
diff mbox series

Patch

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index a9b0f2b54a1c..6a2c94fdbeae 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)
 {
@@ -568,6 +591,7 @@  static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
 
 void acpi_s2idle_setup(void)
 {
+	dmi_check_system(s2idle_dmi_table);
 	acpi_scan_add_handler(&lps0_handler);
 	s2idle_set_ops(&acpi_s2idle_ops_lps0);
 }