Windows implements a DSM called "Turn On Display". This notification is sent to the hardware while on the sleep state if the user interacted with the device and caused it to wake up in such a way where the display should turn on.
This allows the OEM to counter the effects of Sleep entry such as a reduced power envelope to allow for the device to wake up faster. Implement it as part of the "resume" state in the Microsoft-agnostic kernel ABI. Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-firmware-notifications Signed-off-by: Antheas Kapenekakis <[email protected]> --- drivers/acpi/x86/s2idle.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 7693162c68fd..965b78cc8bf5 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -39,12 +39,13 @@ static const struct acpi_device_id lps0_device_ids[] = { #define ACPI_LPS0_DSM_UUID "c4eb40a0-6cd2-11e2-bcfd-0800200c9a66" #define ACPI_LPS0_GET_DEVICE_CONSTRAINTS 1 -#define ACPI_LPS0_DISPLAY_OFF 3 -#define ACPI_LPS0_DISPLAY_ON 4 -#define ACPI_LPS0_ENTRY 5 -#define ACPI_LPS0_EXIT 6 -#define ACPI_LPS0_SLEEP_ENTRY 7 -#define ACPI_LPS0_SLEEP_EXIT 8 +#define ACPI_LPS0_DISPLAY_OFF 3 +#define ACPI_LPS0_DISPLAY_ON 4 +#define ACPI_LPS0_ENTRY 5 +#define ACPI_LPS0_EXIT 6 +#define ACPI_LPS0_SLEEP_ENTRY 7 +#define ACPI_LPS0_SLEEP_EXIT 8 +#define ACPI_LPS0_TURN_ON_DISPLAY 9 /* AMD */ #define ACPI_LPS0_DSM_UUID_AMD "e3f32452-febc-43ce-9039-932122d37721" @@ -352,6 +353,8 @@ static const char *acpi_sleep_dsm_state_to_str(unsigned int state) return "sleep entry"; case ACPI_LPS0_SLEEP_EXIT: return "sleep exit"; + case ACPI_LPS0_TURN_ON_DISPLAY: + return "turn on display"; } } else { switch (state) { @@ -528,6 +531,9 @@ static u8 acpi_s2idle_get_standby_states(void) if (lps0_dsm_func_mask_microsoft & (1 << ACPI_LPS0_SLEEP_ENTRY | 1 << ACPI_LPS0_SLEEP_EXIT)) states |= BIT(PM_STANDBY_SLEEP); + if (lps0_dsm_func_mask_microsoft & + (1 << ACPI_LPS0_TURN_ON_DISPLAY)) + states |= BIT(PM_STANDBY_RESUME); } if (lps0_dsm_func_mask > 0) { @@ -587,6 +593,12 @@ static int acpi_s2idle_do_notification(standby_notification_t state) lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); break; + case PM_SN_RESUME: + if (lps0_dsm_func_mask_microsoft > 0) + acpi_sleep_run_lps0_dsm(ACPI_LPS0_TURN_ON_DISPLAY, + lps0_dsm_func_mask_microsoft, + lps0_dsm_guid_microsoft); + break; default: return -EINVAL; } -- 2.52.0
