Power Management

Peripheral device power management is usually handled by device drivers and the operating system. If a device isn't in use, the driver automatically keeps that device in its lowest power state.

App behaviour drives power consumption. If app code is uses a peripheral device when it doesn't need to, power will be wasted. Power is also wasted if app code runs busy-wait loops or periodically polls for events.

To conserve power, apps should register call-back functions only triggered when events occur. This way app code only runs when an event occurs, rather than waking up to check for events that haven't happened. Every CPU cycle uses power, so when a power-sensitive app is woken up, it should execute as few instructions as possible before going back to sleep.

When all threads are sleeping, the O/S will reduce the CPU power state automatically. When an event handler function returns back to the Legato event loop, it puts the thread to sleep (unless there's another event waiting). If your thread isn't running the Legato event loop, block your thread to put it to sleep when it's not working through poll(), select(), read(), write(), recv(), etc.

If you use a periodic timer (like Timer API) to wake up your app, it will consume power. Set the timer period as long possible to conserve power, and let the O/S go into deeper sleep states.

To maximize power savings, the system can use the Linux auto-sleep feature. Unless the system is busy processing a non-deferrable event, this feature puts the hardware into a SUSPEND state where all peripherals and the CPU are placed into low-power mode. Apps with the appropriate credentials have the option to control the system power state while performing critical operations.

Use Legato's Power Manager to control the system's wake-up (powered) state. Operations needing fast response times or those resulting in high interrupt rates may benefit from keeping the system awake. This provides better performance, but worse power efficiency.

See Manage Device Power for info on how to write power-efficient apps.


Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.