Code/tp-fancontrol
- !/bin/bash
- tp-fancontrol 0.3.02 (http://thinkwiki.org/wiki/ACPI_fan_control_script)
- Provided under the GNU General Public License version 2 or later or
- the GNU Free Documentation License version 1.2 or later, at your option.
- See http://www.gnu.org/copyleft/gpl.html for the Warranty Disclaimer.
- This script dynamically controls fan speed on some ThinkPad models
- according to user-defined temperature thresholds. It implements its
- own decision algorithm, overriding the ThinkPad embedded
- controller. It also implements a workaround for the fan noise pulse
- experienced every few seconds on some ThinkPads.
- Run 'tp-fancontrol --help' for options.
- For optimal fan behavior during suspend and resume, invoke
- "tp-fancontrol -u" during the suspend process.
- WARNING: This script relies on undocumented hardware features and
- overrides nominal hardware behavior. It may thus cause arbitrary
- damage to your laptop or data. Watch your temperatures!
- WARNING: The list of temperature ranges used below is much more liberal
- than the rules used by the embedded controller firmware, and is
- derived mostly from anecdotal evidence, hunches and wishful thinking.
- It is also model-specific (see http://thinkwiki.org/wiki/Thermal_sensors).
- Temperature ranges, per sensor:
- (min temperature: when to step up from 0-th fan level,
- max temperature: when to step up to maximum fan level)
THRESHOLDS=( # Sensor ThinkPad model
# R51 T41/2 Z60t T43-26xx
- min max # ---------- ------- ----- ----- ---------------------------
50 70 # EC 0x78 CPU CPU ? CPU 47 60 # EC 0x79 miniPCI ? ? Between CPU and PCMCIA slot 43 55 # EC 0x7A HDD ? ? PCMCIA slot 49 68 # EC 0x7B GPU GPU ? GPU 40 50 # EC 0x7C BAT BAT BAT Sys BAT (front left of battery) 40 50 # EC 0x7D n/a n/a n/a UltraBay BAT 37 47 # EC 0x7E BAT BAT BAT Sys BAT (rear right of battery) 37 47 # EC 0x7F n/a n/a n/a UltraBay BAT
45 60 # EC 0xC0 ? n/a ? Between northbridge and DRAM 48 62 # EC 0xC1 ? n/a ? Southbridge (under miniPCI) 50 65 # EC 0xC2 ? n/a ? Power circuitry (under CDC)
47 58 # HDD -> -> -> Hard disk internal sensor 47 60 # HDAPS -> -> -> HDAPS readout (same as EC 0x79)
)
LEVELS=( 0 2 4 7) # Fan speed levels
ANTIPULSE=( 0 1 1 0) # Prevent fan pulsing noise at this level
# (reduces frequency of fan RPM updates)
OFF_THRESH_DELTA=3 # when gets this much cooler than 'min' above, may turn off fan MIN_THRESH_SHIFT=0 # increase min thresholds by this much MAX_THRESH_SHIFT=0 # increase max thresholds by this much MIN_WAIT=180 # minimum time (seconds) to spend in a given level before stepping down
IBM_ACPI=/proc/acpi/ibm HDAPS_TEMP=/sys/bus/platform/drivers/hdaps/hdaps/temp1 PID_FILE=/var/run/tp-fancontrol.pid LOGGER=/usr/bin/logger INTERVAL=3 # sample refresh interval SETTLE_TIME=6 # wait this many seconds long before applying anti-pulsing RESETTLE_TIME=600 # briefly disable anti-pulsing at every N seconds SUSPEND_TIME=5 # seconds to sleep when receiving SIGUSR1 DISK_POLL_PERIOD=15 # poll period in seconds for disk sensors (it changes slowly and is expensive to read) HITACHI_MODELS="^(HTS726060M9AT00|HTS5410..G9AT00|IC25[NT]0..ATCS0[45]|HTE541040G9AT00|HTS5416..J9(AT|SA)00)" SEP=',' # Separator char for display
WATCHDOG_DELAY=$(( 3 * INTERVAL )) HAVE_WATCHDOG=`grep -q watchdog $IBM_ACPI/fan