FAQ – Power Management Under Linux or Android

In an unattended operating mode things like power outages can occur. Your terminals need to “resume” their last power state and often this done via the PC BIOS.

With Linux and Android it isn’t quite so simple.

Question:  How do I control the wake and resume and overall power parameters with Linux and/or Android?

One Answer:

On these devices (like most embedded devices), the equivalent of the ‘bios’ is the uboot which is a simple program that initializes as much of the devices peripherals as required load a Linux kernel that subsequently launches the OS (Android/Linux). So there is very little/no state stored by uboot. uboot can be programmed to behave in different ways, ie determine if the the kernel/OS needs to be loaded from a remote file system for an upgrade.

For power management this would have to be managed at the OS level:

For Linux, start up power management could be done within a startup script that determined what to do depending on the current time. A cron job could be used to take the os out of low power mode and your launch application at a specified time interval.

For Android it may be more tricky as a the default power management is quite aggressive. It may be possible to implement a service which periodically checked the time and set a wake lock to keep the screen awake. I’ve used a wake lock for to keeping the screen alive however not for a timed application.

For the above is the important to note that the device is in low power mode and not switched off, uboot is normally only run on a cold start. Also beware that there can be issues with bringing an imx6 device out of the low power mode depending on which peripherals were suspended.

More..

U-Boot has nothing to do with power management for this matter.

In Android, the suspend can be prevented by acquiring a wakelock (refer to Android programming guides).

In Linux this is slightly different, because power management policy is less aggressive. Take a look at ‘caffeine’ (https://launchpad.net/caffeine) for reference.