Difference between revisions of "How to control fan speed"

From ThinkWiki
Jump to: navigation, search
(Added comment - "disengaged" mode is not disengaged on A31s)
(added more info and removed redundant text, such as the OBVIOUS fact that these are thinkpads)
 
(79 intermediate revisions by 54 users not shown)
Line 1: Line 1:
 
This page discusses methods for controlling the system fan.
 
This page discusses methods for controlling the system fan.
 +
 +
{| width="100%" columns="2"
 +
|style="vertical-align:top;white-space:nowrap;" | __TOC__
 +
|style="vertical-align:top" |
 +
 +
{{WARN|When designing fan-control applets, never ignore a valid thermal sensor.
 +
 +
Even if it seems to be stuck at a certain temperature, you must take that sensor into account.  While it will probably make the fan spin faster than if the sensor was ignored, that's exactly what would happen when the fan is under EC control, and could very well be the reason for the "stuck" value in the first place.
 +
 +
Always play it safe.  If a battery pack seems to want the fan to always run faster, the only safe thing to do is to make it run faster.}}
 +
|}
  
 
==For Linux==
 
==For Linux==
===Using a patched kernel===
 
  
The [[Patch for controlling fan speed]] provides a convenient interface via {{path|/proc/acpi/ibm/fan}}.
+
{{NOTE|Fan control operations are disabled by default for safety reasons.}}
 +
 
 +
To enable fan control, the module parameter <tt>fan_control=1</tt> must be given to thinkpad-acpi.
 +
 
 +
For example, in Ubuntu 8.04 (Hardy Heron), add the following to {{path|/etc/modprobe.d/options}}: <tt>options thinkpad_acpi fan_control=1</tt>
 +
 
 +
For Debian Squeeze (testing) create {{path|/etc/modprobe.d/thinkpad_acpi.conf}} with: <tt>options thinkpad_acpi fan_control=1</tt> and install the package <tt>thinkfan</tt>
 +
 
 +
Having done so, reboot and you can use the following commands to control fan speed:
 +
 
 +
{{cmdroot|echo level 0 > /proc/acpi/ibm/fan}} (fan off)
 +
 
 +
{{cmdroot|echo level 2 > /proc/acpi/ibm/fan}} (low speed)
 +
 
 +
{{cmdroot|echo level 4 > /proc/acpi/ibm/fan}} (medium speed)
 +
 
 +
{{cmdroot|echo level 7 > /proc/acpi/ibm/fan}} (maximum speed)
  
Manual speed control can be done through the [[patch for controlling fan speed]]:
+
{{cmdroot|echo level auto > /proc/acpi/ibm/fan}} (automatic - default)
  
'''#cat /proc/acpi/ibm/fan'''
+
{{cmdroot|echo level disengaged > /proc/acpi/ibm/fan}} (disengaged)
status:        enabled
 
level:          auto
 
speed:          4219
 
commands:      enable, disable, level <level>
 
                (<level> is 0-7, auto or disengaged)
 
 
'''#echo level 2 > /proc/acpi/ibm/fan'''
 
 
'''#cat /proc/acpi/ibm/fan'''
 
status:        enabled
 
level:          2
 
speed:          3142
 
commands:      enable, disable, level <level>
 
                (<level> is 0-7, auto or disengaged)
 
  
===Using a stock kernel===
+
If you receive a PERMISSION DENIED error you can use the following command syntax instead as a work-around:
  
If you have the [[ibm-acpi]] module loaded with <tt>experimental=1</tt>, you can control the fan without patching the kernel by directly writing to the relevant embedded controller register using {{path|/proc/acpi/ibm/ecdump}}.
+
<code style="white-space:nowrap;color:#495988;background-color:white;"><nowiki>#</nowiki> echo level 0 | sudo tee /proc/acpi/ibm/fan</code> (fan off)
  
For example:
+
<code style="white-space:nowrap;color:#495988;background-color:white;"><nowiki>#</nowiki> echo level 2 | sudo tee /proc/acpi/ibm/fan</code> (low speed)
  
{{cmdroot|echo 0x2F 0x00 > /proc/acpi/ibm/ecdump}} (fan off)
+
<code style="white-space:nowrap;color:#495988;background-color:white;"><nowiki>#</nowiki> echo level 4 | sudo tee /proc/acpi/ibm/fan</code> (medium speed)
  
{{cmdroot|echo 0x2F 0x02 > /proc/acpi/ibm/ecdump}} (low speed)
+
<code style="white-space:nowrap;color:#495988;background-color:white;"><nowiki>#</nowiki> echo level 7 | sudo tee /proc/acpi/ibm/fan</code> (maximum speed)
  
{{cmdroot|echo 0x2F 0x04 > /proc/acpi/ibm/ecdump}} (medium speed)
+
<code style="white-space:nowrap;color:#495988;background-color:white;"><nowiki>#</nowiki> echo level auto | sudo tee /proc/acpi/ibm/fan</code> (automatic - default)
  
{{cmdroot|echo 0x2F 0x07 > /proc/acpi/ibm/ecdump}} (maximum speed)
+
<code style="white-space:nowrap;color:#495988;background-color:white;"><nowiki>#</nowiki> echo level disengaged | sudo tee /proc/acpi/ibm/fan</code> (disengaged)
  
