NetBSD Documentation: Power Management

Power Management for Laptops


Power Management for Laptops

Sensors

Sensor data includes battery, temperature, fan speed, and AC adapter status readings, which are provided through ACPI on most modern laptops.

NetBSD's framework for sensors is envsys(4). The command line tool provided with NetBSD for examining sensors is envstat(8), but various software in pkgsrc can also read from envsys, including sysutils/conky, sysutils/xbattbar, and various desktop environments.

Suspend-to-RAM

ACPI Suspend (a type of low power mode where most devices are inactive, but can be quickly resumed) is supported. NetBSD can suspend to RAM with the following command:

# sysctl -w hw.acpi.sleep.state=3

The system will automatically resume when it is triggered by the hardware (e.g. by the power button being pressed, or by the lid being lifted).

Suspend events can be automatically triggered by powerd(8) scripts. For example, you can add a suspend command to /etc/powerd/scripts/lid_switch to suspend when your laptop's lid is closed. Make sure powerd is enabled in /etc/rc.conf.

CPU frequency scaling

Reducing the CPU frequency is a common way to reduce power consumption when the system is less active. The current CPU frequency is also controlled via sysctl(8), e.g:

# sysctl -a | grep freq
machdep.cpu.frequency.target = 2300
machdep.cpu.frequency.current = 2300
machdep.cpu.frequency.available = 2300 2200 2000 1900 1800 1700 1500 1400 1300 1100 1000 900 800 600 500
# sysctl -w machdep.cpu.frequency.target=1800
	

The sysutils/estd package in pkgsrc provides a daemon that scales the CPU frequency automatically in line with the current CPU load.


Back to NetBSD Documentation