I have a raspberry PI 4 (8GB) with the raspberry POE HAT installed. When I run the RPI with raspian OS the fan will cycle on and off as needed. Under fedora the fan does not come on. There is a similar question posted at PoE hat fan activation on OS other than Raspbian with an answer for Ubuntu. Unfortunately, the fan does not register any information in /sys/class/thermal/cooling_devices. It does show up in /sys/devices/platform.

Has anyone been successful in replicating this for Fedora?


1 Answer 1


Update for Fedora 36 (beta as I write; 20 Apr 2022). Thanks to a note from Ben Herrick on the Fedora Arm mailing list, I was inspired to update my headless RPi4 boards to Fedora 36. The updates were trouble free. Instead of uploading the custom device tree created in the original note below, I simply followed the General Configuration note on the Fedora project wiki for Raspberry Pi Hats (https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi/HATs#General_configuration).

  1. sudo rm /boot/dtb
  2. sudo echo "FirmwareDT=True" >> /etc/u-boot.conf

I also made sure that in /boot/efi/config.txt that the upstream_kernel=1 line was commented out. These 3 steps boot Fedora with the Firmware device tree. With the firmware files included in Fedora 36 and the changes above, the POE Hat fan powered up and ran as needed. I did not need to add any additional dtoverlay lines in config.txt.

I have one RPi4 that boots using the UEFI boot loader instead of the normal u-boot loader Fedora provides and the POE Hat fan worked without any special configuration or custom device tree as long as the firmware device tree is loaded and not the upstream device tree bundled with the linux kernel..

You can confirm that the device tree includes the POE hat by doing ls -la /proc/device-tree. In the output there will be a directory named pwm-fan as well as addition thermal settings. In addition, lsmod will show the upstream POE Hat device driver: pwm_raspberrypi_poe 16384 1 .

****** original post below *******

A kernel module for the Raspberry POE Hat fan was added to the 5.13 linux kernel. This kernel is in testing for Fedora and I use Fedora on a Kubernetes cluster running on 4 RPi4 machines. I updated the cluster to the 5.13 Fedora test kernel and was able to use the driver to control the POE Hat fan (original model - I do not know if this driver will work with the plus model).

15 Aug Update - the steps below were done with Fedora Minimal which apparently will use the upstream device tree by default. It may be that other versions of Fedora (e.g. Fedora Server) might use the downstream device tree by default.

The kernel module is controlled via settings in the device tree. The module developer provides an example of the device tree patch needed to control the fan at https://lwn.net/ml/linux-kernel/[email protected]/.

The process to apply the patch to the upstream RPI4 firmware is a bit technical but if you are using fedora or Arch or other distribution on a Raspberry Pi 4 you may have the skills and interest to follow along. Ideally, there will be an overlay file at some point that will greatly simplify configuration and control of the fan.

The steps I followed are outlined below. I am not a kernel developer and largely unfamiliar with device tree mechanics so the process below may be needlessly complex.

First, I downloaded the patch (ie the text between the --- and -- lines in the link above. I saved this in a text file as poe.patch.

Second, I downloaded kernel 5.13 source for Fedora using git. I could have also used the generic 5.13 linux kernel source. A git-managed source tree is needed, as git is used to apply the patch.

Third, I applied the patch from the root of the kernel source with:

git am ~/Downloads/poe-fan/poe.patch.

This will patch the upstream firmware file for the RPi4. The firmware file is bcm2711-rpi-4-b.dts file and is located in the arch/arm/boot/dts/broadcom directory in the kernel source tree.

Fourth, from a separate working directory, run the c preprocessor (cpp) on the dts source file:

cpp -v -nostdinc -I ~/src-fc/kernel-ark/include -I ~/src-fc/kernel-ark/arch  -undef -x assembler-with-cpp ~/src-fc/kernel-ark/arch/arm/boot/dts/bcm2711-rpi-4-b.dts > ~/Downloads/poe-fan/bcm2711-rpi-4-b.dts.preprocessed

This creates the dts file that is ready to be compiled. My fedora kernel source root is at ~/src-fc/kernel-ark.

Fifth run the device tree compiler (dtc) on the preprocessed dts source file. This creates the patched bcm2711-rpi-4-b.dtb device tree blob file:

dtc -I dts -O dtb -o bcm2711-rpi-4-b.dtb bcm2711-rpi-4-.dts.preprocessed

Finally, upload the blob file to the appropriate file system location on the RPi4. On Fedora a arch64 running on an RPI4 this is at /boot/dtb/broadcom. You might want to save a copy of the unpatched blob just in case. Reboot and the fan will start to work. If the CPU temperature gets above about 45 C the fan starts. Higher CPU temperatures will spin the fan harder.

Some caveats. This is all done on a standard Fedora 34 install on a Raspberry PI 4 using the instructions at https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi#Are_the_expansion_HATs_supported.3F.

Second, the patched firmware file will need to be copied to the appropriate directory each time the kernel rpm is updated.

Finally, the Fedora 5.13 kernel is still in testing as I write this (3 Aug 2021).

There will be more to come. I wanted to highlight this driver and outline the steps I used to enable it on my RPi4 kubernetes cluster using Fedora 34. I am exploring the overlay but someone will more skills and experience with the upstream device tree implementation may do a much better and faster implementation.

Many thanks to Nicolas Saenz Julienne for writing this driver and providing guidance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.