vmatare / thinkfan

The minimalist fan control program
GNU General Public License v3.0
554 stars 62 forks source link

Fixing unexpected short fan activation when on level "0" for new gen Thinkpads #248

Open tova-cup opened 2 months ago

tova-cup commented 2 months ago

As per issue #114, on newer Thinkpads (at least AMD Thinkpad E14 gen 2 and gen 6 affected) when the fan speed is set to "level 0", the fan spins up up very briefly around every 120 seconds.

In fact, the kernel's thinkpad-acpi documentation states that :

The thinkpad-acpi kernel driver can be programmed to revert the fan level to a safe setting if userspace does not issue one of the procfs fan commands: "enable", "disable", "level" or "watchdog", or if there are no writes to pwm1_enable (or to pwm1 if and only if pwm1_enable is set to 1, manual mode) within a configurable amount of time of up to 120 seconds. This functionality is called fan safety watchdog.

As such, to prevent the watchdog from resetting the fan to "automatic", Thinkfan resets the fan speed every 120 second to the current level.

However at low temperature, and if the speed is set to "level 0", rewriting 'level 0' to /proc/acpi/ibm/fan causes the fan to spin up for half a second or so.

This pull request proposes an alternative to resetting the fan speed in order to prevent the watchdog reset (as per @pennae proposition).

Fixes vmatare/thinkfan#114

bhundven commented 2 weeks ago

Might be nice to add that blurb from the documentation (or a link to that part of the document) as a comment with that code?