You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CM4 IO Board fan still running after shutdown #4632
Is there any way to let the kernel the control the fan using the fan header on the CM4 IO Board? The fan always spins because it's plugged into a power adapter.
It would be nice if there had been a V2 to https://patchwork.kernel.org/project/linux-hwmon/patch/20200928104326.40386-1-biwen.li@oss.nxp.com/ to merge support into the mainline kernel. It's probably worth cherry-picking it back and seeing what state it is in as the requested changes appear not to be too huge.
It's a little concerning that the original poster is reporting a nasty looking kernel splat from it.
Just posting my support for something standardized, too. Right now it seems this project (https://github.com/neg2led/cm4io-fan) is the most common way people are getting any decent PWM control over the fan, other than writing up hackneyed scripts to control speeds like:
$ i2cset -y 10 0x2f 0x30 0x80
(to set it to 50%).
As an aside, and more on point with the thread's original topic of discussion, I noticed that the fan comes on after shutdown, but it seems to pulsate a bit, going faster and slower. Is there any particular reason for that? Or do I just have a ghost somewhere in my IO board or 120mm fan?
dtoverlay=i2c-fan,emc2301,i2c_csi_dsi to load it with the default temps and speeds.
Add midtemp=55000,maxtemp=65000 or similar to change the default switch temperatures, and minpwm=0,maxpwm=255 with alternative numbers to modify the PWM range used.
I have looked at what happens on shutdown, and the simple answer is nothing. The fan remains spinning at the speed that was requested previously. I've tried adding a reboot notifier hook via register_reboot_notifier, but it seems to make no difference (possibly I've messed it up, but it's a tricky one to debug).
The CM4 keeps the 3V3 rail powered up on shutdown, and the 12V is coming directly in from the power supply, so the EMC2301 remains powered and keeps the fan spinning. As noted in https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#POWER_OFF_ON_HALT, you should be able to alter that behaviour via sudo -E rpi-eeprom-config --edit when usbboot'ed (rpi-eeprom-config is disabled for EMMC boot). Kill the power to the EMC2301 and the fan should drop to a default speed, but there are no absolute guarantees over what that is.
And just a minor warning should you have a pre-production CM4IO board (dated 13/5/2020) the TACH and PWM lines of the fan connector are reversed, so it won't work. That's unlikely to affect anyone outside Raspberry Pi or some of the alpha testers.
Or I just wait until a Linux kernel version ≥ 5.15.38 becomes the stable version shipped via apt to Pi OS? (The current stable aarch64-version shipped via apt is 5.15.32-v8+)
Just tested it on latest Kernel - doesn't seem to be working with LoveRPI POE Hat which now has EMC2301 and PWM connector. I can control fan via i2c commands fine but nothing happens automatically.
The default assumes that the fan is on i2c1 - no override needed.
Adding i2c0 looks on i2c-0 (GPIOs 0&1, and CM4IO CAM0 and DISP0 connectors via jumpers J6), whilst i2c_csi_dsi looks on i2c-10 (CAM1 & DISP1 connectors, and where the fan controller and RTC are connected on a CM4IO).
I kept watching it, and as the temp increased the cur_state increased from 0 to 6 or 7. But that didn't seem to influence the fan speed at all. The fan spins, even if the cur_state is 0. And it doesn't seem to go any faster if the cur_state is at 7.
Is there any way to get this to work in home assistant os?
Some people has gotten their fans to work however that's on RPI 4s using the GPIO pins as fan control.
I don't know how to get status of the fan nor of setting it's rpm in home assistant.
Let me just precise that after 2 long evenings trying different sets of parameters with "cur_state" at zero and the fan always off, a simple rpi-update raised my kernel from 6.1.21-v8+ to 6.1.54-v8+, and the fan started to spin according to temperature.
Hi guys, I just got a CM4 with EMMC and a cm4 io board and I tried everything but still my fan are going full power and even with the changes to config.txt, I notice no changes in the rpms. can somebody provide me with a config.txt file to fix my problem or did anybody encounter this problem ? I'm running on pi os 64 (latest version)
my "/boot/firmware/config.txt":
Let me just precise that after 2 long evenings trying different sets of parameters with "cur_state" at zero and the fan always off, a simple rpi-update raised my kernel from 6.1.21-v8+ to 6.1.54-v8+, and the fan started to spin according to temperature.
is your solution still working ? if yes could you please tell me the exact steps that has to be made to get the fan rpm down (best case shutdown if temperature too low)
/boot/firmware/config.txt ?? but that is not the right directory
in /boot/config.txt, the following is written :
"
DO NOT EDIT THIS FILE
The file you are looking for has moved to /boot/firmware/config.txt
"
so I didn't Bother editing this one.
Starting with Bookworm, the firmware partition moved from /boot to /boot/firmware. As a result, any references to /boot/config.txt should be read as /boot/firmware/config.txt.
The early Bookworm releases had symbolic links from /boot/config.txt and /boot/cmdline.txt to the real files in /boot/firmware, but we found that for some people - perhaps because of the editor they use - the symbolic links were being replaced by a copy of the file, which caused their changes to be ignored. Now there are placeholder files directing the user to the new locations.
I managed to control the rpm through i2c-set but then it will mean that I will need a shell script that controls the fan rpms.
Starting with Bookworm, the firmware partition moved from /boot to /boot/firmware. As a result, any references to /boot/config.txt should be read as /boot/firmware/config.txt.
The early Bookworm releases had symbolic links from /boot/config.txt and /boot/cmdline.txt to the real files in /boot/firmware, but we found that for some people - perhaps because of the editor they use - the symbolic links were being replaced by a copy of the file, which caused their changes to be ignored. Now there are placeholder files directing the user to the new locations.
well the fan speed , I just rebooted and the fans are back at 100%. after excecuting dmesg | grep emc I got this message : [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0 smsc95xx.macaddr=2C:CF:67:58:7A:31 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 overlayroot=tmpfs console=ttyS0,115200 console=tty1 root=PARTUUID=f0e0fde2-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cfg80211.ieee80211_regdom=DE modprobe.blacklist=emc2305
yes just found it, thank you sir, I rebooted after deleting it but I still have 100% rpm back.
my /boot/firmware/config.txt looks like this :
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtparam=i2c_vc=on
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Additional overlays and parameters are documented
# /boot/firmware/overlays/README
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Automatically load initramfs files, if found
auto_initramfs=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1
# Run in 64-bit mode
arm_64bit=1
# Disable compensation for displays with overscan
disable_overscan=1
# Run as fast as firmware / board allows
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[cm5]
dtoverlay=dwc2,dr_mode=host
[all]
dtoverlay=i2c-fan,emc2305,midtemp=45000,maxtemp=65000,minpwm=0,maxpwm=100
enable_uart=1
i will continue searching for a solution but I think I'm getting closer
Activity
pelwell commentedon Oct 16, 2021
What does the schematic show the header to be connected to?
buismaarten commentedon Oct 16, 2021
What do you mean? I'm using the fan header on the IO board.
buismaarten commentedon Oct 16, 2021
Is it possible to add support for the EMC2301 chip to handle the fan speed?
See: https://forums.raspberrypi.com/viewtopic.php?t=308787
6by9 commentedon Oct 16, 2021
It would be nice if there had been a V2 to https://patchwork.kernel.org/project/linux-hwmon/patch/20200928104326.40386-1-biwen.li@oss.nxp.com/ to merge support into the mainline kernel. It's probably worth cherry-picking it back and seeing what state it is in as the requested changes appear not to be too huge.
It's a little concerning that the original poster is reporting a nasty looking kernel splat from it.
geerlingguy commentedon Nov 21, 2021
Just posting my support for something standardized, too. Right now it seems this project (https://github.com/neg2led/cm4io-fan) is the most common way people are getting any decent PWM control over the fan, other than writing up hackneyed scripts to control speeds like:
(to set it to 50%).
As an aside, and more on point with the thread's original topic of discussion, I noticed that the fan comes on after shutdown, but it seems to pulsate a bit, going faster and slower. Is there any particular reason for that? Or do I just have a ghost somewhere in my IO board or 120mm fan?
icman003 commentedon May 2, 2022
same issue here after system shutdown the fan still on , I saw somewhere said need update bootloader don'y know how
6by9 commentedon May 10, 2022
EMC230x driver merged with #5026. This is based on the more recent patch set that was sent to linux-hwmon in https://patchwork.kernel.org/project/linux-hwmon/cover/20220430114905.53448-1-michaelsh@nvidia.com/
dtoverlay=i2c-fan,emc2301,i2c_csi_dsito load it with the default temps and speeds.Add
midtemp=55000,maxtemp=65000or similar to change the default switch temperatures, andminpwm=0,maxpwm=255with alternative numbers to modify the PWM range used.I have looked at what happens on shutdown, and the simple answer is nothing. The fan remains spinning at the speed that was requested previously. I've tried adding a reboot notifier hook via
register_reboot_notifier, but it seems to make no difference (possibly I've messed it up, but it's a tricky one to debug).The CM4 keeps the 3V3 rail powered up on shutdown, and the 12V is coming directly in from the power supply, so the EMC2301 remains powered and keeps the fan spinning. As noted in https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#POWER_OFF_ON_HALT, you should be able to alter that behaviour via
sudo -E rpi-eeprom-config --editwhen usbboot'ed (rpi-eeprom-config is disabled for EMMC boot). Kill the power to the EMC2301 and the fan should drop to a default speed, but there are no absolute guarantees over what that is.6by9 commentedon May 10, 2022
And just a minor warning should you have a pre-production CM4IO board (dated 13/5/2020) the TACH and PWM lines of the fan connector are reversed, so it won't work. That's unlikely to affect anyone outside Raspberry Pi or some of the alpha testers.
YPyltiai commentedon May 24, 2022
Does anyone know when is the release with this change expected? Thanks!
6by9 commentedon May 24, 2022
raspberrypi/rpi-firmware@affbf52
So rpi-update will get it a kernel including it.
wadoli commentedon May 25, 2022
Or I just wait until a Linux kernel version ≥ 5.15.38 becomes the stable version shipped via apt to Pi OS? (The current stable aarch64-version shipped via apt is 5.15.32-v8+)
YPyltiai commentedon May 25, 2022
Just tested it on latest Kernel - doesn't seem to be working with LoveRPI POE Hat which now has EMC2301 and PWM connector. I can control fan via i2c commands fine but nothing happens automatically.
Fan is there:
And config.txt has:
What am I doing wrong?
6by9 commentedon May 26, 2022
The default assumes that the fan is on i2c1 - no override needed.
Adding
i2c0looks on i2c-0 (GPIOs 0&1, and CM4IO CAM0 and DISP0 connectors via jumpers J6), whilsti2c_csi_dsilooks on i2c-10 (CAM1 & DISP1 connectors, and where the fan controller and RTC are connected on a CM4IO).pelwell commentedon May 26, 2022
In other words, all you should need is:
i2c_arm=onis included as part of thei2c-fanoverlay.YPyltiai commentedon May 26, 2022
Thanks! Now it makes sense - I didn’t try that yesterday.
3 remaining items
kwinz commentedon Aug 23, 2022
Thank you that was super helpful! Especially knowing about the additional
/sys/variables inthermal_zoneandcooling devicedirectory:I kept watching it, and as the temp increased the cur_state increased from 0 to 6 or 7. But that didn't seem to influence the fan speed at all. The fan spins, even if the
cur_stateis0. And it doesn't seem to go any faster if thecur_stateis at7.My PWM fan is a
Fan-4010-PWM-12Vthat came in a WaveshareWS-19195case bundle.Photo: https://www.dropbox.com/s/x2iv9ax1bs5gp3q/IMG_20220823_215237.jpg?dl=0
Maybe my fan's PWM controller is broken? I don't have another 12V PWM fan at hand right now to test.
Hreimr commentedon Dec 27, 2022
Is there any way to get this to work in home assistant os?
Some people has gotten their fans to work however that's on RPI 4s using the GPIO pins as fan control.
I don't know how to get status of the fan nor of setting it's rpm in home assistant.
dmeziere commentedon Oct 3, 2023
Let me just precise that after 2 long evenings trying different sets of parameters with "cur_state" at zero and the fan always off, a simple
rpi-updateraised my kernel from 6.1.21-v8+ to 6.1.54-v8+, and the fan started to spin according to temperature.habibbenkhedher commentedon Jul 24, 2024
Hi guys, I just got a CM4 with EMMC and a cm4 io board and I tried everything but still my fan are going full power and even with the changes to config.txt, I notice no changes in the rpms. can somebody provide me with a config.txt file to fix my problem or did anybody encounter this problem ? I'm running on pi os 64 (latest version)
my "/boot/firmware/config.txt":
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtparam=i2c_vc=on
dtparam=audio=on
camera_auto_detect=1
auto_initramfs=1
dtoverlay=vc4-kms-v3d
max_framebuffers=2
disable_fw_kms_setup=1
arm_64bit=1
disable_overscan=1
arm_boost=1
[cm4]
otg_mode=1
[cm5]
dtoverlay=dwc2,dr_mode=host
[all]
dtoverlay=i2c-fan,emc2301,midtemp=45000,maxtemp=65000,minpwm=0,maxpwm=255
rofehr commentedon Jul 24, 2024
/boot/firmware/config.txt ??
but that is not the right directory
habibbenkhedher commentedon Jul 24, 2024
is your solution still working ? if yes could you please tell me the exact steps that has to be made to get the fan rpm down (best case shutdown if temperature too low)
in /boot/config.txt, the following is written :
"
DO NOT EDIT THIS FILE
The file you are looking for has moved to /boot/firmware/config.txt
"
so I didn't Bother editing this one.
pelwell commentedon Jul 25, 2024
Starting with Bookworm, the firmware partition moved from
/bootto/boot/firmware. As a result, any references to/boot/config.txtshould be read as/boot/firmware/config.txt.The early Bookworm releases had symbolic links from
/boot/config.txtand/boot/cmdline.txtto the real files in/boot/firmware, but we found that for some people - perhaps because of the editor they use - the symbolic links were being replaced by a copy of the file, which caused their changes to be ignored. Now there are placeholder files directing the user to the new locations.habibbenkhedher commentedon Jul 25, 2024
I managed to control the rpm through
i2c-setbut then it will mean that I will need a shell script that controls the fan rpms.is there a known solution to fix it ?
pelwell commentedon Jul 25, 2024
To fix what - the fan speed or the file locations?
habibbenkhedher commentedon Jul 25, 2024
well the fan speed , I just rebooted and the fans are back at 100%. after excecuting
dmesg | grep emcI got this message :[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0 smsc95xx.macaddr=2C:CF:67:58:7A:31 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 overlayroot=tmpfs console=ttyS0,115200 console=tty1 root=PARTUUID=f0e0fde2-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cfg80211.ieee80211_regdom=DE modprobe.blacklist=emc2305pelwell commentedon Jul 25, 2024
What's that doing there? It is disabling the fan driver that would be responsible for switching off the fan - no wonder it keeps spinning.
habibbenkhedher commentedon Jul 25, 2024
thanks I just noticed it but on
/etc/modprobe.d/rpi-blacklist.confthere is nothing written there so I'm wondering where it has to be modified.pelwell commentedon Jul 25, 2024
/boot/firmware/cmdline.txt?
habibbenkhedher commentedon Jul 25, 2024
yes just found it, thank you sir, I rebooted after deleting it but I still have 100% rpm back.
my
/boot/firmware/config.txtlooks like this :i will continue searching for a solution but I think I'm getting closer