DPM classes allow DPM to automatically choose an appropriate operating point from among a choice of several operating points, according to the constraints set by drivers. For example, a class may offer a choice of a lower power operating point or a higher power operating point, allowing the lower power operating point to be set if no drivers have asserted a constraint disallowing the lower power operating point.
A DPM policy can map an operating state to a single operating point, or it can map an operating state to a class containing multiple operating points. When switching operating points to match a change in operating state, DPM will choose the first operating point in the class that is allowed under the current device constraints. An example for a hypothetical platform:
# Set a device constraint for power param #0 values 1-15. echo "0 15 1" > /sys/devices/bus/devX/power/constraints # Create operating points opA and opB; opA violates that constraint. echo create opA 20 > /sys/dpm/op/control echo create opB 10 > /sys/dpm/op/control # Create a class containing those two operating points. echo create classAB opA opB > /sys/dpm/class/control # Create and activate a policy mapping at least one task operating state to # the class. DPM will choose opB from the class until devX no longer # asserts its constraint. echo create policyAB opidle opidle-task opsleep classAB classAB... echo set policyAB > /sys/dpm/policy/control
To create a class using the sysfs interface, use:
echo create class-name op-name op-name ... > /sys/dpm/class/controlThe class-name must be unique among other classes and operating points.
Each op-name is the name of an operating point included in the class. The order of names is significant: When choosing an operating point from the class, DPM will evaluate each operating point in left-to-right order, choosing the first operating point that meets current constraints.
The class-name is specified in a policy to map an operating state to the class.
DPM operating point classes function properly only when device constraints are operable, which in turn depend upon CONFIG_PM=y.