diff options
Diffstat (limited to 'Documentation/power')
-rw-r--r-- | Documentation/power/pm_qos_interface.txt | 82 |
1 files changed, 60 insertions, 22 deletions
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index 483632087788..a5da5c7e7128 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
@@ -88,17 +88,19 @@ node. | |||
88 | 88 | ||
89 | 2. PM QoS per-device latency and flags framework | 89 | 2. PM QoS per-device latency and flags framework |
90 | 90 | ||
91 | For each device, there are two lists of PM QoS requests. One is maintained | 91 | For each device, there are three lists of PM QoS requests. Two of them are |
92 | along with the aggregated target of latency value and the other is for PM QoS | 92 | maintained along with the aggregated targets of resume latency and active |
93 | flags. Values are updated in response to changes of the request list. | 93 | state latency tolerance (in microseconds) and the third one is for PM QoS flags. |
94 | Values are updated in response to changes of the request list. | ||
94 | 95 | ||
95 | Target latency value is simply the minimum of the request values held in the | 96 | The target values of resume latency and active state latency tolerance are |
96 | parameter list elements. The PM QoS flags aggregate value is a gather (bitwise | 97 | simply the minimum of the request values held in the parameter list elements. |
97 | OR) of all list elements' values. Two device PM QoS flags are defined currently: | 98 | The PM QoS flags aggregate value is a gather (bitwise OR) of all list elements' |
98 | PM_QOS_FLAG_NO_POWER_OFF and PM_QOS_FLAG_REMOTE_WAKEUP. | 99 | values. Two device PM QoS flags are defined currently: PM_QOS_FLAG_NO_POWER_OFF |
100 | and PM_QOS_FLAG_REMOTE_WAKEUP. | ||
99 | 101 | ||
100 | Note: the aggregated target value is implemented as an atomic variable so that | 102 | Note: The aggregated target values are implemented in such a way that reading |
101 | reading the aggregated value does not require any locking mechanism. | 103 | the aggregated value does not require any locking mechanism. |
102 | 104 | ||
103 | 105 | ||
104 | From kernel mode the use of this interface is the following: | 106 | From kernel mode the use of this interface is the following: |
@@ -132,19 +134,21 @@ The meaning of the return values is as follows: | |||
132 | PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been | 134 | PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been |
133 | initialized or the list of requests is empty. | 135 | initialized or the list of requests is empty. |
134 | 136 | ||
135 | int dev_pm_qos_add_ancestor_request(dev, handle, value) | 137 | int dev_pm_qos_add_ancestor_request(dev, handle, type, value) |
136 | Add a PM QoS request for the first direct ancestor of the given device whose | 138 | Add a PM QoS request for the first direct ancestor of the given device whose |
137 | power.ignore_children flag is unset. | 139 | power.ignore_children flag is unset (for DEV_PM_QOS_RESUME_LATENCY requests) |
140 | or whose power.set_latency_tolerance callback pointer is not NULL (for | ||
141 | DEV_PM_QOS_LATENCY_TOLERANCE requests). | ||
138 | 142 | ||
139 | int dev_pm_qos_expose_latency_limit(device, value) | 143 | 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 | 144 | Add a request to the device's PM QoS list of resume latency constraints and |
141 | a sysfs attribute pm_qos_resume_latency_us under the device's power directory | 145 | create a sysfs attribute pm_qos_resume_latency_us under the device's power |
142 | allowing user space to manipulate that request. | 146 | directory allowing user space to manipulate that request. |
143 | 147 | ||
144 | void dev_pm_qos_hide_latency_limit(device) | 148 | void dev_pm_qos_hide_latency_limit(device) |
145 | Drop the request added by dev_pm_qos_expose_latency_limit() from the device's | 149 | 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 | 150 | PM QoS list of resume latency constraints and remove sysfs attribute |
147 | from the device's power directory. | 151 | pm_qos_resume_latency_us from the device's power directory. |
148 | 152 | ||
149 | int dev_pm_qos_expose_flags(device, value) | 153 | 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 | 154 | Add a request to the device's PM QoS list of flags and create sysfs attributes |
@@ -163,7 +167,7 @@ a per-device notification tree and a global notification tree. | |||
163 | int dev_pm_qos_add_notifier(device, notifier): | 167 | int dev_pm_qos_add_notifier(device, notifier): |
164 | Adds a notification callback function for the device. | 168 | Adds a notification callback function for the device. |
165 | The callback is called when the aggregated value of the device constraints list | 169 | The callback is called when the aggregated value of the device constraints list |
166 | is changed. | 170 | is changed (for resume latency device PM QoS only). |
167 | 171 | ||
168 | int dev_pm_qos_remove_notifier(device, notifier): | 172 | int dev_pm_qos_remove_notifier(device, notifier): |
169 | Removes the notification callback function for the device. | 173 | Removes the notification callback function for the device. |
@@ -171,14 +175,48 @@ Removes the notification callback function for the device. | |||
171 | int dev_pm_qos_add_global_notifier(notifier): | 175 | int dev_pm_qos_add_global_notifier(notifier): |
172 | Adds a notification callback function in the global notification tree of the | 176 | Adds a notification callback function in the global notification tree of the |
173 | framework. | 177 | framework. |
174 | The callback is called when the aggregated value for any device is changed. | 178 | The callback is called when the aggregated value for any device is changed |
179 | (for resume latency device PM QoS only). | ||
175 | 180 | ||
176 | int dev_pm_qos_remove_global_notifier(notifier): | 181 | int dev_pm_qos_remove_global_notifier(notifier): |
177 | Removes the notification callback function from the global notification tree | 182 | Removes the notification callback function from the global notification tree |
178 | of the framework. | 183 | of the framework. |
179 | 184 | ||
180 | 185 | ||
181 | From user mode: | 186 | Active state latency tolerance |
182 | No API for user space access to the per-device latency constraints is provided | 187 | |
183 | yet - still under discussion. | 188 | This device PM QoS type is used to support systems in which hardware may switch |
184 | 189 | to energy-saving operation modes on the fly. In those systems, if the operation | |
190 | mode chosen by the hardware attempts to save energy in an overly aggressive way, | ||
191 | it may cause excess latencies to be visible to software, causing it to miss | ||
192 | certain protocol requirements or target frame or sample rates etc. | ||
193 | |||
194 | If there is a latency tolerance control mechanism for a given device available | ||
195 | to software, the .set_latency_tolerance callback in that device's dev_pm_info | ||
196 | structure should be populated. The routine pointed to by it is should implement | ||
197 | whatever is necessary to transfer the effective requirement value to the | ||
198 | hardware. | ||
199 | |||
200 | Whenever the effective latency tolerance changes for the device, its | ||
201 | .set_latency_tolerance() callback will be executed and the effective value will | ||
202 | be passed to it. If that value is negative, which means that the list of | ||
203 | latency tolerance requirements for the device is empty, the callback is expected | ||
204 | to switch the underlying hardware latency tolerance control mechanism to an | ||
205 | autonomous mode if available. If that value is PM_QOS_LATENCY_ANY, in turn, and | ||
206 | the hardware supports a special "no requirement" setting, the callback is | ||
207 | expected to use it. That allows software to prevent the hardware from | ||
208 | automatically updating the device's latency tolerance in response to its power | ||
209 | state changes (e.g. during transitions from D3cold to D0), which generally may | ||
210 | be done in the autonomous latency tolerance control mode. | ||
211 | |||
212 | If .set_latency_tolerance() is present for the device, sysfs attribute | ||
213 | pm_qos_latency_tolerance_us will be present in the devivce's power directory. | ||
214 | Then, user space can use that attribute to specify its latency tolerance | ||
215 | requirement for the device, if any. Writing "any" to it means "no requirement, | ||
216 | but do not let the hardware control latency tolerance" and writing "auto" to it | ||
217 | allows the hardware to be switched to the autonomous mode if there are no other | ||
218 | requirements from the kernel side in the device's list. | ||
219 | |||
220 | Kernel code can use the functions described above along with the | ||
221 | DEV_PM_QOS_LATENCY_TOLERANCE device PM QoS type to add, remove and update | ||
222 | latency tolerance requirements for devices. | ||