Giter Site home page Giter Site logo

Comments (9)

Arnavion avatar Arnavion commented on September 24, 2024

Find the hwmon node for the thinkpad-acpi driver (the directory under /sys/class/hwmon that has a file name with the contents thinkpad). Then check what values the pwm file has as you change them from tpfancontrol. If it goes through the numbers defined at

tpfancontrol-rs/src/acpi.rs

Lines 200 to 207 in 9ede218

Zero = 0,
One = 36,
Two = 72,
Three = 109,
Four = 145,
Five = 182,
Six = 218,
Seven = 255,
, then tpfancontrol is working correctly according to the thinkpad-acpi documentation.

In that case, you can try manipulating the values yourself, say to values between those seven numbers, to see if anything happens. That would check if the documentation is wrong about only those seven values working, though I doubt it's wrong since you say 0 doesn't even turn the fan off. When you do this, make sure tpfancontrol isn't running, and make sure to write 0 to fan_watchdog first so that it doesn't automatically revert your changes to pwm1. Write a 1 to fan_watchdog when you're done with the experiment to let it return to automatic mode.

from tpfancontrol-rs.

martens73 avatar martens73 commented on September 24, 2024

Changing the fan level in tpfancontrol changes the number in /sys/class/hwmon/hwmon5/pwm1 correctly, according to the acpi.rs file. I also tried to modify the level values in acpi.rs, as you suggested, but with no effect on the number thrown in pwm1. Not sure whether I modified the correct source file; I took acpi.rs from the directory ~/.cargo/git/checkouts/tpfancontrol-rs-76f0eaa17046310b/9ede218/src/. Can you confirm if this is the correct one?

When tpfancontrol is not running and 0 is written to fan_watchdog, I can increase the fan speed manually step by step:

echo watchdog 0 | sudo tee /proc/acpi/ibm/fan
echo level 0 | sudo tee /proc/acpi/ibm/fan
echo level 1 | sudo tee /proc/acpi/ibm/fan
echo level 2 | sudo tee /proc/acpi/ibm/fan
echo level 3 | sudo tee /proc/acpi/ibm/fan
echo level 4 | sudo tee /proc/acpi/ibm/fan
...

Interestingly, it seems to work in principal, but the fan speed is not mapped as given in acpi.rs, but rather behaves like this:

level 0 = 0 rpm
level 1 = 3000 rpm
level 2 = 3700 rpm
level 3 = 4200 rpm
level 4 = 4200 rpm
...

So the max speed of 4200 rpm is already reached at a level of 3, while the steps between the first three are large. Is it possible that there is a conflicting script or config file hidden somewhere in the system? I have tried out thinkfan a while ago, but was not happy with it and made a fresh install of Mint in the meantime anyway, so I guess this is not the problem. Quite confused at the moment...

from tpfancontrol-rs.

Arnavion avatar Arnavion commented on September 24, 2024

I also tried to modify the level values in acpi.rs, as you suggested, but with no effect on the number thrown in pwm1.

I meant that you should write different values to the /sys/class/hwmon/hwmon5/pwm1 file, not change the source code. Basically to verify that, for example, none of the values between 0 and 36 turn off the fan.

Interestingly, it seems to work in principal, but the fan speed is not mapped as given in acpi.rs, [...]

To be clear, acpi.rs doesn't have fan speeds. It has numbers in the range of 0-255 since that's what the hwmon interface expects for pwm values. It's just that the Thinkpad fan controller internally deals with eight levels, so the hwmon driver has to map the range of 0-255 to those levels. Since tpfancontrol is Thinkpad-specific, it uses levels as a first-class concept in the UI, so it has to convert it back to what the hwmon interface expects using the mapping I linked to.

(The driver actually does this conversion as hwmon value << 5, so for example the level 1 value is actually 32, not 36. I don't remember exactly where I got the values in acpi.rs from because it's been almost 10 years. )

[...] but rather behaves like this:

level 0 = 0 rpm
level 1 = 3000 rpm
level 2 = 3700 rpm
level 3 = 4200 rpm
level 4 = 4200 rpm
...

So the max speed of 4200 rpm is already reached at a level of 3, while the steps between the first three are large.

It's interesting that level 0 to $proc/fan turns the fan off but writing 0 to $hwmon/pwm1 doesn't. They should be handled by the driver in the same way. So again, do the experiment I said in my previous comment:

