[PATCH v2] arm64: dts: rockchip: add pwm-fan for NanoPC-T6

Hugh Cole-Baker posted 1 patch 2 months, 4 weeks ago
There is a newer version of this series
.../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
[PATCH v2] arm64: dts: rockchip: add pwm-fan for NanoPC-T6
Posted by Hugh Cole-Baker 2 months, 4 weeks ago
FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6
and T6 LTS, which plugs in to the fan connector on the board driven by
pwm1. Add the fan as an active cooling device for the SoC package.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
---
Changes from v1: https://lore.kernel.org/linux-rockchip/20251026194858.92461-1-sigmaris@gmail.com/
* add the fan to the base board dtsi instead of overlay (Heiko)
* just use 2 trip points for warm and hot temperatures (Dragan, Alexey)

References:
FriendlyELEC heatsink with fan addon:
https://www.friendlyelec.com/index.php?route=product/product&product_id=305
Vendor DT with trip points and PWM duty cycle values:
https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90

 .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
index fafeabe9adf9e..9164a0ee6228e 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
@@ -11,6 +11,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/rockchip.h>
 #include <dt-bindings/soc/rockchip,vop2.h>
+#include <dt-bindings/thermal/thermal.h>
 #include <dt-bindings/usb/pd.h>
 #include "rk3588.dtsi"
 
