Green up: Strategies for dynamic power management using embedded Linux
October 01, 2009
Designers can leverage Linux's capabilities to deliver power savings without sacrificing performance.
Device makers are facing a challenge as consumers are demanding full functionality in their devices and mobile devices are becoming more complex and feature-rich. In addition to full functionality, consumers want the convenience of long-lasting battery life. Unfortunately for device makers, these two design goals can only be achieved at the expense of one another. As developers are being pulled in these two separate directions, what can be done to ease their pain?
The dichotomy of performance versus power savings can be maddening as design teams try to deliver both to demanding consumers. Fulfilling these requests means constantly pushing the boundaries of what is possible in performance while squeezing every bit of battery life out of their builds. Fortunately, design teams have resources at their fingertips that enable them to do just that. The following discussion offers insight into how device makers can maximize power savings in handheld devices through the dynamic power-management capabilities of embedded Linux.
The case for power management
Power management is a system-wide design goal that requires the coordination and cooperation of the hardware, kernel, and user-space applications. By offering options for power savings while the CPU is active as well as when it is inactive, Linux provides engineers with several tools that enable them to maximize power savings in their design builds.
But why is power management so important? To begin with, power-management capabilities are a consumer priority. End users expect long-lasting battery life in their mobile devices regardless of the device’s end use, be it voice, video, music, or Web access. Because power management is a necessity for manufacturers that want to win in the market, they must highlight long battery life as a top feature. An engineer’s ability to deliver on those expectations can make the difference between winning in the market and being an also-ran.
Developing a solid power-management strategy that maximizes power savings is a critical step early in the design process. The idea is to plan power savings in a way that is transparent to the end user. This is where a clear strategy is imperative, given that energy-saving methods always trade performance or functionality for energy. Ways that some successful design engineers do this is by scaling back performance when the processor is not busy or putting a peripheral in standby mode when it is not being used.
The global view
When building a power-management strategy, it is important to take a global view of power consumption to extract the most power savings possible in a time-efficient manner. Paying attention to all of the big power consumers in the system instead of making complex optimizations to the algorithms that already provide sufficient returns yields a better return on effort.
For example, think about the major sources of power consumption in an average mobile device. The breakdown shows that the System-on-Chip (SoC) is only one component of the whole strategy. The complete power picture encompasses other substantial energy consumers, including the backlight, DC-to-DC converters, power amplifiers, and others.
The CPU is a major source of power dissipation in an embedded system, and its power usage must be carefully regulated to attain aggressive power-management goals such as long battery life. CPUfreq and CPUidle are systems in the Linux kernel that manage CPU power usage through a technique known as Dynamic Power Management (DPM).
The premise of DPM is that systems experience nonuniform workloads during operation. As such, DPM encompasses a set of techniques that achieves energy-efficient computation by selectively turning off system components or reducing their performance when they are not completely necessary or needed at full capacity. CPUfreq provides the framework for power-efficient design by dynamically scaling the CPU’s voltage and frequency in response to the system’s changing performance requirements. CPUidle controls which of the low-power idle states to enter when the CPU has no work to do.
Working the plan: DPM first, then deeper
Dynamic power management can be implemented in the design process at two critical points: while the CPU is active and while the CPU is inactive.
· While the CPU is active: This can be achieved using a technique known as load scaling. Dynamically scaling the processor’s voltage/frequency while it is executing code can save significant power. Using a plug-in control algorithm known as a governor, the voltage/frequency can be adjusted according to any number of indicators, including workload.
· While the CPU is inactive: This can be done through another technique known as idle scaling. Idle scaling involves entering one of the processor’s low-power states when the system is idle and then returning to an active state (as controlled by CPUfreq) when there are instructions to execute.
For maximum effect, both techniques can be used together. As one can imagine, when idle- and load-scaling strategies are applied simultaneously, the potential for power savings is significant. Both strategies have proven to be effective; they are true workhorses.
More esoteric strategies yield incremental improvements. These typically are not worth the effort. When a strategy known as application scaling is applied to an embedded system doing MPEG-4 playback, only an additional 4 percent power is saved over the load-scaling strategy.
Application scaling requires the playback application to be modified to implement a technique called work ahead. After decoding the frame, the work-ahead algorithm immediately starts decoding the next frame at a lower operating point. It continues to work ahead, decoding future frames at the more power-efficient operating point until it notices it is in danger of missing a deadline, at which time it throttles the system to a higher level of performance to catch up. This complex optimization achieves only small power savings over the load-scaling strategy. Commercial Linux solutions offer out-of-the-box support for both the idle- and load-scaling techniques, which frees designers to investigate and reduce the power consumption of other parts of the system.
Plan ahead for power
The need for power management is not going away; on the contrary, it is becoming an increasingly important feature in mobile device design. Design teams that build with a strong power-management strategy can leverage Linux’s capabilities to deliver the power savings that consumers demand without having to make unacceptable sacrifices in performance.
Creating a power-savings strategy early in the design process, taking a global view of power consumption, and leveraging power savings both while the CPU is active and while it is idle are just the beginning. Other considerations and strategies on the important topic of power management exist, so be sure to further investigate this technology for upcoming projects.
Troy Kitch is senior product line marketing manager at MontaVista Software, based in Santa Clara, California. Troy has spent more than a decade in the development and security software industries, focused on developer productivity, data storage, and disaster recovery. At MontaVista, Troy is responsible for helping organizations get the most out of open source by communicating the value of MontaVista Linux in embedded systems. Troy has a BS in Agribusiness from Cal Poly, San Luis Obispo.
MontaVista Software
408-572-8000
[email protected]
www.mvista.com