diff options
Diffstat (limited to 'Documentation/power')
-rw-r--r-- | Documentation/power/regulator/consumer.txt | 2 | ||||
-rw-r--r-- | Documentation/power/runtime_pm.txt | 320 |
2 files changed, 235 insertions, 87 deletions
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt index 5f83fd24ea84..cdebb5145c25 100644 --- a/Documentation/power/regulator/consumer.txt +++ b/Documentation/power/regulator/consumer.txt | |||
@@ -104,7 +104,7 @@ to set the limit to 500mA when supplying power. | |||
104 | 104 | ||
105 | Consumers can control their supply current limit by calling :- | 105 | Consumers can control their supply current limit by calling :- |
106 | 106 | ||
107 | int regulator_set_current_limit(regulator, min_uV, max_uV); | 107 | int regulator_set_current_limit(regulator, min_uA, max_uA); |
108 | 108 | ||
109 | Where min_uA and max_uA are the minimum and maximum acceptable current limit in | 109 | Where min_uA and max_uA are the minimum and maximum acceptable current limit in |
110 | microamps. | 110 | microamps. |
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index f49a33b704d2..55b859b3bc72 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
@@ -38,83 +38,85 @@ struct dev_pm_ops { | |||
38 | ... | 38 | ... |
39 | int (*runtime_suspend)(struct device *dev); | 39 | int (*runtime_suspend)(struct device *dev); |
40 | int (*runtime_resume)(struct device *dev); | 40 | int (*runtime_resume)(struct device *dev); |
41 | void (*runtime_idle)(struct device *dev); | 41 | int (*runtime_idle)(struct device *dev); |
42 | ... | 42 | ... |
43 | }; | 43 | }; |
44 | 44 | ||
45 | The ->runtime_suspend() callback is executed by the PM core for the bus type of | 45 | The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks are |
46 | the device being suspended. The bus type's callback is then _entirely_ | 46 | executed by the PM core for either the bus type, or device type (if the bus |
47 | _responsible_ for handling the device as appropriate, which may, but need not | 47 | type's callback is not defined), or device class (if the bus type's and device |
48 | include executing the device driver's own ->runtime_suspend() callback (from the | 48 | type's callbacks are not defined) of given device. The bus type, device type |
49 | and device class callbacks are referred to as subsystem-level callbacks in what | ||
50 | follows. | ||
51 | |||
52 | The subsystem-level suspend callback is _entirely_ _responsible_ for handling | ||
53 | the suspend of the device as appropriate, which may, but need not include | ||
54 | executing the device driver's own ->runtime_suspend() callback (from the | ||
49 | PM core's point of view it is not necessary to implement a ->runtime_suspend() | 55 | PM core's point of view it is not necessary to implement a ->runtime_suspend() |
50 | callback in a device driver as long as the bus type's ->runtime_suspend() knows | 56 | callback in a device driver as long as the subsystem-level suspend callback |
51 | what to do to handle the device). | 57 | knows what to do to handle the device). |
52 | 58 | ||
53 | * Once the bus type's ->runtime_suspend() callback has completed successfully | 59 | * Once the subsystem-level suspend callback has completed successfully |
54 | for given device, the PM core regards the device as suspended, which need | 60 | for given device, the PM core regards the device as suspended, which need |
55 | not mean that the device has been put into a low power state. It is | 61 | not mean that the device has been put into a low power state. It is |
56 | supposed to mean, however, that the device will not process data and will | 62 | supposed to mean, however, that the device will not process data and will |
57 | not communicate with the CPU(s) and RAM until its bus type's | 63 | not communicate with the CPU(s) and RAM until the subsystem-level resume |
58 | ->runtime_resume() callback is executed for it. The run-time PM status of | 64 | callback is executed for it. The run-time PM status of a device after |
59 | a device after successful execution of its bus type's ->runtime_suspend() | 65 | successful execution of the subsystem-level suspend callback is 'suspended'. |
60 | callback is 'suspended'. | 66 | |
61 | 67 | * If the subsystem-level suspend callback returns -EBUSY or -EAGAIN, | |
62 | * If the bus type's ->runtime_suspend() callback returns -EBUSY or -EAGAIN, | 68 | the device's run-time PM status is 'active', which means that the device |
63 | the device's run-time PM status is supposed to be 'active', which means that | 69 | _must_ be fully operational afterwards. |
64 | the device _must_ be fully operational afterwards. | 70 | |
65 | 71 | * If the subsystem-level suspend callback returns an error code different | |
66 | * If the bus type's ->runtime_suspend() callback returns an error code | 72 | from -EBUSY or -EAGAIN, the PM core regards this as a fatal error and will |
67 | different from -EBUSY or -EAGAIN, the PM core regards this as a fatal | 73 | refuse to run the helper functions described in Section 4 for the device, |
68 | error and will refuse to run the helper functions described in Section 4 | 74 | until the status of it is directly set either to 'active', or to 'suspended' |
69 | for the device, until the status of it is directly set either to 'active' | 75 | (the PM core provides special helper functions for this purpose). |
70 | or to 'suspended' (the PM core provides special helper functions for this | 76 | |
71 | purpose). | 77 | In particular, if the driver requires remote wake-up capability (i.e. hardware |
72 | 78 | mechanism allowing the device to request a change of its power state, such as | |
73 | In particular, if the driver requires remote wakeup capability for proper | 79 | PCI PME) for proper functioning and device_run_wake() returns 'false' for the |
74 | functioning and device_may_wakeup() returns 'false' for the device, then | 80 | device, then ->runtime_suspend() should return -EBUSY. On the other hand, if |
75 | ->runtime_suspend() should return -EBUSY. On the other hand, if | 81 | device_run_wake() returns 'true' for the device and the device is put into a low |
76 | device_may_wakeup() returns 'true' for the device and the device is put | 82 | power state during the execution of the subsystem-level suspend callback, it is |
77 | into a low power state during the execution of its bus type's | 83 | expected that remote wake-up will be enabled for the device. Generally, remote |
78 | ->runtime_suspend(), it is expected that remote wake-up (i.e. hardware mechanism | 84 | wake-up should be enabled for all input devices put into a low power state at |
79 | allowing the device to request a change of its power state, such as PCI PME) | 85 | run time. |
80 | will be enabled for the device. Generally, remote wake-up should be enabled | 86 | |
81 | for all input devices put into a low power state at run time. | 87 | The subsystem-level resume callback is _entirely_ _responsible_ for handling the |
82 | 88 | resume of the device as appropriate, which may, but need not include executing | |
83 | The ->runtime_resume() callback is executed by the PM core for the bus type of | 89 | the device driver's own ->runtime_resume() callback (from the PM core's point of |
84 | the device being woken up. The bus type's callback is then _entirely_ | 90 | view it is not necessary to implement a ->runtime_resume() callback in a device |
85 | _responsible_ for handling the device as appropriate, which may, but need not | 91 | driver as long as the subsystem-level resume callback knows what to do to handle |
86 | include executing the device driver's own ->runtime_resume() callback (from the | 92 | the device). |
87 | PM core's point of view it is not necessary to implement a ->runtime_resume() | 93 | |
88 | callback in a device driver as long as the bus type's ->runtime_resume() knows | 94 | * Once the subsystem-level resume callback has completed successfully, the PM |
89 | what to do to handle the device). | 95 | core regards the device as fully operational, which means that the device |
90 | 96 | _must_ be able to complete I/O operations as needed. The run-time PM status | |
91 | * Once the bus type's ->runtime_resume() callback has completed successfully, | 97 | of the device is then 'active'. |
92 | the PM core regards the device as fully operational, which means that the | 98 | |
93 | device _must_ be able to complete I/O operations as needed. The run-time | 99 | * If the subsystem-level resume callback returns an error code, the PM core |
94 | PM status of the device is then 'active'. | 100 | regards this as a fatal error and will refuse to run the helper functions |
95 | 101 | described in Section 4 for the device, until its status is directly set | |
96 | * If the bus type's ->runtime_resume() callback returns an error code, the PM | 102 | either to 'active' or to 'suspended' (the PM core provides special helper |
97 | core regards this as a fatal error and will refuse to run the helper | 103 | functions for this purpose). |
98 | functions described in Section 4 for the device, until its status is | 104 | |
99 | directly set either to 'active' or to 'suspended' (the PM core provides | 105 | The subsystem-level idle callback is executed by the PM core whenever the device |
100 | special helper functions for this purpose). | 106 | appears to be idle, which is indicated to the PM core by two counters, the |
101 | 107 | device's usage counter and the counter of 'active' children of the device. | |
102 | The ->runtime_idle() callback is executed by the PM core for the bus type of | ||
103 | given device whenever the device appears to be idle, which is indicated to the | ||
104 | PM core by two counters, the device's usage counter and the counter of 'active' | ||
105 | children of the device. | ||
106 | 108 | ||
107 | * If any of these counters is decreased using a helper function provided by | 109 | * If any of these counters is decreased using a helper function provided by |
108 | the PM core and it turns out to be equal to zero, the other counter is | 110 | the PM core and it turns out to be equal to zero, the other counter is |
109 | checked. If that counter also is equal to zero, the PM core executes the | 111 | checked. If that counter also is equal to zero, the PM core executes the |
110 | device bus type's ->runtime_idle() callback (with the device as an | 112 | subsystem-level idle callback with the device as an argument. |
111 | argument). | ||
112 | 113 | ||
113 | The action performed by a bus type's ->runtime_idle() callback is totally | 114 | The action performed by a subsystem-level idle callback is totally dependent on |
114 | dependent on the bus type in question, but the expected and recommended action | 115 | the subsystem in question, but the expected and recommended action is to check |
115 | is to check if the device can be suspended (i.e. if all of the conditions | 116 | if the device can be suspended (i.e. if all of the conditions necessary for |
116 | necessary for suspending the device are satisfied) and to queue up a suspend | 117 | suspending the device are satisfied) and to queue up a suspend request for the |
117 | request for the device in that case. | 118 | device in that case. The value returned by this callback is ignored by the PM |
119 | core. | ||
118 | 120 | ||
119 | The helper functions provided by the PM core, described in Section 4, guarantee | 121 | The helper functions provided by the PM core, described in Section 4, guarantee |
120 | that the following constraints are met with respect to the bus type's run-time | 122 | that the following constraints are met with respect to the bus type's run-time |
@@ -214,11 +216,20 @@ defined in include/linux/pm.h: | |||
214 | being executed for that device and it is not practical to wait for the | 216 | being executed for that device and it is not practical to wait for the |
215 | suspend to complete; means "start a resume as soon as you've suspended" | 217 | suspend to complete; means "start a resume as soon as you've suspended" |
216 | 218 | ||
219 | unsigned int run_wake; | ||
220 | - set if the device is capable of generating run-time wake-up events | ||
221 | |||
217 | enum rpm_status runtime_status; | 222 | enum rpm_status runtime_status; |
218 | - the run-time PM status of the device; this field's initial value is | 223 | - the run-time PM status of the device; this field's initial value is |
219 | RPM_SUSPENDED, which means that each device is initially regarded by the | 224 | RPM_SUSPENDED, which means that each device is initially regarded by the |
220 | PM core as 'suspended', regardless of its real hardware status | 225 | PM core as 'suspended', regardless of its real hardware status |
221 | 226 | ||
227 | unsigned int runtime_auto; | ||
228 | - if set, indicates that the user space has allowed the device driver to | ||
229 | power manage the device at run time via the /sys/devices/.../power/control | ||
230 | interface; it may only be modified with the help of the pm_runtime_allow() | ||
231 | and pm_runtime_forbid() helper functions | ||
232 | |||
222 | All of the above fields are members of the 'power' member of 'struct device'. | 233 | All of the above fields are members of the 'power' member of 'struct device'. |
223 | 234 | ||
224 | 4. Run-time PM Device Helper Functions | 235 | 4. Run-time PM Device Helper Functions |
@@ -234,41 +245,41 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
234 | removing the device from device hierarchy | 245 | removing the device from device hierarchy |
235 | 246 | ||
236 | int pm_runtime_idle(struct device *dev); | 247 | int pm_runtime_idle(struct device *dev); |
237 | - execute ->runtime_idle() for the device's bus type; returns 0 on success | 248 | - execute the subsystem-level idle callback for the device; returns 0 on |
238 | or error code on failure, where -EINPROGRESS means that ->runtime_idle() | 249 | success or error code on failure, where -EINPROGRESS means that |
239 | is already being executed | 250 | ->runtime_idle() is already being executed |
240 | 251 | ||
241 | int pm_runtime_suspend(struct device *dev); | 252 | int pm_runtime_suspend(struct device *dev); |
242 | - execute ->runtime_suspend() for the device's bus type; returns 0 on | 253 | - execute the subsystem-level suspend callback for the device; returns 0 on |
243 | success, 1 if the device's run-time PM status was already 'suspended', or | 254 | success, 1 if the device's run-time PM status was already 'suspended', or |
244 | error code on failure, where -EAGAIN or -EBUSY means it is safe to attempt | 255 | error code on failure, where -EAGAIN or -EBUSY means it is safe to attempt |
245 | to suspend the device again in future | 256 | to suspend the device again in future |
246 | 257 | ||
247 | int pm_runtime_resume(struct device *dev); | 258 | int pm_runtime_resume(struct device *dev); |
248 | - execute ->runtime_resume() for the device's bus type; returns 0 on | 259 | - execute the subsystem-level resume callback for the device; returns 0 on |
249 | success, 1 if the device's run-time PM status was already 'active' or | 260 | success, 1 if the device's run-time PM status was already 'active' or |
250 | error code on failure, where -EAGAIN means it may be safe to attempt to | 261 | error code on failure, where -EAGAIN means it may be safe to attempt to |
251 | resume the device again in future, but 'power.runtime_error' should be | 262 | resume the device again in future, but 'power.runtime_error' should be |
252 | checked additionally | 263 | checked additionally |
253 | 264 | ||
254 | int pm_request_idle(struct device *dev); | 265 | int pm_request_idle(struct device *dev); |
255 | - submit a request to execute ->runtime_idle() for the device's bus type | 266 | - submit a request to execute the subsystem-level idle callback for the |
256 | (the request is represented by a work item in pm_wq); returns 0 on success | 267 | device (the request is represented by a work item in pm_wq); returns 0 on |
257 | or error code if the request has not been queued up | 268 | success or error code if the request has not been queued up |
258 | 269 | ||
259 | int pm_schedule_suspend(struct device *dev, unsigned int delay); | 270 | int pm_schedule_suspend(struct device *dev, unsigned int delay); |
260 | - schedule the execution of ->runtime_suspend() for the device's bus type | 271 | - schedule the execution of the subsystem-level suspend callback for the |
261 | in future, where 'delay' is the time to wait before queuing up a suspend | 272 | device in future, where 'delay' is the time to wait before queuing up a |
262 | work item in pm_wq, in milliseconds (if 'delay' is zero, the work item is | 273 | suspend work item in pm_wq, in milliseconds (if 'delay' is zero, the work |
263 | queued up immediately); returns 0 on success, 1 if the device's PM | 274 | item is queued up immediately); returns 0 on success, 1 if the device's PM |
264 | run-time status was already 'suspended', or error code if the request | 275 | run-time status was already 'suspended', or error code if the request |
265 | hasn't been scheduled (or queued up if 'delay' is 0); if the execution of | 276 | hasn't been scheduled (or queued up if 'delay' is 0); if the execution of |
266 | ->runtime_suspend() is already scheduled and not yet expired, the new | 277 | ->runtime_suspend() is already scheduled and not yet expired, the new |
267 | value of 'delay' will be used as the time to wait | 278 | value of 'delay' will be used as the time to wait |
268 | 279 | ||
269 | int pm_request_resume(struct device *dev); | 280 | int pm_request_resume(struct device *dev); |
270 | - submit a request to execute ->runtime_resume() for the device's bus type | 281 | - submit a request to execute the subsystem-level resume callback for the |
271 | (the request is represented by a work item in pm_wq); returns 0 on | 282 | device (the request is represented by a work item in pm_wq); returns 0 on |
272 | success, 1 if the device's run-time PM status was already 'active', or | 283 | success, 1 if the device's run-time PM status was already 'active', or |
273 | error code if the request hasn't been queued up | 284 | error code if the request hasn't been queued up |
274 | 285 | ||
@@ -299,12 +310,12 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
299 | run-time PM callbacks described in Section 2 | 310 | run-time PM callbacks described in Section 2 |
300 | 311 | ||
301 | int pm_runtime_disable(struct device *dev); | 312 | int pm_runtime_disable(struct device *dev); |
302 | - prevent the run-time PM helper functions from running the device bus | 313 | - prevent the run-time PM helper functions from running subsystem-level |
303 | type's run-time PM callbacks, make sure that all of the pending run-time | 314 | run-time PM callbacks for the device, make sure that all of the pending |
304 | PM operations on the device are either completed or canceled; returns | 315 | run-time PM operations on the device are either completed or canceled; |
305 | 1 if there was a resume request pending and it was necessary to execute | 316 | returns 1 if there was a resume request pending and it was necessary to |
306 | ->runtime_resume() for the device's bus type to satisfy that request, | 317 | execute the subsystem-level resume callback for the device to satisfy that |
307 | otherwise 0 is returned | 318 | request, otherwise 0 is returned |
308 | 319 | ||
309 | void pm_suspend_ignore_children(struct device *dev, bool enable); | 320 | void pm_suspend_ignore_children(struct device *dev, bool enable); |
310 | - set/unset the power.ignore_children flag of the device | 321 | - set/unset the power.ignore_children flag of the device |
@@ -324,6 +335,20 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
324 | 'power.runtime_error' is set or 'power.disable_depth' is greater than | 335 | 'power.runtime_error' is set or 'power.disable_depth' is greater than |
325 | zero) | 336 | zero) |
326 | 337 | ||
338 | bool pm_runtime_suspended(struct device *dev); | ||
339 | - return true if the device's runtime PM status is 'suspended', or false | ||
340 | otherwise | ||
341 | |||
342 | void pm_runtime_allow(struct device *dev); | ||
343 | - set the power.runtime_auto flag for the device and decrease its usage | ||
344 | counter (used by the /sys/devices/.../power/control interface to | ||
345 | effectively allow the device to be power managed at run time) | ||
346 | |||
347 | void pm_runtime_forbid(struct device *dev); | ||
348 | - unset the power.runtime_auto flag for the device and increase its usage | ||
349 | counter (used by the /sys/devices/.../power/control interface to | ||
350 | effectively prevent the device from being power managed at run time) | ||
351 | |||
327 | It is safe to execute the following helper functions from interrupt context: | 352 | It is safe to execute the following helper functions from interrupt context: |
328 | 353 | ||
329 | pm_request_idle() | 354 | pm_request_idle() |
@@ -374,5 +399,128 @@ pm_runtime_suspend() or pm_runtime_idle() or their asynchronous counterparts, | |||
374 | they will fail returning -EAGAIN, because the device's usage counter is | 399 | they will fail returning -EAGAIN, because the device's usage counter is |
375 | incremented by the core before executing ->probe() and ->remove(). Still, it | 400 | incremented by the core before executing ->probe() and ->remove(). Still, it |
376 | may be desirable to suspend the device as soon as ->probe() or ->remove() has | 401 | may be desirable to suspend the device as soon as ->probe() or ->remove() has |
377 | finished, so the PM core uses pm_runtime_idle_sync() to invoke the device bus | 402 | finished, so the PM core uses pm_runtime_idle_sync() to invoke the |
378 | type's ->runtime_idle() callback at that time. | 403 | subsystem-level idle callback for the device at that time. |
404 | |||
405 | The user space can effectively disallow the driver of the device to power manage | ||
406 | it at run time by changing the value of its /sys/devices/.../power/control | ||
407 | attribute to "on", which causes pm_runtime_forbid() to be called. In principle, | ||
408 | this mechanism may also be used by the driver to effectively turn off the | ||
409 | run-time power management of the device until the user space turns it on. | ||
410 | Namely, during the initialization the driver can make sure that the run-time PM | ||
411 | status of the device is 'active' and call pm_runtime_forbid(). It should be | ||
412 | noted, however, that if the user space has already intentionally changed the | ||
413 | value of /sys/devices/.../power/control to "auto" to allow the driver to power | ||
414 | manage the device at run time, the driver may confuse it by using | ||
415 | pm_runtime_forbid() this way. | ||
416 | |||
417 | 6. Run-time PM and System Sleep | ||
418 | |||
419 | Run-time PM and system sleep (i.e., system suspend and hibernation, also known | ||
420 | as suspend-to-RAM and suspend-to-disk) interact with each other in a couple of | ||
421 | ways. If a device is active when a system sleep starts, everything is | ||
422 | straightforward. But what should happen if the device is already suspended? | ||
423 | |||
424 | The device may have different wake-up settings for run-time PM and system sleep. | ||
425 | For example, remote wake-up may be enabled for run-time suspend but disallowed | ||
426 | for system sleep (device_may_wakeup(dev) returns 'false'). When this happens, | ||
427 | the subsystem-level system suspend callback is responsible for changing the | ||
428 | device's wake-up setting (it may leave that to the device driver's system | ||
429 | suspend routine). It may be necessary to resume the device and suspend it again | ||
430 | in order to do so. The same is true if the driver uses different power levels | ||
431 | or other settings for run-time suspend and system sleep. | ||
432 | |||
433 | During system resume, devices generally should be brought back to full power, | ||
434 | even if they were suspended before the system sleep began. There are several | ||
435 | reasons for this, including: | ||
436 | |||
437 | * The device might need to switch power levels, wake-up settings, etc. | ||
438 | |||
439 | * Remote wake-up events might have been lost by the firmware. | ||
440 | |||
441 | * The device's children may need the device to be at full power in order | ||
442 | to resume themselves. | ||
443 | |||
444 | * The driver's idea of the device state may not agree with the device's | ||
445 | physical state. This can happen during resume from hibernation. | ||
446 | |||
447 | * The device might need to be reset. | ||
448 | |||
449 | * Even though the device was suspended, if its usage counter was > 0 then most | ||
450 | likely it would need a run-time resume in the near future anyway. | ||
451 | |||
452 | * Always going back to full power is simplest. | ||
453 | |||
454 | If the device was suspended before the sleep began, then its run-time PM status | ||
455 | will have to be updated to reflect the actual post-system sleep status. The way | ||
456 | to do this is: | ||
457 | |||
458 | pm_runtime_disable(dev); | ||
459 | pm_runtime_set_active(dev); | ||
460 | pm_runtime_enable(dev); | ||
461 | |||
462 | The PM core always increments the run-time usage counter before calling the | ||
463 | ->prepare() callback and decrements it after calling the ->complete() callback. | ||
464 | Hence disabling run-time PM temporarily like this will not cause any run-time | ||
465 | suspend callbacks to be lost. | ||
466 | |||
467 | 7. Generic subsystem callbacks | ||
468 | |||
469 | Subsystems may wish to conserve code space by using the set of generic power | ||
470 | management callbacks provided by the PM core, defined in | ||
471 | driver/base/power/generic_ops.c: | ||
472 | |||
473 | int pm_generic_runtime_idle(struct device *dev); | ||
474 | - invoke the ->runtime_idle() callback provided by the driver of this | ||
475 | device, if defined, and call pm_runtime_suspend() for this device if the | ||
476 | return value is 0 or the callback is not defined | ||
477 | |||
478 | int pm_generic_runtime_suspend(struct device *dev); | ||
479 | - invoke the ->runtime_suspend() callback provided by the driver of this | ||
480 | device and return its result, or return -EINVAL if not defined | ||
481 | |||
482 | int pm_generic_runtime_resume(struct device *dev); | ||
483 | - invoke the ->runtime_resume() callback provided by the driver of this | ||
484 | device and return its result, or return -EINVAL if not defined | ||
485 | |||
486 | int pm_generic_suspend(struct device *dev); | ||
487 | - if the device has not been suspended at run time, invoke the ->suspend() | ||
488 | callback provided by its driver and return its result, or return 0 if not | ||
489 | defined | ||
490 | |||
491 | int pm_generic_resume(struct device *dev); | ||
492 | - invoke the ->resume() callback provided by the driver of this device and, | ||
493 | if successful, change the device's runtime PM status to 'active' | ||
494 | |||
495 | int pm_generic_freeze(struct device *dev); | ||
496 | - if the device has not been suspended at run time, invoke the ->freeze() | ||
497 | callback provided by its driver and return its result, or return 0 if not | ||
498 | defined | ||
499 | |||
500 | int pm_generic_thaw(struct device *dev); | ||
501 | - if the device has not been suspended at run time, invoke the ->thaw() | ||
502 | callback provided by its driver and return its result, or return 0 if not | ||
503 | defined | ||
504 | |||
505 | int pm_generic_poweroff(struct device *dev); | ||
506 | - if the device has not been suspended at run time, invoke the ->poweroff() | ||
507 | callback provided by its driver and return its result, or return 0 if not | ||
508 | defined | ||
509 | |||
510 | int pm_generic_restore(struct device *dev); | ||
511 | - invoke the ->restore() callback provided by the driver of this device and, | ||
512 | if successful, change the device's runtime PM status to 'active' | ||
513 | |||
514 | These functions can be assigned to the ->runtime_idle(), ->runtime_suspend(), | ||
515 | ->runtime_resume(), ->suspend(), ->resume(), ->freeze(), ->thaw(), ->poweroff(), | ||
516 | or ->restore() callback pointers in the subsystem-level dev_pm_ops structures. | ||
517 | |||
518 | If a subsystem wishes to use all of them at the same time, it can simply assign | ||
519 | the GENERIC_SUBSYS_PM_OPS macro, defined in include/linux/pm.h, to its | ||
520 | dev_pm_ops structure pointer. | ||
521 | |||
522 | Device drivers that wish to use the same function as a system suspend, freeze, | ||
523 | poweroff and run-time suspend callback, and similarly for system resume, thaw, | ||
524 | restore, and run-time resume, can achieve this with the help of the | ||
525 | UNIVERSAL_DEV_PM_OPS macro defined in include/linux/pm.h (possibly setting its | ||
526 | last argument to NULL). | ||