PM: Add resume event mapping for PMSG_POWEROFF
Subsystems (4)
PATCH 1/1 PM: Add resume event mapping for PMSG_POWEROFF
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.
--- drivers/base/power/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/power/main.c +2 -0
@@ -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 ; }
Signature · 1 line
2.53.0
Rafael J. Wysocki (Intel)
maintainerQuoted 28 lines · Mario Limonciello (AMD)
PM_EVENT_POWEROFF(0x0800) andPMSG_POWEROFFwere already defined ininclude/linux/pm.h. Add theresume_event()which is used when a shutdown sequence needs to be aborted and the system should return to normal operation.This completes the
PMSG_POWEROFFinfrastructure 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/diskand 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 <[email protected]>Signed-off-by Mario Limonciello (AMD) <[email protected]>--- drivers/base/power/main.c | 2 ++ 1 file changed, 2 insertions(+)drivers/base/power/main.c +0
-0
drivers/base/power/main.c static pm_message_t resume_event(pm_message_t sleep_state) · line 1476
Quoted 5 lines
drivers/base/power/main.c +2
-0@@ -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 ;
Why should it be PMSG_ON?
pm_op() doesn't actually take PM_EVENT_ON into account, so I'm not sure how the change helps.
Quoted 6 lines
drivers/base/power/main.c +0
-1}return PMSG_ON ; } --2.53.0