UserGuidePowerMgmt PSP 03.00.00.05

From Texas Instruments Wiki
Jump to: navigation, search

Power Management

Introduction

OMAP35x and DM37x provide a rich set of power management features. These features are described in detail in the respective technical reference manuals (TRMs).

In summary, both silicons support:

  • Clock control at the module and clock domain level.
  • Multiple power domains i.e. one or more hardware modules sharing same power source.
  • Control of scalable voltage domains.
  • Independent scaling of OPPs for the VDD1 and VDD2.
  • Support for transitioning power and voltage domains to retention/off.
  • Wakeup on an event.

References

  1. Proceedings of the Linux Symposium, June 27-30, 2007
    Authors: Venkatesh Pallipadi, Shaohua Li, Adam Belay
  2. OMAP Power Management
    Power Management features are being developed on pm branch of the linux-omap git tree. This page provides latest status of PM features on this branch.

Features

The power management features available in this release are based on the proposed PM interface for OMAP. This interface is described in the file Documentation/arm/OMAP/omap_pm in the Linux kernel sources. The features supported in this release are:

  • Dynamic Tick (NO_HZ) framework.
  • The cpuidle framework with MPU and Core transition to retention (RET) and OFF states.
    • The menu governor is supported.
  • Static selection of VDD1 OPP via bootarg - mpurate.
    (The feature is described in section Understanding boot arguments of the User Guide).
    • VDD1 OPP can be scaled (if silicon supports) upto 720MHz.
    • When OPP1 is selected for VDD1, the VDD2 is set at OPP2.
  • Basic implementation for cpufreq.
  • Support SmartReflex with automatic (hardware-controlled) mode of operation.

Architecture

cpuidle

The cpuidle framework consists of two key components:

  • A governor that decides the target C-state of the system.
  • A driver that implements the functions to transition to target C-state.

System Diagram

Cpuidle.png

The idle loop is executed when the Linux scheduler has no thread to run. When the idle loop is executed, current 'governor' is called to decide the target C-state. Governor decides whether to continue in current state/ transition to a different state. Current 'driver' is called to transition to the selected state.

C-states

A C-state is used to identify the power state supported through the cpu idle loop. Each C-state is characterized by its:

  • Power consumption
  • Wakeup latency
  • Preservation of processor state while in 'the' state.

The definition of C-states in the OMAP3 are a combination of the MPU and CORE states. Currently these C-states have been defined:

C-states in OMAP3
State Description
C1 MPU WFI + Core active
C2 MPU WFI + Core inactive
C3 MPU RET + Core inactive
C4 MPU OFF + Core inactive
C5 MPU RET + CORE RET
C6 MPU OFF + CORE RET
C7 MPU OFF + CORE OFF

CPU Idle Governor

The current implementation supports the 'menu' governor to decide the target C-state of the system.

CPU Idle Driver

The cpuidle driver registers itself with the framework during boot-up and populates the C-sates with exit latency, target residency (minimum period for which the state should be maintained for it to be useful) and flag to check the bus activity.

In ACPI implementation, flag CPUIDLE_FLAG_CHECK_BM is used to specify the states requiring bus monitoring interface to be checked. In the OMAP3 implementation, this flag is used to identify the C-states that require CORE domain activity to be checked.

Once the governor has decided the target C-state, the control reaches the function omap3_enter_idle(). Here, the C-state is adjusted based on the value of valid flag corresponding to the chosen state./

Note
The value of valid flag for the idle states relates to the flag enable_off_mode. If transition to OFF mode is disabled, the idle states that require MPU to be turned OFF are made valid.

Performance considerations

Once idle power management is enabled, the system will transition across sleep states of varying latency. This transition can impact the runtime performance of the drivers. The flags sleep_while_idle and enable_off_mode can be used to control the run-time behavior of the cpuidle driver. are now accessible via debugfs.

Important
In previous kernel versions, these flags were accessible via sysfs. In this kernel version, these flags can be accessed via debugfs, if configuration options CONFIG_PM_DEBUG and CONFIG_DEBUG_FS are chosen.

See Configuration for steps to enable these configuration options.

Dynamic Tick Suppression

The dynamic tick suppression is achieved through generic Linux framework for the same. A 32K timer (HZ=128) is used by the tick suppression algorithm.

Suspend & Resume

The suspend operation results in the system transitioning to the lowest power state being supported. The drivers implement the suspend() function defined in the LDM. When the suspend for the system is asserted, the suspend() function is called for all drivers. The drivers release the clocks to reach the desired low power state. The actual transition to suspend is implemented in the function omap3_pm_suspend().

Configuration

To enable/ disable power management start the Linux Kernel Configuration tool.

$ make menuconfig

Select Power management options from the main menu.

