--- power-management-guide.xml.org 2004-10-15 22:33:00.000000000 +0200
+++ power-management-guide.xml 2004-11-01 17:44:44.102676808 +0100
@@ -17,8 +17,8 @@
-Decide yourself whether you want to enable Software Suspend, Suspend-to-Disk
-and Sleep States (see below). If you own an ASUS, Medion or Toshiba laptop,
-enable the appropriate section.
+Decide yourself whether you want to enable Software Suspend, Suspend-to-Disk and
+Sleep States (see below). If you own an ASUS, Medion or Toshiba laptop, enable
+the appropriate section. Recent kernel versions (2.6.9 and later) include an
+
+The kernel has to know how to enable CPU frequency scaling on your processor. As
+each type of CPU has a different interface, you've got to choose the right
+driver for your processor. Be careful here - enabling
@@ -230,70 +240,106 @@
Typical ACPI events are closing the lid, changing the power source or pressing
-the sleep button. Every acpi event recognized by the kernel is catched by acpid
-which calls
-#!/bin/sh
-
-set $*
-
-group=${1/\/*/}
-action=${1/*\//}
-
-
+#!/bin/bash + +# This runlevel will be used in AC mode +#RUNLEVEL_AC="default" + +# This runlevel will be used in battery mode +#RUNLEVEL_BATTERY="battery" + +# This file indicates the AC state +# It's location may vary on your system. The script checks for +# /proc/acpi/ac_adapter/AC/state, /proc/acpi/ac_adapter/AC0/state, +# /proc/acpi/ac_adapter/AC1/state and /proc/acpi/ac_adapter/AC2/state +# If it is something else on your system, uncomment the next line +# and change appropriately. +#AC_STATE="/proc/acpi/ac_adapter/AC/state" ++ +
+#!/bin/bash + +RUNLEVEL_AC="default" +RUNLEVEL_BATTERY="battery" + +if [ -f '/proc/acpi/ac_adapter/AC0/state' ] +then + AC_STATE="/proc/acpi/ac_adapter/AC0/state" +elif [ -f '/proc/acpi/ac_adapter/AC1/state' ] +then + AC_STATE="/proc/acpi/ac_adapter/AC1/state" +elif [ -f '/proc/acpi/ac_adapter/AC2/state' ] +then + AC_STATE="/proc/acpi/ac_adapter/AC2/state" +else + AC_STATE="/proc/acpi/ac_adapter/AC/state" +fi + + +source /etc/acpi/switch_runlevel.conf function SwitchRunlevel() { - if [[ "$(grep ${AC_OFF} ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RLVL_BATTERY}" ]] + + if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] then - logger "Switching to ${RLVL_BATTERY} runlevel" - /sbin/rc ${RLVL_BATTERY} - elif [[ "$(grep ${AC_ON} ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RLVL_AC}" ]] + logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." + exit 1 + fi + + + if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] + then + logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." + exit 1 + fi + + if [ ! -f "${AC_STATE}" ] then - logger "Switching to ${RLVL_AC} runlevel" - /sbin/rc ${RLVL_AC} + logger "${0}: File ${AC_STATE} does not exist. Aborting" + exit 1 + fi + + + if [[ "$(grep off-line ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] + then + logger "Switching to ${RUNLEVEL_BATTERY} runlevel" + /sbin/rc ${RUNLEVEL_BATTERY} + elif [[ "$(grep on-line ${AC_STATE})" != "" && "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] + then + logger "Switching to ${RUNLEVEL_AC} runlevel" + /sbin/rc ${RUNLEVEL_AC} fi } ++
+event=ac_adapter.* +action=/etc/acpi/actions/pmg_ac_adapter.sh %e ++ +
+event=battery.* +action=/etc/acpi/actions/pmg_battery.sh %e ++ +
+#! /bin/bash + +source /etc/acpi/switch_runlevel.sh +SwitchRunlevel ++ +
+#! /bin/bash -case "$group" in - battery) - case "$action" in - battery) - SwitchRunlevel - ;; - *) - logger "ACPI group battery / action $action is not defined" - ;; - esac - ;; - - ac_adapter) - case "$action" in - ac_adapter) - SwitchRunlevel - ;; - *) - logger "ACPI group ac_adapter / action $action is not defined" - ;; - esac - ;; - *) - logger "ACPI group $group / action $action is not defined" - ;; -esac +source /etc/acpi/switch_runlevel.sh +SwitchRunlevel
@@ -313,7 +359,7 @@
# Fake acpi event to switch runlevel if running on batteries -/etc/acpi/default.sh "battery/battery" +/etc/acpi/actions/pmg_battery.sh "battery/battery"
@@ -328,6 +374,43 @@
+CPU frequency scaling brings up some technical terms that might be unknown to
+you. Here's a quick introduction.
+
+First of all, the kernel has to be able to change the processor's frequency. The
+
+This doesn't sound like dynamic frequency changes yet and in fact it isn't.
+Dynamics however can be accomplished with various approaches. For example,
+the
The above is quite nice, but not doable in daily life. Better let your system
-set the appropriate frequency automatically. A couple of user space programs
-like to do it for you. The following table gives a quick overview to help you
-decide on one of them.
+set the appropriate frequency automatically. There are many different approaches
+to do this. The following table gives a quick overview to help you decide on one
+of them. It's roughly seperated in three categories
@@ -548,9 +712,43 @@
+Name
- Pro
- Con
+ Category
+ Switch decision
+ Kernel governors
+ Further governors
+ Comments
+
+
-
+
+
+
+
- Useful client/server interface
+ Small yet powerful with an useful client/server interface. Requires a 2.6
+ kernel.
-
+
+
+There's another area where throttling CPU frequency is useful. If your laptop
+(or Desktop system) has heat problems, frequency throttling can be the only
+alternative to a shutdown.
+# emerge ncpufreqd +# rc-update add ncpufreqd default battery ++ +
+
The last thing to check is that your new policies do a good job. An easy way to -do so is monitoring the CPU speed while working with your laptop: +do so is monitoring CPU speed while working with your laptop:
@@ -716,23 +914,21 @@-To start and stop laptop-mode, create a script /etc/init.d/laptop-mode. You can -take the one included in -
/usr/src/linux/Documentation/laptop-mode.txt . Onces it's ready, -make sure it gets called. +Besides kernel support you also need a script that controls starting and +stopping of laptop-mode. The packagelaptop-mode-tools contains it.-# rc-update add laptop-mode battery +# emerge laptop-mode-tools--Once again: Be careful with sleep/spin down settings of your hard drive. -Setting it to small values might wear out your drive and lose warranty. Be sure -to read the documentation in laptop-mode.txt. Make sure to stop laptop-mode -before your battery runs out of power and data gets written to disk - otherwise -you will at least lose the last 10 minutes of your work. - ++
laptop-mode-tools has it's configuration file in +/etc/laptop-mode/laptop-mode.conf . Adjust it the way you like it, +it's well commented. If you haveapm oracpi in your USE flags, +laptop-mode will be started automatically in battery mode. Otherwise you can +automate it by runningrc-update add laptop-mode battery . +
+
+