Advanced embedded power management based on open source software

Source: Internet
Author: User

Power Management (or energy consumption management) is a research topic for chip design, manufacturing process, system design, and software, we strive to minimize static and dynamic power consumption in each phase. The traditional voltage control and management standby modes are still being adopted by most electronic devices and will continue. However, with smart phones, navigation devices, and wireless sensor network devices, with the rapid increase in the market scale of devices that consume a lot of power and are always online, power management has become an important topic for the entire electronic design. "Power consumption has become the primary consideration for electronic product design," said Jordan selburn, chief analyst at iSuppli, a market research institute ."

Linux has proved to be an embedded operating system that is widely used in embedded systems, especially in consumer electronic products. It is recognized by semiconductor companies, design companies and equipment manufacturers for its rich features, comprehensive functions, the latest hardware support and royalty-free business models. In addition to further optimizing the performance, compressing the size, and improving the reliability of the Linux technology in consumer electronic products, building a sound and elastic power management system has become an increasingly important project and requirement, it will also become an important tool for Linux to replace traditional RTOS, WinCE/mobile, and Symbian, and occupy the leading position of the open-source software (OS) of consumer electronics.

Linux power management quality service

Currently, we have published Linux versions 2.6.24 and 2.6.25, which contain the following embedded technologies. Lttng (linuxtrace tool); Power Management Quality Service (PM QoS, also known as qospm); kpagemap-an application in userspace that can measure memory consumption in more detail; latency measurement API-a latency measurement API is also the foundation of latencytop. This tool's sister combination is called powertop's power analysis software, which is a useful power management tool, you can analyze the power consumption of each specific application. Recently, commercial embedded Linux company Meng Avista transplanted it to mobilinux5.0 to support the arm structure. Smack, a simple access control security module, is worth trying to use in embedded systems.

Here, we will focus on PM QoS. The purpose of constructing PM QoS is to provide a mechanism for inter-hardware access so that the application can provide power management resource information when performance is required. In terms of implementation, it builds a new kernel structure to complete the communication between drivers, systems, and applications that require latency and throughput performance.

The current version of PM QoS has three parameters (pm_qos_params.c): cpu_dma_lantency, network_latency, and network_throughput. Pm_qos_init () can be used to add new parameters in the kernel. Using PM QoS in userspace is like a feature of the driver file. Open the driver file and change the latency parameter equivalent. After the file is written, closing the file means that the request to the kernel is canceled and automatic protection is enabled to avoid damage to the kernel system due to possible downtime.

In kernel APIs, there are requireand notifier interfaces. These parameters are represented by drivers that require latency and throughput performance. Typical applications include a Driver (iw14965) with a pm_qos wireless network card developed by Intel open source lab ). The wireless chip has six Power Supply Configuration points, which can affect the power of the antenna and set parameters such as the speed of entering the wireless sleep and the distance between the Wireless AP sites, this application uses the delay parameter of PM QoS, which is very suitable. Currently, this driver is related to the driver and is mounted through sysfs, the driver simply needs to register and inform the requirements for changing the network latency parameter, and then switch to the desired power management layer.

PM QoS currently has three main applications. The first is the idle CPU management, which can be used for components with high power consumption and relative latency, such as audio, hard disk, USB, and display. For example, if the image does not require high resolution, you can disable the hardware acceleration function. However, hardware acceleration is delayed when enabled, you can set proper latency to save power without affecting usage. The second is the WiFi application. The third is Gigabit Ethernet. PM QoS can help control network latency and bandwidth requirements to save power when available. For example, the Network Browser can be set to 2 S latency and the mail client's network latency is 0.5s. PM QoS is still very preliminary, and now the main applications are network and Internet terminals. I believe there will be more and more drivers and applications supporting PM QoS in the future after the Linux kernel is entered, power Management for embedded system devices is an option.

Dynamic Voltage and Current Control interfaces of Linux kernel

As mentioned above, the power consumption of semiconductor devices is composed of two parts: static power consumption and dynamic power consumption. Static power consumption mainly comes from the leakage current in the STANDBY state. Compared with the dynamic power consumption, the power consumption is greater. For example, the increase in the frequency and voltage in audio/video playback will make the power usage grow linearly, dynamic power consumption is also the main problem to be solved in power management. There are several ways to solve dynamic power consumption, such as the development of DPM projects by IBM and montavista (currently used in the mengavista mobilinux 5.0 product) and Linux Power Management of Ti omap3430. Liam Girdwood of Wolfson Microelectronics recently introduced a method of dynamic voltage and current control called regulator, which is of great reference and practical value.

