tracing: extend sched_pi_setprio
[deliverable/linux.git] / Documentation / power / notifiers.txt
CommitLineData
b10d9117 1Suspend notifiers
91e7c75b
RW
2 (C) 2007-2011 Rafael J. Wysocki <rjw@sisk.pl>, GPL
3
4There are some operations that subsystems or drivers may want to carry out
5before hibernation/suspend or after restore/resume, but they require the system
6to be fully functional, so the drivers' and subsystems' .suspend() and .resume()
7or even .prepare() and .complete() callbacks are not suitable for this purpose.
8For example, device drivers may want to upload firmware to their devices after
9resume/restore, but they cannot do it by calling request_firmware() from their
10.resume() or .complete() routines (user land processes are frozen at these
11points). The solution may be to load the firmware into memory before processes
12are frozen and upload it from there in the .resume() routine.
13A suspend/hibernation notifier may be used for this purpose.
14
15The subsystems or drivers having such needs can register suspend notifiers that
16will be called upon the following events by the PM core:
b10d9117 17
6bc08ed0
BP
18PM_HIBERNATION_PREPARE The system is going to hibernate, tasks will be frozen
19 immediately. This is different from PM_SUSPEND_PREPARE
20 below because here we do additional work between notifiers
21 and drivers freezing.
b10d9117
RW
22
23PM_POST_HIBERNATION The system memory state has been restored from a
91e7c75b
RW
24 hibernation image or an error occurred during
25 hibernation. Device drivers' restore callbacks have
b10d9117
RW
26 been executed and tasks have been thawed.
27
c3e94d89 28PM_RESTORE_PREPARE The system is going to restore a hibernation image.
91e7c75b 29 If all goes well, the restored kernel will issue a
c3e94d89
AS
30 PM_POST_HIBERNATION notification.
31
91e7c75b
RW
32PM_POST_RESTORE An error occurred during restore from hibernation.
33 Device drivers' restore callbacks have been executed
c3e94d89
AS
34 and tasks have been thawed.
35
91e7c75b 36PM_SUSPEND_PREPARE The system is preparing for suspend.
b10d9117 37
25985edc 38PM_POST_SUSPEND The system has just resumed or an error occurred during
91e7c75b
RW
39 suspend. Device drivers' resume callbacks have been
40 executed and tasks have been thawed.
b10d9117
RW
41
42It is generally assumed that whatever the notifiers do for
43PM_HIBERNATION_PREPARE, should be undone for PM_POST_HIBERNATION. Analogously,
44operations performed for PM_SUSPEND_PREPARE should be reversed for
45PM_POST_SUSPEND. Additionally, all of the notifiers are called for
46PM_POST_HIBERNATION if one of them fails for PM_HIBERNATION_PREPARE, and
47all of the notifiers are called for PM_POST_SUSPEND if one of them fails for
48PM_SUSPEND_PREPARE.
49
50The hibernation and suspend notifiers are called with pm_mutex held. They are
51defined in the usual way, but their last argument is meaningless (it is always
52NULL). To register and/or unregister a suspend notifier use the functions
53register_pm_notifier() and unregister_pm_notifier(), respectively, defined in
54include/linux/suspend.h . If you don't need to unregister the notifier, you can
55also use the pm_notifier() macro defined in include/linux/suspend.h .
This page took 0.679554 seconds and 5 git commands to generate.