Skip to content

Instantly share code, notes, and snippets.

@Yatoom
Last active April 19, 2024 06:41
Show Gist options
  • Star 80 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
  • Save Yatoom/1c80b8afe7fa47a938d3b667ce234559 to your computer and use it in GitHub Desktop.
Save Yatoom/1c80b8afe7fa47a938d3b667ce234559 to your computer and use it in GitHub Desktop.
Thinkfan configuration

Thinkfan setup

Note: I configured this thinkfan setup for my old Thinkpad w520 on Ubuntu 17.10.

1. Install necessary programs

Install lm-sensors and thinkfan.

sudo apt-get install lm-sensors thinkfan

2. Setup configuration

Find the temperature control devices with

find /sys/devices -type f -name "temp*_input"

Add them to /etc/thinkfan.conf, including (level, min_temperature, max_temperature):

hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input

(0,	0,	60)
(1,	60,	65)
(2,	65,	70)
(3,	70,	75)
(4,	75,	80)
(5,	80,	85)
(7,	85,	32767)

3. Enable fan control

echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkfan.conf
modprobe thinkpad_acpi
  • You can check with lsmod if thinkfan_acpi is running
  • To reload a module you need to remove it with sudo modprobe -r <module>, but this is not always possible, so we might need a reboot here.

4. Testing and running

To test thinkfan, use:

thinkfan -n

And to run it, use:

sudo service thinkfan start

And to retrieve the status, use:

service thinkfan status

5. Running on startup

To make it run at startup, we need to edit /etc/modules and add the lines below, to make the modules thinkpad_acpi and coretemp load at boot time. The thinkpad_acpi has to be loaded before coretemp.

thinkpad_acpi
coretemp

Note that this may change the /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp*_input paths (hwmon3 can become hwmon2 or vice versa), probably because of the order in which the modules are loaded or something. So, in the /etc/thinkfan.conf config, you might need to update these lines.

Furthermore, we need to enable the thinkfan service via systemctl.

sudo systemctl enable thinkfan.service
######################################################################
# thinkfan 0.7 example config file
# ================================
#
# ATTENTION: There is only very basic sanity checking on the configuration.
# That means you can set your temperature limits as insane as you like. You
# can do anything stupid, e.g. turn off your fan when your CPU reaches 70°C.
#
# That's why this program is called THINKfan: You gotta think for yourself.
#
######################################################################
#
# IBM/Lenovo Thinkpads (thinkpad_acpi, /proc/acpi/ibm)
# ====================================================
#
# IMPORTANT:
#
# To keep your HD from overheating, you have to specify a correction value for
# the sensor that has the HD's temperature. You need to do this because
# thinkfan uses only the highest temperature it can find in the system, and
# that'll most likely never be your HD, as most HDs are already out of spec
# when they reach 55 °C.
# Correction values are applied from left to right in the same order as the
# temperatures are read from the file.
#
# For example:
# tp_thermal /proc/acpi/ibm/thermal (0, 0, 10)
# will add a fixed value of 10 °C the 3rd value read from that file. Check out
# http://www.thinkwiki.org/wiki/Thermal_Sensors to find out how much you may
# want to add to certain temperatures.
# Syntax:
# (LEVEL, LOW, HIGH)
# LEVEL is the fan level to use (0-7 with thinkpad_acpi)
# LOW is the temperature at which to step down to the previous level
# HIGH is the temperature at which to step up to the next level
# All numbers are integers.
#
# I use this on my T61p:
#tp_fan /proc/acpi/ibm/fan
#hwmon /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)
#hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
(0, 0, 60)
(1, 60, 65)
(2, 65, 70)
(3, 70, 75)
(4, 75, 80)
(5, 80, 85)
(7, 85, 32767)
Copy link

ghost commented Sep 11, 2019

Nice one!

For new visitors if you are lazy just use:

   find /sys/devices -type f -name "temp*_input"|sed 's/^/hwmon /g'

@woolfg
Copy link

woolfg commented Nov 18, 2019

thanks +1 , just helped me to setup thinkfan on my T440s

@managervcf
Copy link

Thanks! It helped with my X1C6.

@lukaspour
Copy link

@managervcf HI, can you please share your x1c6 config?

