Skip to content

Commit a0bc002

Browse files
superm1rafaeljw
authored andcommitted
ACPI: x86: s2idle: Add module parameter to prefer Microsoft GUID
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 <[email protected]> Tested-by: Philipp Zabel <[email protected]> # GA402RJ Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent fd894f0 commit a0bc002

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/acpi/x86/s2idle.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ static bool sleep_no_lps0 __read_mostly;
2727
module_param(sleep_no_lps0, bool, 0644);
2828
MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface");
2929

30+
static bool prefer_microsoft_dsm_guid __read_mostly;
31+
module_param(prefer_microsoft_dsm_guid, bool, 0644);
32+
MODULE_PARM_DESC(prefer_microsoft_dsm_guid, "Prefer using Microsoft GUID in LPS0 device _DSM evaluation");
33+
3034
static const struct acpi_device_id lps0_device_ids[] = {
3135
{"PNP0D80", },
3236
{"", },
@@ -402,6 +406,9 @@ static int lps0_device_attach(struct acpi_device *adev,
402406
if (lps0_device_handle)
403407
return 0;
404408

409+
lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
410+
ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
411+
&lps0_dsm_guid_microsoft);
405412
if (acpi_s2idle_vendor_amd()) {
406413
static const struct acpi_device_id *dev_id;
407414
const struct amd_lps0_hid_device_data *data;
@@ -416,24 +423,21 @@ static int lps0_device_attach(struct acpi_device *adev,
416423
rev_id = data->rev_id;
417424
lps0_dsm_func_mask = validate_dsm(adev->handle,
418425
ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
419-
lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
420-
ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
421-
&lps0_dsm_guid_microsoft);
422426
if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) {
423427
lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
424428
acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
425429
ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
426430
} else if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid &&
427-
(!strcmp(hid, "AMDI0007") ||
428-
!strcmp(hid, "AMDI0008"))) {
431+
!prefer_microsoft_dsm_guid) {
429432
lps0_dsm_func_mask_microsoft = -EINVAL;
430433
acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
431434
}
432435
} else {
433436
rev_id = 1;
434437
lps0_dsm_func_mask = validate_dsm(adev->handle,
435438
ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
436-
lps0_dsm_func_mask_microsoft = -EINVAL;
439+
if (!prefer_microsoft_dsm_guid)
440+
lps0_dsm_func_mask_microsoft = -EINVAL;
437441
}
438442

439443
if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)

0 commit comments

Comments
 (0)