Writing Device Drivers

Device Power Management Flow of Control for Component Zero

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 power off the component. If the component is component zero, the framework calls the driver's detach(9E) entry point with the command DDI_PM_SUSPEND to enable the driver to save all hardware state to memory. The framework then calls the power(9E) entry point to set the power level of the component to power level zero.

When component zero is needed again, the driver calls ddi_dev_is_needed(9F) on the powered off component. The framework then calls power(9E) to power up the component and calls attach(9E) with the DDI_PM_RESUME command to restore the state of the device and unblock any pending operations. At this point, the ddi_dev_is_needed(9F) call returns to the device driver. The component is idle but powered on, and the driver can mark it as busy by calling pm_busy_component(9F).