1. Basic concepts of the collimator

The so-called calibration tool is to carefully adjust the input power supply under software control. For example, for Voltage Control, the 5 V output at input is 1.8 V; the current limit is 20mA; the maximum is; simple switching and power switch are shown in 1.

 

Figure 1 calibration Tool

The power supply field is a set of schedulers. The device composition and input may be the collimator, the switch may be the power supply field, the power supply field can be cascade, and the power supply constraint can work with the power supply field to protect hardware. For example, an Internet tablet/PMP consists of CPU, nor flash, audio codecs, touch screens, LCD controllers, USB, WiFi, and other peripherals, as shown in figure 2.

 

Figure 2 Internet tablet/PMP System Structure

To achieve the above idea, we need to establish a calibration framework in the kernel to design a standard kernel interface that can control voltage and current to save energy and prolong the battery supply as much as possible. The architecture of this kernel is divided into four parts: the consumer interface for the device driver (consumer), the interface for the calibration driver, the interface configured by the system, and the userspace interface for the Application sysfs.

2. Consumer API

Regulator = regulator_get (Dev, "VCC ");

Dev is a string of the "VCC" device. The regulator returns a pointer, which is also used by regulator_put (regulator.

The following describes how to enable and disable the regulator API.

Int regulator_enable (regulator );

Int regulator_disable (regulator );

3. Voltage API

Consumers can apply for the voltage provided to them, as shown below.

Int regulator_set_voltage (regulator, int min_uv, int max_uv );

Check the constraints before changing the voltage, as shown below.

Regulator_set_voltage (regulator, 100000,150000)

The following changes are made to the voltage values.

Int regulator_get_voltage) struct regulator * regulator );

4. Current API

The current API is similar. It should be noted that the calibration tool method is not necessarily the most efficient, and the efficiency is related to loading (such as loading 10mA current) and operation mode, you can use the following API to change the mode settings.

Regulator_set_optimum_mode (requlator, 10000); // 10mA

5. Driver and system configuration of the collimator

Before using the collimator, you need to write the driver of the collimator according to the following structure, and then notify the consumer to use it after registration.

Struct regulator_ops {

/* Get/set regulator voltage */

INT (* set_voltage) (struct regulator_cdev *, int UV );

INT (* get_voltage) (struct regulator_cdev *);

/* Get/set regulator current */

INT (* set_current) (struct regulator_cdev *, int UA );

INT (* get_current) (struct regulator_cdev *);

/* Enable/disable regulator */

INT (* enable) (struct regulator_cdev *);

INT (* disable) (struct regulator_cdev *);

INT (* is_enabled) (struct regulator_cdev *);

/* Get/set regulator operating mode (defined in regulator. h )*/

INT (* set_mode) (struct regulator_cdev *, unsigned int mode );

Unsigned int (* get_mode) (struct regulator_cdev *);

/* Get most efficient regulator operating mode for load */

Unsigned int (* get_optimum_mode) (struct regulator_cdev *, int input_uv,

Int output_uv, int load_ua );

};

