From: Antheas Kapenekakis <lkml@antheas.dev>
To: linux-pm@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org, Mario.Limonciello@amd.com,
luke@ljones.dev, me@kylegospodneti.ch
Subject: [PATCH v1 2/4] acpi/x86: s2idle: handle screen off/on calls outside of suspend sequence
Date: Thu, 19 Sep 2024 19:19:50 +0200 [thread overview]
Message-ID: <20240919171952.403745-3-lkml@antheas.dev> (raw)
In-Reply-To: <20240919171952.403745-1-lkml@antheas.dev>
Currently, the screen off/on calls are handled within the suspend
sequence, which is a deviation from Windows. This causes issues with
certain devices, such as the ROG Ally, which expects this call to be
executed with the kernel fully awake. The subsequent half-suspended
state makes the controller of the device to fail to suspend properly.
This patch calls the screen off/on callbacks before entering the suspend
sequence, which fixes this issue. In addition, it opens the possibility
of modelling a state such as "Screen Off" that mirrors Windows, as the
callbacks will be accessible and validated to work outside of the
suspend sequence.
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
kernel/power/suspend.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 19734b297527..afa95271ef00 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -507,6 +507,19 @@ int suspend_devices_and_enter(suspend_state_t state)
pm_suspend_target_state = state;
+ /*
+ * Linux does not have the concept of a "Screen Off" state, so call
+ * the platform functions for screen off prior to beginning the suspend
+ * sequence, mirroring Windows which calls them outside of it as well.
+ *
+ * If Linux ever gains a "Screen Off" state, the following callbacks can
+ * be replaced with a call that checks if we are in "Screen Off", in which
+ * case they will NOOP and if not call them as a fallback.
+ */
+ error = platform_suspend_screen_off();
+ if (error)
+ goto Screen_on;
+
if (state == PM_SUSPEND_TO_IDLE)
pm_set_suspend_no_platform();
@@ -540,6 +553,9 @@ int suspend_devices_and_enter(suspend_state_t state)
Close:
platform_resume_end(state);
pm_suspend_target_state = PM_SUSPEND_ON;
+
+ Screen_on:
+ platform_suspend_screen_on();
return error;
Recover_platform:
--
2.46.1
next prev parent reply other threads:[~2024-09-19 17:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 17:19 [PATCH v1 0/4] acpi/x86: s2idle: move Display off/on calls outside suspend (fixes ROG Ally suspend) Antheas Kapenekakis
2024-09-19 17:19 ` [PATCH v1 1/4] acpi/x86: s2idle: add support for screen off and screen on callbacks Antheas Kapenekakis
2024-09-19 17:29 ` Mario Limonciello
2024-09-19 17:36 ` Antheas Kapenekakis
2024-09-19 20:17 ` Mario Limonciello
2024-09-19 17:19 ` Antheas Kapenekakis [this message]
2024-09-19 17:35 ` [PATCH v1 2/4] acpi/x86: s2idle: handle screen off/on calls outside of suspend sequence Mario Limonciello
2024-09-19 18:21 ` Alex Deucher
2024-09-19 18:32 ` Mario Limonciello
2024-09-19 18:35 ` Antheas Kapenekakis
2024-09-19 17:19 ` [PATCH v1 3/4] acpi/x86: s2idle: call screen on and off as part of callbacks Antheas Kapenekakis
2024-09-19 19:01 ` Mario Limonciello
2024-09-19 20:45 ` Antheas Kapenekakis
2024-09-19 20:51 ` Mario Limonciello
2024-09-19 20:54 ` Antheas Kapenekakis
2024-09-21 1:03 ` Denis Benato
2024-09-21 6:22 ` Antheas Kapenekakis
2024-09-21 14:47 ` Denis Benato
2024-09-21 19:44 ` Antheas Kapenekakis
2024-09-22 2:07 ` Denis Benato
2024-09-22 7:48 ` Antheas Kapenekakis
2024-09-19 17:19 ` [PATCH v1 4/4] platform/x86: asus-wmi: remove Ally (1st gen) and Ally X suspend quirk Antheas Kapenekakis
2024-09-19 18:36 ` Mario Limonciello
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240919171952.403745-3-lkml@antheas.dev \
--to=lkml@antheas.dev \
--cc=Mario.Limonciello@amd.com \
--cc=linux-pm@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=me@kylegospodneti.ch \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.