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 daemon provided by package. First install lm-sensors as described in lm_sensors. Make sure that any Super I/O chip is enabled in the kernel, and if its module loaded.

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

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

Assuming the output of pwmconfig is written to, 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.

Typically thinkfan works with specific Thinkpad devices. Therefore the kernel needs to have the ACPI Thinkpad driver:

This will create a module called thinkpad_acpi. This module 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.

Manual speed control
It is possible to manually control the fan speed:

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

Automatic speed control using the thinkfan script
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:
 * speed 0 (off) until the detected temperature exceeds 45 degrees centigrade
 * speed 1 until the temperature goes below 43 degrees, or exceeds 50 degrees
 * speed 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