After the collimator driver is completed, the next step is the system settings (such as voltage, ldo1, and NAND.

Regulator_set_supply ("ldo1", Dev, "VCC ")

For userspace, the calibration tool uses sysfs, but currently all information including voltage, current, operation mode, and restrictions is read-only, it should be very suitable for tools like powertop.

6 Applications

Typical applications of the calibration tool include: cpufreq -- CPU frequency adjustment; CPU idle -- CPU idle mode control; LCD backlight Adjustment -- controlling the brightness of LED lights through current to control the LCD backlight; audio unit-for example, the FM radio should be closed when MP3 is used, while the speaker amplifier should be closed when the microphone is used, and the NAND/nor memory is a large power-consuming device, optimize the operation mode (control current) according to different operation modes (read/write, erase, etc.) to save power. Compared with other power management methods, the calibration tool has a certain degree of hardware independence and abstraction, which is simple and practical. In principle, it can be suitable for any power management chip that supports embedded system power management, it has been transplanted to several highly integrated power management devices such as Freescale mc13783 and Wolfson wm8350/8400.

Component-based CPU-oriented Power Management Technology

Whether it's the pm_qos, voltage and current control calibration method, or the Linux BSP Power Management Section that many semiconductor companies support their CPU and power management chips, there is no component-level embedded system power solution or commercial product built on a higher level. Although CELF (consumption and embedded Linux Forum) and Intel-led mobile & Internet Linux projects have set up a dedicated power manager project ), however, it is clearly far from people's requirements and practical applications.

Based on the past joint development of DPM (Dynamic Power Management) technology with IBM, recently, the component method of embedded power management technology was proposed on mobilinux5.0, which is specially designed for mobile phones, Internet mobile terminals, PMP/pdn and other portable consumer electronic devices. The component mode of montavista is mainly for the next-generation embedded systems with advanced multimedia application processors as the core, such as Freescale mx31 and Ti omap2430/3430 as the core system-level power management, it contains the following main parts.

1. Dynamic voltage and frequency adjustment

As mentioned above, the increase in voltage and frequency will linearly increase the power consumption, an Effective Method for greatly reducing power consumption by adjusting the voltage and frequency to an appropriate operation point according to the design requirements and application instructions. To achieve dynamic voltage and frequency adjustment (dvfs), The cpurefs subsystem is a key component in the kernel, as shown in figure 3.

 

Figure 3 cpurefs Structure

So what is the change in operation of a manager (governor? Performance requirements, power-saving requirements, user applications, CPU usage efficiency, and other conditions can allow managers to change the operation mode. Mobilinux5.0 provides the userspace mechanism to act as the manager's job, that is, the application can change the Operation Point.

In Ti omap3, there is a technology called smartreflex that dynamically adjusts the vdd1 and vdd2 operating points to adapt to chip characteristics, temperature, and voltage. Smartreflex technology has four levels: Level 0-operation points set after optimization calibration during factory production; Level 1-operation points calibrated after optimization during pilot; level 2: Real-time voltage points are optimized through software cycles and then set by the CPU interrupt program; Level 3: completely optimized hardware cycle voltage points without CPU intervention, it is a hardware control "Dummies" Operation point change method. Both mobilinux5.0 and Ti 3430 Linux distribution support dvfs and smartreflex drivers.

2. Suspension and recovery

In the kernel, mobilinux5.0 has provided the support for pending and restoring drivers. New drivers must add callback functions to respond to the shutdown and wakeup actions in System sleep.

3. Drivers supporting power management

Each driver must be re-written to support dvfs, that is, when the operation point changes, the driver responds through the notification of cpurefs. The driver must also properly handle system suspension and recovery events.

4 CPU idle adjustment

A cpu idle driver is managed by a CPU-specific idle state, a CPU idle framework of the kernel, and a manager. For example, omap3430 defines seven Idle State points.

5. Application Design strategies

The main energy consumption distribution of portable consumer electronic products, including mobile phones, is shown in figure 4.

 

Figure 4 energy consumption distribution of portable electronic products

In addition to CPUs, LCD backlight, nor/NAND Flash/RAM memory, DC/DC conversion, and audio/video amplifiers are the main energy consuming devices. For example, playback of MPEG4 is a centralized application.

How to use commercial embedded operating systems such as mobilinux5.0 with power management functions to minimize the energy consumption of portable electronic products? The following method should be considered by the designer.

· The actual measurement results show that using dvfs is the key to reducing the energy consumption during CPU operation. Of course, the design personnel should fully consider how to set operation points and status transfer for managers.

· Do not ignore the energy consumption management of idle CPU. Cpurefs of mobilinux5.0 and all drivers have supported idle scaling, and the kernel uses a dynamic tick clock (Dynamic tick ), in the past, the CPU was awakened at a fixed time, whether or not it was running, greatly saving energy.

· A delayable timer (deferrable timer)-It tells the kernel that a timer does not need to be awakened when the time limit is reached, which can reduce energy consumption.

· Powertop tool-the tool mentioned above has been integrated into mobilinux5.0 and proved to be a very useful tool for analyzing the idle state of the system.

Conclusion

The above describes how to implement a large number of Linux-based power management technologies, we should acknowledge that the power management technology of embedded operating systems, such as WinCE, mobile, and Symbian, is more complete and easy to use, however, compared with open-source Linux, flexibility and openness are much inferior. More importantly, power management is a system-level design, not just software design. Linux power management that keeps track of technological developments will be favored by more and more designers, after the Linux operating system is used to optimize power management, the electronic products will be more energy-efficient and long-term. (He Xiaoqing, Beijing mctai Software Technology Co., Ltd)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.