Linux Power Management development
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: mario.limonciello@amd.com, rafael@kernel.org, lenb@kernel.org,
	pavel@kernel.org, gregkh@linuxfoundation.org, dakr@kernel.org
Cc: "Mario Limonciello (AMD)" <superm1@kernel.org>,
	Eric Naim <dnaim@cachyos.org>,
	linux-pm@vger.kernel.org, driver-core@lists.linux.dev
Subject: [PATCH] PM: Add resume event mapping for PMSG_POWEROFF
Date: Wed, 16 Sep 2026 16:13:14 -0500	[thread overview]
Message-ID: <20260916211317.433349-1-superm1@kernel.org> (raw)

PM_EVENT_POWEROFF (0x0800) and PMSG_POWEROFF were already defined in
include/linux/pm.h. Add the resume_event() which is used when a shutdown
sequence needs to be aborted and the system should return to normal
operation.

This completes the PMSG_POWEROFF infrastructure needed to support
differentiating between hibernation and shutdown sequences when
re-using callbacks for common code.

Hibernation is started by writing a hibernation method (such as 'platform'
'shutdown', or 'reboot') to use into /sys/power/disk and writing 'disk' to
/sys/power/state.

Later shutdown will be initiated with the reboot() syscall with arguments
on whether to halt the system or power it off.

Tested-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/base/power/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e130da4281410..7265553ba24ca 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1472,6 +1472,8 @@ static pm_message_t resume_event(pm_message_t sleep_state)
 		return PMSG_RECOVER;
 	case PM_EVENT_HIBERNATE:
 		return PMSG_RESTORE;
+	case PM_EVENT_POWEROFF:
+		return PMSG_ON;
 	}
 	return PMSG_ON;
 }
-- 
2.53.0


             reply	other threads:[~2026-09-16 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 21:13 Mario Limonciello (AMD) [this message]
2026-09-25 19:29 ` [PATCH] PM: Add resume event mapping for PMSG_POWEROFF Rafael J. Wysocki (Intel)

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=20260916211317.433349-1-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dnaim@cachyos.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=pavel@kernel.org \
    --cc=rafael@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