Difference between revisions of "Patch for controlling fan speed"
(Added disengaged mode to patch) |
Chazchaz101 (Talk | contribs) m |
||
(45 intermediate revisions by 15 users not shown) | |||
Line 1: | Line 1: | ||
==Overview== | ==Overview== | ||
− | This patch extends the | + | {{NOTE|The patch is no longer necessary with kernel > 2.6.10. After opening a root shell with '''$sudo -s''', you should be able to run al of these commands. See: [[How_to_control_fan_speed|How to control fan speed]]}} |
+ | |||
+ | |||
+ | This patch extends the [[ibm-acpi]] Linux kernel module to control fan speed. It can be used to reduce [[Problem with fan noise|fan noise]] (both speed and pulsing) and to decrease fan power consumption. | ||
When this patch is applied and the <tt>ibm-acpi</tt> module is loaded with the <tt>experimental=1</tt> module parameter, the following new capabilities are added to {{path|/proc/acpi/ibm/fan}}: | When this patch is applied and the <tt>ibm-acpi</tt> module is loaded with the <tt>experimental=1</tt> module parameter, the following new capabilities are added to {{path|/proc/acpi/ibm/fan}}: | ||
Line 9: | Line 12: | ||
* {{cmdroot|cat /proc/acpi/ibm/fan}} shows the current fan level (in addition to the fan speed in RPM). | * {{cmdroot|cat /proc/acpi/ibm/fan}} shows the current fan level (in addition to the fan speed in RPM). | ||
− | This patch is best used with | + | For example: |
+ | |||
+ | '''#cat /proc/acpi/ibm/fan''' | ||
+ | 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) | ||
+ | |||
+ | This patch is best used with an [[ACPI fan control script#Variable speed control scripts|ACPI fan control script]] that monitors system temperature and sets the fan speed accordingly. | ||
{{WARN|Overriding the system's automatic temperature control may cause permanent hardware damage. Even when using temperature monitoring software, it is not clear whether the software can access all temperature sensor accessible to the embedded controller and understand them correctly. Moreover, this patch relies on an undocumented hardware interface, and may thus have arbitrary effects (especially on models it wasn't tested on).}} | {{WARN|Overriding the system's automatic temperature control may cause permanent hardware damage. Even when using temperature monitoring software, it is not clear whether the software can access all temperature sensor accessible to the embedded controller and understand them correctly. Moreover, this patch relies on an undocumented hardware interface, and may thus have arbitrary effects (especially on models it wasn't tested on).}} | ||
− | == | + | ==The patch== |
− | |||
− | |||
− | + | ===for ibm-acpi 0.11=== | |
+ | {{CodeRef|ibm-acpi-0.11-2.6.13-fan.patch}} | ||
− | + | This also includes a minor fix (rename of <tt>device_add</tt>) to make [[ibm-acpi]] 0.11 compile on kernel 2.6.13. | |
− | + | ===for ibm-acpi 0.12a as found in kernels 2.6.14 and 2.6.17=== | |
− | + | A slightly modified version which also keeps the lines in the format expected by the gkrellm plugin. | |
− | + | {{CodeRef|ibm-acpi-0.12a-2.6.14-fan.patch}} | |
− | + | {{CodeRef|ibm-acpi-0.12a-2.6.17-fan.patch}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {{NOTE|In order to patch the ibm_acpi.c file you have to issue the following command: <code>patch -p0 -l < fanpatch</code>. The '-l' option is important because the patch pasted here doesn't have any tabs any more. Another piece of advice: Always try to patch the files first before really patching them. That is done by adding --dry-run to the command.}} | |
− | + | ===Ideas for improvement=== | |
− | + | * When fan speed is controlled from userspace (e.g., by the [[ACPI fan control script#Variable speed control scripts|ACPI fan control scripts]]), the userspace component may die (for whatever reason) leaving the fan at a low speed, potentially leading to damage. We can add a watchdog to the kernel component, which resets the fan to Embedded Controller control (<tt>leve: auto</tt>) if {{path|/proc/acpi/ibm/fan}} was not written to for ''N'' seconds. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ==Alternative methods and hardware specs== | |
− | + | See [[How to control fan speed]]. | |
− | + | ==Supported models== | |
− | + | See [[How to control fan speed]]. | |
[[Category:Patches]] | [[Category:Patches]] |
Latest revision as of 01:08, 24 March 2008
Contents
Overview
This patch extends the ibm-acpi Linux kernel module to control fan speed. It can be used to reduce fan noise (both speed and pulsing) and to decrease fan power consumption.
When this patch is applied and the ibm-acpi module is loaded with the experimental=1 module parameter, the following new capabilities are added to /proc/acpi/ibm/fan:
# echo level LEVEL > /proc/acpi/ibm/fan
sets a fan speed level between 0 and 7, where LEVEL=0 means fan off and LEVEL=7 is the fastest speed.# echo level auto > /proc/acpi/ibm/fan
tells the embedded controller to set the fan speed automatically according to system temperatures (this is the default).# echo level disengaged > /proc/acpi/ibm/fan
tells the embedded controller to disengage fan speed control (see specs below).# cat /proc/acpi/ibm/fan
shows the current fan level (in addition to the fan speed in RPM).
For example:
#cat /proc/acpi/ibm/fan 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)
This patch is best used with an ACPI fan control script that monitors system temperature and sets the fan speed accordingly.
The patch
for ibm-acpi 0.11
ibm-acpi-0.11-2.6.13-fan.patch (download)
This also includes a minor fix (rename of device_add) to make ibm-acpi 0.11 compile on kernel 2.6.13.
for ibm-acpi 0.12a as found in kernels 2.6.14 and 2.6.17
A slightly modified version which also keeps the lines in the format expected by the gkrellm plugin.
ibm-acpi-0.12a-2.6.14-fan.patch (download)
ibm-acpi-0.12a-2.6.17-fan.patch (download)
patch -p0 -l < fanpatch
. The '-l' option is important because the patch pasted here doesn't have any tabs any more. Another piece of advice: Always try to patch the files first before really patching them. That is done by adding --dry-run to the command.Ideas for improvement
- When fan speed is controlled from userspace (e.g., by the ACPI fan control scripts), the userspace component may die (for whatever reason) leaving the fan at a low speed, potentially leading to damage. We can add a watchdog to the kernel component, which resets the fan to Embedded Controller control (leve: auto) if /proc/acpi/ibm/fan was not written to for N seconds.