Lm_sensor's fancontrol

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

Introduction

Fancontrol is a generic fan control script provided by package sys-apps/lm-sensors which can run as a system daemon. First install lm-sensors as described in lm_sensors. Make sure that any Super I/O chip is enabled in the kernel, and its module loaded.

Check that the sensors are working

Verify that temperatures are measured and that there are fans shown with the sensors command:

root #sensors
nct6796-isa-0290
Adapter: ISA adapter
Vcore:                  +1.24 V  (min =  +0.00 V, max =  +1.74 V)
 ..
in14:                   +1.67 V  (min =  +0.00 V, max =  +0.00 V)
fan1:                   490 RPM  (min =    0 RPM)
fan2:                     0 RPM  (min =    0 RPM)
fan3:                     0 RPM  (min =    0 RPM)
fan4:                     0 RPM  (min =    0 RPM)
fan5:                     0 RPM  (min =    0 RPM)
fan7:                     0 RPM  (min =    0 RPM)
SYSTIN:                 +28.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
CPUTIN:                 +28.5°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
AUXTIN0:               +104.0°C    sensor = thermistor
AUXTIN1:               +114.0°C    sensor = thermistor
AUXTIN2:               +114.0°C    sensor = thermistor
AUXTIN3:                -12.0°C    sensor = thermistor
PCH_CHIP_CPU_MAX_TEMP:   +0.0°C
PCH_CHIP_TEMP:           +0.0°C
PCH_CPU_TEMP:            +0.0°C
PCH_MCH_TEMP:            +0.0°C

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +36.0°C  (crit = +95.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +36.0°C  (high = +105.0°C, crit = +105.0°C)
Core 0:        +34.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:        +35.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:        +35.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:        +35.0°C  (high = +105.0°C, crit = +105.0°C)

Note that not all sensors and fans may be connected and/or provide sensible values. In this case:

  • The system has only one fan; fan2 to fan6 are not connected
  • Temperature readings for AUXTIN0 to PCH_MCH_TEMP are not very likely, and are probably not connected
  • Temperatures reported by the the ACPI interface (acpitz-acpi-0) and the ISA adapter (coretemp-isa-0000) are more real.

Configuration

Execute pwmconfig as root to create the configuration file for fancontrol:

root #pwmconfig
# pwmconfig revision $Revision$ ($Date$)
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 is coretemp
   hwmon2 is nct6796

Found the following PWM controls:
   hwmon2/pwm1           current value: 224
hwmon2/pwm1 is currently setup for automatic speed control.
In general, automatic mode is preferred over manual mode, as
it is more efficient and it reacts faster. Are you sure that
you want to setup this output for manual control? (n)

Answer all questions posed by pwmconfig. Note that pwmconfig also works for voltage controlled fans.

Warning
Pwmconfig will shutdown your fans to calibrate settings against fan speed. Make sure your system won't overheat while you configure your system. Preferably the computer is completely idle, and all powersaving measures are enabled. Check Power_management/Guide if needed.

It is possible to manually fine tune the configuration file:

FILE /etc/fancontrol
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=5
DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/nct6775.656
DEVNAME=hwmon0=acpitz hwmon2=nct6796
FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input
FCFANS= hwmon2/pwm1=hwmon2/fan1_input
MINTEMP=hwmon2/pwm1=50
MAXTEMP=hwmon2/pwm1=90
MINSTART=hwmon2/pwm1=70
MINSTOP=hwmon2/pwm1=30

Useful parameters to tune are:

  • INTERVAL: the number of seconds between temperature samples
  • MINTEMP: the temperature at which the fan should start working
  • MAXTEMP: the temperature at which the fan should spin at maximum RPM

Start fancontrol as a service

Start fancontrol as a service, and enable the service for automatic start:

root #rc-service fancontrol
root #rc-config add fancontrol