Created attachment 1857125 [details] output of command "hwinfo" Description of problem: fedora-iot 35 fails to control the raspberry pi 4's gpio-fan via dtoverlay Version-Release number of selected component (if applicable): fedora-iot:fedora/stable/aarch64/iot Version: 35.20220121.0 (2022-01-21T19:25:22Z) BaseCommit: 73ea*e7f4 Raspberry Pi 4 with 4GB RAM original case fan: https://www.raspberrypi.com/products/raspberry-pi-4-case-fan/ How reproducible: root@rpi4:~# cat /boot/efi/config.txt | grep fan # Enable case fan at 80>70 degrees celsius dtoverlay=gpio-fan,gpiopin=14,temp=80000 Steps to Reproduce: 1. boot fedora iot on Raspberry Pi 4 2. put dtoverlay=gpio-fan,gpiopin=14,temp=80000 into /boot/efi/config.txt 3. reboot 4. gpio-fan is constantly running, does not spin down below 70 degrees celsius 5. boot Raspberry Pi OS (raspbian/ debian 10/11) with same config.txt 6. gpio-fan stops below 70 degrees celsius and spins up above 80 degrees celsius Actual results: gpio-fan is constantly running, does not spin down below 70 degrees celsius Expected results: gpio-fan should only start at 80 degrees celsius and spin down below 70 degrees celsius Additional info:
> Steps to Reproduce: > > 1. boot fedora iot on Raspberry Pi 4 > 2. put dtoverlay=gpio-fan,gpiopin=14,temp=80000 into /boot/efi/config.txt > 3. reboot > 4. gpio-fan is constantly running, does not spin down below 70 degrees > celsius > 5. boot Raspberry Pi OS (raspbian/ debian 10/11) with same config.txt > 6. gpio-fan stops below 70 degrees celsius and spins up above 80 degrees > celsius > > Actual results: > > gpio-fan is constantly running, does not spin down below 70 degrees celsius > > Expected results: > > gpio-fan should only start at 80 degrees celsius and spin down below 70 > degrees celsius Did you follow the configuration option in the wiki to be able to use the firmware provided DT and overlays? It won't work if you don't. https://fedoraproject.org/w/index.php?title=Architectures/ARM/Raspberry_Pi/HATs#General_configuration
I am using the rpm-ostree based Fedora IOT, not traditional Fedora on the RPI4. The Wiki reads (https://fedoraproject.org/w/index.php?title=Architectures/ARM/Raspberry_Pi/HATs#General_configuration): To use Firmware DT on a traditional Fedora, note this step isn't needed for Fedora IoT, system and hence use config.txt to configure a HAT run the following commands: $ sudo rm /boot/dtb $ sudo echo "FirmwareDT=True" >> /etc/u-boot.conf The device tree symnlink won't be updated for future kernel upgrades. This will enable booting with the Firmware DT, reboot to test that it works in it's current form. From there you can edit the config.txt to enable the various dtoverlay options. It's likely useful to take backups as you change things. You can edit the file directly: Both /boot/dtb and /etc/u-boot.conf do not exist on my Fedora IOT system. So I do not understand how I can switch Fedora IOT to using the Firmware DT instead of the Kernel DT.
> Both /boot/dtb and /etc/u-boot.conf do not exist on my Fedora IOT system. > > So I do not understand how I can switch Fedora IOT to using the Firmware DT > instead of the Kernel DT. I missed that it was IoT, that uses firmware DT by default. Can you try a F-36 image?
tried Fedora-IoT-36-20220405.0.aarch64.raw.xz no network, broadcom throws kernel stack trace on dhcp request now back on Fedora-IoT-35
(In reply to Armin Warda from comment #4) > tried Fedora-IoT-36-20220405.0.aarch64.raw.xz > no network, broadcom throws kernel stack trace on dhcp request > now back on Fedora-IoT-35 Did the fan stuff work though? Network will be fixed with the next kernel update (see bug 2053729)
yes, fan goes on/off, but no hysteresis? The fan control worked with Fedora-IoT-36-20220405.0.aarch64 dtoverlay=gpio-fan,gpiopin=14,temp=80000 1. Fan switched off after boot. 2. I logged in and started 4x "while true; do :; done" and watched the temp in /sys/devices/... go up 3. this bumped the temp to 80°C and triggered the fan on for a few seconds... 4. ...until below 80°C when it switched off 5. fan goes on/off around 80°C with no hysteresis => fan should stay on until cooled down to 80-10°C = 70°C? I also did a test with overclocking the CPU to 2000MHz => idle temp is already at 77°C, just need 1 "while true; do :; done" to bump temp to 80°C, fan is flipping on/off around 80°C without hysteresis
(In reply to Armin Warda from comment #6) > yes, fan goes on/off, but no hysteresis? What do you mean by this?
a) given: dtoverlay=gpio-fan,gpiopin=14,temp=80000 # = 80°C degrees celsius b) observed behaviour: 1) temp>80°C triggers fan on 2) temp<80°C triggers fan off => fan is continuously being switched on and off every few seconds and temp is circling around 79~81°C c) expected behaviour: 0) initial state: temp low (e.g. room temp) and the fan is off 1) temp increases, when temp goes above 80°C it triggers the fan on 2) now fan is cooling the system, temp falls below 80°C, but fan should stay on 3) when temp continues to fall below 70°C, then the fan should be turned off... 4) ... and should only be turned on again above 80°C, see 1) d) So the rules should be should be: 1) temp>80°C triggers fan on 2) 70°C<temp<80°C should not trigger the fan at all, fan should remain in the on or off state it is currently in 3) temp<70°C triggers fan off
> 2) 70°C<temp<80°C should not trigger the fan at all, fan should remain in > the on or off state it is currently in > 3) temp<70°C triggers fan off That's not what's in the rpi firmware overlay: https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/overlays/gpio-fan-overlay.dts#L63
But that's what line 63 hysteresis = <10000> should specify if I put dtoverlay=gpio-fan,gpiopin=14,temp=80000 # = 80°C degrees celsius in config.txt! actual_temperature > temp => fan switch on actual temperature < temp - hysteresis => fan switch off That's how I undestand the term "hysteresis".
Fedora-IoT-36-20220411.0.aarch64.raw.xz, kernel 5.17.2-300.fc36.aarch64: /boot/efi/config.txt: dtoverlay=gpio-fan,gpiopin=14,temp=80000 [+] ethernet is working [+] Raspberry Pi 4b case-fan/gpio-fan control with dtoverlay is working [-] hysteresis 70<80°C not working: fan is flipping on/off around ~80°C
I checked again with Fedora-IoT-36-20220413.0.aarch64.raw.xz and Fedora-IoT-36-20220426.0.aarch64.raw.xz and /boot/efi/config.txt: dtoverlay=gpio-fan,gpiopin=14,temp=80000 same result: [+] Raspberry Pi 4b case-fan/gpio-fan control with dtoverlay is working [-] hysteresis 70<80°C not working: fan is flipping on/off around ~80°C To compare, I then booted Raspian OS 64bit: 2022-04-04-raspios-bullseye-arm64-lite.img.xz (Kernel 5.15.32-v8+ aarch64) /boot/config.txt: dtoverlay=gpio-fan,gpiopin=14,temp=80000 and here the hysteresis _is_ working as expected: temp>80°C => case-fan/gpio-fan is switched on temp<70°C => case-fan/gpio-fan is switched off If the temp is between 70 and 80°C, the fan is not triggered on/off! Thus this seems to be a bug in the Fedora Linux Kernel!
*** Bug 2079041 has been marked as a duplicate of this bug. ***
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle. Changing version to 37.
I can confirm this behaviour on Raspberry PI 4 and Fedora 37 Workstation pre release image. Default image, the fan is on continuously. Switching to Firmware device tree instead of kernel DT, the fan is off < 80 C and no hysteresis. Fan turns on the moment the temperature crosses 80C and turns off the moment the temperature is below 80C.
> I can confirm this behaviour on Raspberry PI 4 and Fedora 37 Workstation pre > release image. Default image, the fan is on continuously. Switching to That is expected as the RPi doesn't ship with any form of fan or interface for a fan so we can't set a default because there isn't one. BUT: Looking at the downstream vs upstream kernel code/configs we both use the step wise thermal governor so in theory it should work the same but looking at the actual commits against that code and there's patches they pull in that never made it upstream. In particular this one: https://patchwork.kernel.org/project/linux-pm/patch/20180507175408.2154-1-ilina@codeaurora.org/ Plus a one line fix from someone at RPi. The problem is the above referenced patch never made it upstream as there were changes requested and AFAICT there was no follow up from the person submitting the patch. So as it stands ATM it's working as expected. For reference this is what the downstream overlay documents: From the /boot/efi/overlays/README file: Name: gpio-fan Info: Configure a GPIO pin to control a cooling fan. Load: dtoverlay=gpio-fan,<param>=<val> Params: gpiopin GPIO used to control the fan (default 12) temp Temperature at which the fan switches on, in millicelcius (default 55000) And looking at the upstream overlay to what we ship it has the following: cpu_hot: trip-point@0 { temperature = <55000>; /* (millicelsius) Fan started at 55°C */ hysteresis = <10000>; /* (millicelsius) Fan stopped at 45°C */ type = "active"; }; Which means the hysteresis is hardwired to stop when it drops 10C below the threshold.
Updating the description as gpio-fan does turn on/off now as expected, it's just that hysteresis doesn't work because support isn't upstream. As it stands ATM it's working as expected UPSTREAM, and the RPi kernel has special patches. I'm likely to close this as WONTFIX because unless someone works to get this upstream it will remain as it is.
Will this issue be resolved with the kernel in f37, now that the rpi4 will become an officially supported platform for Fedora?`
(In reply to Armin Warda from comment #18) > Will this issue be resolved with the kernel in f37, now that the rpi4 will > become an officially supported platform for Fedora?` No, it won't, please read comments 16 and 17, nothing has changed since those
This message is a reminder that Fedora Linux 37 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '37'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see it. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 37 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed.
Fedora Linux 37 entered end-of-life (EOL) status on None. Fedora Linux 37 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed.