Skip to contentSkip to conversation

platform/x86: Add missing LPS0 functions for AMD

PATCH Superseded Alex Deucher 3 participants 4 messages Mar 17, 2021 – Mar 18, 2021 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 platform/x86: Add missing LPS0 functions for AMD

These are supposedly not required for AMD platforms, but at least some HP laptops seem to require it to properly turn off the keyboard backlight.

Based on a patch from Marcin Bachry <[email protected]>.

---
 drivers/acpi/x86/s2idle.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/acpi/x86/s2idle.c +4 -0
index 2b69536cdccb..2d7ddb8a8cb6 100644
@@ -42,6 +42,8 @@ static const struct acpi_device_id lps0_device_ids[] = {
 
 /* AMD */
 #define ACPI_LPS0_DSM_UUID_AMD      "e3f32452-febc-43ce-9039-932122d37721"
+#define ACPI_LPS0_ENTRY_AMD         2
+#define ACPI_LPS0_EXIT_AMD          3
 #define ACPI_LPS0_SCREEN_OFF_AMD    4
 #define ACPI_LPS0_SCREEN_ON_AMD     5
 
@@ -408,6 +410,7 @@ int acpi_s2idle_prepare_late(void)
 
 	if (acpi_s2idle_vendor_amd()) {
 		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF_AMD);
+		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD);
 	} else {
 		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF);
 		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY);
@@ -422,6 +425,7 @@ void acpi_s2idle_restore_early(void)
 		return;
 
 	if (acpi_s2idle_vendor_amd()) {
+		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT_AMD);
 		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON_AMD);
 	} else {
 		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT);
Signature · 6 lines
2.30.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

PATCH v2 2/2 platform/x86: force LPS0 functions for AMD

ACPI_LPS0_ENTRY_AMD/ACPI_LPS0_EXIT_AMD are supposedly not required for AMD platforms, and on some platforms they are not even listed in the function mask but at least some HP laptops seem to require it to properly support s0ix.

Based on a patch from Marcin Bachry <[email protected]>.

---

V2: rework the patch to just fix up the specific problematic
case by setting the function flags that are missing.

 drivers/acpi/x86/s2idle.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/x86/s2idle.c +7 -0
index 2d7ddb8a8cb6..482e6b23b21a 100644
@@ -368,6 +368,13 @@ static int lps0_device_attach(struct acpi_device *adev,
 
 	ACPI_FREE(out_obj);
 
+	/*
+	 * Some HP laptops require ACPI_LPS0_ENTRY_AMD/ACPI_LPS0_EXIT_AMD for proper
+	 * S0ix, but don't set the function mask correctly.  Fix that up here.
+	 */
+	if (acpi_s2idle_vendor_amd())
+		lps0_dsm_func_mask |= (1 << ACPI_LPS0_ENTRY_AMD) | (1 << ACPI_LPS0_EXIT_AMD);
+
 	acpi_handle_debug(adev->handle, "_DSM function mask: 0x%x\n",
 			  lps0_dsm_func_mask);
 
Signature · 6 lines
2.30.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH 2/2 V2] platform/x86: force LPS0 functions for AMD

Hi,

Quoted 7 lines · Alex Deucher

ACPI_LPS0_ENTRY_AMD/ACPI_LPS0_EXIT_AMD are supposedly not required for AMD platforms, and on some platforms they are not even listed in the function mask but at least some HP laptops seem to require it to properly support s0ix.

Based on a patch from Marcin Bachry <[email protected]>.

Quoted 7 lines

---

V2: rework the patch to just fix up the specific problematic
case by setting the function flags that are missing.

Thanks, the new version looks good to me:

Regards,

Hans

Quoted 23 lines
 drivers/acpi/x86/s2idle.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/x86/s2idle.c +7 -0
index 2d7ddb8a8cb6..482e6b23b21a 100644
@@ -368,6 +368,13 @@ static int lps0_device_attach(struct acpi_device *adev,
 
 	ACPI_FREE(out_obj);
 
+	/*
+	 * Some HP laptops require ACPI_LPS0_ENTRY_AMD/ACPI_LPS0_EXIT_AMD for proper
+	 * S0ix, but don't set the function mask correctly.  Fix that up here.
+	 */
+	if (acpi_s2idle_vendor_amd())
+		lps0_dsm_func_mask |= (1 << ACPI_LPS0_ENTRY_AMD) | (1 << ACPI_LPS0_EXIT_AMD);
+
 	acpi_handle_debug(adev->handle, "_DSM function mask: 0x%x\n",
 			  lps0_dsm_func_mask);
 
#3 lore raw

Re: [PATCH 2/2 V2] platform/x86: force LPS0 functions for AMD

In reply to Alex Deucher

Let's hold off on these patches for the time being. At least one of them seems to cause problems on another laptop.

Thanks,

Alex

Quoted 40 lines · Alex Deucher

ACPI_LPS0_ENTRY_AMD/ACPI_LPS0_EXIT_AMD are supposedly not required for AMD platforms, and on some platforms they are not even listed in the function mask but at least some HP laptops seem to require it to properly support s0ix.

Based on a patch from Marcin Bachry <[email protected]>.

---

V2: rework the patch to just fix up the specific problematic
case by setting the function flags that are missing.

 drivers/acpi/x86/s2idle.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/x86/s2idle.c +7 -1
index 2d7ddb8a8cb6..482e6b23b21a 100644
@@ -368,6 +368,13 @@ static int lps0_device_attach(struct acpi_device *adev,
 
        ACPI_FREE(out_obj);
 
+       /*
+        * Some HP laptops require ACPI_LPS0_ENTRY_AMD/ACPI_LPS0_EXIT_AMD for proper
+        * S0ix, but don't set the function mask correctly.  Fix that up here.
+        */
+       if (acpi_s2idle_vendor_amd())
+               lps0_dsm_func_mask |= (1 << ACPI_LPS0_ENTRY_AMD) | (1 << ACPI_LPS0_EXIT_AMD);
+
        acpi_handle_debug(adev->handle, "_DSM function mask: 0x%x\n",
                          lps0_dsm_func_mask);
 
--

2.30.2

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx