[PATCH] arm64: dts: rockchip: enable built-in thermal monitoring on rk3588

Dragan Simic dsimic at manjaro.org
Sun Jan 21 23:57:54 PST 2024


On 2024-01-22 08:36, Alexey Charkov wrote:
> On Mon, Jan 22, 2024 at 10:22 AM Dragan Simic <dsimic at manjaro.org> 
> wrote:
>> On 2024-01-22 07:03, Alexey Charkov wrote:
>> > On Mon, Jan 22, 2024 at 8:55 AM Dragan Simic <dsimic at manjaro.org> wrote:
>> >> On 2024-01-21 19:56, Alexey Charkov wrote:
>> >> > I think I'll also add a board-specific active cooling mechanism on the
>> >> > package level in the next iteration, given that Rock 5B has a PWM fan
>> >> > defined as a cooling device. That will go in the separate patch that
>> >> > updates rk3588-rock-5b.dts (your feedback to v2 of this patch is also
>> >> > duly noted, thank you!)
>> >>
>> >> Great, thanks.  Sure, making use of the Rock 5B's support for attaching
>> >> a PWM-controlled cooling fan is the way to go.
>> >>
>> >> Just to reiterate a bit, any "active" trip points belong to the board
>> >> dts file(s), because having a cooling fan is a board-specific feature.
>> >> As a note, you may also want to have a look at the RockPro64 dts(i)
>> >> files, for example;  the RockPro64 also comes with a cooling fan
>> >> connector and the associated PWM fan control logic.
>> >
>> > Thanks for the pointer! There is also a helpful doc within devicetree
>> > bindings descriptions, although it sits under hwmon which was a bit
>> > confusing to me. I've already tested it locally (by adding to the
>> > board dts), and it spins up and down quite nicely, and even modulates
>> > the fan speed swiftly when the load changes - yay!
>> 
>> Nice!  Also, isn't it like magic? :)  To me, turning LEDs on/off and
>> controlling fans acts as some kind of a "bridge" between the virtual
>> and the real world. :)
> 
> Oh yes! I also keep admiring how one can add just a couple of lines of
> text here and there that's not even real code, and the whole kernel
> machinery starts crunching numbers, analyzing temperatures, running
> PID loops, etc etc so that I could enjoy the satisfying whistle of a
> small fan when I type `make -j8` :-D

Yes, it's very satisfying, :) and it also demonstrates the true power
of the device trees as hardware definitions.  Just a few more lines and
the cooling works! :)

>> As a suggestion, it would be good to test with a couple of different
>> fans, to make sure that the PWM values work well for more that one fan
>> model.  The Rock 5B requires a 5 V fan, if I'm not mistaken?
> 
> It is 5V, yes. I only have one fan to try though, and I simply relied
> on the PWM values that are already defined in the upstream
> rk3588-rock-5b.dts. They don't look ideal for my particular fan,
> because the lowest non-zero cooling state currently uses a PWM value
> of 95, which doesn't always make it spin up. But in the end it doesn't
> seem to matter that much, because that tiny fan needs to spin at full
> 255 whenever all eight cores are loaded (and even then it can only
> balance the temperature at around 60.5С), and when the load is lighter
> (such as during various ./configure runs) it just switches off
> completely as the temperature goes down to 46C even with the fan not
> spinning.

I see, 5 V fans unfortunately aren't very common.  I'm not sure why
Radxa opted for 5 V there;  maybe the goal was to use Raspberry Pi 5 V
fans, but using those tiny fans doesn't make much sense, IMHO.

I think you can freely adjust the PWM values a bit to make your fan
start reliably at the lowest state, regardless of how rarely that state
will be used.  See, if your fan doesn't spin up reliably with the 
current
lowest state, chances for other fan models not to spin up are quite 
high.
IOW, it's better to play safe there, if you agree.

What kind of heatsink are you using with your Rock 5B?  Ah yes, and
what's the actual model of the fan you're using?

> I don't currently use the GPU/NPU/VPU though - maybe those would
> produce more moderate load which could benefit from spinning the fan
> at medium speeds.

Perhaps, but it will need to be tested at some point.  Have you tried
loading only one or two CPU cores?



More information about the Linux-rockchip mailing list