iWave Japan      Welcome to iWave Systems

Power Management in Embedded Systems for Longer Battery Life

In the world of embedded connected devices, inefficient power management could result in poor battery life, excess heat dissipation and unsatisfied customers.

Solution to above problem in the world of battery operated devices is “Efficient Power Management”, which is undoubtedly required for all smart phones and tablet devices. Power management is a combined hardware and software mechanism to reduce the power consumption of a device in active and sleep mode.

The ultimate aim is to make resourceful utilization of power which could result in longer battery life and efficient usage of device resources in terms of power consumption. Before discovering ways to achieve efficient power management; let’s have a look at typical battery operated embedded devices model.

Power Management in Embedded Systems

As we can see there will be many peripherals inter linked with the processor by using various interfaces supported. To make the device run effectively we need operating system running on it! In our case we will be taking Android as an example.

Power Management Embedded Systems

The underlying Linux kernel built-in with power management support, which holds building blocks like

  • Suspend and Resume
  • CPU Idle
  • Runtime power management
  • Dynamic frequency and voltage scaling

Suspend and resume block implements the platform hooks and driver specific suspend and resume functionality. The platform hooks like prepare (), enter (), finish (), valid () are useful in making the device to enter into suspend and resume its operation state back to original. The platform hooks are like generic instructors to whole system; it instructs or commands the device to switch between suspend and resume states based on CPU state.

Usually the suspend event will be triggered on android device using power ON key and screen time out. The resume event will be triggered by using same Power ON key or any other hardware/software interrupts (Incoming call, Incoming message and alarms etc...).

The CPU idle block will come in to picture when there is nothing left to run, in this mode CPU will execute power saving halt instructions, enter NAP mode and even disable the timers.

The CPU itself will supports different operating modes like WAIT, STOP, Standby and Deep sleep mode etc. The “WAIT” mode of the CPU will be triggered by “Idle process of operating system”; the “STOP” mode of the CPU will triggered by OS when system is waiting for operation. When there is a limited interaction with external events standby mode will be triggered. In similarly way the deep sleep mode will be triggered after surpassing the “STOP” mode.

The runtime power management deals with enabling functionalities which allows IO devices to be put into energy saving state; at run-time after a specified period of inactivity and woke up in response to a hardware generated wake-up event or a driver request.
The dynamic voltage and frequency scaling is one of the effective power management technique which allow you to control the CPU frequency and implied voltage dynamically. This mechanism in kernel is supported by “cpufreq” kernel infrastructure.

The generic governors supported by “cpufreq” kernel infrastructure are

  • Performance: CPU will be instructed to operate at its maximum frequency
  • Powersave: CPU will be instructed to operate at its minimum frequency.
  • Ondemand: CPU frequency will be adjusted based on the load.
  • Conservative: CPU frequency will be adjusted gradually based on the load.
  • Userspace: Demon utility present in userspace will take care of adjusting CPU frequency.

In addition to power management techniques supported at kernel level, we also have power management techniques supported at android application level. Although the android stack is based on Linux kernel, but Google added several features to Linux kernel to support android one of the feature is “power driver” which corresponds to power management.

This feature is introduced to Linux kernel because, as we know the android devices will have limited battery life and more importantly the power saving features are lot different than personal computers. Any application which requires CPU resources is channelled through application framework layer of android and native Linux libraries. The application framework layer provides set of power management APIs which can be utilized by application layer (applications).

The locking mechanism known as “wake lock” will be used by application and services to request CPU resources. The application framework layer is equipped to support two types locking constructs WAKE_LOCK_SUSPEND and WAKE_LOCK_IDLE each with different functionality.

Power Management Block Diagram

The WAKE_LOCK_SUSPEND prevents full system suspend whereas WAKE_LOCK_IDLE is low power sate, which often cause large interrupt latencies or that disable a set of interrupts . The device will not enter into to idle state unless the wake locks acquired by application is released.

In block diagram we might notice “android_register_early_suspend()” and “android_register_early_resume()” these functions corresponds to platform hook functions mentioned in early stage. After learning about wake lock mechanism we might think that “How exactly the wake-lock helps in reducing power consumption?” because it only prevents the system from entering into various idle mode operation supported by CPU.

The android always tries to put the system into sleep or even better suspend mode as soon as possible. Some of the mission critical application requires the system to be up and running for long period of time (important update or a critical download etc...). The PARTIAL_WAKE_LOCK ensures that the CPU is running; the screen and keyboard backlight will be allowed to go off.

In addition to making use of power management architecture supported by android kernel and android application layer framework, we can implement additional mechanisms which make use of these to enable efficient power management.

  • Techniques like using the proximity sensors of the device to adjust the brightness of LCD to reduce battery consumption.
  • Making use of the external power management chip which can reduce the voltage level of peripherals based on the CPU state; if the CPU is no longer active then, reduce the voltage levels of peripherals interfaced to it.
  • Using core regulator for processor which can reduce the voltage level required for core and memory when the CPU is in idle state; restoring it back to original state when CPU is active.
  • Mechanism to monitor applications which is consuming more power and reporting it to user who can either terminate or uninstall it.
  • Wi-Fi, GPS and other power hungry devices can be controlled by implementing sophisticated algorithms which can reduce the battery usage. 

Somashekar
iWave Systems Technologies Pvt. Ltd.