Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Lenovo ThinkPad x240 在 debian13的風扇控制

緣起:

為了確認筆電在 linux系統的散熱問題, 嘗試了網路上最常見的套件 nbfc (NoteBook Fan Control), 但不見得有相對應筆電型號的控制參數與設定 config, 像這次的 x240 在 nbfc的套件設定檔就沒有, 可能有最接近的 x230 但是測試過沒有明顯效果, sensors 工具中顯示, CPU風扇轉速都是沒有明顯變化, 而 pwm也是沒看到有明顯調控,

因此在網路上搜尋到 thinkfan的套件包, debian本身就有收錄, 裝來試試看吧!

安裝:

$ sudo apt install thinkfan

踩完坑最後的設定檔放到 /etc/thinkfan.yaml

###################################################################
# thinkfan Example Config File
# ============================
#
# Please read the config manpage thinkfan.conf(5) before playing around with
# this.
#
###################################################################


###################################################################
# Sensor Drivers and Temperature Inputs
# =====================================
#
sensors:
  - hwmon: /sys/class/hwmon/hwmon4/temp1_input

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

  - tpacpi: /proc/acpi/ibm/thermal
    indices: [1, 2, 3, 4]

###################################################################


###################################################################
# Fan Drivers
# ===========
#
#
fans:
  # hwmon: Full path to a PWM file
  # ==============================
  #- hwmon: /sys/class/hwmon/hwmon4/pwm1
  
  # tpacpi: Thinkpad-specific fan interface
  # =======================================
  - tpacpi: /proc/acpi/ibm/fan

###################################################################


###################################################################
# Fan Speeds (simple mode)
# ========================
# Samples: (tpacpi 專用)
# #- [128, 65, 80] 
  #- ["level auto", 40, 75]
  #- ["level disengaged", 70, 255]

# 測試過以下在 tpacpi也能生效:  
# 須注意每個 level的 下限到上限區間要跟上一個 level的區間要有重疊 overlapped.
# 0級: 0~40 ; 1級: 39~45 ; 2級: 43~55 ... 以此規則定義!然後 tpacpi的界面只能有 0~7共 8個 level,
levels:
  - [0, 0, 40]
  - [1, 39, 45]
  - [3, 43, 55]
  - [5, 53, 63]
  - [7, 60, 85]
  #- [128, 65, 80] 
  #- ["level auto", 40, 75]
  #- ["level disengaged", 70, 255]

###################################################################


##############################################################################
# Fan Speeds (detailed mode) 參考用:
# ==========================
#
# It is generally advisable to configure the temperature limits for each
# sensor individually.
#
# The speed values used here range from 0 to 255, which is valid for the PWM
# control files used by hwmon-based drivers.
#
# The temperatures specified in upper_limit and lower_limit apply to the
# sensors in the same order in which they were specified in the "sensors:"
# section above, and their length must match the total number of sensors that
# have been configured.
#
#levels:
#  - speed: 0
#    upper_limit: [50, 50, 50]
#
#  - speed: 100
#    lower_limit: [45, 45, 45]
#    upper_limit: [65, 65, 65]
#
#  - speed: 255
#    lower_limit: [60, 60, 60]
##############################################################################

啟動:

$ sudo thinkfan

用 sensors工具看狀態:

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        4511 RPM
CPU:          +46.0°C  
GPU:           +0.0°C  
temp3:         +0.0°C  
temp4:         +0.0°C  
temp5:         +0.0°C  
temp6:         +0.0°C  
temp7:         +0.0°C  
temp8:         +0.0°C  
pwm1:             54%  MANUAL CONTROL

...後略...

上面可以看到 fan1現時的風扇轉速, CPU溫度, ** 特別是 pwm1調控值後面出現 MANUAL CONTROL,**

這是在 nbfc中所未見到的改變, MANUAL CONTROL 表示 pwm1受到手動調整, 而此手動調整是由 thinkfan主程序做調控, 會依據我們設定檔的 levels範圍分作 7段做風扇變速,

測試:

以 firefox瀏覽器去 youtube觀看 1080p 的影片就能看到 fan1、CPU、pwm1明顯的數值變化, CPU利用率到 90%以上, fan1最高可以到 6500 RPM, CPU溫度來到 5x~65度, pwm1調控值會到達 255%全速, 可以聽到風扇明顯噴熱氣出來!

隨著關閉 firefox CPU%降低, sensors顯示調控值也降低回 54%, 風扇大約就是 3xxx~4500 RPM, CPU溫度 45度, 可以當成一般的 baseline.

設定成系統服務

既然能如預期運作, 那就設定啟用到 systemd服務,

sudo systemctl enable thinkfan

Done!

About

Lenovo ThinkPad x240 在 debian13的風扇控制

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors