Next Previous Contents

3. Advanced Power Management

Portable systems in general, but even many desktop computers come equipped with support for apm, the ``advanced power management'' scheme. This section describes how to activate apm support in your Linux kernel. People who are experienced with Linux may find this section rather boring and want to skip to the next.

3.1 What APM can do for you

I won't describe it in detail here, check the Linux APM drivers page at http://www.cs.utexas.edu/users/kharker/linux-laptop/apm.html for more information. All that you need to know is that with the help of apm, the cpu can tell the bios when there's nothing really exciting going on so that the bios can take care of some power saving by itself - e. g. reducing the cpu clock, turning off the harddisk, turning off the display's backlight etc.

Apm is also responsible for the ``system suspend'' (or ``sleep'') mode and for the ``suspend to disk'' (or ``hiberntation'') mode. And yet another cool, though not very important feature is that with the help of apm, shutdown -h will not just halt your system, but also turn it off.

(By the way, most Linux systems put a shutdown -r in their /etc/inittab and map it to pressing control-alt-delete. I prefer having shutdown -h there, so when pressing the famous key combination, my laptop simply turns itself off.)

Not all manufacturers implement a correct apm bios, so some laptops have trouble with the Linux apm drivers (if your machine has trouble with apm, it will most likely either lock up at Linux' boot up or after returning from suspend). If you are not sure, check the Linux laptop page for your specific model.

3.2 How to activate APM support in Linux

It's easy - just recompile the Linux kernel. Check the Kernel-HOWTO if you don't know how to do that.

When the configuration script reaches the ``character devices'' section, the default setting for full apm bios support in kernel version 2.0.30 or higher is:

Advanced Power Management BIOS support: Yes
Ignore USER SUSPEND: No
Enable PM at boot time: Yes
Make CPU Idle calls when idle: Yes
Enable console blanking using APM: Yes
Power off on shutdown: Yes

Please read the configuration script's help texts. They explain in detail what each option does, so I won't repeat them here.

If your system does not fully support the apm bios standard, some of those options might crash your system. Test all apm features with the new kernel to make sure that everything works as it should.

(A sidenote about console blanking: David Bateman tells me that you should not enable it because it can cause problems with the current version of XFree 3.2: ``The symptoms are that the screen will be blank when X starts, and it can be fixed usually by just hitting a key. It's a small but annoying problem. The next relase of XFree, will have pretty good DPMS support for a lot of laptop chipset, which should include code to turn off the LCD. Check out the manpage for xset in XFree 3.2A.'' David also notes that the lifetime of your display's backlight is determined by the number of times it's switched on and off: ``So its a compromise, lifetime of the battery versus lifetime of the backlight.'')

(Update: With XFree 3.3, this problem still remained on my laptop. I am told that this will be fixed in a future kernel version.)

3.3 APM support and the PCMCIA drivers

After recompiling the kernel, don't forget to recompile the linux pcmcia drivers as well.

The precompiled pcmcia drivers that come with most linux distribution have apm support disabled, so that the bios can't instruct your card adapters to turn off.

Also, you must recompile the drivers if you upgrade to a new kernel version and your old kernel was compiled with module version information turned on (this option is found in the ``loadable module support'' section of the kernel configuration).

Read the PCMCIA-HOWTO for detailed instructions on how to compile the drivers or go to the Linux PCMCIA drivers homepage at http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html.

3.4 The apmd package

Now that you have APM support installed, go and get the apmd package from the Linux APM drivers page. You don't really need it, but it is a very useful collection of programs. The apmd daemon logs your battery's behaviour and it will send out a warning if you are on low power. The apm command will suspend your system with a shell command and xapm shows the current state of your battery.

(BTW, if you have problems with pcmcia cards after returning from suspend, you can check out an alternative apmd package at http://www.cut.de/bkr/linux/apmd/apmd.html. It unloads the pcmcia driver module before going to suspend and reloads the module on resume.)

Grant Taylor has been playing a little with the apmd package and came up with helpful tips.

He found that his laptop's harddisk forgets its hdparm -S standby period when returning from suspend: ``I modified apmd to reset this setting on each resume. This may be system-specific; but it's an important thing to do...''

(Note: On my own laptop, the bios takes care of the harddisk standby period and resets the value on resuming. So I could not test if this little problem is system-specific. If it happens to you as well, send me a message.)

Grant also had a nice trick for screen blanking with the XFree86 package and the help of the apmd package, you'll find it there.

3.5 And if my laptop does not support APM?

If your computer's bios does not offer any power saving settings (even the old ones without apm should at least allow to set harddisk and display standby), you can use hdparm -S to define your harddisk's standby period. This will already help a lot, since harddisk activity consumes a lot of power. Your system should have hdparm installed, so read man hdparm for the command syntax.


Next Previous Contents