...
...
Boot options  --->
CPU Power Management  --->
Floating point emulation  --->
Userspace binary formats  --->
Power management options  --->
[*] Networking support  --->
Device Drivers  --->
...
...

Select Power Management support to toggle the power management support.

[*] Power Management support
[ ]   Power Management Debug Support
[*] Suspend to RAM and standby
< > Advanced Power Management Emulation

Debugging support in Power Management

Start the Linux Kernel Configuration tool.

$ make menuconfig

Select Power management options from the main menu.

...
...
Floating point emulation  --->
Userspace binary formats  --->
Power management options  --->
[*] Networking support  --->
Device Drivers  --->
...
...

Select Power Management support from the next menu.

[*] Power Management support
[*]   Power Management Debug Support
[*] Suspend to RAM and standby
< > Advanced Power Management Emulation

Enabling debug filesystem

Start the Linux Kernel Configuration tool.

$ make menuconfig

Select Kernel hacking from the main menu.

File systems  --->
Kernel hacking  --->
Security options  --->
-*- Cryptographic API  --->

Select Debug Filesystem from the next menu.

[ ] Enable unused/obsolete exported symbols
[*] Debug Filesystem
[ ] Run 'make headers_check' when building vmlinux
[*] Kernel debugging


cpuidle

Start the Linux Kernel Configuration tool.

$ make menuconfig

Select CPU Power Management from the main menu.

...
...
System Type  --->
Bus support  --->
Kernel Features  --->
Boot options  --->
CPU Power Management  --->
Floating point emulation  --->
Userspace binary formats  --->
...
...

Select CPU idle PM support to enable the cpuidle driver.

[ ] CPU Frequency scaling
[*] CPU idle PM support

cpufreq

Start the Linux Kernel Configuration tool.

$ make menuconfig

Select CPU Power Management from the main menu.

...
...
System Type  --->
Bus support  --->
Kernel Features  --->
Boot options  --->
CPU Power Management  --->
Floating point emulation  --->
Userspace binary formats  --->
...
...

Select CPU idle PM support to enable the cpuidle driver.

[*] CPU Frequency scaling
[ ] CPU idle PM support

SmartReflex

Start the Linux Kernel Configuration tool.

$ make menuconfig

Select System Type from the main menu.

...
...
[*] Enable the block layer  --->
System Type  --->
Bus support  --->
Boot options  --->
CPU Power Management  --->
...
...

Select TI OMAP Implementations from the menu.

ARM system type (TI OMAP)  --->
TI OMAP Implementations  --->
-*- OMAP34xx Based System
-*-   OMAP3430 support
[*] OMAP35x Family
...
...

Select SmartReflex support from the menu.

...
...
[ ] Emit debug messages from clockdomain layer
[*] SmartReflex support
[ ]   SmartReflex testing support
...
...

Software Interface

The cpuidle framework defines a standard interface through /sys interface.

Mounting debug filesystem

To mount the filesystem, execute these commands:

$ mkdir /dbg
$ mount -t debugfs debugfs /dbg

Note
The commands in this document assume /dbg as mount point. Appropriate changes should be made if a different mount point is being used.

cpuidle

The parameters controlling cpuidle can be viewed via via /sys interface.

$ ls -1 /sys/devices/system/cpu/cpuidle/
current_driver
current_governor_ro
$

current_governor_ro lists the current governor.

$ cat /sys/devices/system/cpu/cpuidle/current_governor_ro
menu
$

current_driver lists the current driver.

$ cat /sys/devices/system/cpu/cpuidle/current_driver
omap3_idle
$

The cpuidle interface also exports information about each idle state. This information is organized in a directory corresponding to each idle state.

$ ls -1 /sys/devices/system/cpu/cpu0/cpuidle
state0
state1
state2
state3
state4
state5
state6
$
$ ls -1 /sys/devices/system/cpu/cpu0/cpuidle/state0
desc
latency
name
power
time
usage

Idle state transition

To allow/prevent the processor to enter idle states, execute these commands:

$ echo 1 > /dbg/pm_debug/sleep_while_idle
$ echo 0 > /dbg/pm_debug/sleep_while_idle

To allow/ prevent transition to OFF mode:

$ echo 1 > /dbg/pm_debug/enable_off_mode
$ echo 0 > /dbg/pm_debug/enable_off_mode

Suspend & Resume

The suspend for device can be asserted as follows:

$ echo -n "mem" > /sys/power/state

To wakeup, press a key on the OMAP3EVM keypad; or tap any on the serial console.

SmartReflex

To enable/ disable SmartReflex for VDD1:

$ echo 1 > /sys/power/sr_vdd1_autocomp
$ echo 0 > /sys/power/sr_vdd1_autocomp

To enable/ disable SmartReflex for VDD2:

$ echo 1 > /sys/power/sr_vdd2_autocomp
$ echo 0 > /sys/power/sr_vdd2_autocomp