[PATCH 1/2] arm64: dts: rockchip: Add the rk3588 thermal zones

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Mon Jan 22 12:34:57 PST 2024


The driver got added back in 45d7b3867a5cabb97fc31f16122cda8540c3a30c,
but the dts never got updated, so here it is!

I’ve added it to the rk3588s because that’s where most of the
definitions are, but I’ve only tested on a rk3588 so maybe there are
subtle changes.

The rk3588 TRM also documents slightly different values (in part 1
section 14.5.3) than the driver, but I’ve left the values alone since I
have no way to determine which one is (more) correct.

Only the CPU is properly mapped, as neither the GPU nor the NPU have
been added to the dts for now, I’ve left some TODOs there.

All of the thermal zones report almost the same value on my rock-5b
board, I’m not sure if this is due to a programming error or if this is
to be expected.  For instance, after running for a while, all of the
zones report 44384 m℃, despite having used neither the GPU nor the NPU.

Additionally, the alert and crit temperatures have been arbitrarily
chosen based on other dts files, not based on any knowledge of the
thermal behaviours of this specific SoC.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
---
 arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 181 ++++++++++++++++++++++
 1 file changed, 181 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
index 36b1b7acfe6a..c7a2078960b7 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
@@ -10,6 +10,7 @@
 #include <dt-bindings/reset/rockchip,rk3588-cru.h>
 #include <dt-bindings/phy/phy.h>
 #include <dt-bindings/ata/ahci.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	compatible = "rockchip,rk3588";
@@ -436,6 +437,186 @@ scmi_shmem: sram at 0 {
 		};
 	};
 
+	thermal_zones: thermal-zones {
+		soc-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 0>;
+
+			trips {
+				soc_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				soc_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				map0 {
+					trip = <&soc_alert>;
+					cooling-device = <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		cluster1-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 1>;
+
+			trips {
+				cluster1_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cluster1_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				map0 {
+					trip = <&cluster1_alert>;
+					cooling-device = <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		cluster2-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 2>;
+
+			trips {
+				cluster2_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cluster2_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				map0 {
+					trip = <&cluster2_alert>;
+					cooling-device = <&cpu_b2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_b3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		cluster0-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 3>;
+
+			trips {
+				cluster0_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cluster0_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				map0 {
+					trip = <&cluster0_alert>;
+					cooling-device = <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+					                 <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		center-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 4>;
+
+			trips {
+				center_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				center_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				/* TODO: what exactly is "center"? */
+			};
+		};
+
+		gpu-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 5>;
+
+			trips {
+				gpu_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				gpu_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				/* TODO: Add the GPU here once it is supported. */
+			};
+		};
+
+		npu-thermal {
+			polling-delay-passive = <250>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+			thermal-sensors = <&tsadc 6>;
+
+			trips {
+				npu_alert: trip-alert {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				npu_crit: trip-crit {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				/* TODO: Add the NPU here once it is supported. */
+			};
+		};
+	};
+
 	usb_host0_ehci: usb at fc800000 {
 		compatible = "rockchip,rk3588-ehci", "generic-ehci";
 		reg = <0x0 0xfc800000 0x0 0x40000>;
-- 
2.43.0




More information about the linux-arm-kernel mailing list