I have a Raspberry Pi 5 with the official cooler/fan. The firmware enables it from 50°C and up in different steps. I'd like to control it manually, which is possible by writing the steps to /sys/class/thermal/cooling_device0/cur_state
:
echo '4' | sudo tee -a /sys/class/thermal/cooling_device0/cur_state
0
disables the fan, while 1
is the first 50°C step (30% speed), 2
the second (50%) and so on. 4
is the last one, which leads to 100% fan speed. This works, but only for 1-2 seconds. It seems that the firmware is resetting my custom changes.
What doesn't work
I tried to disable the fan in the /boot/config.txt
:
$ grep cooling /boot/config.txt
dtparam=cooling_fan=off
Using pinctrl
it's possible to set some changes, which are not overwritten by the firmware:
# Disabling the fan
pinctrl FAN_PWM op dh
# 100% fan speed
pinctrl FAN_PWM op dl
# Letting the firmware automatically control the fan again
pinctrl FAN_PWM a0
This works until the next reboot. But I'm very limited, since I can only choose between 0% (fan disabled) and 100% fan speed.
My question
How can we disable the automatic firmware, so that the 4 steps (+1 to disable) in /sys/class/thermal/cooling_device0/cur_state
are kept longer (at least to the next reboot) instead of just for 1-2 seconds?
pinctrl FAN_PWM op dh
disables/sys/class/thermal/cooling_device0/cur_state
becauseecho '4' | sudo tee -a /sys/class/thermal/cooling_device0/cur_state
doesn't have any effect any more. And the file keeps4
even after several seconds, so no firmware touch it, but it seems also not to be used.