blob: bfed898a03fcc292af8dcb55132b015010c382d0 [file] [log] [blame]
Richard Hughesbf1db692008-08-05 13:01:35 -07001PM Quality Of Service Interface.
Mark Grossd82b3512008-02-04 22:30:08 -08002
3This interface provides a kernel and user mode interface for registering
4performance expectations by drivers, subsystems and user space applications on
5one of the parameters.
6
7Currently we have {cpu_dma_latency, network_latency, network_throughput} as the
8initial set of pm_qos parameters.
9
Richard Hughesbf1db692008-08-05 13:01:35 -070010Each parameters have defined units:
11 * latency: usec
12 * timeout: usec
13 * throughput: kbs (kilo bit / sec)
14
Mark Grossd82b3512008-02-04 22:30:08 -080015The infrastructure exposes multiple misc device nodes one per implemented
16parameter. The set of parameters implement is defined by pm_qos_power_init()
17and pm_qos_params.h. This is done because having the available parameters
18being runtime configurable or changeable from a driver was seen as too easy to
19abuse.
20
Mark Grossed771342010-05-06 01:59:26 +020021For each parameter a list of performance requests is maintained along with
Mark Grossd82b3512008-02-04 22:30:08 -080022an aggregated target value. The aggregated target value is updated with
Mark Grossed771342010-05-06 01:59:26 +020023changes to the request list or elements of the list. Typically the
24aggregated target value is simply the max or min of the request values held
Mark Grossd82b3512008-02-04 22:30:08 -080025in the parameter list elements.
26
27From kernel mode the use of this interface is simple:
Mark Grossd82b3512008-02-04 22:30:08 -080028
Mark Grossed771342010-05-06 01:59:26 +020029handle = pm_qos_add_request(param_class, target_value):
30Will insert an element into the list for that identified PM_QOS class with the
31target value. Upon change to this list the new target is recomputed and any
32registered notifiers are called only if the target value is now different.
33Clients of pm_qos need to save the returned handle.
Mark Grossd82b3512008-02-04 22:30:08 -080034
Mark Grossed771342010-05-06 01:59:26 +020035void pm_qos_update_request(handle, new_target_value):
36Will update the list element pointed to by the handle with the new target value
37and recompute the new aggregated target, calling the notification tree if the
38target is changed.
39
40void pm_qos_remove_request(handle):
41Will remove the element. After removal it will update the aggregate target and
42call the notification tree if the target was changed as a result of removing
43the request.
Mark Grossd82b3512008-02-04 22:30:08 -080044
45
46From user mode:
Mark Grossed771342010-05-06 01:59:26 +020047Only processes can register a pm_qos request. To provide for automatic
48cleanup of a process, the interface requires the process to register its
49parameter requests in the following way:
Mark Grossd82b3512008-02-04 22:30:08 -080050
51To register the default pm_qos target for the specific parameter, the process
52must open one of /dev/[cpu_dma_latency, network_latency, network_throughput]
53
54As long as the device node is held open that process has a registered
Mark Grossed771342010-05-06 01:59:26 +020055request on the parameter.
Mark Grossd82b3512008-02-04 22:30:08 -080056
Mark Grossed771342010-05-06 01:59:26 +020057To change the requested target value the process needs to write an s32 value to
58the open device node. Alternatively the user mode program could write a hex
59string for the value using 10 char long format e.g. "0x12345678". This
60translates to a pm_qos_update_request call.
Mark Grossd82b3512008-02-04 22:30:08 -080061
62To remove the user mode request for a target value simply close the device
63node.
64
65
66