Suspend and Resume Handling (Windows CE 5.0)
Power managed stream device drivers will continue to receive notifications of system suspend and resume states through their XXX_PowerDown (Device Manager) and XXX_PowerUp (Device Manager). These notifications are sent in an interrupt context just before the kernel calls OEMPowerOff. The PowerDown/PowerUp callback mechanism is independent of the Power Manager and allows legacy device drivers to function under Microsoft® Windows® CE .NET 4.0 and later.
Device driver developers need to be aware that during an OS suspend state, the microprocessor will no longer be active. In theory the Power Manager will put all devices into a device power state that is appropriate to an OS suspend state. However, it is possible that a suspend system power state configuration or an application device power requirement may not be appropriate for a particular device. For example, an audio device might be required to stay in state D0 by a multimedia application. If the audio chip requires frequent microprocessor servicing to set up DMA buffers, the device driver developer may decide that D0 is an inappropriate state for an OS suspend state and power the device off.
Device driver developers must know what states are appropriate for their device during an OS suspend state and implement their driver accordingly. It is appropriate for driver developers to be conservative when making decisions about power management during an OS suspend state. However, not all devices should necessarily be forced off at an OS suspend state. For example, if the audio device had a line in jack and could play music independently of the microprocessor it would be appropriate for the device to remain powered during a suspend state.
If a device driver developer alters the device power state during a suspend state, it should restore it during a resume state. Such drivers should try to keep their actual behavior during an OS suspend state as transparent to the Power Manager as possible.
Power-manageable stream devices can automatically notify the Power Manager of their presence when they are loaded by ActivateDeviceEx. If the GUID "{A32942B7-920C-486b-B0E6-92A702A99B35}" is part of their IClass value, which is a REG_MULTI_SZ, the Power Manager will receive a device notification when the device is loaded. The Power Manager requests notifications for all classes listed in the HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Power\Interfaces registry key.
Devices can manage their own power by calling the DevicePowerNotify function when they receive the IOCTL_POWER_CAPABILITIES I/O control. The Power Manager will recognize requests issued while the device is processing the IOCTL.
If an OEM chooses to implement a device API outside of the stream interface, the OEM needs to customize the Power Manager to communicate using the new mechanism.
See Also
Device Power Management Guidelines | XXX_PowerDown (Device Manager) | XXX_PowerUp (Device Manager) | OEMPowerOff | ActivateDeviceEx | DevicePowerNotify | IOCTL_POWER_CAPABILITIES
Send Feedback on this topic to the authors