CPU Fan Control on ThinkPad Laptop
It's worth noting that the performance improves and error messages subside after one disassembles the laptop and cleans out the heat sink; maybe even properly applies a fresh coat of thermal compound on it. This improvement, however, never lasts too long as the dust accumulates within the heatsink area again.
I can recall reading anecdotal evidence of this problem from other ThinkPad owners on the Lenovo forums and other places when I first came across these scary messages on my system. Those owners running Linux on their laptops offered explanations about the poor air flow around the CPU socket, cheap parts, bad chassis design, and/or other guesstimates trying to rationalize this phenomenon. However, I always wondered why I had no noticeable performance issues when I was running Windows. Even though there was no Windows equivalent to dmesg or journal messages that would notify with instantaneous alerts, the CPU fan activity seemed to be more aggressive and responsive than on Linux; one can argue that this is due to the resource-intensive nature of a Winblows Operating System, still, something didn't quite add up. As we all know the reluctance of most major OEMs to work with the Open Source community is, as always, a major hurdle for Kernel- and otherwise FOSS developers that deal with hardware devices. Developing generalized blanket solutions for an ever-growing pool of hardware devices and their proprietary low-level software leaves the Linux community to their own devices--no pun intended--to rectify the situation.
Besides third-party projects that may or may not be in your distribution's repositories, e.g. tpfanco and thinkfan, the lm_sensors package, which is included in most distros' repos, comes with a fancontrol program (bash script) that can be easily configured with the pwmconfig command. The prerequisite for, probably, all of the methods related to manually overriding CPU fan control is to pass some options to the thinkpad_acpi module. This can be accomplished by executing the following command to save the options persistently to a file:
# echo options experimental=1 fan_control=1 > /etc/modprobe.d/thinkpad_acpi.conf
You may have to reboot the system for these changes to take affect. Once this prerequisite is fulfilled, you can continue with the pwmconfig command. The process looks something like this:
# pwmconfig # pwmconfig revision 6166 (2013-05-01) This program will search your sensors for pulse width modulation (pwm) controls, and test each one to see if it controls a fan on your motherboard. Note that many motherboards do not have pwm circuitry installed, even if your sensor chip supports pwm. We will attempt to briefly stop each fan using the pwm controls. The program will attempt to restore each fan to full speed after testing. However, it is ** very important ** that you physically verify that the fans have been to full speed after the program has completed. Found the following devices: hwmon0 is acpitz hwmon1/device is thinkpad hwmon2/device is coretemp Found the following PWM controls: hwmon1/device/pwm1 current value: 255 Giving the fans some time to reach full speed... Found the following fan sensors: hwmon1/device/fan1_input current speed: 4365 RPM Warning!!! This program will stop your fans, one at a time, for approximately 5 seconds each!!! This may cause your processor temperature to rise!!! If you do not want to do this hit control-C now!!! Hit return to continue: Testing pwm control hwmon1/device/pwm1 ... hwmon1/device/fan1_input ... speed was 4365 now 4150 no correlation No correlations were detected. There is either no fan connected to the output of hwmon1/device/pwm1, or the connected fan has no rpm-signal connected to one of the tested fan sensors. (Note: not all motherboards have the pwm outputs connected to the fan connectors, check out the hardware database on http://www.almico.com/forumindex.php) Did you see/hear a fan stopping during the above test (n)? y Testing is complete. Please verify that all fans have returned to their normal speed. The fancontrol script can automatically respond to temperature changes of your system by changing fanspeeds. Do you want to set up its configuration file now (y)? What should be the path to your fancontrol config file (/etc/fancontrol)? Select fan output to configure, or other action: 1) hwmon1/device/pwm1 3) Just quit 5) Show configuration 2) Change INTERVAL 4) Save and quit select (1-n): 1 Devices: hwmon0 is acpitz hwmon1/device is thinkpad hwmon2/device is coretemp Current temperature readings are as follows: hwmon0/temp1_input 48 hwmon2/device/temp1_input 55 hwmon2/device/temp2_input 56 hwmon2/device/temp3_input 49 hwmon2/device/temp4_input 50 hwmon2/device/temp5_input 47 Select a temperature sensor as source for hwmon1/device/pwm1: 1) hwmon0/temp1_input 2) hwmon2/device/temp1_input 3) hwmon2/device/temp2_input 4) hwmon2/device/temp3_input 5) hwmon2/device/temp4_input 6) hwmon2/device/temp5_input 7) None (Do not affect this PWM output) select (1-n): 2 Enter the low temperature (degree C) below which the fan should spin at minimum speed (20): Enter the high temperature (degree C) over which the fan should spin at maximum speed (60): Enter the minimum PWM value (0-255) at which the fan STOPS spinning (press t to test) (100): Enter the minimum PWM value (100-255) at which the fan STARTS spinning (press t to test) (150): Enter the PWM value (0-100) to use when the temperature is below the low temperature limit (0): Enter the PWM value (100-255) to use when the temperature is over the high temperature limit (255): Select fan output to configure, or other action: 1) hwmon1/device/pwm1 3) Just quit 5) Show configuration 2) Change INTERVAL 4) Save and quit select (1-n): 5 Common Settings: INTERVAL=10 Settings of hwmon1/device/pwm1: Depends on hwmon2/device/temp1_input Controls MINTEMP=20 MAXTEMP=60 MINSTART=150 MINSTOP=100 Select fan output to configure, or other action: 1) hwmon1/device/pwm1 3) Just quit 5) Show configuration 2) Change INTERVAL 4) Save and quit select (1-n): 4 Saving configuration to /etc/fancontrol... Configuration saved
The configuration file that's created looks like this:
# cat /etc/fancontrol # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 DEVPATH=hwmon1=devices/platform/thinkpad_hwmon hwmon2=devices/platform/coretemp.0 DEVNAME=hwmon1=thinkpad hwmon2=coretemp FCTEMPS=hwmon1/device/pwm1=hwmon2/device/temp1_input FCFANS= hwmon1/device/pwm1= MINTEMP=hwmon1/device/pwm1=20 MAXTEMP=hwmon1/device/pwm1=60 MINSTART=hwmon1/device/pwm1=150 MINSTOP=hwmon1/device/pwm1=100
The user can also create this file or make changes to it even without running the pwmconfig utility, though, the initial setup is probably best done with pwmconfig.
NOTE: This method is, potentially, dangerous. Read all pertinent warnings and instructions carefully before you embark on this journey. Also, I'm assuming that the user has lm_sensors properly configured, though, I'm not sure if this is a prerequisite for the pwmconfig/fancontrol utility.