CPU FAN Control (x86_64)

Is there a way to control CPU FAN speed for x86_64?

That depends on the hardware (and to some extent its drivers).

This is usually sorted by the hwmon kernel modules necessary for your mainboard, the easiest way to find this out would be booting a linux live medium on your device (once) and to run sensors-detect there (as it has likely all potential hwmon drivers available and preinstalled), once you know what is needed - you can install and use it on OpenWrt as well.

Just taking my case as an example (it will be different, but somewhat similar for you):

  • kmod-hwmon-f71882fg is the necessary hwmon driver for me, providing the f71882fg kernel module as indicated by sensors-detect on a more full-featured general purpose linux system
  • once installed/ loaded, it will expose its sensor readings and tuneables under /sys/devices/platform/f71882fg.2576/
  • the (single-) case fan is fan1 and its operating points can be controlled via pwm1

The following does the job for me, reducing the operating points to make the fan (normally) run at lower speeds:

# cat /etc/rc.local 
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

echo 80 >/sys/devices/platform/f71882fg.2576/pwm1_auto_point5_pwm

exit 0

Installing lm-sensors may provide you a more human readable overview:

# sensors 
soc_dts1-virtual-0
Adapter: Virtual device
temp1:        +47.0°C  

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +46.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:       +46.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:       +47.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:       +47.0°C  (high = +105.0°C, crit = +105.0°C)

f71889fg-isa-0a10
Adapter: ISA adapter
in0:           1.65 V  
in1:         832.00 mV (max =  +2.04 V)
in2:           1.35 V  
in3:           1.21 V  
in4:         976.00 mV 
in5:         848.00 mV 
in6:         744.00 mV 
in7:           1.66 V  
in8:           1.61 V  
fan1:        1587 RPM
fan2:           0 RPM  ALARM
fan3:           0 RPM  ALARM
temp1:        +38.0°C  (high = +85.0°C, hyst = +84.0°C)
                       (crit = +100.0°C, hyst = +99.0°C)  sensor = transistor
temp2:        +37.0°C  (high = +85.0°C, hyst = +81.0°C)
                       (crit = +100.0°C, hyst = +96.0°C)  sensor = transistor
temp3:          FAULT  (high = +70.0°C, hyst = +68.0°C)
                       (crit = +85.0°C, hyst = +83.0°C)  sensor = transistor

soc_dts0-virtual-0
Adapter: Virtual device
temp1:        +46.0°C 

Again, the above is only valid for my hardware, but there will be similarities for yours, once you've identified and installed/ loaded the correct hwmon driver for your mainboard. You will have to experiment a little with the (minimum reasonable/ safe settings for the-) operating points, making sure that the fan still spins up when needed.

2 Likes

Thx, that is a neat idea, but would not I get the same results if I simply install all available hwmon modules and run sensors-detect after?

If the hwmon module has been packaged for OpenWrt, yes - but it might not be, if no one identified it as useful for OpenWrt's x86_64 images yet (there are a few dozens of hwmon drivers, a general purpose ('desktop') linux kernel tends to provide/ install modules for all of them, OpenWrt uses a much more fine grained/ modular packaging approach, at the expense of some human having to identify the kernel modules as relevant - >=150 MB kernel packages vs <5 MB).

For me, just booting a linux live USB stick once/ for 5 minutes was easier to do, but your approach could work as well (if everything needed is already packaged, if it isn't, that would be easy to sort out - the difficulty is finding out what you need).

Btw. collectd can also make use of the hwmon sensors:

Well, collectd is working fine and I can see the tmeperatures, but I wanted to control the CPU FAN speed. I have installed all 36 kmod-hmon-* packages, but sensors-detect still only output coretemp.

This one kmod-hwmon-pwmfan - 5.10.138-1 - Kernel module for PWM controlled FANs was promising, but it is an empty package...

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): 
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 16h thermal sensors...                           No
AMD Family 17h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Hygon Family 18h thermal sensors...                         No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
Intel 5500/5520/X58 thermal sensor...                       No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Some Super I/O chips contain embedded sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): 
Probing for Super-I/O at 0x2e/0x2f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      Yes
Found unknown chip with ID 0x8628
Probing for Super-I/O at 0x4e/0x4f
Trying family `National Semiconductor/ITE'...               No
Trying family `SMSC'...                                     No
Trying family `VIA/Winbond/Nuvoton/Fintek'...               No
Trying family `ITE'...                                      No

Some systems (mainly servers) implement IPMI, a set of common interfaces
through which system health data may be retrieved, amongst other things.
We first try to get the information from SMBIOS. If we don't find it
there, we have to read from arbitrary I/O ports to probe for such
interfaces. This is normally safe. Do you want to scan for IPMI
interfaces? (YES/no): 
Probing for `IPMI BMC KCS' at 0xca0...                      No
Probing for `IPMI BMC SMIC' at 0xca8...                     No

Some hardware monitoring chips are accessible through the ISA I/O ports.
We have to write to arbitrary I/O ports to probe them. This is usually
safe though. Yes, you do have ISA I/O ports even if you do not have any
ISA slots! Do you want to scan the ISA I/O ports? (YES/no): 
Probing for `National Semiconductor LM78' at 0x290...       No
Probing for `National Semiconductor LM79' at 0x290...       No
Probing for `Winbond W83781D' at 0x290...                   No
Probing for `Winbond W83782D' at 0x290...                   No

Lastly, we can probe the I2C/SMBus adapters for connected hardware
monitoring devices. This is the most risky part, and while it works
reasonably well on most systems, it has been reported to cause trouble
on some systems.
Do you want to probe the I2C/SMBus adapters now? (YES/no): 
Using driver `i2c-i801' for device 0000:00:1f.4: Kaby Lake (PCH)

Next adapter: i915 gmbus dpc (i2c-0)
Do you want to scan it? (yes/NO/selectively): yes

Next adapter: i915 gmbus dpb (i2c-1)
Do you want to scan it? (yes/NO/selectively): yes

Next adapter: i915 gmbus dpd (i2c-2)
Do you want to scan it? (yes/NO/selectively): yes

Next adapter: AUX B/port B (i2c-3)
Do you want to scan it? (yes/NO/selectively): yes

Next adapter: AUX C/port C (i2c-4)
Do you want to scan it? (yes/NO/selectively): yes

Next adapter: AUX D/port D (i2c-5)
Do you want to scan it? (yes/NO/selectively): yes

Next adapter: SMBus I801 adapter at f040 (i2c-6)
Do you want to scan it? (YES/no/selectively): yes
Client found at address 0x51
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 No
Client found at address 0x53
Probing for `Analog Devices ADM1033'...                     No
Probing for `Analog Devices ADM1034'...                     No
Probing for `SPD EEPROM'...                                 No


Now follows a summary of the probes I have just done.
Just press ENTER to continue: 

Driver `coretemp':
  * Chip `Intel digital thermal sensor' (confidence: 9)

Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no): 
Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors
for initialization at boot time.
You should now start the lm_sensors service to load the required
kernel modules.

That's the problem, the necessary hwmon module might not be packaged up for OpenWrt yet, no way to find out without using a full-featured (general purpose/ everything and the kitchensink) kernel.

(and even that might not be successful in every case, as I've never been able to find a hwmon module for my Lenovo M73 SFF - while it was easy to find for an M83 SFF).

Yeah, I might do that, but knowing what I need does not help me if it is not available. I guess I will have to find another way to control the temperature.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.