{{cmdroot|echo 0x2F 0x80 > /proc/acpi/ibm/ecdump}} (automatic - default)
+
===Automated control scripts===
  
{{cmdroot|echo 0x2F 0x40 > /proc/acpi/ibm/ecdump}} (disengaged)
+
An [[ACPI fan control script#Variable speed control scripts|ACPI fan control script]] can be used to override the firmware's fan algorithm with gentler, quieter version. It monitors the laptop's [[thermal sensors]] and sets the fan speed accordingly, according to customizable thresholds. For the default behavior, simply save {{CodeRef|tp-fancontrol}} as {{path|tp-fancontrol}}, make sure you've loaded [[thinkpad-acpi]] with the "fan_control=1" parameter, and run:<br />
 +
{{cmdroot|./tp-fancontrol}}
  
See the specifications below for the meaning of these modes.
+
There is an distro independent daemon (http://launchpad.net/tp-fan/tpfand/0.94/+download/tpfand-0.94.tar.gz), written in python. Packages are available for debian based linux systems.
  
===On/off control using stock kernel===
+
[http://www.gambitchess.org/moin.py/ThinkPad_Fan_Control A GTK GUI program (packaged for Ubuntu 7.10 and 8.04)] may also help.
  
If you only wish to turn the fan on and off (with automatic control when it's on), you can use the following.
+
===Automated program - Simple ThinkPad Fan Control===
  
When loading [[ibm-acpi]] v0.11 with experimental switch ({{cmdroot|1=modprobe ibm_acpi experimental=1}}), it is possible to read and write the status of fan:
+
'''[https://github.com/Stanko/ThinkPad-Fan-Control GitHub Page]'''
  
'''#cat /proc/acpi/ibm/fan'''
+
This is program for controlling fans speed on IBM/Lenovo ThinkPads. It is written
status:        enabled
+
for Linux only. This program is written in C, using GTK GUI.
speed:          3580
 
commands:      enable, disable
 
 
   
 
   
'''#echo disable > /proc/acpi/ibm/fan'''
+
You are required to have the Linux kernel with 'thinkpad-acpi' patch.
 +
You must also enable manual control for your fans. For Linux 2.6.22 and above,
 +
you must add 'fan_control=1' as a module parameter to 'thinkpad-acpi'.
 +
For example, in Debian Lenny (and Ubuntu 8.04), you must add the following
 +
to "/etc/modprobe.d/options":
 +
        options thinkpad_acpi fan_control=1
 
   
 
   
  '''cat /proc/acpi/ibm/fan'''
+
Having done so, reboot. Now you'll be able to use this program easily.
status:         disabled
+
   
speed:         0
+
Here is screenshot:
commands:      enable, disable
+
[[Image:Tpfc.png|none]]
 +
 
 +
and direct download (src + i386 32bit binary). Please read README.txt file
 +
included in package.
 +
 
 +
'''Download links'''
 +
 
 +
'''[https://github.com/Stanko/ThinkPad-Fan-Control GitHub Page]'''
 +
 
 +
 
 +
'''Direct download:'''
 +
 
 +
[[http://www.box.net/shared/phz3foll8oe0501k8s1j tpfc0.5.tar.gz]]
 +
 
 +
 
 +
----
 +
 
 +
I wrote this for my own personal use, and thought that it would be a good idea
 +
to release it to the world, and hope that it will be useful to someone!
 +
Feel free to send comments, bug reports or a thanks to the e-mail above. Although I don't use ThinkPad anymore (so I can't test the program), I still try to respond to all emails I get.
 +
 
 +
===Ansible ThinkPad Fan Control===
 +
 
 +
{{NOTE|Only tested with Fedora 28 + Lenovo ThinkPad W540, model 20BHA02CCL}}
  
When off, the fan will then '''never''' wake up. It is advised to use an automated control script to reduce the chance of hardware damage.
+
Ansible will ask the level that you expect that fan, and defaults to full-speed, in order to be use it when things goes hot:
  
===Automated control scripts===
+
{{HINT|git clone https://github.com/barbudone/thinkpad-fan.git}}
  
An [[ACPI fan control script#Variable speed control scripts|ACPI fan control script]] can be to override the firmware's fan algorithm with gentler, quieter version. It monitors the laptop's [[thermal sensors]] and sets the fan speed accordingly, according to customizable thresholds. For the default behavior, simply save the [[ACPI fan control script#Variable speed control scripts|script]] as {{path|tp-fancontrol}} and run<br />
+
'''[https://github.com/barbudone/thinkpad-fan GitHub Page]'''
{{cmdroot|./tp-fancontrol}}
 
  
 
==For Windows==
 
==For Windows==
  
 
Shimodax's ThinkPad fan control tool offers similar functionality (see [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com).  Source and binaries are available through the [http://sourceforge.net/projects/tp4xfancontrol "Tp4xFanControl"] project on SourceForge.
 
Shimodax's ThinkPad fan control tool offers similar functionality (see [http://forum.thinkpads.com/viewtopic.php?t=17715 forum discussion] at thinkpads.com).  Source and binaries are available through the [http://sourceforge.net/projects/tp4xfancontrol "Tp4xFanControl"] project on SourceForge.
 +
 +
IbmPad's IBM_ECW fan control program can also be used, but it is more flexible in terms of compatibility. This program can be downloaded at IbmPad's [http://bertrand.deo.free.fr/IBM_EC/index_e.html website]. For additional help or support, please post in this [https://forum.thinkpads.com/viewtopic.php?t=105203 forum topic].
  
 
==Hardware specs==
 
==Hardware specs==
Line 77: Line 117:
 
The following hardware behavior was discovered experimentally by [[User:Thinker|Thinker]] and neither provided by nor confirmed by IBM/Lenovo. The following description may be inaccurate and may vary by model (see list of models above). The terminology probably does not match the one used by IBM/Lenovo engineers.
 
The following hardware behavior was discovered experimentally by [[User:Thinker|Thinker]] and neither provided by nor confirmed by IBM/Lenovo. The following description may be inaccurate and may vary by model (see list of models above). The terminology probably does not match the one used by IBM/Lenovo engineers.
  
ACPI DSDT register _SB.PCI0.LPC.EC.HFSP (8 bits, offset 0x2F in the <tt>EmbeddedController</tt> address space, accessed through the standard EC interface at IO ports 0x62 and 0x66) is read/writable and has the following meaning:
+
{{NOTE|Information on other models is included in the [[thinkpad-acpi]] [[Git]] version.}}
 +
{{NOTE|1=The ThinkPad {{X61s}} and {{X61}} with WWAN have a [http://forum.notebookreview.com/showthread.php?t=141931 second system fan]. It shares the same control register as the main fan (cannot be controlled separately), and exposes a second tachometer.}}
 +
 
 +
ACPI DSDT register HFSP (8 bits, offset 0x2F in the <tt>EmbeddedController</tt> address space, accessed through the standard EC interface at IO ports 0x62 and 0x66) is read/writable and has the following meaning:
 
   
 
   
 
  Bits  7 6 5 4 3 2 1 0
 
  Bits  7 6 5 4 3 2 1 0
Line 85: Line 128:
 
         0 0 N N N N N N  - manual (0..63; 0=disable fan, 1=min, ..., 7=max)
 
         0 0 N N N N N N  - manual (0..63; 0=disable fan, 1=min, ..., 7=max)
  
 +
Changing modes may not be immediate on all ThinkPads.  Later ThinkPad models seem to take at least 5s to start responding to a fan mode change, for example.
 +
 +
After boot, the HFSP register may not reflect the true state of the EC (on some models it reads 0x07 even though the EC is actually in automatic mode).
 +
 +
The HFSP register controls both fans at the same time in the X61/X61s.
 +
 +
=== Fan Tachometer ===
 +
 +
The embedded controller registers 0x84 (LSB), 0x85 (MSB) are the main fan tachometer, and report fan speed in RPM in everything since the {{A31}} and maybe a little earlier.  Not much is know about the tachometer in earlier models, or even whether they had one or not.
 +
 +
On the X61/X61s, one must select through EC register 0x31 bit 0 which fan the tachometer registers will expose (Firmware 7M).  Beware: this is the same register used for brightness control in other models.
 +
 +
If the speed reported is 65335, then is typically due to a broken fan assembly.
 +
The fan might still be rotating.
 +
This error can be intermittent and can prevent booting (Error 'Fan error')
 +
 +
=== Automatic mode ===
 
In ''automatic'' mode, the embedded controller sets the fan speed automatically according to system temperatures and some unknown algorithm.
 
In ''automatic'' mode, the embedded controller sets the fan speed automatically according to system temperatures and some unknown algorithm.
  
In ''manual'' mode, the fan level is forced to the given value and the EC will auto-regulate the fan to maintain at a (roughly) constant RPM, which is model-dependent. Manual speed levels 8-63 yield the same behavior as level 7, and the the ACPI DSDT uses level 7 for the emergency mode it enters upon critical CPU/GPU temperature, so apparently 7 is the real maximum level.
+
Note that the ACPI DSDT may supplement this in some models.  The {{X40}}, for example, changes the profile of speeds the automatic mode should use depending on battery status.
  
In ''disengaged'' mode, the embedded controller does not read the fan RPM (hence <tt>EmbeddedController</tt> offset 0x84 is not updated), and does not maintain a stable fan speed. When disengaged mode is entered the fan speed is not immediately changed (except if the fan was disabed, in which case it is turned on at a low level). However, once in disengaged mode, fan speed will slowly increase to ''beyond'' the maximum manual level (this may cause hardware damage!).
+
=== Manual mode ===
  
{{NOTE|The "disengaged" mode has a different behaviour on ThinkPad {{A31}} than that described above.  As above, the fan speed increases beyond the levels of the regular 0-7 speed settings. However, the speed increase is fairly instantaneous (the change being as fast as the transition between any other two speed levels, except 0 (off) which seems faster, i.e. immediate); and the fan speed reading is ''continuously'' available while in "disengaged" mode.  In the {{A31}}, the speed reaches about 4000 RPM as listed in the table below.}}
+
In ''manual'' mode, the fan level is forced to the given value and the EC will auto-regulate the fan to maintain at a (roughly) constant RPM, which is model-dependent. Manual speed levels 8-63 yield the same behavior as level 7, and the the ACPI DSDT uses level 7 for the emergency mode it enters upon critical CPU/GPU temperature, so apparently 7 is the real maximum level.
  
After boot, the HFSP register may not reflect the true state of the EC (on some models it reads 0x07 even though the EC is actually in automatic mode).
+
=== Disengaged (full-speed) mode ===
  
{{HINT|Apparently the [[Problem with fan noise|pulsing fan noise]] experienced by some users can be cured by repeatedly running 2-4 seconds of manual control followed by 0.5-1 seconds of disengaged mode. The pulse occurs when the the embedded controller computes the fan speed and adjusts the fan voltage adaptively every few seconds (~4.8sec for the ThinkPad T43); the aforementioned mode switching doesn't give it a chance to do so. One of the [[ACPI fan control script#Variable speed control scripts|ACPI fan control scripts]] implements this solution.}}
+
In ''disengaged'' mode, the embedded controller does not monitor the fan speed.  It "disengages" the closed-loop control function that keeps track of fan speed, and uses an open-loop control function that ramps up the fan to its maximum speed (100% duty-cycle). The end speed is not stable, but it is often much faster than the maximum speed manual and automatic modes would set the fan to.
  
==Supported models==
+
Most newer ThinkPads take quite a while (in excess of one minute) to fully enter disengaged mode.  Exiting it is much faster.  The {{A31}} acts differently, and switches to disengaged mode as fast as it switches to other modes.
  
The above was successfully tested on the following models:
+
For some reason, the embedded controller may stop updating the tachometer registers while entering or exiting disengaged mode in some ThinkPad firmware versions (hence the EC tachometer registers will not be updated on these models while entering/exiting disengaged mode).  Once it arrives at maximum speed, or once it gets back at closed-loop cruise speed, the embedded controller starts updating the tachometer registers again.  Later T models such as the {{T43}} have this problem, while the {{A31}} does not.
  
* ThinkPad {{T43}}, {{T43p}} (fan levels RPM: 1-2 = ~3300, 3-5 = ~4100, 6-7 = ~4700; disengaged mode works)
+
{{HINT|Apparently the [[Problem with fan noise|pulsing fan noise]] experienced by some users can be cured by repeatedly running 2-4 seconds of manual control followed by 0.5-1 seconds of disengaged mode. The pulse occurs when the the embedded controller computes the fan speed and adjusts the fan voltage adaptively every few seconds (~4.8sec for the ThinkPad T43); the aforementioned mode switching doesn't give it a chance to do so. Some of the [[ACPI fan control script#Variable speed control scripts|ACPI fan control scripts]] implements this solution.}}
* ThinkPad {{T42}}, {{T42p}} (fan levels RPM: 1-2 = ~2900, 3-5 = ~3700, 6-7 = ~4700; disengaged mode works at ~5200)
 
* ThinkPad {{T41}}, {{T41p}} (fan levels RPM: 1-2 = ~2980, 3-5 = ~3500, 6-7 = ~4050; disengaged mode works at ~5100)
 
* ThinkPad {{T40}} (fan levels RPM: 1-2 = ~2950, 3-5 = ~3600, 6-7 = ~4050)
 
* ThinkPad {{T30}}
 
* ThinkPad {{T22}}
 
* ThinkPad {{T23}} (low speed = ~2200, medium and maximum speed = ~4800; disengaged mode works at ~5800)
 
* ThinkPad {{R52}}
 
* ThinkPad {{R50}} (highest manual level is 3; disengage mode works and reaches much higher RPM)
 
* ThinkPad {{R50p}} (disengaged mode works at ~5100)
 
* ThinkPad {{R51}} (level 0 = off, level 1-2 = ~3150, level 3-5 = ~3350, level 6 = ~3750, disengaged = ~5100)
 
* ThinkPad {{X30}} (level 0 = off, low = ~3900, medium = ~4200, maximum = ~4650, disengaged = ~5900)
 
* ThinkPad {{X31}}
 
* ThinkPad {{X40}}
 
* ThinkPad {{X41T}}
 
* ThinkPad {{Z60t}} (fan levels RPM: 1-2 = ~1700, 3-5 = ~2800, 6-7 = ~3500)
 
* ThinkPad {{Z60m}} (fan levels like Z60t)
 
* ThinkPad {{X60}}
 
* ThinkPad {{A31}} (fan levels RPM: 0 = off, 1-2 = ~3280-3380 (!), 3-5 = ~3200, 6-7 = ~3380, "disengaged" = ~4000 (see NOTE above))
 
Probably other models are supported too (please update this page if you confirm this).
 
  
==Models using a different interface==
+
{{HINT|To force engaged mode using [http://www.staff.uni-marburg.de/~schmitzr/donate.html TPFanControl] for Windows, enter '64' as the value (0-7) for manual mode. This can also be incorporated into smart mode through a custom tpfancontrol.ini}}
  
The following models also work, use a different access method which supported (only) via the {{path|/proc/acpi/ibm/fan}} of [[ibm-acpi]]. No need for patching.
+
==Supported models==
 +
The above was successfully tested on the following models:
 +
* {{A31}}, {{A31p}} (fan levels RPM: 0 = off, 1-2 = ~3280-3380 (!), 3-5 = ~3200, 6-7 = ~3380, "disengaged" = ~4000 (see NOTE above))
 +
* {{R50}} (highest manual level is 3; disengage mode works and reaches much higher RPM)
 +
* {{R50p}} (fan levels RPM: 0 = off, 1-2 = ~3200, 3-5 = ~3500-3600, 6-7 = ~3700-3800, disengaged = ~5300)
 +
* {{R51}} (fan levels RPM: 0 = off, 1-2 = ~3150, 3-5 = ~3350, 6 = ~3750, disengaged = ~5100)
 +
* {{R51e}} (fan levels RPM: 0 = off, 1-2 = ~3300, 3-5 = ~3800, 6 = ~4150, disengaged = ~5100)
 +
* {{R52}} (fan levels RPM: 0 = off, 1-2 = ~3350, 3-5 = ~3650, 6 = ~4250, disengaged = ~5245)
 +
* {{R60}} (fan levels RPM: 0 = off, 1-1 = ~2650, 3-5 = ~3300, 6-7 = ~3950, disengaged = ~4800)
 +
* {{R60e}}
 +
* {{R61i}} (fan levels RPM: 0 = off, 1 = 2689, 2 = 2729, 3 = 3059, 4 = 3047, 5 = 3051, 6 = 3515, 7 = 3468, full-speed/disengaged = 4119~4200)mod.#7650-D7G@+/-2yr.used
 +
* {{T22}}
 +
* {{T23}}
 +
** (low speed = '''~2200''', medium and maximum speed = '''~4800'''; disengaged mode works at '''~5800''')
 +
** (fan levels = ~RPM: 0 = '''0'''; 1,2 = '''~2200'''; 3,4,5,6,7 = '''~4900''';  disengaged,full-speed = '''~6331''')
 +
* {{T30}}
 +
* {{T40}} (fan levels RPM: 1-2 = ~2950, 3-5 = ~3600, 6-7 = ~4050; disengaged = ~5400)
 +
* {{T400}} (fan levels RPM: 1 = ~1886, 2 = ~2800, 3-5 = ~3000, 6-7 = ~3500; disengaged mode works at ~5100)
 +
* {{T41}}, {{T41p}} (fan levels RPM: 1-2 = ~2980, 3-5 = ~3500, 6-7 = ~4050; disengaged mode works at ~5100)
 +
* {{T410i}} (fan levels RPM: 0 = off, 1 = ~1950, 2 = ~3575, 3-4 = ~3700, 5-6 = ~3825, 7 = ~4525; full-speed/disengaged = ~5450; only Linux-tested with tpfc0.5)
 +
* {{T42}}, {{T42p}} (fan levels RPM: 1-2 = ~2900, 3-5 = ~3700, 6-7 = ~4700; disengaged mode works at ~5200)
 +
* {{T43}}, {{T43p}} (fan levels RPM: 1-2 = ~3300, 3-5 = ~4100, 6-7 = ~4700; disengaged mode works at ~6450)
 +
* {{T60}} (fan levels RPM: 1-2 = 3000-3100, 3-5 = ~3600, 6-7 = ~4500; disengaged mode works at ~5500)
 +
* {{T61}} (fan levels RPM: 0 = off, 1-2 = ~2980, 3-5 = ~3330, 6-7 = ~3760; disengaged mode works at ~4500)
 +
* {{W500}} (fan levels RPM: 0=off, 1-2 = 1900, 3-5 = ~3000, 6-7 = ~3500; disengaged mode works at ~5100)
 +
* {{W510}} (fan levels RPM: 0=off, 1 = ~2750, 2 = ~3100, 3-5 = ~3500, 6-7 = ~4000; disengaged mode works at ~4585)
 +
* {{X30}} (level 0 = off, low = ~3900, medium = ~4200, maximum = ~4650, disengaged = ~5900)
 +
* {{X31}} (fan levels RPM: 0 = off, 1-2 = ~2850, 3-5 = ~3450, 6 = ~4050, 7 = ~4150; disengaged mode works at ~4975)
 +
* {{X40}}
 +
* {{X41}}
 +
* {{X41 Tablet}}
 +
* {{X60}} (fan levels RPM: 0 = 0, 1-2 = ~2850, 3-5 = ~3110, 6 = ~3600, 7 = ~3700, disengaged = ~4700)
 +
* {{X61}} (fan levels RPM: 1-2 = ~3400, 3-5 = ~3800, 6-7 = ~4500, disengaged = ~6700)
 +
* {{X61s}} (fan levels RPM: 0 = off, 1-2 = ~3800, 3-5 = ~4500, 6-7 = ~4800, disengaged = ~4800) (though fancontrol can keep it at 2500rpm...)
 +
* {{X120e}}
 +
* {{X201i}}  (fan levels RPM: 0 = off, 1 = ~1900, 4 = ~3400, 7 = ~4200, disengaged = ~6300)
 +
* {{X220}}  (fan levels RPM: 0 = off, 1 = ~2000, 2 = ~3000, 3-4 = ~3500, 5-6 = ~3900, 7 = ~4500, full-speed = ~5300, disengaged = ~5300)
 +
* {{Z60t}}, {{Z60m}} (fan levels RPM: 1-2 = ~1700, 3-5 = ~2800, 6-7 = ~3500)
 +
* {{Z61m}}
 +
* {{Z61p}} (fan levels 0-7, auto, disengaged; enable, disable; watchdog (untested))
 +
* {{Edge11}} (fan levels: 0 = off, 1, 2, 3, 7 = full; RPM shown value is around 492 - 503, but should be 1000 - 3000) 
 +
Probably other models are supported too (please update this page if you confirm this; maintain some ordering too).
  
* ThinkPad {{600E}}, {{600X}}, {{770E}}, {{770X}} (these use a different fan control interface)
+
==Supported models using a different interface==
 +
The following models also work, which uses a different access method that is supported (only) via the {{path|/proc/acpi/ibm/fan}} of [[thinkpad-acpi]]. There is no need for patching.
 +
* {{240}}, {{240X}}, {{240Z}}
 +
* {{570}}, {{570E}}
 +
* {{600}}, {{600E}}, {{600X}}
 +
* {{770}}, {{770E}}, {{770ED}}, {{770X}}, {{770Z}}
  
 
==Unsupported models==
 
==Unsupported models==
 
+
* {{390}}, {{390E}}, {{390X}} (these models use a different method and register to regulate fan speed)
* ThinkPad {{560}} (these models don't have a fan)
+
* {{560}}, {{560X}} (these models don't have a fan)
 +
* {{8 Series}} (these models use a different method and register to regulate fan speed)
 +
* {{SL300}}, {{SL400}}, {{SL400c}}, {{SL500}}, {{SL500c}} (these models use a different method and register to regulate fan speed)
 +
* {{R30}}, {{R31}}, {{R32}}, {{R40}}, {{R40e}} (these models use a different method and register to regulate fan speed)

Latest revision as of 14:17, 4 November 2020

This page discusses methods for controlling the system fan.

ATTENTION!
When designing fan-control applets, never ignore a valid thermal sensor.

Even if it seems to be stuck at a certain temperature, you must take that sensor into account. While it will probably make the fan spin faster than if the sensor was ignored, that's exactly what would happen when the fan is under EC control, and could very well be the reason for the "stuck" value in the first place.

Always play it safe. If a battery pack seems to want the fan to always run faster, the only safe thing to do is to make it run faster.

For Linux

NOTE!
Fan control operations are disabled by default for safety reasons.

To enable fan control, the module parameter fan_control=1 must be given to thinkpad-acpi.

For example, in Ubuntu 8.04 (Hardy Heron), add the following to /etc/modprobe.d/options: options thinkpad_acpi fan_control=1

For Debian Squeeze (testing) create /etc/modprobe.d/thinkpad_acpi.conf with: options thinkpad_acpi fan_control=1 and install the package thinkfan

Having done so, reboot and you can use the following commands to control fan speed:

# echo level 0 > /proc/acpi/ibm/fan (fan off)

# echo level 2 > /proc/acpi/ibm/fan (low speed)

# echo level 4 > /proc/acpi/ibm/fan (medium speed)

# echo level 7 > /proc/acpi/ibm/fan (maximum speed)

# echo level auto > /proc/acpi/ibm/fan (automatic - default)

# echo level disengaged > /proc/acpi/ibm/fan (disengaged)

If you receive a PERMISSION DENIED error you can use the following command syntax instead as a work-around:

# echo level 0 | sudo tee /proc/acpi/ibm/fan (fan off)

# echo level 2 | sudo tee /proc/acpi/ibm/fan (low speed)

# echo level 4 | sudo tee /proc/acpi/ibm/fan (medium speed)

# echo level 7 | sudo tee /proc/acpi/ibm/fan (maximum speed)

# echo level auto | sudo tee /proc/acpi/ibm/fan (automatic - default)

# echo level disengaged | sudo tee /proc/acpi/ibm/fan (disengaged)

Automated control scripts

An ACPI fan control script can be used to override the firmware's fan algorithm with gentler, quieter version. It monitors the laptop's thermal sensors and sets the fan speed accordingly, according to customizable thresholds. For the default behavior, simply save tp-fancontrol (download) as tp-fancontrol, make sure you've loaded thinkpad-acpi with the "fan_control=1" parameter, and run:
# ./tp-fancontrol

There is an distro independent daemon (http://launchpad.net/tp-fan/tpfand/0.94/+download/tpfand-0.94.tar.gz), written in python. Packages are available for debian based linux systems.

A GTK GUI program (packaged for Ubuntu 7.10 and 8.04) may also help.

Automated program - Simple ThinkPad Fan Control

GitHub Page

This is program for controlling fans speed on IBM/Lenovo ThinkPads. It is written for Linux only. This program is written in C, using GTK GUI.

You are required to have the Linux kernel with 'thinkpad-acpi' patch. You must also enable manual control for your fans. For Linux 2.6.22 and above, you must add 'fan_control=1' as a module parameter to 'thinkpad-acpi'. For example, in Debian Lenny (and Ubuntu 8.04), you must add the following to "/etc/modprobe.d/options":

       options thinkpad_acpi fan_control=1

Having done so, reboot. Now you'll be able to use this program easily.

Here is screenshot:

Tpfc.png

and direct download (src + i386 32bit binary). Please read README.txt file included in package.

Download links

GitHub Page


Direct download:

[tpfc0.5.tar.gz]



I wrote this for my own personal use, and thought that it would be a good idea to release it to the world, and hope that it will be useful to someone! Feel free to send comments, bug reports or a thanks to the e-mail above. Although I don't use ThinkPad anymore (so I can't test the program), I still try to respond to all emails I get.

Ansible ThinkPad Fan Control

NOTE!
Only tested with Fedora 28 + Lenovo ThinkPad W540, model 20BHA02CCL

Ansible will ask the level that you expect that fan, and defaults to full-speed, in order to be use it when things goes hot:

Hint:

GitHub Page

For Windows

Shimodax's ThinkPad fan control tool offers similar functionality (see forum discussion at thinkpads.com). Source and binaries are available through the "Tp4xFanControl" project on SourceForge.

IbmPad's IBM_ECW fan control program can also be used, but it is more flexible in terms of compatibility. This program can be downloaded at IbmPad's website. For additional help or support, please post in this forum topic.

Hardware specs

The following hardware behavior was discovered experimentally by Thinker and neither provided by nor confirmed by IBM/Lenovo. The following description may be inaccurate and may vary by model (see list of models above). The terminology probably does not match the one used by IBM/Lenovo engineers.

NOTE!
Information on other models is included in the thinkpad-acpi Git version.
NOTE!
The ThinkPad X61s and X61 with WWAN have a second system fan. It shares the same control register as the main fan (cannot be controlled separately), and exposes a second tachometer.

ACPI DSDT register HFSP (8 bits, offset 0x2F in the EmbeddedController address space, accessed through the standard EC interface at IO ports 0x62 and 0x66) is read/writable and has the following meaning:

Bits   7 6 5 4 3 2 1 0
       ---------------
Value  1 0 * * * * * *  - automatic
       * 1 * * * * * *  - disengaged
       0 0 N N N N N N  - manual (0..63; 0=disable fan, 1=min, ..., 7=max)

Changing modes may not be immediate on all ThinkPads. Later ThinkPad models seem to take at least 5s to start responding to a fan mode change, for example.

After boot, the HFSP register may not reflect the true state of the EC (on some models it reads 0x07 even though the EC is actually in automatic mode).

The HFSP register controls both fans at the same time in the X61/X61s.

Fan Tachometer

The embedded controller registers 0x84 (LSB), 0x85 (MSB) are the main fan tachometer, and report fan speed in RPM in everything since the A31 and maybe a little earlier. Not much is know about the tachometer in earlier models, or even whether they had one or not.

On the X61/X61s, one must select through EC register 0x31 bit 0 which fan the tachometer registers will expose (Firmware 7M). Beware: this is the same register used for brightness control in other models.

If the speed reported is 65335, then is typically due to a broken fan assembly. The fan might still be rotating. This error can be intermittent and can prevent booting (Error 'Fan error')

Automatic mode

In automatic mode, the embedded controller sets the fan speed automatically according to system temperatures and some unknown algorithm.

Note that the ACPI DSDT may supplement this in some models. The X40, for example, changes the profile of speeds the automatic mode should use depending on battery status.

Manual mode

In manual mode, the fan level is forced to the given value and the EC will auto-regulate the fan to maintain at a (roughly) constant RPM, which is model-dependent. Manual speed levels 8-63 yield the same behavior as level 7, and the the ACPI DSDT uses level 7 for the emergency mode it enters upon critical CPU/GPU temperature, so apparently 7 is the real maximum level.

Disengaged (full-speed) mode

In disengaged mode, the embedded controller does not monitor the fan speed. It "disengages" the closed-loop control function that keeps track of fan speed, and uses an open-loop control function that ramps up the fan to its maximum speed (100% duty-cycle). The end speed is not stable, but it is often much faster than the maximum speed manual and automatic modes would set the fan to.

Most newer ThinkPads take quite a while (in excess of one minute) to fully enter disengaged mode. Exiting it is much faster. The A31 acts differently, and switches to disengaged mode as fast as it switches to other modes.

For some reason, the embedded controller may stop updating the tachometer registers while entering or exiting disengaged mode in some ThinkPad firmware versions (hence the EC tachometer registers will not be updated on these models while entering/exiting disengaged mode). Once it arrives at maximum speed, or once it gets back at closed-loop cruise speed, the embedded controller starts updating the tachometer registers again. Later T models such as the T43 have this problem, while the A31 does not.

Hint:
Apparently the pulsing fan noise experienced by some users can be cured by repeatedly running 2-4 seconds of manual control followed by 0.5-1 seconds of disengaged mode. The pulse occurs when the the embedded controller computes the fan speed and adjusts the fan voltage adaptively every few seconds (~4.8sec for the ThinkPad T43); the aforementioned mode switching doesn't give it a chance to do so. Some of the ACPI fan control scripts implements this solution.
Hint:
To force engaged mode using TPFanControl for Windows, enter '64' as the value (0-7) for manual mode. This can also be incorporated into smart mode through a custom tpfancontrol.ini

Supported models

The above was successfully tested on the following models:

  • A31, A31p (fan levels RPM: 0 = off, 1-2 = ~3280-3380 (!), 3-5 = ~3200, 6-7 = ~3380, "disengaged" = ~4000 (see NOTE above))
  • R50 (highest manual level is 3; disengage mode works and reaches much higher RPM)
  • R50p (fan levels RPM: 0 = off, 1-2 = ~3200, 3-5 = ~3500-3600, 6-7 = ~3700-3800, disengaged = ~5300)
  • R51 (fan levels RPM: 0 = off, 1-2 = ~3150, 3-5 = ~3350, 6 = ~3750, disengaged = ~5100)
  • R51e (fan levels RPM: 0 = off, 1-2 = ~3300, 3-5 = ~3800, 6 = ~4150, disengaged = ~5100)
  • R52 (fan levels RPM: 0 = off, 1-2 = ~3350, 3-5 = ~3650, 6 = ~4250, disengaged = ~5245)
  • R60 (fan levels RPM: 0 = off, 1-1 = ~2650, 3-5 = ~3300, 6-7 = ~3950, disengaged = ~4800)
  • R60e
  • R61i (fan levels RPM: 0 = off, 1 = 2689, 2 = 2729, 3 = 3059, 4 = 3047, 5 = 3051, 6 = 3515, 7 = 3468, full-speed/disengaged = 4119~4200)mod.#7650-D7G@+/-2yr.used
  • T22
  • T23
    • (low speed = ~2200, medium and maximum speed = ~4800; disengaged mode works at ~5800)
    • (fan levels = ~RPM: 0 = 0; 1,2 = ~2200; 3,4,5,6,7 = ~4900; disengaged,full-speed = ~6331)
  • T30
  • T40 (fan levels RPM: 1-2 = ~2950, 3-5 = ~3600, 6-7 = ~4050; disengaged = ~5400)
  • T400 (fan levels RPM: 1 = ~1886, 2 = ~2800, 3-5 = ~3000, 6-7 = ~3500; disengaged mode works at ~5100)
  • T41, T41p (fan levels RPM: 1-2 = ~2980, 3-5 = ~3500, 6-7 = ~4050; disengaged mode works at ~5100)
  • T410i (fan levels RPM: 0 = off, 1 = ~1950, 2 = ~3575, 3-4 = ~3700, 5-6 = ~3825, 7 = ~4525; full-speed/disengaged = ~5450; only Linux-tested with tpfc0.5)
  • T42, T42p (fan levels RPM: 1-2 = ~2900, 3-5 = ~3700, 6-7 = ~4700; disengaged mode works at ~5200)
  • T43, T43p (fan levels RPM: 1-2 = ~3300, 3-5 = ~4100, 6-7 = ~4700; disengaged mode works at ~6450)
  • T60 (fan levels RPM: 1-2 = 3000-3100, 3-5 = ~3600, 6-7 = ~4500; disengaged mode works at ~5500)
  • T61 (fan levels RPM: 0 = off, 1-2 = ~2980, 3-5 = ~3330, 6-7 = ~3760; disengaged mode works at ~4500)
  • W500 (fan levels RPM: 0=off, 1-2 = 1900, 3-5 = ~3000, 6-7 = ~3500; disengaged mode works at ~5100)
  • W510 (fan levels RPM: 0=off, 1 = ~2750, 2 = ~3100, 3-5 = ~3500, 6-7 = ~4000; disengaged mode works at ~4585)
  • X30 (level 0 = off, low = ~3900, medium = ~4200, maximum = ~4650, disengaged = ~5900)
  • X31 (fan levels RPM: 0 = off, 1-2 = ~2850, 3-5 = ~3450, 6 = ~4050, 7 = ~4150; disengaged mode works at ~4975)
  • X40
  • X41
  • X41 Tablet
  • X60 (fan levels RPM: 0 = 0, 1-2 = ~2850, 3-5 = ~3110, 6 = ~3600, 7 = ~3700, disengaged = ~4700)
  • X61 (fan levels RPM: 1-2 = ~3400, 3-5 = ~3800, 6-7 = ~4500, disengaged = ~6700)
  • X61s (fan levels RPM: 0 = off, 1-2 = ~3800, 3-5 = ~4500, 6-7 = ~4800, disengaged = ~4800) (though fancontrol can keep it at 2500rpm...)
  • X120e
  • X201i (fan levels RPM: 0 = off, 1 = ~1900, 4 = ~3400, 7 = ~4200, disengaged = ~6300)
  • X220 (fan levels RPM: 0 = off, 1 = ~2000, 2 = ~3000, 3-4 = ~3500, 5-6 = ~3900, 7 = ~4500, full-speed = ~5300, disengaged = ~5300)
  • Z60t, Z60m (fan levels RPM: 1-2 = ~1700, 3-5 = ~2800, 6-7 = ~3500)
  • Z61m
  • Z61p (fan levels 0-7, auto, disengaged; enable, disable; watchdog (untested))
  • Template:Edge11 (fan levels: 0 = off, 1, 2, 3, 7 = full; RPM shown value is around 492 - 503, but should be 1000 - 3000)

Probably other models are supported too (please update this page if you confirm this; maintain some ordering too).

Supported models using a different interface

The following models also work, which uses a different access method that is supported (only) via the /proc/acpi/ibm/fan of thinkpad-acpi. There is no need for patching.

Unsupported models

  • 390, 390E, 390X (these models use a different method and register to regulate fan speed)
  • 560, 560X (these models don't have a fan)
  • 800, 820, 821, 822, 823, 850, 851, 860 (these models use a different method and register to regulate fan speed)
  • SL300, SL400, SL400c, SL500, SL500c (these models use a different method and register to regulate fan speed)
  • R30, R31, R32, R40, R40e (these models use a different method and register to regulate fan speed)