[openwrt/openwrt] mvebu: setup effective thermal zones on Puzzle M901 and M902

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 25 11:21:08 PST 2023


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/aa41f4a395bda69cb6ef0ef423e2a4077284fbcd

commit aa41f4a395bda69cb6ef0ef423e2a4077284fbcd
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Sat Feb 25 17:42:23 2023 +0000

    mvebu: setup effective thermal zones on Puzzle M901 and M902
    
    Assign fan with 4 active cooling levels to be used for the main CPU as
    well as external SerDes units.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../arm64/boot/dts/marvell/cn9131-puzzle-m901.dts  | 27 +++++++-------
 .../arm64/boot/dts/marvell/cn9132-puzzle-m902.dts  | 32 +++++++++--------
 .../arm64/boot/dts/marvell/puzzle-thermal.dtsi     | 41 ++++++++++++++++++++++
 3 files changed, 70 insertions(+), 30 deletions(-)

diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts
index 80d876b4ad..0ad25fafbb 100644
--- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts
+++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts
@@ -6,6 +6,7 @@
  */
 
 #include "cn9130.dtsi"
+#include "puzzle-thermal.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -109,26 +110,18 @@
 			chassis_fan_group0: fan-group at 0 {
 				#cooling-cells = <2>;
 				reg = <0x00>;
-				cooling-levels = <64 102 170 230 250>;
+				cooling-levels = <80 102 170 230 255>;
 			};
 		};
 	};
 };
 
-&ap_thermal_cpu1 {
-	trips {
-		cpu_active: cpu-active {
-			temperature = <44000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-	};
-	cooling-maps {
-		fan-map {
-			trip = <&cpu_active>;
-			cooling-device = <&chassis_fan_group0 64 THERMAL_NO_LIMIT>;
-		};
-	};
+&ap_thermal_ic {
+	PUZZLE_FAN_THERMAL(ic, &chassis_fan_group0);
+};
+
+&cp0_thermal_ic {
+	PUZZLE_FAN_THERMAL(cp0, &chassis_fan_group0);
 };
 
 /* on-board eMMC - U9 */
@@ -396,6 +389,10 @@
 	};
 };
 
+&cp1_thermal_ic {
+	PUZZLE_FAN_THERMAL(cp1, &chassis_fan_group0);
+};
+
 &cp1_usb3_1 {
 	status = "okay";
 	phys = <&cp1_comphy3 1>;
diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts
index fd99eb2d13..398e53a5f9 100644
--- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts
+++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts
@@ -6,6 +6,7 @@
  */
 
 #include "cn9130.dtsi"
+#include "puzzle-thermal.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -154,28 +155,21 @@
 			chassis_fan_group0: fan-group at 0 {
 				#cooling-cells = <2>;
 				reg = <0x00>;
-				cooling-levels = <64 102 170 230 250>;
+				cooling-levels = <80 102 170 230 255>;
 			};
 		};
 	};
 };
 
-&ap_thermal_cpu1 {
-	trips {
-		cpu_active: cpu-active {
-			temperature = <44000>;
-			hysteresis = <2000>;
-			type = "active";
-		};
-	};
-	cooling-maps {
-		fan-map {
-			trip = <&cpu_active>;
-			cooling-device = <&chassis_fan_group0 64 THERMAL_NO_LIMIT>;
-		};
-	};
+&ap_thermal_ic {
+	PUZZLE_FAN_THERMAL(ic, &chassis_fan_group0);
+};
+
+&cp0_thermal_ic {
+	PUZZLE_FAN_THERMAL(cp0, &chassis_fan_group0);
 };
 
+
 /* on-board eMMC - U9 */
 &ap_sdhci0 {
 	pinctrl-names = "default";
@@ -447,6 +441,10 @@
 	};
 };
 
+&cp1_thermal_ic {
+	PUZZLE_FAN_THERMAL(cp1, &chassis_fan_group0);
+};
+
 /*
  * Instantiate the second connected CP115
  */
@@ -562,3 +560,7 @@
 		};
 	};
 };
+
+&cp2_thermal_ic {
+	PUZZLE_FAN_THERMAL(cp2, &chassis_fan_group0);
+};
diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi
new file mode 100644
index 0000000000..94677532f2
--- /dev/null
+++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi
@@ -0,0 +1,41 @@
+#define PUZZLE_FAN_THERMAL(_cname, _fan)					\
+	trips {									\
+		_cname##_active_high: cpu-active-high {				\
+			temperature = <80000>;					\
+			hysteresis = <2000>;					\
+			type = "active";					\
+		};								\
+		_cname##_active_med: cpu-active-med {				\
+			temperature = <72000>;					\
+			hysteresis = <2000>;					\
+			type = "active";					\
+		};								\
+		_cname##_active_low: cpu-active-low {				\
+			temperature = <65000>;					\
+			hysteresis = <2000>;					\
+			type = "active";					\
+		};								\
+		_cname##_active_idle: cpu-active-idle {				\
+			temperature = <60000>;					\
+			hysteresis = <2000>;					\
+			type = "active";					\
+		};								\
+	};									\
+	cooling-maps {								\
+		cpu-active-high {						\
+			trip = <&_cname##_active_high>;				\
+			cooling-device = <_fan 3 THERMAL_NO_LIMIT>;		\
+		};								\
+		cpu-active-med {						\
+			trip = <&_cname##_active_med>;				\
+			cooling-device = <_fan 2 THERMAL_NO_LIMIT>;		\
+		};								\
+		cpu-active-low {						\
+			trip = <&_cname##_active_low>;				\
+			cooling-device = <_fan 1 THERMAL_NO_LIMIT>;		\
+		};								\
+		cpu-active-idle {						\
+			trip = <&_cname##_active_idle>;				\
+			cooling-device = <_fan 0 THERMAL_NO_LIMIT>;		\
+		};								\
+	}




More information about the lede-commits mailing list