mvebu: LS421DE: fix the thermal zones
authorDaniel González Cabanelas <dgcbueu@gmail.com>
Sun, 3 Jan 2021 21:32:59 +0000 (22:32 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 30 Jan 2021 00:03:00 +0000 (01:03 +0100)
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@gmail.com>
target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls421de.dts

index dee271541e3acee3e355e902c1b98087fd84c41d..57f1acf5f1eaffada69946713e986b3d21a631dc 100644 (file)
        };
 
        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";
                                };
 
                        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 {
                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>;
        };
 };