From: Antheas Kapenekakis <lkml@antheas.dev>
To: dmitry.osipenko@collabora.com
Cc: bob.beckett@collabora.com, bookeldor@gmail.com,
hadess@hadess.net, jaap@haitsma.org, kernel@collabora.com,
lennart@poettering.net, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, lkml@antheas.dev, mccann@jhu.edu,
rafael@kernel.org, richard@hughsie.com,
sebastian.reichel@collabora.com, superm1@kernel.org,
systemd-devel@lists.freedesktop.org, xaver.hugl@gmail.com
Subject: [RFC v1 5/8] acpi/x86: s2idle: move DSM notifications to do_notification callback
Date: Fri, 26 Dec 2025 12:26:43 +0200 [thread overview]
Message-ID: <20251226102656.6296-6-lkml@antheas.dev> (raw)
In-Reply-To: <20251226102656.6296-1-lkml@antheas.dev>
Currently, the DSM Sleep Entry/Exit/Display On/Off notifications fire
during the suspend sequence. Move them to the new do_notification
callback so they can be called during runtime as well. The kernel will
still ensure that they are called during s2idle without userspace
involvement.
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
drivers/acpi/x86/s2idle.c | 87 +++++++++++++++++++++++----------------
1 file changed, 52 insertions(+), 35 deletions(-)
diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 08fa7841a484..7693162c68fd 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -547,6 +547,53 @@ static u8 acpi_s2idle_get_standby_states(void)
return states;
}
+static int acpi_s2idle_do_notification(standby_notification_t state)
+{
+ switch ((__force unsigned int)state) {
+ case PM_SN_INACTIVE_ENTRY:
+ if (lps0_dsm_func_mask > 0)
+ acpi_sleep_run_lps0_dsm(
+ acpi_s2idle_vendor_amd() ?
+ ACPI_LPS0_DISPLAY_OFF_AMD :
+ ACPI_LPS0_DISPLAY_OFF,
+ lps0_dsm_func_mask, lps0_dsm_guid);
+
+ if (lps0_dsm_func_mask_microsoft > 0)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_DISPLAY_OFF,
+ lps0_dsm_func_mask_microsoft,
+ lps0_dsm_guid_microsoft);
+ break;
+ case PM_SN_INACTIVE_EXIT:
+ if (lps0_dsm_func_mask > 0)
+ acpi_sleep_run_lps0_dsm(
+ acpi_s2idle_vendor_amd() ?
+ ACPI_LPS0_DISPLAY_ON_AMD :
+ ACPI_LPS0_DISPLAY_ON,
+ lps0_dsm_func_mask, lps0_dsm_guid);
+ if (lps0_dsm_func_mask_microsoft > 0)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_DISPLAY_ON,
+ lps0_dsm_func_mask_microsoft,
+ lps0_dsm_guid_microsoft);
+ break;
+ case PM_SN_SLEEP_ENTRY:
+ if (lps0_dsm_func_mask_microsoft > 0)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_SLEEP_ENTRY,
+ lps0_dsm_func_mask_microsoft,
+ lps0_dsm_guid_microsoft);
+ break;
+ case PM_SN_SLEEP_EXIT:
+ if (lps0_dsm_func_mask_microsoft > 0)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_SLEEP_EXIT,
+ lps0_dsm_func_mask_microsoft,
+ lps0_dsm_guid_microsoft);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int acpi_s2idle_begin_lps0(void)
{
if (pm_debug_messages_on && !lpi_constraints_table) {
@@ -576,33 +623,16 @@ static int acpi_s2idle_prepare_late_lps0(void)
if (pm_debug_messages_on)
lpi_check_constraints();
- /* Screen off */
+ /* LPS0 entry */
if (lps0_dsm_func_mask > 0)
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
- ACPI_LPS0_DISPLAY_OFF_AMD :
- ACPI_LPS0_DISPLAY_OFF,
+ ACPI_LPS0_ENTRY_AMD :
+ ACPI_LPS0_ENTRY,
lps0_dsm_func_mask, lps0_dsm_guid);
if (lps0_dsm_func_mask_microsoft > 0)
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_DISPLAY_OFF,
- lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
-
- /* LPS0 entry */
- if (lps0_dsm_func_mask > 0 && acpi_s2idle_vendor_amd())
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
- lps0_dsm_func_mask, lps0_dsm_guid);
-
- if (lps0_dsm_func_mask_microsoft > 0) {
- /* Modern Standby entry */
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_SLEEP_ENTRY,
- lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
- }
-
- if (lps0_dsm_func_mask > 0 && !acpi_s2idle_vendor_amd())
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
- lps0_dsm_func_mask, lps0_dsm_guid);
list_for_each_entry(handler, &lps0_s2idle_devops_head, list_node) {
if (handler->prepare)
@@ -643,27 +673,14 @@ static void acpi_s2idle_restore_early_lps0(void)
ACPI_LPS0_EXIT,
lps0_dsm_func_mask, lps0_dsm_guid);
- if (lps0_dsm_func_mask_microsoft > 0) {
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
- lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
- /* Modern Standby exit */
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_SLEEP_EXIT,
- lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
- }
-
- /* Screen on */
if (lps0_dsm_func_mask_microsoft > 0)
- acpi_sleep_run_lps0_dsm(ACPI_LPS0_DISPLAY_ON,
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
- if (lps0_dsm_func_mask > 0)
- acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
- ACPI_LPS0_DISPLAY_ON_AMD :
- ACPI_LPS0_DISPLAY_ON,
- lps0_dsm_func_mask, lps0_dsm_guid);
}
static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
.get_standby_states = acpi_s2idle_get_standby_states,
+ .do_notification = acpi_s2idle_do_notification,
.begin = acpi_s2idle_begin_lps0,
.prepare = acpi_s2idle_prepare,
.prepare_late = acpi_s2idle_prepare_late_lps0,
--
2.52.0
next prev parent reply other threads:[~2025-12-26 10:36 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-26 10:26 [RFC v1 0/8] acpi/x86: s2idle: Introduce and implement runtime standby ABI for ACPI s0ix platforms Antheas Kapenekakis
2025-12-26 10:26 ` [RFC v1 1/8] Documentation: PM: Add documentation for Runtime Standby States Antheas Kapenekakis
2026-03-13 20:07 ` Rafael J. Wysocki
2026-03-16 19:54 ` Antheas Kapenekakis
2025-12-26 10:26 ` [RFC v1 2/8] acpi/x86: s2idle: Rename LPS0 constants so they mirror their function Antheas Kapenekakis
2026-03-13 20:12 ` Rafael J. Wysocki
2026-03-16 20:01 ` Antheas Kapenekakis
2025-12-26 10:26 ` [RFC v1 3/8] acpi/x86: s2idle: add runtime standby transition function Antheas Kapenekakis
2026-03-13 20:29 ` Rafael J. Wysocki
2026-03-16 20:06 ` Antheas Kapenekakis
2025-12-26 10:26 ` [RFC v1 4/8] acpi/x86: s2idle: add support for querying runtime standby state support Antheas Kapenekakis
2025-12-26 10:26 ` Antheas Kapenekakis [this message]
2025-12-26 10:26 ` [RFC v1 6/8] acpi/x86: s2idle: implement turn on display DSM as resume notification Antheas Kapenekakis
2025-12-26 10:26 ` [RFC v1 7/8] PM: hibernate: Enter s2idle sleep state before hibernation Antheas Kapenekakis
2026-03-13 20:33 ` Rafael J. Wysocki
2026-03-16 20:09 ` Antheas Kapenekakis
2025-12-26 10:26 ` [RFC v1 8/8] PM: standby: Add sysfs attribute for runtime standby transitions Antheas Kapenekakis
2026-01-12 20:33 ` [RFC v1 0/8] acpi/x86: s2idle: Introduce and implement runtime standby ABI for ACPI s0ix platforms Antheas Kapenekakis
2026-01-13 9:48 ` Dmitry Osipenko
2026-01-13 10:11 ` Antheas Kapenekakis
2026-01-14 23:07 ` Dmitry Osipenko
2026-01-15 7:49 ` Antheas Kapenekakis
2026-03-16 19:02 ` Dmitry Osipenko
2026-03-16 19:33 ` Antheas Kapenekakis
2026-03-16 19:36 ` Antheas Kapenekakis
2026-03-17 11:04 ` Dmitry Osipenko
2026-02-27 14:59 ` Antheas Kapenekakis
2026-02-27 18:42 ` Rafael J. Wysocki
2026-03-13 19:36 ` Rafael J. Wysocki
2026-03-16 19:52 ` Antheas Kapenekakis
2026-03-17 11:56 ` Dmitry Osipenko
2026-03-17 12:09 ` Rafael J. Wysocki
2026-03-17 15:13 ` Mario Limonciello
2026-03-19 12:35 ` Antheas Kapenekakis
2026-03-20 20:41 ` Mario Limonciello (AMD) (kernel.org)
2026-03-21 13:46 ` Antheas Kapenekakis
2026-03-21 13:52 ` Antheas Kapenekakis
2026-03-21 18:43 ` Mario Limonciello
2026-03-21 22:33 ` Antheas Kapenekakis
2026-03-23 4:36 ` Mario Limonciello
2026-03-23 9:26 ` 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=20251226102656.6296-6-lkml@antheas.dev \
--to=lkml@antheas.dev \
--cc=bob.beckett@collabora.com \
--cc=bookeldor@gmail.com \
--cc=dmitry.osipenko@collabora.com \
--cc=hadess@hadess.net \
--cc=jaap@haitsma.org \
--cc=kernel@collabora.com \
--cc=lennart@poettering.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mccann@jhu.edu \
--cc=rafael@kernel.org \
--cc=richard@hughsie.com \
--cc=sebastian.reichel@collabora.com \
--cc=superm1@kernel.org \
--cc=systemd-devel@lists.freedesktop.org \
--cc=xaver.hugl@gmail.com \
/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