From 356a0b86ebe111609001cfb3f553ca43182d551b Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Tue, 6 Feb 2024 19:31:04 +0100 Subject: [PATCH] realtek: add support for chassis fan on ZyXEL XGS1250-12 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 --- .../dts-5.15/rtl9302_zyxel_xgs1250-12.dts | 105 ++++++++++++++++++ target/linux/realtek/image/rtl930x.mk | 1 + 2 files changed, 106 insertions(+) diff --git a/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts b/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts index fd139c9ada..0c35d7b004 100644 --- a/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts +++ b/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts @@ -6,6 +6,7 @@ #include #include #include +#include / { compatible = "zyxel,xgs1250-12", "realtek,rtl838x-soc"; @@ -70,6 +71,107 @@ // (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 { @@ -180,6 +282,7 @@ 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 { @@ -189,6 +292,7 @@ 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 { @@ -198,6 +302,7 @@ 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 */ diff --git a/target/linux/realtek/image/rtl930x.mk b/target/linux/realtek/image/rtl930x.mk index 891a18c517..7f0b691759 100644 --- a/target/linux/realtek/image/rtl930x.mk +++ b/target/linux/realtek/image/rtl930x.mk @@ -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 | \ -- 2.30.2