Category:How to - Low Power
Contents
Status
This page is a work in progress. Many users are running Gumstix COMs in power sensitive applications and need to reduce power consumption as much as possible. This page is being developed by the Gumstix community as the steps are learned for reducing power.
Relevant Emails
sample numbers for Overo Earth COM power consumption
Building a linux omap3 pm for Overo
Background
The default omap3 openembedded build does not provide an optimal setup for power reduction on Gumstix Overo COMS. In order to achieve the lowest power possible for your application, you have to perform a combination of the following:
- Use the latest OMAP Power Management (pm) kernel branch
- Enable power saving features such as sleep when idle, off mode, and dvfs
- Disable internal OMAP devices
- Hold unused external chips such as USB, Wifi, Bluetooth, etc. in reset
- Turn off unused LEDs
PM Kernel
The PM kernel is a development branch of the linux-omap kernel focused on developing the power management features of OMAP. Many of the changes of the PM branch have been merged to the mainstream linux-omap branch. Not all changes have been merged though so you must manually configure openembedded to use the PM kernel instead of the mainstream branch.
Compile PM Kernel
NOTE: The linux-omap-pm bitbake recipe is setup to use the 2.6.29 branch + patches. This is significantly older than the 2.6.36 kernel available in the open embedded build. The 2.6.36 contains most of the changes in the 2.6.29 branch. For the best power savings you'll need to follow the alternate method below.
TODO: Figure out how to update recipe for latest PM branch.
To enable the PM kernel edit the file
org.openembedded.dev/conf/machine/overo.conf
and change the line
PREFERRED_PROVIDER_virtual/kernel = "linux-omap3"
to
PREFERRED_PROVIDER_virtual/kernel = "linux-omap-pm"
Save the changes and then run bitbake as usual e.g.
$ bitbake omap3-console-image
The pm branch will be downloaded and compiled.
Once you have the PM kernel built, follow the instructions for copying the new image and filesystem to your microSD card.
PM Kernel Alternate Method
There is an alternate method for building the omap-pm kernel taken from Peter Lawrence on the Gumstix mailing list.
NOTE: As per the comments below, this method disables nand and microSD access.
TODO: See how to get nand and microSD working with the latest PM kernel.
Here are steps to build the kernel "the traditional way". 1) Download and install cross-compiler tools: The easiest solution is to download the CodeSourcery binaries: http://www.codesourcery.com/sgpp/lite/arm CodeSourcery provides an install program. (You'll have to set the executable bit on the file to run it.) Note that the CodeSourcery install modifies .bash_profile to add the path, but this file does not run automatically in Ubuntu. To fix this, refer to: http://www.linuxquestions.org/questions/linux-general-1/do-i-put-path-in-bash_profile-or-bashrc-or-both-540288/ which says: "You can change the second by opening a gnome-terminal window and going to Edit / Profiles - select the Default profile and click the Edit button. On the Title and Command tab, click the check box for Run command as a login shell. Your .bash_profile file should be sourced the next time you open a gnome-terminal." 2) Get latest Linux OMAP PM code "git" the latest code: git clone git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git The result will be in the subdirectory "linux-omap-pm". 3) Build the OMAP3_PM Linux Kernel Extract the download Linux kernel code and cd to that directory. The command sequence is: export ARCH=arm make omap3_pm_defconfig This creates a .config file suitable for Linux OMAP3 PM. TBD: patch the .config file for JFFS2 and SD card export CROSS_COMPILE=arm-none-eabi- make uImage [this takes a very long while] The resultant kernel file will be in: ./arch/arm/boot/uImage 4) Download the initramfs filesystem Obtain "rd-ext2-8M.bin" from: http://code.google.com/p/beagleboard/downloads/list 5) Create a bootable MicroSD card Follow the [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/111.html instructions here]. However, one can omit the "MLO" and the "u-boot.bin" files. One should, however, copy over the "uImage" file created in step #3, and the "rd-ext2-8M.bin" (as "rd-ext2.bin") created in step #4. 6) Boot the Overo Use the "Press any key" prompt at boot to operate the U-Boot app. Enter the following commands: (these commands must be done individually, as U-Boot does not have a large enough buffer for the entire quantity to be pasted at once) mmc init fatload mmc 1:1 0x80300000 uImage.pm fatload mmc 1:1 0x81600000 rd-ext2.bin setenv bootargs console=ttyS2,115200n8 ramdisk_size=8192 root=/dev/ram0 rw rootfstype=ext2 initrd=0x81600000,8M bootm 0x80300000 TBD: change u-boot parameters to perform this automatically Linux should boot to a BusyBox console prompt.
PM Features
For a full list of PM features see OMAP Power Management. The features listed here are the most common needed to reduce power.
Setup Debug FS
Before you can enable PM features, you need to setup the debug file system for manipulating pm configuration.
mkdir /debug mount -t debugfs debugfs /debug
Sleep While Idle
Next, enable "sleep while idle". This will allow the processor to attempt deeper sleep states when idle. You must also enable sleep timeouts for the serial ports, otherwise this will result in increased power consumption.
$ echo 5 > /sys/devices/platform/serial8250.0/sleep_timeout $ echo 5 > /sys/devices/platform/serial8250.1/sleep_timeout $ echo 5 > /sys/devices/platform/serial8250.2/sleep_timeout $ echo 1 > /debug/pm_debug/sleep_while_idle
You can also enable "off mode" after enabling "sleep while idle".
$ echo 1 > /debug/pm_debug/enable_off_mode
NOTE: Enabling sleep when idle will cause the device to "miss" the first character or two from the serial console (and most likely all UARTS). Since the UART is asleep, a character must be sent to wake it up. This character will be missed as well as subsequent characters until the UART is fully awake.
DVFS
Dynamic frequency and voltage scaling dynamically reduces clock frequency and voltage for further power savings. This function is not available in the mainline kernel. Will fill in after switching to PM kernel.
TBD
Disable Internal Devices
The internal peripherals and devices such as the DSP and GPU consume power if not being used. All unused peripherals, DSP, and GPU should be turned off.
Turn Off Peripherals
TBD
Turn Off DSP
This section applies only to the OMAP3530-based Overo COMs, as the OMAP3530 has both a DSP and Graphics engine.
TBD
Turn Off GPU
This section applies only to the OMAP3530-based Overo COMs, as the OMAP3530 has both a DSP and Graphics engine.
TBD
Disable External Chipsets
Several external chipsets on the Gumstix COM consume power even if not being used. Their power consumption can be reduced (although not completely eliminated) by holding the chips in reset.
USB
You can hold the USB chip in reset with the following commands:
$ echo 183 > /sys/class/gpio/export $ echo out > /sys/class/gpio/gpio183/direction $ echo 0 > /sys/class/gpio/gpio183/value
These commands will export GPIO 183 for access through the sys interface, set the GPIO to output, and drive "0" to the reset line on the USB chip.
You can also turn off power to the USB chip.
If someone wanted to try the same nasty kernel hack, I added this two lines: twl_i2c_write_u8(TWL4030_MODULE_USB, 0x08 /* value */, 0xBB /* register (CARKIT_ANA_CTRL) */); twl_i2c_write_u8(TWL4030_MODULE_USB, 0x01 /* value */, 0xFD /*register (PHY_PWR_CTRL) */); in the function "twl_probe" in /drivers/mfd/twl-core.c just prior to the comment "load power event scripts".
Wifi/Bluetooth
If not using the combined Wifi/Bluetooth module, you can hold it in reset. You can also hold it in reset and only enable as needed for periodic connectivity.
TBD
Disable LEDs
The on-board blue LED can be disabled with the following commands.
$ echo 211 > /sys/class/gpio/export $ echo out > /sys/class/gpio/gpio211/direction $ echo 1 > /sys/class/gpio/gpio211/value
This category currently contains no pages or media.