Friday, April 11, 2008

Power Management under Windows CE [part 2/3]

In the last article we saw that the Power Manager is in charge of the management of the power on a Windows CE device, and interact with the system to change the system power consumption according to the user and system activity. Each driver can support 5 different levels of power states that can be setup from the registry.

Device Drivers Interface

The Power Manager is using IoControls to communicate with the drivers, to set, get the current power state of the driver. So drivers have to implement the support of those IoControl codes if they can manage the power of the managed device. The command codes are the following:

  • IOCTL_POWER_CAPABILITIES: used by the Power Manager to identify the power capabilities of the device driver. This command is called once when Power Manager enumerates the device on the system.
  • IOCTL_POWER_GET: used to get the current power state of the device.
  • IOCTL_POWER_SET: used to request a power transition.
  • IOCTL_POWER_QUERY: used to validate that the driver will support a power transition from its current state to the specified state.

Power Manager interface for device drivers

The device drivers cannot change their power state by themselves, without notifying the power manager; otherwise the power manager is not aware of state modification and cannot optimize the power on the device. When drivers require power level modification, they should request the power manager for that by calling DevicePowerNotify from the driver. Then the power manager will use the IoControls to request user to change is power state.

Next time we will identify how the applications can request system power transition.

[Updated] : Access to part 3/3

- Nicolas

No comments: