Of course, if you're running 2.6, you won't have to worry about this as much, since ACPI support in 2.6 is a lot better; plus, in 2.6, you don't even need ACPI support for SpeedStep.
In any case, switching to a slower mode using ACPI is done by echoing two numbers to /proc/acpi/processor/CPU0/limit. I'm doing this for battery mode:
echo '1:5' > /proc/acpi/processor/CPU0/limit
and this for AC adapter mode:
echo '0:0' > /proc/acpi/processor/CPU0/limit
which means 'run at full processor power when the AC adapter is connected, and at reduced SpeedStep mode, with 31% throttling when it is not'.
You'll want to install acpid for complete ACPI support; however, it seems that the battery does not issue an event. I've fixed this by checking whether we're on AC power at boot time, and switching the system accordingly. That Works For Me, but YMMV.
OTOH, if you're running 2.6, there's a neat new feature in the kernel,
called the ``CPU Frequency Scaling'', which will do the switching of
processor speed fully automatic, in kernel space, with no need to
configure anything. You want CONFIG_CPU_FREQ
,
CONFIG_CPU_FREQ_GOV_PERFORMANCE
,
CONFIG_CPU_FREQ_GOV_POWERSAVE
, and
CONFIG_X86_P4_CLOCKMOD
. Additionally, you may be interested in
setting frequencies manually, for which you need the userspace
governor.
Now, if you run on battery power, the kernel will automatically select the ``powersave'' governor, and when you connect the system to a power source of some kind, the ``performance'' governor will be selected. If you compile governors as modules (I don't recommend that), make sure to load the additional module before you (dis)connect your system to/from a power outlet.
You can view the current processor speed in /proc/cpuinfo, and configure the driver through files in /sys/devices/system/cpu/cpu0/cpufreq
The buttons (lid and power) do work, OTOH. Create a file in /etc/acpi/events with a contents such as
event=button[ /]lid action=/etc/acpi/powerbtn.shand a file called /etc/acpi/powerbtn.sh with a contents like
echo '1' > /proc/acpi/sleepto make your system suspend to RAM when you close the lid. Or, if you're using 2.6, make the contents of the latter file look like this:
echo '4' > /proc/acpi/sleepto have it hibernate. Which, by the way, is pretty cool :-) Wouter Verhelst 2004-01-09