Fan speed control/thinkfan
Introduction
Thinkfan is a fan controlling deamon provided by app-laptop/thinkfan and is aimed specifically towards IBM/Lenovo Thinkpad laptops. It can read multiple sensors, but control only a single fan.
Kernel configuration
The kernel needs to have the Thinkpad ACPI driver configured:
Device Drivers ---> [*] X86 Platform Specific Device Drivers ---> <M> ThinkPad ACPI Laptop Extras
This will create a module called thinkpad_acpi, which needs to be configured to allow for controlling a fan.
Edit or create /etc/modprobe.d/thinkpad.conf as follows:
/etc/modprobe.d/thinkpad.conf
<syntaxhighlight lang="bash">options thinkpad_acpi fan_control=1</syntaxhighlight>
Most Thinkpads provide /proc/acpi/ibm/fan as a path to the fan device.
Manual fan control
It is possible to manually control the fan speed:
root #
echo level 7 > /proc/acpi/ibm/fan
root #
cat /proc/acpi/ibm/fan
status: enabled speed: 3957 level: 7 commands: level <level> (<level> is 0-7, auto, disengaged, full-speed) commands: enable, disable commands: watchdog <timeout> (<timeout> is 0 (off), 1-120 (seconds))
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.
Thinkfan software installation
Automatic speed control can be achieved through a package app-laptop/thinkfan.
Review thinkfan's USE flags prior to installing it:
USE flags for app-laptop/thinkfan simple fan control program for thinkpads
Install thinkfan as per normal:
root #
emerge --ask app-laptop/thinkfan
Configuration
The configuration file of thinkfan is in /etc/thinkfan.conf. It requires manual configuration and supports as of version 1.0 configuration based on yaml. An example of a simple mode configuration is as follows:
/etc/thinkfan.conf
<syntaxhighlight lang="yaml">sensors: - tpacpi: /proc/acpi/ibm/thermal indices: [0] fans: - tpacpi: /proc/acpi/ibm/fan levels: - [0, 0, 41] - [1, 38, 51] - [2, 45, 56] - [3, 51, 61] - [4, 55, 64] - [5, 60, 66] - [6, 63, 68] - [7, 65, 74] - [127, 70, 3276]</syntaxhighlight>
Details about the configuration can be found in /usr/share/doc/thinkfan-1.2.1/thinkfan.yaml.bz2, and in thinkfan.conf man page.
Thinkfan also takes commandline parameters, see thinkfan's man page for details. Take special note of the bias value, which will exaggerate or dampen a sudden increase or decrease between two temperature samples.
Testing
Test the behaviour of thinkfan as follows:
root #
thinkfan -n -b -5 -c /etc/thinkfan.conf
Temperatures(bias): 46(0) -> level 1 Temperatures(bias): 51(0) -> level 2 Temperatures(bias): 59(-3) -> level 3 Temperatures(bias): 64(-3) -> level 4 Temperatures(bias): 68(-3) -> level 5 Temperatures(bias): 69(-2) -> level 6 Temperatures(bias): 62(0) -> level 5 Temperatures(bias): 69(-3) -> level 6 Temperatures(bias): 62(0) -> level 5 Temperatures(bias): 66(0) -> level 6 Temperatures(bias): 62(0) -> level 5
It may take a few cycles of configuration update and testing to find the optimum between all the different settings that are possible.
Start thinkfan as a service
Update /etc/init.d/thinkpad as per the selected commandline parameters:
/etc/init.d/thinkfan
<syntaxhighlight lang="ini">#command_args="-q -s5 -c /etc/thinkfan.conf" command_args="-q -s2 -b0 -c /etc/thinkfan.conf"</syntaxhighlight>
Start the thinkfan as a service and enable it as follows:
root #
rc-service thinkfan start
root #
rc-config add thinkfan