@@ -89,6 +90,14 @@ usr_led: led-1 {
 		};
 	};
 
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		cooling-levels = <0 35 64 100 150 255>;
+		fan-supply = <&vcc5v0_sys>;
+		pwms = <&pwm1 0 50000 0>;
+		#cooling-cells = <2>;
+	};
+
 	sound {
 		compatible = "simple-audio-card";
 		pinctrl-names = "default";
@@ -591,6 +600,36 @@ &i2s6_8ch {
 	status = "okay";
 };
 
+&package_thermal {
+	polling-delay = <1000>;
+
+	trips {
+		package_warm: package-warm {
+			temperature = <50000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+
+		package_hot: package-hot {
+			temperature = <60000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map0 {
+			trip = <&package_warm>;
+			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
+		};
+
+		map1 {
+			trip = <&package_hot>;
+			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
 &pcie2x1l0 {
 	reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
 	vpcie3v3-supply = <&vcc_3v3_pcie20>;
-- 
2.50.1 (Apple Git-155)
Re: [PATCH v2] arm64: dts: rockchip: add pwm-fan for NanoPC-T6
Posted by Dragan Simic 2 months, 4 weeks ago
Hello Hugh,

Thanks for the v2!  Please, see a couple of nitpicks below.

On Sunday, November 09, 2025 20:20 CET, Hugh Cole-Baker <sigmaris@gmail.com> wrote:
> FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6
> and T6 LTS, which plugs in to the fan connector on the board driven by
> pwm1. Add the fan as an active cooling device for the SoC package.
> 
> Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
> ---
> Changes from v1: https://lore.kernel.org/linux-rockchip/20251026194858.92461-1-sigmaris@gmail.com/
> * add the fan to the base board dtsi instead of overlay (Heiko)
> * just use 2 trip points for warm and hot temperatures (Dragan, Alexey)
> 
> References:
> FriendlyELEC heatsink with fan addon:
> https://www.friendlyelec.com/index.php?route=product/product&product_id=305
> Vendor DT with trip points and PWM duty cycle values:
> https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90

I think it would be better to move these references to the patch
description, so they become directly available in the repository.
It might be the best to use the "... [n]" form for the references,
which puts them as close to the backed contents as possible.

Oh, and I think that "arm64: dts: rockchip: Enable active cooling
on NanoPC-T6" as the patch subject would read nicer. :)

>  .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 39 +++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> index fafeabe9adf9e..9164a0ee6228e 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> @@ -11,6 +11,7 @@
>  #include <dt-bindings/input/input.h>
>  #include <dt-bindings/pinctrl/rockchip.h>
>  #include <dt-bindings/soc/rockchip,vop2.h>
> +#include <dt-bindings/thermal/thermal.h>
>  #include <dt-bindings/usb/pd.h>
>  #include "rk3588.dtsi"
>  
> @@ -89,6 +90,14 @@ usr_led: led-1 {
>  		};
>  	};
>  
> +	fan: pwm-fan {
> +		compatible = "pwm-fan";
> +		cooling-levels = <0 35 64 100 150 255>;
> +		fan-supply = <&vcc5v0_sys>;
> +		pwms = <&pwm1 0 50000 0>;
> +		#cooling-cells = <2>;
> +	};
> +
>  	sound {
>  		compatible = "simple-audio-card";
>  		pinctrl-names = "default";
> @@ -591,6 +600,36 @@ &i2s6_8ch {
>  	status = "okay";
>  };
>  
> +&package_thermal {
> +	polling-delay = <1000>;
> +
> +	trips {
> +		package_warm: package-warm {
> +			temperature = <50000>;
> +			hysteresis = <2000>;
> +			type = "active";
> +		};
> +
> +		package_hot: package-hot {
> +			temperature = <60000>;
> +			hysteresis = <2000>;
> +			type = "active";
> +		};
> +	};

It should be better to use 55 and 65 oC as the trip thresholds,
because people often report around 50 oC as the observed idle-state
temperature of their RK3588 SoCs, so increasing the first threshold
to 55 oC should be beneficial by preventing the fan from spinning
when the SoC is actually idle.  The second threshold is usually set
to be 10 oC higher, so it should end up at 65 oC.

> +	cooling-maps {
> +		map0 {
> +			trip = <&package_warm>;
> +			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
> +		};
> +
> +		map1 {
> +			trip = <&package_hot>;
> +			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
> +		};
> +	};
> +};
> +
>  &pcie2x1l0 {
>  	reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
>  	vpcie3v3-supply = <&vcc_3v3_pcie20>;
Re: [PATCH v2] arm64: dts: rockchip: add pwm-fan for NanoPC-T6
Posted by Hugh Cole-Baker 1 week, 5 days ago
Hello Dragan,

I haven't been able to test patches for a while, but now I have access to
the NanoPC board again, and I've done some tests:

On 10/11/2025 00:23, Dragan Simic wrote:
> Hello Hugh,
> 
> Thanks for the v2!  Please, see a couple of nitpicks below.
> 
> On Sunday, November 09, 2025 20:20 CET, Hugh Cole-Baker <sigmaris@gmail.com> wrote:
>> FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6
>> and T6 LTS, which plugs in to the fan connector on the board driven by
>> pwm1. Add the fan as an active cooling device for the SoC package.
>>
>> Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
>> ---
>> Changes from v1: https://lore.kernel.org/linux-rockchip/20251026194858.92461-1-sigmaris@gmail.com/
>> * add the fan to the base board dtsi instead of overlay (Heiko)
>> * just use 2 trip points for warm and hot temperatures (Dragan, Alexey)
>>
>> References:
>> FriendlyELEC heatsink with fan addon:
>> https://www.friendlyelec.com/index.php?route=product/product&product_id=305
>> Vendor DT with trip points and PWM duty cycle values:
>> https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90
> 
> I think it would be better to move these references to the patch
> description, so they become directly available in the repository.
> It might be the best to use the "... [n]" form for the references,
> which puts them as close to the backed contents as possible.
> 
> Oh, and I think that "arm64: dts: rockchip: Enable active cooling
> on NanoPC-T6" as the patch subject would read nicer. :)
> 
>>  .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 39 +++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>> index fafeabe9adf9e..9164a0ee6228e 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
>> @@ -11,6 +11,7 @@
>>  #include <dt-bindings/input/input.h>
>>  #include <dt-bindings/pinctrl/rockchip.h>
>>  #include <dt-bindings/soc/rockchip,vop2.h>
>> +#include <dt-bindings/thermal/thermal.h>
>>  #include <dt-bindings/usb/pd.h>
>>  #include "rk3588.dtsi"
>>  
>> @@ -89,6 +90,14 @@ usr_led: led-1 {
>>  		};
>>  	};
>>  
>> +	fan: pwm-fan {
>> +		compatible = "pwm-fan";
>> +		cooling-levels = <0 35 64 100 150 255>;
>> +		fan-supply = <&vcc5v0_sys>;
>> +		pwms = <&pwm1 0 50000 0>;
>> +		#cooling-cells = <2>;
>> +	};
>> +
>>  	sound {
>>  		compatible = "simple-audio-card";
>>  		pinctrl-names = "default";
>> @@ -591,6 +600,36 @@ &i2s6_8ch {
>>  	status = "okay";
>>  };
>>  
>> +&package_thermal {
>> +	polling-delay = <1000>;
>> +
>> +	trips {
>> +		package_warm: package-warm {
>> +			temperature = <50000>;
>> +			hysteresis = <2000>;
>> +			type = "active";
>> +		};
>> +
>> +		package_hot: package-hot {
>> +			temperature = <60000>;
>> +			hysteresis = <2000>;
>> +			type = "active";
>> +		};
>> +	};
> 
> It should be better to use 55 and 65 oC as the trip thresholds,
> because people often report around 50 oC as the observed idle-state
> temperature of their RK3588 SoCs, so increasing the first threshold

Were these people using the heatsink accessory on the NanoPC-T6, or were
they using some other board with worse heat dissipation? I recorded the
package temperature on my NanoPC-T6 with the FriendlyELEC heatsink and fan
and even though it's not idle but actually running Home Assistant,
OpenLDAP, PostgreSQL, Prometheus, Grafana and Nginx, the temperature ranges
between 46 and 48°C, and the fan never even spins up.

Then I ran stress-ng and recorded the temperature under CPU load, with this
version of the patch and another version with 55 & 65°C trip points. [1]

I suspect if people are seeing 50°C at idle, they're either using a less
effective heatsink, or in a very warm ambient temperature. When talking
about the NanoPC-T6 fan specifically, we kinda have to assume the
FriendlyELEC heatsink is used, as there's no mounting for the fan without
the heatsink.

> to 55 oC should be beneficial by preventing the fan from spinning
> when the SoC is actually idle.  The second threshold is usually set
> to be 10 oC higher, so it should end up at 65 oC.

I'll send a v3 with 55 and 65°C trip points, but I doubt it makes any
difference to the fan activating while idle; from my testing it seems to
just let the SoC get a bit hotter under heavy load.

[1]: https://gist.github.com/sigmaris/2d5590271cf26da8ec6cfc7ef8e3e8bc

>> +	cooling-maps {
>> +		map0 {
>> +			trip = <&package_warm>;
>> +			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
>> +		};
>> +
>> +		map1 {
>> +			trip = <&package_hot>;
>> +			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
>> +		};
>> +	};
>> +};
>> +
>>  &pcie2x1l0 {
>>  	reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
>>  	vpcie3v3-supply = <&vcc_3v3_pcie20>;
> 
Re: [PATCH v2] arm64: dts: rockchip: add pwm-fan for NanoPC-T6
Posted by Dragan Simic 1 week, 5 days ago
Hello Hugh,

On Sunday, January 25, 2026 19:04 CET, Hugh Cole-Baker <sigmaris@gmail.com> wrote:
> On 10/11/2025 00:23, Dragan Simic wrote:
> > On Sunday, November 09, 2025 20:20 CET, Hugh Cole-Baker <sigmaris@gmail.com> wrote:
> >> FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6
> >> and T6 LTS, which plugs in to the fan connector on the board driven by
> >> pwm1. Add the fan as an active cooling device for the SoC package.
> >>
> >> Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
> >> ---
> >> Changes from v1: https://lore.kernel.org/linux-rockchip/20251026194858.92461-1-sigmaris@gmail.com/
> >> * add the fan to the base board dtsi instead of overlay (Heiko)
> >> * just use 2 trip points for warm and hot temperatures (Dragan, Alexey)
> >>
> >> References:
> >> FriendlyELEC heatsink with fan addon:
> >> https://www.friendlyelec.com/index.php?route=product/product&product_id=305
> >> Vendor DT with trip points and PWM duty cycle values:
> >> https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90
> > 
> > I think it would be better to move these references to the patch
> > description, so they become directly available in the repository.
> > It might be the best to use the "... [n]" form for the references,
> > which puts them as close to the backed contents as possible.
> > 
> > Oh, and I think that "arm64: dts: rockchip: Enable active cooling
> > on NanoPC-T6" as the patch subject would read nicer. :)
> > 
> >>  .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi   | 39 +++++++++++++++++++
> >>  1 file changed, 39 insertions(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> >> index fafeabe9adf9e..9164a0ee6228e 100644
> >> --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> >> +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi
> >> @@ -11,6 +11,7 @@
> >>  #include <dt-bindings/input/input.h>
> >>  #include <dt-bindings/pinctrl/rockchip.h>
> >>  #include <dt-bindings/soc/rockchip,vop2.h>
> >> +#include <dt-bindings/thermal/thermal.h>
> >>  #include <dt-bindings/usb/pd.h>
> >>  #include "rk3588.dtsi"
> >>  
> >> @@ -89,6 +90,14 @@ usr_led: led-1 {
> >>  		};
> >>  	};
> >>  
> >> +	fan: pwm-fan {
> >> +		compatible = "pwm-fan";
> >> +		cooling-levels = <0 35 64 100 150 255>;
> >> +		fan-supply = <&vcc5v0_sys>;
> >> +		pwms = <&pwm1 0 50000 0>;
> >> +		#cooling-cells = <2>;
> >> +	};
> >> +
> >>  	sound {
> >>  		compatible = "simple-audio-card";
> >>  		pinctrl-names = "default";
> >> @@ -591,6 +600,36 @@ &i2s6_8ch {
> >>  	status = "okay";
> >>  };
> >>  
> >> +&package_thermal {
> >> +	polling-delay = <1000>;
> >> +
> >> +	trips {
> >> +		package_warm: package-warm {
> >> +			temperature = <50000>;
> >> +			hysteresis = <2000>;
> >> +			type = "active";
> >> +		};
> >> +
> >> +		package_hot: package-hot {
> >> +			temperature = <60000>;
> >> +			hysteresis = <2000>;
> >> +			type = "active";
> >> +		};
> >> +	};
> > 
> > It should be better to use 55 and 65 oC as the trip thresholds,
> > because people often report around 50 oC as the observed idle-state
> > temperature of their RK3588 SoCs, so increasing the first threshold
> 
> Were these people using the heatsink accessory on the NanoPC-T6, or were
> they using some other board with worse heat dissipation? I recorded the
> package temperature on my NanoPC-T6 with the FriendlyELEC heatsink and fan
> and even though it's not idle but actually running Home Assistant,
> OpenLDAP, PostgreSQL, Prometheus, Grafana and Nginx, the temperature ranges
> between 46 and 48°C, and the fan never even spins up.
> 
> Then I ran stress-ng and recorded the temperature under CPU load, with this
> version of the patch and another version with 55 & 65°C trip points. [1]
> 
> I suspect if people are seeing 50°C at idle, they're either using a less
> effective heatsink, or in a very warm ambient temperature. When talking
> about the NanoPC-T6 fan specifically, we kinda have to assume the
> FriendlyELEC heatsink is used, as there's no mounting for the fan without
> the heatsink.

Those are all valid points, the overall thermal performance depends
on the room temperature and the actually used cooling solution, while
the latter depends on the specific board.

You're right that, based on thermals you observed, raising the trip
points to 55 and 65 oC may not always lead to the expected improvements,
but let's keep in mind that it actually may keep the fan spinning less
in some environments, which is good for both the end-user perception
and for the fan's longevity.

> > to 55 oC should be beneficial by preventing the fan from spinning
> > when the SoC is actually idle.  The second threshold is usually set
> > to be 10 oC higher, so it should end up at 65 oC.
> 
> I'll send a v3 with 55 and 65°C trip points, but I doubt it makes any
> difference to the fan activating while idle; from my testing it seems to
> just let the SoC get a bit hotter under heavy load.
> 
> [1]: https://gist.github.com/sigmaris/2d5590271cf26da8ec6cfc7ef8e3e8bc

Having the SoC running about 5 oC hotter under load is still fine while
it possibly makes the fan spin a bit less, so it may all together be
a reasonable compromise.

> >> +	cooling-maps {
> >> +		map0 {
> >> +			trip = <&package_warm>;
> >> +			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
> >> +		};
> >> +
> >> +		map1 {
> >> +			trip = <&package_hot>;
> >> +			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
> >> +		};
> >> +	};
> >> +};
> >> +
> >>  &pcie2x1l0 {
> >>  	reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
> >>  	vpcie3v3-supply = <&vcc_3v3_pcie20>;