Hi Guenter,
Am 08.11.24 um 17:26 schrieb Guenter Roeck:
On 11/8/24 08:13, Werner Sembach wrote:
Hi,
Am 08.11.24 um 15:30 schrieb Guenter Roeck:
On 11/8/24 04:05, Werner Sembach wrote:
Hi everyone,
I'm currently conceptualizing an upstream implementation for the fan
control on our Sirius 16 Gen 1 & 2 devices which has the following custom
WMI functions (pseudo code):
void SMOD(bool mode): Toggle firmware controlled fans vs manually (aka via
the commands below) controlled fans
bool GMOD(): Get current SMOD setting
int GCNT(): Get number of fans
enum GTYP(int index): Returns "CPU-fan" or "GPU-fan"
void SSPD(int index, int value): Set fan speed target as a fraction of max
speed
int GSPD(int index): Get current fan speed target as a fraction of max speed
int GRPM(int index): Get current actual fan speed in revolutions per minute
int GTMP(int index): Get temperature of thing fan with respective index is
pointed at (CPU or GPU die, see GTYP)
However there are some physical limitations that are not in the firmware
and I would like to implement as low as possible in software, aka the
driver, to avoid hardware damage:
1. Valid fan speeds are 0% (fan off) and 25-100%. Values from 1%-24% must
not be written.
2. As long as GTMP is > 80°C fan speed must be at least 30%.
We would love to see the same driver enforced restrictions in the Uniwil
driver Armin is working on and the Clevo driver Juno Computers is working on.
My Idea so far:
1. Round SSPD input: 0-12% -> 0%, 13-25% -> 25%
That is acceptable.
2. Periodically check GTMP (every second should be enough) in driver and if
the temperature is over 80°C set current and incoming speed commands to at
at least 30%.
Is this legitimate with the hwmon design?
No. That would have to utilize the thermal subsystem. hwmon is not intended to
_control_ the environment, only to monitor it.
Thanks for the hint, I was not aware of the thermal subsystem until now.
But still wondering, doesn't have the hwmon interface also some write
functionality? Or am I completely mistaken here?
That is to set limits and other chip configuration, not for active
environmental control.
From the thermal subsystem I found my way to this page:
https://www.kernel.org/doc/html/latest/driver-api/thermal/nouveau_thermal.html
-> "1: The fan can be driven in manual (use pwm1 to change the speed);"
So it seems like the thermal subsystem is exposing a pwm hwmon attribute itself
which can be used for manual control.
Second question: Is there a good way to implement a userspace controlled
switch between auto and manual mode?
Only if that is a direction to the chip to switch between modes.
Yes, via WMI you can set the mode to "manual", then you can use the wmi to
set the fan speed to whatever speed you like. When it is set to auto, the EC
itself applies an internal fixed fan curve.
The standard attribute for that would be pwmX_enable (since fans are usually
controlled through pwm).
Thanks for the input so far. I have to look deeper into the thermal subsystem.
Regards,
Werner
Guenter
Thanks,
Guenter
Kind regards,
Werner
PS.: By missclick I accidentally sent an empty email before. just ignore it.