How to make use of Power Management features

From ThinkWiki
Revision as of 03:57, 28 November 2004 by 24.20.43.42 (Talk) (Screen blanking (Standby))
Jump to: navigation, search

APM

general

You need to enable the APM Power Management support in the kernel and install the apmd to handle the events triggered by the kernel driver. The configuration for what to do at the different events is done in the proxy script which is usually found in /etc/apmd_proxy. See man apmd for further information on this.

Screen blanking (Standby)

Todo...

Suspend to RAM (Sleep)

Todo...

Suspend to disk (Hibernate)

The Phoenix BIOS allows you two ways to hibernate with APM: using a special partition or using a hibernation file on a dos type partition.

using a hibernation partition

The partition to be used for hibernation must be a primary partition that is at least as big as your laptop's memory including its video ram. First set the partition type of this partition to a0 (IBM Thinkpad hibernation) with fdisk, and then use tphdisk to write a hibernation file directly to this partition.

Only follow these instructions, if you understand them. You will overwrite a partition on your hard disk and might loose valuable data - consider yourself warned. For example, assume that /dev/hda2 is the partition that is to be converted to a hibernation partition. Become root and type /sbin/fdisk /dev/hda. At the fdisk prompt type t to change the partition type, then type 2 to indicate that you want to change the type of partition 2, and then enter the partition type: a0. Now type w to write the partition table back to disk and exit. After that use tphdisk to initialize the hibernation partition. First estimate the size of your laptop's memory (main and video). For the sake of this example, let us assume that the main memory is 1024 MB and the video card has 128 MB of memory. Then the command tphdisk 1152 > /dev/hda2 will initialize the hibernation partition. Note that this will only work if the partition is big enough. After a reboot, Fn+F12 will work as expected.

I have successfully used this method on a T41 (2373GEU) that runs Fedora Core 3.

using a hibernation file on a dos partition

The partition to put the file on must be a dos or vfat partition. Fat32 formatted partitions have been reported successful as well as Fat16 formatted ones. The file is either created with phdisk.exe, if you happen to have a floppy drive and a bootable dos floppy disk that you can start it from. Under Linux tphdisk will do this job for you.

Todo... (how to create the file, partition size)

ACPI

general

Todo...

Screen blanking (Standby)

Make sure you have

  • Option "DPMS"

in you XF86Config/xorg.conf.

Running "xset +dpms" and then "xset xdpms force off" will turn off the backlight on a laptop screen. To force a screen off that is using a radeon chipset, install the package "radeontools."

Todo...

Suspend to RAM (Sleep)

ACPI Sleep and suspend-to-ram with recent 2.6.x kernels usually works fine, too.

Todo...

Suspend to disk (Hibernate)

There are two drivers for this available:

  • swsusp, which is in the kernel and
  • SoftwareSuspend2 which is more feature rich, but not yet in the kernel, so you have to patch it in yourself

Both are reported to work fine as long as you use open-source graphic drivers. A comparison of the features can be found on this page.

using swsusp

Todo...

using SoftwareSuspend2

Todo...

Dynamic Frequency Scaling (SpeedStep)

configuring the kernel

2.4 kernels

Todo...

2.6 kernels

Todo...

If you have a Coppermine-piix-smi based Thinkpads like from the A2x, X2x and T2x series you might want to look at this page.

configuring SpeedStep daemons

Harddisk Power Management

Todo...

enabling the harddisks power management features

#!/bin/sh
# I' using this on FC2 and FC3
# cpu throttling off as FC does thisout-of-the-box
# turning swap off is only for those that feel comfortable
# doing something this nasty.
#
# pcfe, 2004-11-15
                                                                                                                                     
# cpu throttling
# cat /proc/acpi/processor/CPU0/throttling for more info
ACAD_THR=0
BATT_THR=2
                                                                                                                                    
# spindown time for HD (man hdparm for valid values)
# I prefer 2 hours for acad and 2 min for batt
ACAD_HD=244
BATT_HD=24
                                                                                                                                    
# Power management level
# 255 (off) on AC
# 128 (medium) on batt
# lowered to 32, pcfe, 2004-06-23
# upped to 64, pcfe, 2004-07-14
# upped to 96, pcfe, 2004-10-20
ACAD_PM=255
BATT_PM=96
                                                                                                                                    
# ac/battery event handler
                                                                                                                                    
status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/AC/state`
                                                                                                                                     
case $status in
       "on-line")
               logger "Running /sbin/laptop_mode stop"
               /sbin/laptop_mode stop
               logger "Setting HD spindown for AC mode with hdparm -S $ACAD_HD /dev/hda."
               /sbin/hdparm -S $ACAD_HD /dev/hda > /dev/null 2>&1
               logger "Setting HD powersaving for AC mode with hdparm -B $ACAD_PM /dev/hda."
               /sbin/hdparm -B $ACAD_PM /dev/hda > /dev/null 2>&1
               #logger "Turning on swap."
               #/sbin/swapon -a
               #echo -n $ACAD_CPU:$ACAD_THR > /proc/acpi/processor/CPU0/limit
               exit 0
       ;;
       "off-line")
               #logger "Turning off swap."
               #/sbin/swapoff -a
               logger "Running /sbin/laptop_mode start"
               /sbin/laptop_mode start
               logger "Setting HD spindown for battery mode with hdparm -S $BATT_HD /dev/hda."
               /sbin/hdparm -S $BATT_HD /dev/hda > /dev/null 2>&1
               logger "Setting HD powersaving for battery mode with hdparm -B $BATT_PM /dev/hda."
               /sbin/hdparm -B $BATT_PM /dev/hda > /dev/null 2>&1
               #echo -n $BATT_CPU:$BATT_THR > /proc/acpi/processor/CPU0/limit
               exit 0
       ;;
esac

Laptop-mode

Todo...

DynamicClocks in the Radeon Xorg driver

The xorg X server have support for a power saving feature from ATI called PowerPlay. Xorg calls this feature DynamicClocks. It can be enabled in the server by adding Option "DynamicClocks" "on" in the Device section in /etc/X11/xorg.conf

Section "Device"
       Identifier  "Videocard0"
       Driver      "radeon"
       VendorName  "IBM Thinkpad"
       BoardName   "ATI Radeon Mobility M9"
       Option      "DynamicClocks" "on"
EndSection


With this option enabled, the X11 server should print (/var/log/Xorg.0.log):

(**) RADEON(0): Option "DynamicClocks" "on"
(II) RADEON(0): Dynamic Clock Scaling Enabled

http://www.ati.com/products/pdf/powerplaywp2.pdf


other Hardware

Todo...(if any - other ways of saving power and such)