Thanks! It helped with my X1C6.

@managervcf
Copy link

@lukaspour

HI, can you please share your x1c6 config?

Actually, I have changed the thinkfan.conf file recently because of /proc/acpi/ibm/thermal consisting of 8 temperatures on battery and 16 temperatures on AC.

Every time I plugged/unplugged AC and rebooted, I got an unexpected behavior or an error from the thinkfan.service saying:

ERROR: Sensor /proc/acpi/ibm/thermal has 8 temperatures, but you have 16 correction values for it.

This variable number of temperatures (8 on battery vs 16 on AC) didn't let me use the simple syntax below.

tp_thermal /proc/acpi/ibm/thermal (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -66, 0, 0, 0, 0, 0)

(0,	0,	50)
(1,	50,	60)
(2,	60,	65)
(3,	65,	70)
(4,	70,	75)
(5,	75,	80)
(6,	80,	85)
(7,	85,	32767)

As I couldn't find any relevant info about this problem online, I tried experimenting with the complex example syntax (/usr/share/doc/thinkfan/examples/thinkfan.conf.complex).

Finally, this config below fixed my problem of variable number of temperatures to correct. Of course, fan levels and min/max thresholds are just an example that happens to work for my machine. I hope it will help you or anyone having a simiar problem.

######################################################################
## thinkfan 0.9 example config file
## ================================
##
## ATTENTION: There is only very basic sanity checking on the configuration.
## That means you can set your temperature limits as insane as you like. You
## can do anything stupid, e.g. turn off your fan when your CPU reaches 70°C.
##
## That's why this program is called thinkfan: You gotta think for yourself.
##
#######################################################################
##
## This file shows how to use sensor-specific temperature limits.
## First of all, you need to specify temperature inputs. On a Thinkpad, you can
## just use:
##
tp_thermal /proc/acpi/ibm/thermal  # provides us with 16 temperature inputs

##
## On other systems, you have to specify a file in /sys/class/hwmon for each
## sensor you want to use. They are numbered in their order of appearance.
## For example:
#
# hwmon /sys/class/hwmon5/temp2_input           #1
# hwmon /sys/class/hwmon0/device/temp3_input    #2
#
## If you want to read temperatures directly from the hard disk, thinkfan needs
## to be compiled with -DUSE_ATASMART. Then you can do:
#
# atasmart /dev/sda                             #3
# ...
#
## You can have as many temperature inputs as you like. You should at get the
## temperature from the CPU, the GPU and the hard disk.
#

#
## Next we specify the fan we want to use. On a Thinkpad, this is:
#
tp_fan /proc/acpi/ibm/fan

#
## On anything other than a Thinkpad you'll probably use some PWM control file
## in /sys/class/hwmon. Remember that fan levels range from 0 to 255 and that
## they're just a number, not including the word "level" as seen below.
## A sysfs fan would be specified like this:
#
# pwm_fan /sys/class/hwmon/hwmon2/device/pwm1
#
## But remember you can only have one fan.

#
## Then you need to specify the temperature limits for each of the sensors.
## A dot means that the corresponding sensor should be ignored. The length of the
## UPPER and LOWER limits must be the same as the number of temperatures. In this
## example, /proc/acpi/ibm/thermal contains 16 sensors (on older thinkpads,
## there may be only 8), some of which are unused (hence the dots).
## A sysfs temperature input always contains only one sensor, so if you specify
## 5 sysfs files above, the length of your limits must be 5, too.
#
## I've come up with these preliminary settings for my Thinkpad T61p. They probably
## don't make sense for anything else, so you most definitely have to work
## something out for yourself.
#


{ "level 0"   # the fan level
# ^-------^   This works for /proc/acpi/ibm/thermal.
#             for a PWM fan in /sys/class/hwmon it would have to be just
#             0 or "0".
#
#    Sensor count:
#    1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16
#    ==============================================
    (0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0)      # LOWER limit
    (50	.  .  .  .  .  .  .  .  .  .  .  .  .  .  .)      # UPPER limit
}


