realtek: add support for chassis fan on ZyXEL XGS1250-12
authorTobias Schramm <tobias@t-sys.eu>
Tue, 6 Feb 2024 18:31:04 +0000 (19:31 +0100)
committerSander Vanheule <sander@svanheule.net>
Mon, 12 Feb 2024 19:09:24 +0000 (20:09 +0100)
The ZyXEL XGS1250-12 has a chassis fan. The fan is positioned perfectly to
provide additional cooling to the Aquantia NBase-T phys. Testing has shown
that the phys can reach temperatures upwards of 72 degrees Celsius quite
easily at about 20 degrees Celsius ambient.
Support the chassis fan to give the phys a bit of extra cooling.

Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts
target/linux/realtek/image/rtl930x.mk

index fd139c9adaf9d3bb0df438b1fc3a59815bc5e674..0c35d7b004123c301e4e917b0c060df0c4a57046 100644 (file)
@@ -6,6 +6,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
        compatible = "zyxel,xgs1250-12", "realtek,rtl838x-soc";
                                                          // (5G, 10/100) (10G, 5G, 2.5G)
                led_set2 = <0x0a20 0x0a01>; // LED set 2: 1000MBit, 10GBit
        };
+
+       thermal-zones {
+               phy24-thermal {
+                       /* Poll every 10 seconds */
+                       polling-delay-passive = <10000>;
+                       polling-delay = <10000>;
+                       thermal-sensors = <&phy24>;
+
+                       trips {
+                               phy24_trip0: phy24-trip0 {
+                                       /* At 80 degrees turn on fan */
+                                       temperature = <80000>;
+                                       hysteresis = <1000>;
+                                       type = "active";
+                               };
+
+                               phy24_trip1: phy24-trip1 {
+                                       /* At 108 degrees phys exceed spec */
+                                       temperature = <108000>;
+                                       hysteresis = <5000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map {
+                                       trip = <&phy24_trip0>;
+                                       cooling-device = <&chassis_fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               phy25-thermal {
+                       /* Poll every 10 seconds */
+                       polling-delay-passive = <10000>;
+                       polling-delay = <10000>;
+                       thermal-sensors = <&phy25>;
+
+                       trips {
+                               phy25_trip0: phy25-trip0 {
+                                       /* At 80 degrees turn on fan */
+                                       temperature = <80000>;
+                                       hysteresis = <1000>;
+                                       type = "active";
+                               };
+
+                               phy25_trip1: phy25-trip1 {
+                                       /* At 108 degrees phys exceed spec */
+                                       temperature = <108000>;
+                                       hysteresis = <5000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map {
+                                       trip = <&phy25_trip0>;
+                                       cooling-device = <&chassis_fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               phy26-thermal {
+                       /* Poll every 10 seconds */
+                       polling-delay-passive = <10000>;
+                       polling-delay = <10000>;
+                       thermal-sensors = <&phy26>;
+
+                       trips {
+                               phy26_trip0: phy26-trip0 {
+                                       /* At 80 degrees turn on fan */
+                                       temperature = <80000>;
+                                       hysteresis = <1000>;
+                                       type = "active";
+                               };
+
+                               phy26_trip1: phy26-trip1 {
+                                       /* At 108 degrees phys exceed spec */
+                                       temperature = <108000>;
+                                       hysteresis = <5000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map {
+                                       trip = <&phy26_trip0>;
+                                       cooling-device = <&chassis_fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+       };
+
+       /* YEN SUN TECHNOLOGY FD122510LL-N fan */
+       chassis_fan: gpio-fan {
+               compatible = "gpio-fan";
+               gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
+               gpio-fan,speed-map = <0    0
+                                     7000 1>;
+               #cooling-cells = <2>;
+       };
 };
 
 &spi0 {
                        sds = < 6 >;
                        // Disabled because we do not know how to bring up again
                        // reset-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+                       #thermal-sensor-cells = <0>;
                };
 
                phy25: ethernet-phy@25 {
                        sds = < 7 >;
                        // Disabled because we do not know how to bring up again
                        // reset-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+                       #thermal-sensor-cells = <0>;
                };
 
                phy26: ethernet-phy@26 {
                        sds = < 8 >;
                        // Disabled because we do not know how to bring up again
                        // reset-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+                       #thermal-sensor-cells = <0>;
                };
 
                /* SFP Ports */
index 891a18c517306a15ad86d3679482f9dcbe0cfc0e..7f0b6917598abd4b9e15ff8c92ddda4738774638 100644 (file)
@@ -6,6 +6,7 @@ define Device/zyxel_xgs1250-12
   ZYXEL_VERS := ABWE
   DEVICE_VENDOR := Zyxel
   DEVICE_MODEL := XGS1250-12
+  DEVICE_PACKAGES := kmod-hwmon-gpiofan kmod-thermal
   IMAGE_SIZE := 13312k
   KERNEL_INITRAMFS := \
        kernel-bin | \