Skip to content

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

Open
tova-cup wants to merge 1 commit into
vmatare:masterfrom
tova-cup:short_fan_activation_fix
Open

Fixing unexpected short fan activation when on level "0" for new gen Thinkpads#248
tova-cup wants to merge 1 commit into
vmatare:masterfrom
tova-cup:short_fan_activation_fix

Conversation

@tova-cup

@tova-cup tova-cup commented Sep 1, 2024

Copy link
Copy Markdown

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 #114

@bhundven

Copy link
Copy Markdown
Contributor

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?

Comment thread src/fans.cpp
if (!(f.is_open() && f.good()))
throw IOerror(MSG_FAN_INIT(path_), errno);
if (!(f << "watchdog " << watchdog_.count() << std::flush))
throw IOerror(MSG_FAN_INIT(path_), errno);

@ile371 ile371 May 18, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old open PR but can confirm this fix works! However, one side effect is that the Watchdog ping starts happening every cycle after the first one because the last_watch_dog_ping_ isn't set. Should set it at row 147 every time the else if runs similarly to what the set_speed function does:

Suggested change
throw IOerror(MSG_FAN_INIT(path_), errno);
throw IOerror(MSG_FAN_INIT(path_), errno);
last_watchdog_ping_ = std::chrono::system_clock::now();

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When on level "0": Unexpected short fan activation.

3 participants