{ "level 1"
# ^-------^ For a PWM fan you may have to use something around 30 to get the
# same speed.
    (50 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (55 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level 2"
    (55 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (60 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level 3"
    (60 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (65 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level 4"
    (65 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (70 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level 5"
    (70 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (75 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level 6"
    (75 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (80 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level 7"
    (80 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (85 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

{ "level disengaged" # nice idea: "level auto" can also be used.
                     # but again: only numbers for sysfs.
    (85 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
    (99 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .)
}

@cohnt
Copy link

cohnt commented Jul 1, 2020

Used this to help get thinkfan running on my P53. Thank you for sharing!

@dsboo
Copy link

dsboo commented Dec 13, 2020

thanks very much i use this on my t480s:)

@sebfoucault
Copy link

thanks very much i use this on my t480s:)

Hi @dsboo, Any specific adaptation for t480s that would be valuable to share ?

@kendoori
Copy link

@managervcf your variant worked for me on my T480. It's been super difficult to get updated config for modern TPs

@jasonwert
Copy link

@managervcf Thanks so much! This works great for me on a T440p using Kde Neon, I just had to change to 8 sensors from 16.

@grssnbchr
Copy link

grssnbchr commented Apr 20, 2021

@managervcf Thanks, I'm using your config, but I still get the following error:

You have configured more temperature limits than sensors. That doesn't make sense.
Refusing to run without usable config file!

This is because sometimes my /proc/acpi/ibm/thermal has 8 readings, sometimes it has 16 (and it doesn't actually matter whether on AC or BAT). So I thought your config covers that variability.. maybe I'm doing something wrong?

@uguremirmustafa
Copy link

This was helpful! I use it with my L14 gen1.

@jheled
Copy link

jheled commented Aug 2, 2021

Can someone tell me how to get the system fan control running again after I started thinkfan?

I tried 'sudo systemctl stop thinkfan', but the fan control remains off, and even
manually setting the fan (echo level 7 | sudo tee /proc/acpi/ibm/fan) fails to start the fan.

Thanks, Joseph

Copy link

ghost commented Aug 2, 2021

Can someone tell me how to get the system fan control running again after I started thinkfan?

I tried 'sudo systemctl stop thinkfan', but the fan control remains off, and even
manually setting the fan (echo level 7 | sudo tee /proc/acpi/ibm/fan) fails to start the fan.

Thanks, Joseph

After you execute the echo command please provide output fom ¨cat /proc/acpi/ibm/fan' command.

printf '%s' 'level 7' > /proc/acpi/ibm/fan
cat /proc/acpi/ibm/fan

@monosoul
Copy link

Wrote an article with a configuration example for ThinkPad P14s (Gen 2) and a bit of deep dive into configuration settings: https://blog.monosoul.dev/2021/10/17/how-to-control-thinkpad-p14s-fan-speed-in-linux/

@johnsidoli
Copy link

Is there any way I can check that thinkfan is running when I reboot? I think I've done everything correctly and even tested it, as per this excellent new answer on askubuntu (which uses new undeprecated codes): https://askubuntu.com/a/1139409/1587772

@fakamaz
Copy link

fakamaz commented Jul 8, 2022

Hi All,

After doing all the above and with settings like that, fans are still not rolling... granted temperature is in 50, but still...

hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp4_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp5_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon1/temp1_input
hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon1/temp2_input

(0, 0, 40)
(1, 40, 44)
(2, 44, 48)
(3, 48, 52)
(4, 52, 56)
(5, 56, 60)
(6, 60, 64)
(7, 64, 68)
(127, 68, 32767)

While running "status" one of the lines shows this:
Jul 08 09:58:15 ThinkPad-L430 thinkfan[15995]: WARNING: Using default fan control in /proc/acpi/ibm/fan.

EDIT: Managed to fix default fan control and now it's not stating an error, but fans are not working anyway...

So how to start them? Thanks in advance.

@williamzerner
Copy link

Hi, my laptop model is S230u but when i run the command
find /sys/devices -type f -name "temp*_input"`

I am not getting (level, min_temperature, max_temperature). Is my device incompatible? I am on Ubuntu 22.04.1 LTS

@hareldev
Copy link

Hello,
Following the comment of step number 5. - (hwmon3 can become hwmon2 or vice versa), and as hwmon is updated with every reboot, I created this script to run at startup, and update the /etc/thinkfan.conf file respectively:
https://github.com/hareldev/cmd-utils/tree/main/thinkfan

@justarandomuser
Copy link

Thinkpad T15g gen 1

Suggested config:

hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp6_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp3_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp7_input
# hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp4_input
# hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp8_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp1_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp5_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp2_input
# /sys/devices/pci0000:00/0000:00:1d.0/0000:55:00.0/nvme/nvme0/hwmon3/temp3_input
# /sys/devices/pci0000:00/0000:00:1d.0/0000:55:00.0/nvme/nvme0/hwmon3/temp1_input
# /sys/devices/pci0000:00/0000:00:1d.0/0000:55:00.0/nvme/nvme0/hwmon3/temp2_input
hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon1/temp1_input
hwmon /sys/devices/virtual/thermal/thermal_zone9/hwmon7/temp1_input
hwmon /sys/devices/virtual/thermal/thermal_zone7/hwmon4/temp1_input

(0,	0,	40)
(1,	40,	55)
(2,	55,	70)
(3,	70,	75)
(4,	75,	80)
(5,	80,	85)
(7,	85,	32767)

@matteyeux
Copy link

T14 Gen 3 suggested config :

hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp6_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp3_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp7_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp4_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp1_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5/temp5_input


(0, 0 , 39)
(1, 39, 52)
(2, 51, 55)
(3, 54, 58)
(4, 56, 66)
(5, 64, 70)
(6, 68, 80)
(7, 79, 86)
(127, 84, 32767)

@mat127
Copy link

mat127 commented Dec 2, 2022

My P15v Gen 1 (Fedora 37) /etc/thinkfan.conf:

sensors:
  - hwmon: /sys/class/hwmon
    name: thinkpad
    indices: [1, 2, 3, 4, 5, 6, 7]

  - hwmon: /sys/class/hwmon
    name: thinkpad
    indices: [8]
    optional: true

  - hwmon: /sys/class/hwmon
    name: coretemp
    indices: [1, 2, 3, 4, 5]

  - hwmon: /sys/class/hwmon
    name: nvme
    indices: [1]

  - hwmon: /sys/class/hwmon
    name: acpitz
    indices: [1]

  - hwmon: /sys/class/hwmon
    name: pch_cometlake
    indices: [1]

  - hwmon: /sys/class/hwmon
    name: iwlwifi_1
    indices: [1]
    optional: true

fans:
  - tpacpi: /proc/acpi/ibm/fan

levels:
  - [0, 0, 60]
  - [2, 60, 65]
  - [3, 65, 70]
  - [5, 70, 75]
  - [6, 75, 80]
  - [7, 80, 85]
  - ["level disengaged", 85, 255]

@panapnamana
Copy link

Hello, Following the comment of step number 5. - (hwmon3 can become hwmon2 or vice versa), and as hwmon is updated with every reboot, I created this script to run at startup, and update the /etc/thinkfan.conf file respectively: https://github.com/hareldev/cmd-utils/tree/main/thinkfan

I am using this. Thank you for your work!

@matteyeux
Copy link

Hello,

fyi zcfan does the job : https://github.com/cdown/zcfan

@DenGontsov
Copy link

For Lenovo ThinkPad T460s
Suggested config:

hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp6_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp3_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp7_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp4_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp8_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp1_input
hwmon /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp5_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
hwmon /sys/devices/virtual/thermal/thermal_zone2/hwmon5/temp1_input
hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon1/temp1_input
hwmon /sys/devices/virtual/thermal/thermal_zone1/hwmon4/temp1_input

(0, 0, 40)
(1, 40, 44)
(2, 44, 48)
(3, 48, 52)
(4, 52, 56)
(5, 56, 60)
(6, 60, 64)
(7, 64, 68)
(127, 68, 32767)

@reddare
Copy link

reddare commented Aug 2, 2023

Thinkpad T14 G3 (AMD) Arch:

sensors:
  - hwmon: /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon5
    name: thinkpad
    indices: [1, 3, 5, 6, 7]

  - hwmon: /sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon6
    name: k10temp
    indices: [1]

  - hwmon: /sys/devices/pci0000:00/0000:00:02.4/0000:03:00.0/nvme/nvme0/hwmon4
    name: nvme
    indices: [1, 2, 3]

  - hwmon: /sys/devices/virtual/thermal/thermal_zone0/hwmon1
    name: acpitz
    indices: [1]

fans:
  - tpacpi: /proc/acpi/ibm/fan
 
levels:
  - [0, 0, 52]
  - [1, 52, 60]
  - [2, 60, 65]
  - [level auto, 65, 75]
  - [level disengaged, 75, 255]

@theopaid
Copy link

theopaid commented Oct 13, 2023

Thank you for this guide!! I used the config that @reddare posted above for my new T14 G4 AMD and it's great. :)

Some notes:

  • At 3. when you say "You can check with lsmod if thinkfan_acpi is running", you probably meant thinkpad_acpi
  • I did not have to edit the '/etc/modules' file to make it work (Arch|Gnome|systemd-boot)

@amirrezaalavi
Copy link

amirrezaalavi commented Nov 15, 2023

ThinkPad T490 Intel GPU:

sensors:
  - hwmon: /sys/class/hwmon/hwmon1/temp1_input
fans:
  - tpacpi: /proc/acpi/ibm/fan
levels:
  - [0, 0, 53]
  - [1, 52, 60]
  - [2, 59, 68]
  - [3, 65, 70]
  - [4, 69, 75]
  - [5, 74, 80]
  - [6, 79, 85]
  - [7, 84, 86]
  - ["level full-speed", 85, 32767]

@bizonek27
Copy link

ThinkPad T15g - Options

sensors:
  ######### Common CPU - Option 1 with GPU #########

  # GPU - [2] is a GPU - not used by me
  #- tpacpi: /proc/acpi/ibm/thermal
  #  name: GPU
  #  indices: [2]

  # CPU
  #- tpacpi: /proc/acpi/ibm/thermal
  #  name: CPU
  #  indices: [1]

  ######### Common CPU - Option 2 with GPU #########
  # CPU
  #- hwmon: /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon9/temp1_input
  # GPU
  #- hwmon: /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon9/temp2_input


  ######### Common CPU - Option 3 without GPU #########
  # Package id 0
  #- hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp1_input

  # CPU per Core
  # Core 0
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp2_input
  # Core 1
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp3_input
  # Core 2
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp4_input
  # Core 3
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp5_input
  # Core 4
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp6_input
  # Core 5
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon11/temp7_input
    #name: coretemp
    #indices: [1, 2, 3, 4, 5, 6, 7]

  ######### GPU nouveau #########
  #- hwmon: /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon7/temp1_input
    #name: nouveau
    #indices: [1]

  ######### SSD nvme0 #########
  #- hwmon: /sys/devices/pci0000:00/0000:00:1b.0/0000:02:00.0/nvme/nvme0/hwmon3/temp1_input
  #- hwmon: /sys/devices/pci0000:00/0000:00:1b.0/0000:02:00.0/nvme/nvme0/hwmon3/temp2_input
  #- hwmon: /sys/devices/pci0000:00/0000:00:1b.0/0000:02:00.0/nvme/nvme0/hwmon3/temp3_input
    #name: nvme
    #indices: [1, 2, 3]
    #correction: [-5, 0, 0]

  ######### SSD nvme1 #########
  #- hwmon: /sys/devices/pci0000:00/0000:00:1d.0/0000:55:00.0/nvme/nvme1/hwmon4/temp1_input
  #- hwmon: /sys/devices/pci0000:00/0000:00:1d.0/0000:55:00.0/nvme/nvme1/hwmon4/temp2_input
    #name: nvme
    #indices: [1, 2]

  ######### acpitz #########
  - hwmon: /sys/devices/virtual/thermal/thermal_zone0/hwmon1/temp1_input
    #name: acpitz
    #indices: [1]

  # cometlake
  - hwmon: /sys/devices/virtual/thermal/thermal_zone4/hwmon8/temp1_input
    #name: pch_cometlake
    #indices: [1]

  # iwlwifi
  - hwmon: /sys/devices/virtual/thermal/thermal_zone10/hwmon12/temp1_input
    #name: iwlwifi_1
    #indices: [1]

fans:
  - tpacpi: /proc/acpi/ibm/fan

levels:
  - [0, 0, 52]
  - [1, 52, 60]
  - [2, 60, 65]
  - ["level auto", 65, 75]
  - ["level disengaged", 75, 255]

Testing


Temperatures(bias): 55(0), 54(0), 53(0), 52(0), 51(0), 51(0), 51(0), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 58(-3), 67(-6), 58(-2), 59(-3), 57(-2), 57(-2), 56(-1), 55(0), 59(0) -> Fans: level 2
Temperatures(bias): 54(0), 56(0), 55(0), 54(0), 55(0), 54(0), 58(-1), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 53(0), 56(0), 54(0), 54(0), 53(0), 53(0), 55(0), 56(0), 60(0) -> Fans: level 2
Temperatures(bias): 53(0), 55(0), 54(0), 54(0), 54(0), 53(0), 56(0), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 55(0), 57(0), 55(0), 55(0), 55(0), 54(0), 56(0), 56(0), 60(0) -> Fans: level 2
Temperatures(bias): 53(0), 56(0), 55(0), 54(0), 54(0), 54(0), 56(0), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 53(0), 56(0), 55(0), 54(0), 54(0), 54(0), 56(0), 57(0), 60(0) -> Fans: level 2
Temperatures(bias): 54(0), 57(0), 56(0), 55(0), 55(0), 54(0), 57(0), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 54(0), 57(0), 56(0), 55(0), 55(0), 54(0), 57(0), 56(0), 60(0) -> Fans: level 2
Temperatures(bias): 54(0), 57(0), 56(0), 55(0), 54(0), 54(0), 57(0), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 55(0), 59(0), 57(0), 56(0), 57(-1), 56(0), 57(0), 57(0), 60(0) -> Fans: level 2
Temperatures(bias): 55(0), 58(0), 56(0), 56(0), 56(0), 56(0), 57(0), 56(0), 59(0) -> Fans: level 1
Temperatures(bias): 56(0), 58(0), 57(0), 57(0), 57(0), 55(0), 57(0), 56(0), 60(0) -> Fans: level 2

@5nizza
Copy link

5nizza commented Dec 11, 2023

Just a note: on my X1YogaGen7 I was getting errors

ERROR: Module thinkpad_acpi doesn't seem to support fan_control
ERROR: ~TpFanDriver: Resetting fan control in /proc/acpi/ibm/fan: Invalid argument

To resolve them, use

echo "options thinkpad_acpi fan_control=1 experimental=1" > /etc/modprobe.d/thinkfan.conf

instead of the original line without experimental=1. The issue may be related to the laptop having two fans instead of one (or maybe not).

And here is my config file, inspired by @managervcf. It works on thinkpad x1 yoga G7:

##
## This file shows how to use sensor-specific temperature limits.
## First of all, you need to specify temperature inputs. 
##
tp_thermal /proc/acpi/ibm/thermal  # provides 8 temperature inputs on x1 yoga G7, and only the first value is relevant

#
## Next we specify the fan we want to use. On a Thinkpad, this is:
#
tp_fan /proc/acpi/ibm/fan

#
## Then you need to specify the temperature limits for each of the sensors.
## A dot means that the corresponding sensor should be ignored. The length of the
## UPPER and LOWER limits must be the same as the number of temperatures. In this
## example, /proc/acpi/ibm/thermal contains 8 sensors, some of which are unused (hence the dots).
#

{ "level 0"   # the fan level
# ^-------^   This works for /proc/acpi/ibm/thermal.
#
#    Sensor count:
#    1  2  3  4  5  6  7  8
#    ======================
    (0  0  0  0  0  0  0  0)      # LOWER limit
    (53	.  .  .  .  .  .  .)      # UPPER limit
}


{ "level 1"
    (48 .  .  .  .  .  .  .)
    (60 .  .  .  .  .  .  .)
}

{ "level 2"
    (55 .  .  .  .  .  .  .)
    (65 .  .  .  .  .  .  .)
}

{ "level auto"
    (60 .  .  .  .  .  .  .)
    (99 .  .  .  .  .  .  .)
}

Probably there is no need for level 0, level 1, level 2, level auto separation,
and a simpler separation level 0, level auto will do just fine,
as my goal is to avoid the fan kicking in too early.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment