Supporting Multiple-Component Devices with Single or Multiple Functional Power States
[Applies to KMDF only]
A KMDF driver for a multiple-component device can define one or more functional power states for each component.
In this case, the driver registers directly with the power management framework (PoFx). To specify that WDF should not register with PoFx, the driver calls WdfDeviceAssignS0IdleSettings with the IdleTimeoutType member of the WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS structure set to DriverManagedIdleTimeout. Typically, the driver calls this method from its EvtDriverDeviceAdd callback function.
Next, the driver must register with PoFx. To do so, the driver calls PoFxRegisterDevice and then PoFxStartDevicePowerManagement. Your driver must register with PoFx only once, when the device is first started. One way to do this is by calling these routines from a driver-supplied EvtDeviceSelfManagedIoInit function. EvtDeviceSelfManagedIoInit is called only the first time the device is started.
When the device is removed, the driver must call PoFxUnregisterDevice to unregister the device from PoFx. To unregister only once, we recommend the driver call this routine from a driver-supplied EvtDeviceSelfManagedIoFlush function. EvtDeviceSelfManagedIoFlush is called only when the device is being removed. By unregistering in EvtDeviceSelfManagedIoFlush, the driver retains power registration during sleep and rebalance transitions and does not have to maintain power references for I/O requests that remain pending during these transitions.
When the driver calls PoFxRegisterDevice, it receives a power registration handle (POHANDLE) that it can use to interact directly with PoFx, as described in the following topics:
- Coordinating I/O Requests with Component Power State
- Reporting Device Powered On When System Returns to S0
- Supporting Idle Power-Down on Multiple-Component Devices
In addition, the driver can call power framework routines directly to send power control requests and specify latency, residency, and wake requirements.
For more information about PoFx, see Overview of the Power Management Framework.