4. Power management

Unfortunately, this is not very reliably supported under FreeBSD. If you are lucky, some functions may work reliably; or they may not work at all.

To make things a little more complex, there are two existing standards for power management: APM and ACPI, the latter superseding the former and including more features, but also introducing more problems.

Some laptops support both APM and ACPI (to a certain degree), others just support one of them, so chances are that you have to experiment with both of them to have reliable power management on your laptop.

Note:

You cannot have APM and ACPI enabled at the same time, even if your laptop has support for both of them.

4.1. APM

The APM (Advanced Power Management) BIOS provides support for various power management features like standby, suspend, hibernation, CPU clock slow down etc. and is available under FreeBSD 4.X and FreeBSD 5.X.

To enable APM support, you can compile a kernel with power management support (device apm0 on FreeBSD 4.X and device apm on FreeBSD 5.X). A kernel module for APM is available under FreeBSD 5.X, to simply load the APM kernel module at boot add the line apm_load="YES" to /boot/loader.conf.

On FreeBSD 5.X, you also have to set hint.apm.0.disabled="0" in /boot/device.hints.

You can start APM at boot time by having apm_enable="YES" in /etc/rc.conf. You may also want start the apmd(8) daemon by adding apmd_enable="YES" to /etc/rc.conf, which takes care of various APM events that are posted to the BIOS, so you can have your laptop suspend/resume by pressing some function key on the keyboard or by closing/opening the lid.

The APM commands are listed in the apm(8) manual page. For instance, apm -b gives you battery status (or 255 if not supported), apm -Z puts the laptop on standby, apm -z (or zzz) suspends it. To shutdown and power off the machine, use shutdown -p. Again, some or all of these functions may not work very well or at all.

You may find that laptop suspension/standby works in console mode but not under X (that is, the screen does not come on again); if you are running FreeBSD 5.X, one solution for this might be to put options SC_NO_SUSPEND_VTYSWITCH in your kernel configuration file and recompile your kernel. Another workaround is to switch to a virtual console (using Ctrl+Alt+F1 or another function key) and then execute apm(8). You can automate this with vidcontrol(1), if you are running apmd(8). Simply edit /etc/apmd.conf and change it to this:

apm_event SUSPENDREQ {
 exec "vidcontrol -s 1 < /dev/console";
 exec "/etc/rc.suspend";
}

apm_event USERSUSPENDREQ {
 exec "vidcontrol -s 1 < /dev/console";
 exec "sync && sync && sync";
 exec "sleep 1";
 exec "apm -z";
}

apm_event NORMRESUME, STANDBYRESUME {
 exec "/etc/rc.resume";
 exec "vidcontrol -s 9 < /dev/console";
}

4.2. ACPI

ACPI (Advanced Configuration and Power Management Interface) provides not only power management but also platform hardware discovery (superseding PnP and PCI BIOS). ACPI is only available under FreeBSD 5.X and is enabled by default, so you do not have to do anything special to get it running. You can control ACPI behaviour with acpiconf(8).

Unfortunately, vendors often ship their laptops with broken ACPI implementations, thus having ACPI enabled sometimes causes more problems than being useful, up to the point that you cannot even boot FreeBSD on some machines with ACPI enabled.

If ACPI is causing problems, you might check if your laptop vendor has released a new BIOS version that fixes some bugs. Since the FreeBSD ACPI implementation is still very evolving code, you might also want to upgrade your system; chances are that your problems are fixed.

If you want to disable ACPI simply add hint.acpi.0.disabled="1" to /boot/device.hints. You can disable ACPI temporarily at the boot loader prompt by issuing unset acpi_load if you are having problems booting an ACPI enabled machine. FreeBSD 5.1-RELEASE and later come with a boot-time menu that controls how FreeBSD is booted. One of the proposed options is to turn off ACPI. So to disable ACPI just select 2. Boot FreeBSD with ACPI disabled in the menu.

4.3. Display Power Management

The X window system (Xorg) also includes display power management (look at the xset(1) manual page, and search for dpms there). You may want to investigate this. However, this, too, works inconsistently on laptops: it often turns off the display but does not turn off the backlight.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.