jshufro
Posts: 3
Joined: Tue Jun 02, 2020 8:09 pm

poe hat thermal zones [ubuntu]

Thu Jun 04, 2020 9:03 pm

Heyo,

I'm having trouble setting sane thermal_zone controls for my poe hat fan.

I'm curious why I see 4 different links to the same cooling devince in /sys/class/thermal/
jacob@ubuntu:~$ ls -al /sys/class/thermal/thermal_zone0/cdev*
lrwxrwxrwx 1 root root 0 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev0 -> ../cooling_device0
-r--r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev0_trip_point
-rw-r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev0_weight
lrwxrwxrwx 1 root root 0 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev1 -> ../cooling_device0
-r--r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev1_trip_point
-rw-r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev1_weight
lrwxrwxrwx 1 root root 0 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev2 -> ../cooling_device0
-r--r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev2_trip_point
-rw-r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev2_weight
lrwxrwxrwx 1 root root 0 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev3 -> ../cooling_device0
-r--r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev3_trip_point
-rw-r--r-- 1 root root 4096 Jun 4 20:48 /sys/class/thermal/thermal_zone0/cdev3_weight
this is a raspberry pi 4 with ubuntu server 20.04, kernel 5.4.0-1011-raspi

from my read of https://www.kernel.org/doc/Documentatio ... fs-api.txt there should really only be 1 cooling device.

Right now in /etc/udev/rules.d/ i have placed a file
jacob@ubuntu:~$ cat /etc/udev/rules.d/50-rpi-fan.rules
SUBSYSTEM=="thermal"
KERNEL=="thermal_zone0"

# If the temp hits 60c, turn on the fan. Turn it off again when it goes back down to 60.
ATTR{trip_point_0_temp}="50000"
ATTR{trip_point_0_hyst}="5000"
#
# If the temp hits 70c, higher RPM.
ATTR{trip_point_1_temp}="80000"
ATTR{trip_point_1_hyst}="3000"
#
# If the temp hits 80c, higher RPM.
ATTR{trip_point_2_temp}="81000"
ATTR{trip_point_2_hyst}="2000"
#
# If the temp hits 81c, highest RPM.
ATTR{trip_point_3_temp}="82000"
ATTR{trip_point_3_hyst}="3000"
The fan has max_state of 4, so i assume 0 is off, 1 is low RPM and 4 is highest RPM.
Above trip point 0 I would expect to be in state 1 until 45C is met, yet i routinely see state 3 and 4 when temperatures are in the low 50s
jacob@ubuntu:~$ cat /sys/class/thermal/thermal_zone0/temp /sys/class/thermal/cooling_device0/cur_state
46738
4
I'm having trouble figuring out why.

jshufro
Posts: 3
Joined: Tue Jun 02, 2020 8:09 pm

Re: poe hat thermal zones

Thu Jun 04, 2020 9:20 pm

I'm here to answer my own question. My thermal zones are backwards. Zone 0 should be hottest and zone 3 should be coolest. I replaced them and now it's quietly staying in zone 1!

Image

Return to “Ubuntu”