Power Manager Activity Timers (Compact 2013)

3/26/2014

Power Manager implements activity timers that you can use to determine when to transfer your platform into a new system power state. Activity timers indicate how long Power Manager waits before concluding that a particular activity source is inactive-expiration of this wait causes Power Manager to signal an inactive event. Typically, you use activity timers to measure the length of time since an activity event such as a keypad press or touch-panel tap was last detected by the system. You can use activity timers as input to your system power state transition logic to determine when to transition to another power state. For example, Power Manager might trigger a system power state transition on a user activity timeout, thereby causing the platform to enter a system power state in which the display and backlight are off so that your platform conserves power while the user is not actively using the system.

Upon initialization, Power Manager reads the registry to acquire a list of activity timer names. For each activity timer that you configure in the registry, Power Manager checks for a timeout and an optional list of wake sources. It then creates the following named events:

  • A timer reset event
  • An active status manual-reset event
  • A manual-reset event

If the timeout associated with the timer expires without a reset event, Power Manager signals the active event and sets the inactive event. If the reset event is signaled, Power Manager signals the inactive event and sets the active event.

The following code example is a registry setting for configuring an activity timer called SystemActivity:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ActivityTimers\SystemActivity]
"Timeout"=dword:A
"WakeSources"=multi_sz:"0x20"

The Timeout registry setting is expressed in seconds. The optional WakeSources registry setting associates a wake source identifier for the activity timer. The wake source identifier is the SYSINTR value of the wake up source. For more about SYSINTR values, see Implementing Your Device Driver. If the OS resumes and Power Manager determines that the wake source corresponding to this identifier caused the system to resume, Power Manager sets the associated activity timer to active. Power Manager calls KernelIoControl with the IOCTL_HAL_GET_WAKE_SOURCE command to determine which wake source woke the system.

The following set of registry values causes Power Manager to create three events with the following names.

PowerManager/ActivityTimer/SystemActivity
PowerManager/SystemActivity_Active
PowerManager/SystemActivity_Inactive

The first event, SystemActivity, is an auto-reset event that any device driver can signal to indicate system activity. Device drivers that support resetting activity timers read the name of the timer reset event from the registry. The remaining events, SystemActivity_Active and SystemActivity_Inactive, are manual reset events, of which only one is signaled at a time. Device drivers, applications, or Power Manager itself can open handles to these events to determine whether the activity timer has expired. These events indicate the status of the activity timer. The reset event is an input to the activity timer system, and the status events are the corresponding outputs.

Any number of device drivers can open handles to a reset event, and device drivers can signal the activity timer when appropriate. Potential sources of activity include all device drivers that open handles to the reset event of the activity timer. Any number of threads can open handles to the manual-reset activity/inactivity events and wait for those events in order to determine the status of the OS. For example, a backlight device driver can use the pair of manual-reset events created for an activity timer to decide how to control backlight power and intensity.

When the system enters a suspended state, Power Manager signals the active manual-reset events associated with activity timers. On a resume event, it scans the timers to see if any are associated with the wake source that caused the system to resume. If it finds a match, it signals that activity event. This makes it possible for Power Manager to resume into the system power state associated with that activity timer. A keypad press or touch-panel tap can reset the activity timer.

See Also

Concepts

Power Manager