[openwrt/openwrt] realtek: HPE 1920 8G PoE+ 180W move fans to hwmon
LEDE Commits
lede-commits at lists.infradead.org
Tue Jan 14 23:30:22 PST 2025
svanheule pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/f64541db020ef5689186609e8b7b7a3bb9755160
commit f64541db020ef5689186609e8b7b7a3bb9755160
Author: Evan Jobling <evan at jobling.au>
AuthorDate: Tue Jan 14 12:13:21 2025 +0000
realtek: HPE 1920 8G PoE+ 180W move fans to hwmon
The GPIO numbering has changed and is not stable. As a result fan
control via gpio_switch is broken, resulting in errors:
"export_store: invalid GPIO 456"
Move to using hwmon and gpio-fan. This is by adding gpio_fan_array to
DTS and kmod-hwmon-gpiofan to DEVICE_PACKAGES.
In combination with the new rtl8231 gpio driver the default fan
behaviour will be maximum fan speed.
Bump compat value to 1.1 due to existing config in /etc/config/system
via gpio_switch. Also notify in device compat that fan is now going to
be at bootloader setting (maximum in this case) by default unless turned
down.
Signed-off-by: Evan Jobling <evan at jobling.au>
Link: https://github.com/openwrt/openwrt/pull/17605
Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
target/linux/realtek/base-files/etc/board.d/03_gpio_switches | 1 -
target/linux/realtek/base-files/etc/board.d/05_compat-version | 3 +++
target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts | 11 +++++++++++
target/linux/realtek/image/common.mk | 8 ++++++++
target/linux/realtek/image/rtl838x.mk | 3 ++-
5 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches
index c869153e4c..c178bd4330 100644
--- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches
@@ -6,7 +6,6 @@ board_config_update
board=$(board_name)
case "$board" in
-hpe,1920-8g-poe-180w|\
hpe,1920-24g-poe-180w|\
hpe,1920-24g-poe-370w)
ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0"
diff --git a/target/linux/realtek/base-files/etc/board.d/05_compat-version b/target/linux/realtek/base-files/etc/board.d/05_compat-version
index 5c4ecb9aae..687cbb32a5 100644
--- a/target/linux/realtek/base-files/etc/board.d/05_compat-version
+++ b/target/linux/realtek/base-files/etc/board.d/05_compat-version
@@ -8,6 +8,9 @@
board_config_update
case "$(board_name)" in
+ hpe,1920-8g-poe-180w)
+ ucidef_set_compat_version "1.1"
+ ;;
zyxel,gs1900-8 | \
zyxel,gs1900-8hp-v1 | \
zyxel,gs1900-8hp-v2 | \
diff --git a/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts b/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts
index 6398e6d034..f15498354e 100644
--- a/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts
+++ b/target/linux/realtek/dts/rtl8380_hpe_1920-8g-poe-180w.dts
@@ -5,6 +5,17 @@
/ {
compatible = "hpe,1920-8g-poe-180w", "realtek,rtl838x-soc";
model = "HPE 1920-8G-PoE+ 180W (JG922A)";
+
+ gpio_fan_array {
+ compatible = "gpio-fan";
+
+ 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 {
diff --git a/target/linux/realtek/image/common.mk b/target/linux/realtek/image/common.mk
index d9647dbc07..e600b2347d 100644
--- a/target/linux/realtek/image/common.mk
+++ b/target/linux/realtek/image/common.mk
@@ -56,6 +56,14 @@ define Device/hpe_1920
append-metadata
endef
+define Device/hwmon-fan-migration
+ DEVICE_COMPAT_VERSION := 1.1
+ DEVICE_COMPAT_MESSAGE := Fan control switched to hwmon. Your fans will retain \
+ bootloader speed unless another control scheme is in place. \
+ Config cannot be kept due to conflict in gpio_switch config 'fan_ctrl' under \
+ /etc/config/system.
+endef
+
define Device/zyxel_gs1900
DEVICE_COMPAT_VERSION := 2.0
DEVICE_COMPAT_MESSAGE := Dual firmware paritition merged due to size constraints. \
diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk
index 866659ad14..27dbc6ce59 100644
--- a/target/linux/realtek/image/rtl838x.mk
+++ b/target/linux/realtek/image/rtl838x.mk
@@ -120,9 +120,10 @@ TARGET_DEVICES += hpe_1920-8g-poe-65w
define Device/hpe_1920-8g-poe-180w
$(Device/hpe_1920)
+ $(Device/hwmon-fan-migration)
SOC := rtl8380
DEVICE_MODEL := 1920-8G-PoE+ 180W (JG922A)
- DEVICE_PACKAGES += realtek-poe
+ DEVICE_PACKAGES += realtek-poe kmod-hwmon-gpiofan
H3C_DEVICE_ID := 0x00010025
SUPPORTED_DEVICES += hpe_1920-8g-poe
endef
More information about the lede-commits
mailing list