From: Antheas Kapenekakis <lkml@antheas.dev>
To: linux-pm@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org,
Mario Limonciello <mario.limonciello@amd.com>,
luke@ljones.dev, me@kylegospodneti.ch,
Denis Benato <benato.denis96@gmail.com>,
Antheas Kapenekakis <lkml@antheas.dev>
Subject: [PATCH v2 1/5] acpi/x86: s2idle: add support for Display Off and Display On callbacks
Date: Sun, 22 Sep 2024 19:22:54 +0200 [thread overview]
Message-ID: <20240922172258.48435-2-lkml@antheas.dev> (raw)
In-Reply-To: <20240922172258.48435-1-lkml@antheas.dev>
The Display Off and Display On firmware notifications are meant to signify
the system entering a state where the user is not actively interacting
with it (i.e., in Windows this state is called "Screen Off" and the
system enters it once it turns the screen off e.g., due to inactivity).
Currently, these functions are called within the suspend sequence, which
causes issues when these notifications interact with e.g., a USB device
and makes them unable to be called as part of the screen turning off.
This patch adds a set of callbacks to allow calling the Display On/Off
notifications outside of the suspend/resume path.
Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
include/linux/suspend.h | 5 +++++
kernel/power/suspend.c | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index da6ebca3ff77..8f33249cc067 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -132,6 +132,7 @@ struct platform_suspend_ops {
};
struct platform_s2idle_ops {
+ int (*display_off)(void);
int (*begin)(void);
int (*prepare)(void);
int (*prepare_late)(void);
@@ -140,6 +141,7 @@ struct platform_s2idle_ops {
void (*restore_early)(void);
void (*restore)(void);
void (*end)(void);
+ int (*display_on)(void);
};
#ifdef CONFIG_SUSPEND
@@ -160,6 +162,9 @@ extern unsigned int pm_suspend_global_flags;
#define PM_SUSPEND_FLAG_FW_RESUME BIT(1)
#define PM_SUSPEND_FLAG_NO_PLATFORM BIT(2)
+int platform_suspend_display_off(void);
+int platform_suspend_display_on(void);
+
static inline void pm_suspend_clear_flags(void)
{
pm_suspend_global_flags = 0;
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 09f8397bae15..c527dc0ae5ae 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -254,6 +254,18 @@ static bool sleep_state_supported(suspend_state_t state)
(valid_state(state) && !cxl_mem_active());
}
+int platform_suspend_display_off(void)
+{
+ return s2idle_ops && s2idle_ops->display_off ? s2idle_ops->display_off() : 0;
+}
+EXPORT_SYMBOL_GPL(platform_suspend_display_off);
+
+int platform_suspend_display_on(void)
+{
+ return s2idle_ops && s2idle_ops->display_on ? s2idle_ops->display_on() : 0;
+}
+EXPORT_SYMBOL_GPL(platform_suspend_display_on);
+
static int platform_suspend_prepare(suspend_state_t state)
{
return state != PM_SUSPEND_TO_IDLE && suspend_ops->prepare ?
--
2.46.1
next prev parent reply other threads:[~2024-09-22 17:24 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-22 17:22 [PATCH v2 0/5] acpi/x86: s2idle: move Display off/on calls outside suspend (fixes ROG Ally suspend) Antheas Kapenekakis
2024-09-22 17:22 ` Antheas Kapenekakis [this message]
2024-09-23 15:57 ` [PATCH v2 1/5] acpi/x86: s2idle: add support for Display Off and Display On callbacks Mario Limonciello
2024-09-22 17:22 ` [PATCH v2 2/5] acpi/x86: s2idle: handle Display On/Off calls outside of suspend sequence Antheas Kapenekakis
2024-09-23 16:03 ` Mario Limonciello
2024-09-23 16:15 ` Antheas Kapenekakis
2024-09-23 16:30 ` Mario Limonciello
2024-09-23 16:43 ` Antheas Kapenekakis
2024-09-23 17:01 ` Antheas Kapenekakis
2024-09-23 17:05 ` Mario Limonciello
2024-09-23 17:13 ` Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 3/5] acpi/x86: s2idle: add quirk table for modern standby delays Antheas Kapenekakis
2024-09-22 17:54 ` Denis Benato
2024-09-22 18:00 ` Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 4/5] acpi/x86: s2idle: call Display On/Off as part of callbacks and rename Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 5/5] platform/x86: asus-wmi: remove Ally (1st gen) and Ally X suspend quirk Antheas Kapenekakis
2024-09-22 18:15 ` [PATCH v2 0/5] acpi/x86: s2idle: move Display off/on calls outside suspend (fixes ROG Ally suspend) Derek J. Clark
2024-09-22 19:40 ` Antheas Kapenekakis
2024-09-23 1:35 ` Derek J. Clark
2024-09-23 5:57 ` Antheas Kapenekakis
2024-09-23 11:09 ` Luke Jones
2024-09-23 13:11 ` Antheas Kapenekakis
2024-09-23 15:56 ` Mario Limonciello
2024-09-23 16:11 ` Antheas Kapenekakis
2024-09-23 16:21 ` Mario Limonciello
2024-09-23 16:54 ` Antheas Kapenekakis
2024-09-23 17:15 ` Mario Limonciello
2024-09-23 17:48 ` Antheas Kapenekakis
2024-10-05 14:21 ` Hans de Goede
2024-10-05 15:10 ` Antheas Kapenekakis
2024-10-05 16:24 ` Hans de Goede
2024-10-05 16:27 ` Hans de Goede
2024-10-05 16:50 ` Antheas Kapenekakis
2024-10-05 16:57 ` Antheas Kapenekakis
2024-10-05 21:47 ` Hans de Goede
2024-10-05 22:15 ` Antheas Kapenekakis
2024-10-06 10:16 ` Hans de Goede
2024-10-06 11:29 ` Antheas Kapenekakis
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=20240922172258.48435-2-lkml@antheas.dev \
--to=lkml@antheas.dev \
--cc=benato.denis96@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=mario.limonciello@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox