[PATCH] realtek: hpe 1920-48-poe jg928a: add fan control

Evan Jobling evan.jobling at mslsc.com.au
Mon Oct 28 02:44:42 PDT 2024


JG928A has an rtl8231 on the alt mdio bus.
Add it to device tree.
Add fan gpio and alarm to device tree.
Add hwmon kernel module to image.

Known issues:
Due to
3810e897295cb66bc45a62bc2c0b70a01004fe3b
"realtek: ensure output drivers are enabled in RTL8231"
This will change the default fan speed from what
bootloader has set.

Signed-off-by: Evan Jobling <evan.jobling at mslsc.com.au>
---
 .../realtek/dts/rtl8393_hpe_1920-48g-poe.dts  | 20 +++++++++++++++++++
 target/linux/realtek/image/rtl839x.mk         |  4 +++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts b/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts
index e242775434..297db96266 100644
--- a/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts
+++ b/target/linux/realtek/dts/rtl8393_hpe_1920-48g-poe.dts
@@ -5,8 +5,28 @@
 / {
 	compatible = "hpe,1920-48g-poe", "realtek,rtl8393-soc";
 	model = "HPE 1920-48G-PoE (JG928A)";
+
+	gpio1: rtl8231-gpio {
+			compatible = "realtek,rtl8231-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			indirect-access-bus-id = <0>;
+	};
+
+	gpio_fan_array {
+		compatible = "gpio-fan";
+		target-rpm = <10000>;
+
+		gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
+		gpio-fan,speed-map =    <5000 0>,
+		                        <8200 1>;
+
+		alarm-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+		#cooling-cells = <2>;
+	};
 };
 
+
 &uart1 {
 	status = "okay";
 };
diff --git a/target/linux/realtek/image/rtl839x.mk b/target/linux/realtek/image/rtl839x.mk
index 14d23ff371..806ed5e70d 100644
--- a/target/linux/realtek/image/rtl839x.mk
+++ b/target/linux/realtek/image/rtl839x.mk
@@ -21,7 +21,9 @@ define Device/hpe_1920-48g-poe
   $(Device/hpe_1920)
   SOC := rtl8393
   DEVICE_MODEL := 1920-48G-PoE (JG928A)
-  DEVICE_PACKAGES += realtek-poe
+  DEVICE_PACKAGES += \
+			realtek-poe \
+			kmod-hwmon-gpiofan
   H3C_DEVICE_ID := 0x0001002b
 endef
 TARGET_DEVICES += hpe_1920-48g-poe
-- 
2.39.5




More information about the openwrt-devel mailing list