[ltp] X20 fan control notes
Richard
linux-thinkpad@linux-thinkpad.org
Fri, 21 Jul 2006 17:57:34 +0100 (BST)
Dear All,
I finally got my X20's fan to be silent. Here are a few observations,
which may help. Feel free to reuse on the wiki.
1)Without any form of intervention, the fan behaviour is this:
i) Boot up => fan off
ii)Iff the CPU temp ever exceeds 85 degrees (which can happen if CPU
heavily loaded for a minute) => fan on
iii)Subsequently, even when the CPU cools as low as 38 degrees, the fan
never turns off!
This latching behaviour is rather unfortunate!
2)The fan's "whirr" is relatively quiet. However, it is controlled by a
PWM circuit, which sends short pulses about 10 times/sec. These cause the
fan to "tick" relatively loudly, and far more annoyingly.
3)One can cure the ticking by adding a 1000uF capacitor across the fan.
However, I didn't do this because it then makes the (original) peak
voltage into the (new) average voltage, thereby speeding up the fan.
4)Fan control is possible via ibm_acpi, provided that it is loaded with
experimental=1.
In Mandriva 2006, I had to modify rc.sysinit, to replace
for module in /lib/modules....acpi;
do insmod $module ; done
by
for module in /lib/modules....acpi;
do modprobe `basename $module .ko`; done
. Otherwise, you have to rmmod and modprobe it, but that breaks acpid.
5)Both of the following have the same effect, namely to stop the fan for
about 3 seconds:
echo "disable" > /proc/acpi/ibm/fan
echo "enable" > /proc/acpi/ibm/fan
However, the fan will automatically re-engage on its own.
Thus, I have modified the fan script below, which works perfectly on
the X20, but which would probably be *dangerous* on another model, since
it relies on a specific bug in the hardware.
6) Result: thinkpad is normally totally inaudible (except for slight
"chirping" from the CPU itself). If run for over about 60 secs on full
cpuload, the fan comes on till it cools down.
7)Incidentally:
a)Reading from the acpi battery status still kills off the nvram - if
(and only if) the nvram has not been read at least once before the battery
is read.
[rjn@toffee-pecan ~]$ cat tp-x20-fan2.sh
------------------------------------
#!/bin/sh
# july 2005 Erik Groeneveld, erik@cq2.nl
# It makes sure the fan is on in case of errors
# and only turns it off when all temps are ok.
# Modified by Richard Neill, now ONLY suitable for X20. Might be dangerous
# on other models, since it allows the BIOS to re-initialise the fan.
IBM_ACPI=/proc/acpi/ibm
THERMOMETER=$IBM_ACPI/thermal
FAN=$IBM_ACPI/fan
MAXTRIPPOINT=65
MINTRIPPOINT=55 #was 60
TRIPPOINT=$MINTRIPPOINT
STATUSFILE=/tmp/fanstatus #So we can run this script redirected to
/dev/null
if [ ! -e $FAN ]; then
echo "Sorry, $FAN does not exist. Did you load ibm_acpi with
experimental=1 ? "
exit 1
fi
echo fancontrol: Thermometer: $THERMOMETER, Fan: $FAN
echo fancontrol: Current `cat $THERMOMETER`
echo fancontrol: Controlling temperatures between $MINTRIPPOINT and
$MAXTRIPPOINT degrees.
# Make sure the fan is turned on when the script crashes or is killed
trap "echo enable > $FAN; exit 0" HUP KILL INT ABRT STOP QUIT SEGV TERM
while [ 1 ];
do
command=enable
temperatures=`sed s/temperatures:// < $THERMOMETER`
result=
for temp in $temperatures
do
test $temp -le $TRIPPOINT && result=$result.Ok
done
if [ "$result" = ".Ok.Ok.Ok.Ok.Ok.Ok.Ok.Ok" ]; then
#We're cool enough. Disable the fan. But don't sleep too
long, since
#temperature rises very fast. (=> 5sec). Also, we must
stop the
#embedded controller taking over (=> 0.5 sec)
echo "disable" > $FAN
echo "Fan Off" > $STATUSFILE
TRIPPOINT=$MAXTRIPPOINT
sleep 0.5
else
#We're too hot! Enable the fan. Since temperature falls
quit slowly,
#and we want to prevent hunting, sleep for 30 seconds.
#BUT, on the X20, a peculiarity is that echoing "enable"
#actually stops the fan for a moment! So, echo nothing,
and let
#it start on its own...
#echo "enable" > $FAN
echo "Fan On" > $STATUSFILE
TRIPPOINT=$MINTRIPPOINT
sleep 30
fi
done
-------------------------
Best wishes,
Richard