[PATCH] mvebu: LS421DE: fix the thermal zones

Daniel González Cabanelas dgcbueu at gmail.com
Sun Jan 3 16:32:59 EST 2021


The thermal zones kernel documentation is misleading, we cannot use more
than one sensor in a thermal zone node.

Furthermore the drivetemp driver for some reason it only catches one
sensor from the hard drives array (the first available).

In the Buffalo Linkstation LS421DE board there is also a sensor at the
ethernet phy chip that can also be monitored. Very useful to stop the fan
when there are no hard drives in the bays.

(It might be also possible to add the CPU sensor, but it requires kernel
patching for registering the sensor via device tree, using the function:
devm_thermal_zone_of_sensor_register)

Fix the thermal zones to use only one sensor per node and add the ethernet
phy sensor. Also adjust the hdd temperatures to be more conservative for
a mechanical hard drive.

Signed-off-by: Daniel González Cabanelas <dgcbueu at gmail.com>
---
 .../boot/dts/armada-370-buffalo-ls421de.dts   | 55 ++++++++++++++-----
 1 file changed, 42 insertions(+), 13 deletions(-)

diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts
index dee271541e..57f1acf5f1 100644
--- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts
+++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts
@@ -50,31 +50,30 @@
 	};
 
 	thermal-zones {
-		chassis-thermal {
+		hdd-thermal {
 			polling-delay = <20000>;
 			polling-delay-passive = <2000>;
 
-			thermal-sensors = <&hdd0_temp>, <&hdd1_temp>;
-			coefficients = <1 1>;
+			thermal-sensors = <&hdd0_temp>; /* only one drivetemp sensor is supported */
 
 			trips {
-				chassis_alert1: chassis-alert1 {
+				hdd_alert1: trip1 {
 					temperature = <36000>;
 					hysteresis = <2000>;
 					type = "active";
 				};
-				chassis_alert2: chassis-alert2 {
-					temperature = <46000>;
+				hdd_alert2: trip2 {
+					temperature = <44000>;
 					hysteresis = <2000>;
 					type = "active";
 				};
-				chassis_alert3: chassis-alert3 {
-					temperature = <56000>;
+				hdd_alert3: trip3 {
+					temperature = <52000>;
 					hysteresis = <2000>;
 					type = "passive";
 				};
-				chassis_crit: chassis-crit {
-					temperature = <66000>;
+				hdd_crit: trip4 {
+					temperature = <60000>;
 					hysteresis = <2000>;
 					type = "critical";
 				};
@@ -82,19 +81,48 @@
 
 			cooling-maps {
 				map1 {
-					trip = <&chassis_alert1>;
+					trip = <&hdd_alert1>;
 					cooling-device = <&system_fan THERMAL_NO_LIMIT 1>;
 				};
 				map2 {
-					trip = <&chassis_alert2>;
+					trip = <&hdd_alert2>;
 					cooling-device = <&system_fan 2 2>;
 				};
 				map3 {
-					trip = <&chassis_alert3>;
+					trip = <&hdd_alert3>;
 					cooling-device = <&system_fan 3 THERMAL_NO_LIMIT>;
 				};
 			};
 		};
+
+		ethphy-thermal {
+			polling-delay = <20000>;
+			polling-delay-passive = <2000>;
+
+			thermal-sensors = <&ethphy0>;
+
+			trips {
+				ethphy_alert1: trip1 {
+					temperature = <65000>;
+					hysteresis = <4000>;
+					type = "passive";
+				};
+
+				ethphy_crit: trip2 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map1 {
+					trip = <&ethphy_alert1>;
+					cooling-device = <&system_fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+
+			};
+		};
 	};
 
 	gpio_keys {
@@ -243,6 +271,7 @@
 		marvell,reg-init = <0x3 0x10 0x1 0x1991>, /* LED function */
 				   <0x3 0x11 0x1 0x4401>, /* LED polarity */
 				   <0x3 0x12 0x1 0x4905>; /* LED timer */
+		#thermal-sensor-cells = <0>;
 	};
 };
 
-- 
2.30.0







More information about the openwrt-devel mailing list