Introduction to low power strategy for Embedded Linux

Source: Internet
Author: User
Tags apm
An overview of the low-power strategy for Embedded Linux-Linux general technology-Linux programming and kernel information. For more information, see the following. Abstract: power consumption is a very important performance indicator of embedded devices. After the hardware design and selection, the power consumption level depends greatly on the software design. In view of the increasing application of Lioux in embedded devices, several software programming strategies are proposed in embedded Linux. These software compilation methods can effectively reduce the power consumption of the final product.

Introduction

Linux has many characteristics that are required by embedded operating systems, such as adaptability to multiple CPUs and multiple hardware platforms, stable performance, good cropping ability, open source code, simple development and use. At present, the number of embedded devices based on Linux applications is increasing, and Linux is playing an increasingly important role in the embedded field.

For embedded devices, especially mobile devices, power consumption is an important indicator of the system. One of the important objectives of system design is to minimize power consumption. At present, the research on power consumption is mainly focused on hardware solutions, and there is little research on software. Practice has proved that after the hardware design and selection are determined, the power consumption is highly correlated with the software design. The quality of software design and programming greatly affects the power consumption of final products. To reduce power consumption, several software programming strategies are proposed in embedded Linux.

1. Problem Analysis

Because the final energy consumption is hardware, when considering the use of software methods to reduce power consumption, we should fully consider the features and performance of the hardware, that is, how to organize hardware operations to reduce power consumption on the basis of ensuring system implementation. Full-speed execution, standby, and sleep all use the inherent capabilities of the CPU to reduce power consumption by reducing the operating voltage or frequency. In addition, if most users do not notice it, the actual power management can gradually change the system status according to the load status. Sometimes this situation can be generated several hundred times within 1 s.

In addition, you may encounter such a situation when writing a program, such as recording the Status Register content and waiting for the set mark to appear; check the FIFO status mark of the serial port to see if the data is received; monitor a dual-port memory to check whether another CPU has written a variable in the system to control shared resources. On the surface, there is no problem with such code, but recording register status continuously during each clock cycle will not be able to effectively prolong the battery life of the device.

Based on these problems, several strategies are proposed below to effectively reduce the power consumption of the final product.

2. Use Linux kernel Power Management

The basis of the power management policy is to adjust the operating voltage and frequency of the processor kernel. However, the modern embedded CPU has a very high power efficiency, so that the CPU is not always the most important energy-consuming component. Other high-energy-consuming components include high-performance memory, display, and RF interfaces. Therefore, if the power management system can only adjust the voltage and frequency of the CPU kernel, its usage will be limited. A truly effective power management solution should be able to coordinate or be independent of CPU kernel execution, supporting fast adjustment of a series of voltages and frequencies.

Linux supports two power management standards: APM (AdvancedPower managemim) and ACPI (Advanced configtlationand P0wer Interface ). APM is a traditional advanced power management solution that is still used in many Linus-based portable devices, while ACPI provides more flexible interfaces for computer and device management. These two standards cannot run simultaneously. By default, Linux runs ACPI. APM can enable the server to be In the Suspend or Standby status and check the battery capacity. ACPI can also enable independent power outages for peripherals (such as monitors and PCI, more control over power saving. To make the power management function take effect, you need to enable it in the Linux kernel and load necessary application software in Linux.

Power Management activities require special intervention on the operating system kernel and device drivers. In Embedded Linux, although the low-level power management reside in the operating system kernel, the power management policies and mechanisms come from the intermediary software and user application code, as shown in l.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // linux.ccidnet.com/col/attachment/2006/12/953085.jpg'); ">



The power management mechanism in Linux kernel is responsible for maintaining the power status of the entire system. It can be seen as an element that provides services for drivers, intermediary software, and applications.

By implementing the power management interface in the driver, the driver can closely monitor the system status. Driven by external events, they reflect the work of devices by setting different states. To implement the device power management interface, perform the following operations:

① Use pm_register to register each instance of the device;

② Call pm_access before operating the hardware (this ensures that the device has been awakened and is in ready state );

③ The user's own pnl_callback function will be called when the system enters the suspend state or recovers from the suspend state;

④ Call the pm_dev_idle function when the device is not in use (this operation is optional to enhance the monitoring capability of the device's idle status );

⑤ When unIoad is used, use pm_unreggister to cancel the registration of the device.

The intermediary allows you to pre-define certain policies, track power status, and perform specific operations.

In an application, you can use the APIS provided by the intermediary program to set basic constraints and force the power management mechanism to make changes that match the execution requirements. Linix power management implementation mechanisms include the following APIs, such as dpm_set_ OS () (kernel), assert_constraint (), remove_constraint () and set_operatInK-state () (kernel and driver), set_policy () and set_task_state () (called by the System user) and/proc interface.
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.