diff mbox series

[RFC,04/13] acpi/x86: s2idle: add support for Turn On Display callback

Message ID 20241121172239.119590-5-lkml@antheas.dev
State New
Headers show
Series acpi/x86: s2idle: implement Modern Standby transition states and expose to userspace | expand

Commit Message

Antheas Kapenekakis Nov. 21, 2024, 5:22 p.m. UTC
The Turn On Display callback was introduced in Windows 22H2, to allow
devices to resume faster from sleep. Essentially, if the device lowers
its power limit (PLx) while it is in the Sleep state, this might lengthen
the suspend sequence in an undesirable manner. Therefore, this callback
can be used to restore PLx while still remaining in the sleep state.

Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
 include/linux/suspend.h | 1 +
 kernel/power/suspend.c  | 7 +++++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 733dffb09b28..01ee64321cda 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -142,6 +142,7 @@  struct platform_s2idle_ops {
 	void (*restore_early)(void);
 	void (*restore)(void);
 	void (*end)(void);
+	int (*turn_on_display)(void);
 	int (*sleep_exit)(void);
 	int (*display_on)(void);
 };
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 3f4bbefa9b82..a42e8514ee7a 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -264,6 +264,13 @@  static int platform_standby_sleep_entry(void)
 	return s2idle_ops && s2idle_ops->sleep_entry ? s2idle_ops->sleep_entry() : 0;
 }
 
+static int platform_standby_turn_on_display(void)
+{
+	return s2idle_ops && s2idle_ops->turn_on_display ?
+		       s2idle_ops->turn_on_display() :
+		       0;
+}
+
 static int platform_standby_sleep_exit(void)
 {
 	return s2idle_ops && s2idle_ops->sleep_exit ? s2idle_ops->sleep_exit() : 0;