From 161a871edd15194a2b419530d40d7886e3bbc772 Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Sun, 17 May 2026 22:02:19 +0000 Subject: [PATCH] realtek: wire up GPIO fan for Zyxel XS1930 switches The switches from Zyxels XS1930 have one or two fans in the case. They might be controlled in a limited fashion. There's a single GPIO which - depending on the state - drives the fan in slow or fast mode. Wire that up as a device tree node to be able to control that in userspace. XS1930-10 and XS1930-12HP use the same GPIO while XS1930-12F moves that to one of its GPIO expanders. Also add 'kmod-hwmon-gpiofan' for all three devices to be selected by default. Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/23428 Signed-off-by: Robert Marko --- target/linux/realtek/dts/rtl9313_zyxel_xs1930-12f.dts | 2 ++ target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi | 10 ++++++++++ target/linux/realtek/image/rtl931x.mk | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/dts/rtl9313_zyxel_xs1930-12f.dts b/target/linux/realtek/dts/rtl9313_zyxel_xs1930-12f.dts index 34d412b724a..a058f6f0b5d 100644 --- a/target/linux/realtek/dts/rtl9313_zyxel_xs1930-12f.dts +++ b/target/linux/realtek/dts/rtl9313_zyxel_xs1930-12f.dts @@ -122,6 +122,8 @@ }; }; +&fan0 { gpios = <&gpio1 35 GPIO_ACTIVE_HIGH>; }; + &gpio0 { pinctrl-names = "default"; pinctrl-0 = <&pinmux_disable_jtag>, diff --git a/target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi b/target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi index a594f42d97d..ef8c70f26d2 100644 --- a/target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi +++ b/target/linux/realtek/dts/rtl9313_zyxel_xs1930.dtsi @@ -78,6 +78,16 @@ gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; }; }; + + fan0: gpio-fan { + compatible = "gpio-fan"; + gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; + + gpio-fan,speed-map = + <3600 0>, + <9000 1>; + #cooling-cells = <2>; + }; }; &spi0 { diff --git a/target/linux/realtek/image/rtl931x.mk b/target/linux/realtek/image/rtl931x.mk index a824376b0fd..865ef551a9f 100644 --- a/target/linux/realtek/image/rtl931x.mk +++ b/target/linux/realtek/image/rtl931x.mk @@ -49,7 +49,7 @@ TARGET_DEVICES += xikestor_sks8300-12x-v1 define Device/zyxel_xs1930 SOC := rtl9313 - DEVICE_PACKAGES := kmod-hwmon-lm85 + DEVICE_PACKAGES := kmod-hwmon-lm85 kmod-hwmon-gpiofan FLASH_ADDR := 0xb4280000 IMAGE_SIZE := 31808k ZYNFW_ALIGN := 0x10000