diff mbox series

[6/7] PM: suspend: introduce PM_SUSPEND_LATE event

Message ID 20220505015814.3727692-7-rui.zhang@intel.com
State New
Headers show
Series PM: Solution for S0ix failure caused by PCH overheating | expand

Commit Message

Zhang, Rui May 5, 2022, 1:58 a.m. UTC
In some cases, special handling is needed after the .suspend_noirq phase.

Introduce a new suspend event PM_SUSPEND_LATE and call the notifier chain
for this purpose.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
---
 include/linux/suspend.h | 1 +
 kernel/power/suspend.c  | 2 ++
 2 files changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 300273ff40cc..01ec171e8f60 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -477,6 +477,7 @@  static inline int is_hibernate_resume_dev(dev_t dev) { return 0; }
 #define PM_POST_SUSPEND		0x0004 /* Suspend finished */
 #define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
 #define PM_POST_RESTORE		0x0006 /* Restore failed */
+#define PM_SUSPEND_LATE		0x0007 /* Late suspend phase */
 
 extern struct mutex system_transition_mutex;
 
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 6fcdee7e87a5..3c662acc908f 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -415,6 +415,8 @@  static int suspend_enter(suspend_state_t state, bool *wakeup)
 	if (suspend_test(TEST_PLATFORM))
 		goto Platform_wake;
 
+	pm_notifier_call_chain(PM_SUSPEND_LATE);
+
 	if (state == PM_SUSPEND_TO_IDLE) {
 		s2idle_loop();
 		goto Platform_wake;