diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 07:01:40 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 07:01:40 -0400 |
| commit | e52cff8bdd4a30c40a7f65c7ea8f1f425f8a15eb (patch) | |
| tree | 1729332ebab51bb560ca64effe46cdab38ab537f | |
| parent | 405a1086bdd091d2d55db0ac905cd6332b35cec1 (diff) | |
| parent | f5ce1572109049b90484e2bb44927cb6034c5eb1 (diff) | |
Merge branch 'pm-assorted'
* pm-assorted:
PM / QoS: Add pm_qos and dev_pm_qos to events-power.txt
PM / QoS: Add dev_pm_qos_request tracepoints
PM / QoS: Add pm_qos_request tracepoints
PM / QoS: Add pm_qos_update_target/flags tracepoints
PM / QoS: Update Documentation/power/pm_qos_interface.txt
PM / Sleep: Print last wakeup source on failed wakeup_count write
PM / QoS: correct the valid range of pm_qos_class
PM / wakeup: Adjust messaging for wake events during suspend
PM / Runtime: Update .runtime_idle() callback documentation
PM / Runtime: Rework the "runtime idle" helper routine
PM / Hibernate: print physical addresses consistently with other parts of kernel
33 files changed, 315 insertions, 113 deletions
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index 79a2a58425ee..483632087788 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
| @@ -7,7 +7,7 @@ one of the parameters. | |||
| 7 | Two different PM QoS frameworks are available: | 7 | Two different PM QoS frameworks are available: |
| 8 | 1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput. | 8 | 1. PM QoS classes for cpu_dma_latency, network_latency, network_throughput. |
| 9 | 2. the per-device PM QoS framework provides the API to manage the per-device latency | 9 | 2. the per-device PM QoS framework provides the API to manage the per-device latency |
| 10 | constraints. | 10 | constraints and PM QoS flags. |
| 11 | 11 | ||
| 12 | Each parameters have defined units: | 12 | Each parameters have defined units: |
| 13 | * latency: usec | 13 | * latency: usec |
| @@ -86,13 +86,17 @@ To remove the user mode request for a target value simply close the device | |||
| 86 | node. | 86 | node. |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | 2. PM QoS per-device latency framework | 89 | 2. PM QoS per-device latency and flags framework |
| 90 | |||
| 91 | For each device, there are two lists of PM QoS requests. One is maintained | ||
| 92 | along with the aggregated target of latency value and the other is for PM QoS | ||
| 93 | flags. Values are updated in response to changes of the request list. | ||
| 94 | |||
| 95 | Target latency value is simply the minimum of the request values held in the | ||
| 96 | parameter list elements. The PM QoS flags aggregate value is a gather (bitwise | ||
| 97 | OR) of all list elements' values. Two device PM QoS flags are defined currently: | ||
| 98 | PM_QOS_FLAG_NO_POWER_OFF and PM_QOS_FLAG_REMOTE_WAKEUP. | ||
| 90 | 99 | ||
| 91 | For each device a list of performance requests is maintained along with | ||
| 92 | an aggregated target value. The aggregated target value is updated with | ||
| 93 | changes to the request list or elements of the list. Typically the | ||
| 94 | aggregated target value is simply the max or min of the request values held | ||
| 95 | in the parameter list elements. | ||
| 96 | Note: the aggregated target value is implemented as an atomic variable so that | 100 | Note: the aggregated target value is implemented as an atomic variable so that |
| 97 | reading the aggregated value does not require any locking mechanism. | 101 | reading the aggregated value does not require any locking mechanism. |
| 98 | 102 | ||
| @@ -119,6 +123,38 @@ the request. | |||
| 119 | s32 dev_pm_qos_read_value(device): | 123 | s32 dev_pm_qos_read_value(device): |
| 120 | Returns the aggregated value for a given device's constraints list. | 124 | Returns the aggregated value for a given device's constraints list. |
| 121 | 125 | ||
| 126 | enum pm_qos_flags_status dev_pm_qos_flags(device, mask) | ||
| 127 | Check PM QoS flags of the given device against the given mask of flags. | ||
| 128 | The meaning of the return values is as follows: | ||
| 129 | PM_QOS_FLAGS_ALL: All flags from the mask are set | ||
| 130 | PM_QOS_FLAGS_SOME: Some flags from the mask are set | ||
| 131 | PM_QOS_FLAGS_NONE: No flags from the mask are set | ||
| 132 | PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been | ||
| 133 | initialized or the list of requests is empty. | ||
| 134 | |||
| 135 | int dev_pm_qos_add_ancestor_request(dev, handle, value) | ||
| 136 | Add a PM QoS request for the first direct ancestor of the given device whose | ||
| 137 | power.ignore_children flag is unset. | ||
| 138 | |||
| 139 | int dev_pm_qos_expose_latency_limit(device, value) | ||
| 140 | Add a request to the device's PM QoS list of latency constraints and create | ||
| 141 | a sysfs attribute pm_qos_resume_latency_us under the device's power directory | ||
| 142 | allowing user space to manipulate that request. | ||
| 143 | |||
| 144 | void dev_pm_qos_hide_latency_limit(device) | ||
| 145 | Drop the request added by dev_pm_qos_expose_latency_limit() from the device's | ||
| 146 | PM QoS list of latency constraints and remove sysfs attribute pm_qos_resume_latency_us | ||
| 147 | from the device's power directory. | ||
| 148 | |||
| 149 | int dev_pm_qos_expose_flags(device, value) | ||
| 150 | Add a request to the device's PM QoS list of flags and create sysfs attributes | ||
| 151 | pm_qos_no_power_off and pm_qos_remote_wakeup under the device's power directory | ||
| 152 | allowing user space to change these flags' value. | ||
| 153 | |||
| 154 | void dev_pm_qos_hide_flags(device) | ||
| 155 | Drop the request added by dev_pm_qos_expose_flags() from the device's PM QoS list | ||
| 156 | of flags and remove sysfs attributes pm_qos_no_power_off and pm_qos_remote_wakeup | ||
| 157 | under the device's power directory. | ||
| 122 | 158 | ||
| 123 | Notification mechanisms: | 159 | Notification mechanisms: |
| 124 | The per-device PM QoS framework has 2 different and distinct notification trees: | 160 | The per-device PM QoS framework has 2 different and distinct notification trees: |
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 6c9f5d9aa115..71d8fe4e75d3 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
| @@ -144,8 +144,12 @@ The action performed by the idle callback is totally dependent on the subsystem | |||
| 144 | (or driver) in question, but the expected and recommended action is to check | 144 | (or driver) in question, but the expected and recommended action is to check |
| 145 | if the device can be suspended (i.e. if all of the conditions necessary for | 145 | if the device can be suspended (i.e. if all of the conditions necessary for |
| 146 | suspending the device are satisfied) and to queue up a suspend request for the | 146 | suspending the device are satisfied) and to queue up a suspend request for the |
| 147 | device in that case. The value returned by this callback is ignored by the PM | 147 | device in that case. If there is no idle callback, or if the callback returns |
| 148 | core. | 148 | 0, then the PM core will attempt to carry out a runtime suspend of the device; |
| 149 | in essence, it will call pm_runtime_suspend() directly. To prevent this (for | ||
| 150 | example, if the callback routine has started a delayed suspend), the routine | ||
| 151 | should return a non-zero value. Negative error return codes are ignored by the | ||
| 152 | PM core. | ||
| 149 | 153 | ||
| 150 | The helper functions provided by the PM core, described in Section 4, guarantee | 154 | The helper functions provided by the PM core, described in Section 4, guarantee |
| 151 | that the following constraints are met with respect to runtime PM callbacks for | 155 | that the following constraints are met with respect to runtime PM callbacks for |
| @@ -301,9 +305,10 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
| 301 | removing the device from device hierarchy | 305 | removing the device from device hierarchy |
| 302 | 306 | ||
| 303 | int pm_runtime_idle(struct device *dev); | 307 | int pm_runtime_idle(struct device *dev); |
| 304 | - execute the subsystem-level idle callback for the device; returns 0 on | 308 | - execute the subsystem-level idle callback for the device; returns an |
| 305 | success or error code on failure, where -EINPROGRESS means that | 309 | error code on failure, where -EINPROGRESS means that ->runtime_idle() is |
| 306 | ->runtime_idle() is already being executed | 310 | already being executed; if there is no callback or the callback returns 0 |
| 311 | then run pm_runtime_suspend(dev) and return its result | ||
| 307 | 312 | ||
| 308 | int pm_runtime_suspend(struct device *dev); | 313 | int pm_runtime_suspend(struct device *dev); |
| 309 | - execute the subsystem-level suspend callback for the device; returns 0 on | 314 | - execute the subsystem-level suspend callback for the device; returns 0 on |
| @@ -660,11 +665,6 @@ Subsystems may wish to conserve code space by using the set of generic power | |||
| 660 | management callbacks provided by the PM core, defined in | 665 | management callbacks provided by the PM core, defined in |
| 661 | driver/base/power/generic_ops.c: | 666 | driver/base/power/generic_ops.c: |
| 662 | 667 | ||
| 663 | int pm_generic_runtime_idle(struct device *dev); | ||
| 664 | - invoke the ->runtime_idle() callback provided by the driver of this | ||
| 665 | device, if defined, and call pm_runtime_suspend() for this device if the | ||
| 666 | return value is 0 or the callback is not defined | ||
| 667 | |||
| 668 | int pm_gene | ||
