Writing Device Drivers

Power Management Flow of Control

Figure 9–1 illustrates the flow of control in the power management framework.

When a component's activity is complete, a driver can call pm_idle_component(9F) to mark the component as idle. When the component has been idle for its threshold time, the framework may lower the power of the component to its next lower level. The framework does this by calling the power(9E) function to set the power level of the component to its next lower supported power level (if any). The driver's power(9E) function should reject any attempt to lower the power level of a component when it is busy. The driver's power(9E) function should also save any state that will be lost as a result of the transition to the lower power level before making that transition.

When the component is needed again at a higher power level, the driver calls pm_busy_component(9F) to keep the framework from lowering the power still further, and then calls pm_raise_power(9F) on the component. The framework then calls power(9E) to raise the power of the component (before the call to pm_raise_power(9F) returns). The driver's power(9E) code must restore any state that was lost in the lower level but is needed in the higher level after making the power transition.

When a driver is detaching, it should call pm_lower_power(9F) for each component to lower its power to its lowest level. The framework may then call into the driver's power(9E) routine (before the call to pm_lower_power(9F) returns) to lower the power of the component.

Figure 9–1 Power Management Conceptual State Diagram

Diagram shows the flow of control through power management routines.