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