echo 0 > /sys/class/hwmon/hwmon5/device/driver/fan_watchdog
echo 1 > /sys/class/hwmon/hwmon5/pwm1_enable
echo N > /sys/class/hwmon/hwmon5/pwm1

Vary N between 0 and 36, and see if the fan stops for any value.

Is it possible that there is a conflicting script or config file hidden somewhere in the system?

If the fan stayed off when you wrote level 0 to $proc/fan, then it's unlikely that anything else would be interfering for the other levels. But the usual suspects would be thinkfan or fancontrol, so double-check that neither of those are running.

from tpfancontrol-rs.

martens73 avatar martens73 commented on September 24, 2024

I meant that you should write different values to the /sys/class/hwmon/hwmon5/pwm1 file, not change the source code. Basically to verify that, for example, none of the values between 0 and 36 turn off the fan.

OK, thanks for clarifying. This makes much more sense. So I followed your instruction again and found the following behavior of the fan while changing the pwm values:

echo N | sudo tee /sys/class/hwmon/hwmon5/pwm1

N < 32 : 0 rpm
32 < N < 64 : 3000 rpm
64 < N < 95 : 3700 rpm
N > 95 : 4200 rpm

That's strange!
Neither thinkfan nor fancontrol are installed, nor could I find any remnant file from those, so this is not a problem.

from tpfancontrol-rs.

Arnavion avatar Arnavion commented on September 24, 2024

Okay, so putting aside the fact that the fan curve ramps to max speed at level 3, at least the sysfs values are being mapped to levels correctly. Every increase of 32 is a new level.

So, in the OP you said that when you set tpfancontrol to level 0,the fan remains on at 2000 RPM, and at higher levels it remains stuck at 2400 RPM. Can you double-check that? Because not only does it disagree with the fact that the levels appear to work when you write to sysfs directly, but also you don't get those two speeds when you write to sysfs directly.

from tpfancontrol-rs.

martens73 avatar martens73 commented on September 24, 2024

I double-checked again and could reproduce the problem. So changing the level in tpfcontrol results in correct pwm1 values, but only in the fan speeds of 1900-2000 respectively 2300-2400 rpm. On the other hand, directly writing to pwm1 yields the behaviour described in my previous comment.
Another thing I struggle with and stumbled across right now is when tpfancontrol is launched, the value in /sys/class/hwmon/hwmon5/device/driver/fan_watchdog turns 10, and will persist also after closing tpfancontrol. Is this correct? I thought the value is either 0 or 1, i.e. on or off.

from tpfancontrol-rs.

Arnavion avatar Arnavion commented on September 24, 2024

So changing the level in tpfcontrol results in correct pwm1 values, but only in the fan speeds of 1900-2000 respectively 2300-2400 rpm.

I cannot parse the second half of this sentence.

I thought the value is either 0 or 1, i.e. on or off.

It's not on or off. It's a number of seconds after which the hwmon device will revert to automatic mode, assuming that the process that was managing it manually has died.

from tpfancontrol-rs.

martens73 avatar martens73 commented on September 24, 2024

So changing the level in tpfcontrol results in correct pwm1 values, but only in the fan speeds of 1900-2000 respectively 2300-2400 rpm.

I cannot parse the second half of this sentence.

Sorry, it was too late at night. I meant at level=0 the fan speed is around ~2000 rpm, and at 1 it is ~2400, but which fluctuates around these values by ~100 rpm, while those when pwm1 values are entered directly to sysfs are stable.

It's not on or off. It's a number of seconds after which the hwmon device will revert to automatic mode

Okay, thanks for the explanation.

It seems to be a tricky issue, so I will try to get tpfancontrol running on my T440s, which is a different Thinkpad model, but with the same system installed, just to make sure that this issue is not related to this specific model or OS.

from tpfancontrol-rs.

martens73 avatar martens73 commented on September 24, 2024

tpfancontrol works flawlessly on my Thinkpad T440s, which has also Linux Mint 20.2 installed. To make sure that the issue is not kernel-related, I tested it with versions 5.4.0-91 and 5.13.0-21, and it makes no difference. Hence I conclude that the issue is not related to the kernel nor to the Mint version, but to the hardware of the T495s. Maybe it is the AMD chipset (AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx), which made some problems under Linux in the past.

Nonetheless, interesting that the fan speed of the T440s at level 1 is also 3000 rpm, so this seems to be the min speed for this fan. But then I don't understand why the fan of the T495s is 'underclocked' when tpfancontrol is running, while it is not when pwm1 values are entered manually.

from tpfancontrol-rs.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.