Fan speed control

Introduction
Most systems have fans to control the temperature of CPUs and other chips. Typically the speed of the fan or fans is controlled by the BIOS, but it may be possible to control the fan speed with userspace utilities. Reasons for wanting to deviate from BIOS controlled fans could be that the BIOS makes them spin too much (resulting in too much noise), or too slow (resulting in too high temperatures).

This article discusses two of those userspace utilities:
 * fancontrol, and
 * thinkfan

Controlling fan speed is not supported on all computers. The computer needs to have:
 * A BIOS that allows users to control the fan speed
 * A motherboard capable of regulating fan speeds
 * Fans that allow their speed to be controlled

Fans have 2, 3, or 4 wires:
 * 1) ground
 * 2) fan voltage
 * 3) tacho
 * 4) PWM

Fans with 2 or 3 wires may have voltage regulation: higher voltage (typically up to 12 Volt) results in higher rotation per minute (RPM). Fans with 4 wires are controlled through pulse width modulation (PWM), in theory a more efficient way of controlling the fan speed. The third wire provides feedback on the actual RPM of the fan.

Fancontrol
Fancontrol is a generic fan control script provided by package which can run as a system daemon. First install lm-sensors as described in lm_sensors. Make sure that any Super I/O chip is enabled in the kernel, and its module loaded.

Verify that temperatures are measured and that there are fans shown with the sensors command:

Note that not all sensors and fans may be connected and/or provide sensible values. In this case:
 * The system has only one fan; fan2 to fan6 are not connected
 * Temperature readings for AUXTIN0 to PCH_MCH_TEMP are not very likely, and are probably not connected
 * Temperatures reported by the the ACPI interface (acpitz-acpi-0) and the ISA adapter (coretemp-isa-0000) are more real.

Execute pwmconfig as root to create the configuration file for fancontrol.

It is possible to manually finetune the configuration file:

Useful parameters to tune are:
 * INTERVAL: the number of seconds between temperature samples
 * MINTEMP: the temperature at which the fan should start working
 * MAXTEMP: the temperature at which the fan should spin at maximum RPM

It is now possible to start fancontrol as a service, and to enable the service for automatic start:

Thinkfan
Thinkfan is a fan controlling deamon provided by and is aimed specifically towards IBM/Lenovo Thinkpad laptops. It can read multiple sensors, but control only a single fan.

The kernel needs to have the Thinkpad ACPI driver configured:

This will create a module called thinkpad_acpi, which needs to be configured to allow for controlling a fan.

Edit or create as follows:

Most Thinkpads provide as a path to the fan device.

It is possible to manually control the fan speed:

There are a few special values:
 * level auto: the fan RPM is controlled by the BIOS
 * level full-speed: the maximum speed while being monitored
 * level disengaged: even faster, where the controller does not monitor the fan speed.

Automatic speed control can be achieved through a package.

Review thinkfan's USE flags prior to installing it:

Install thinkfan as per normal:

The configuration file of thinkfan is in. It requires manual configuration and supports a simple mode and a complex mode. Simple mode evaluates the highest temperature detected, complex mode allows configuration per sensor. The below example of the configuration file is based on simple mode:

The sensors to be considered can be found as follows:

The list of arrays show the fan speed in a range of 0 to 7, and the lower and higher temperature. This example can be read as:
 * level 0 (off) until the detected temperature exceeds 45 degrees centigrade
 * level 1 until the temperature goes below 43 degrees, or exceeds 50 degrees
 * level 2 until the temperature goes below 48 degrees, or exceeds 55 degrees
 * and so on

Test the behaviour of thinkfan as follows:

Start the thinkfan as a service and enable it as follows:

External resources

 * What is PWM and how does it work?
 * How to control fan speed