[PATCH] ramips: define Yuncore AX820 switch LEDs

Thibaut VARÈNE hacks at slashdirt.org
Wed Aug 17 10:36:41 PDT 2022


This patch defines the two switch LED to bring them under user control
and cleans up the existing LED definitions: the labels are unnecessary.

Fixes: a0e1d3ab7b4f ("ramips: improve YunCore AX820 LEDs")
Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 .../linux/ramips/dts/mt7621_yuncore_ax820.dts | 19 ++++++++++++++++---
 .../mt7621/base-files/etc/board.d/01_leds     |  4 ++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_yuncore_ax820.dts b/target/linux/ramips/dts/mt7621_yuncore_ax820.dts
index 9638f1f060..833174982b 100644
--- a/target/linux/ramips/dts/mt7621_yuncore_ax820.dts
+++ b/target/linux/ramips/dts/mt7621_yuncore_ax820.dts
@@ -4,6 +4,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	compatible = "yuncore,ax820", "mediatek,mt7621-soc";
@@ -32,21 +33,30 @@
 		   As a result, all 3 LEDs are defined even if only one may be available, and
 		   the color information is absent as it is not reliable */
 		wlan2g {
-			label = "wlan2g";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy0radio";
 		};
 
 		led_system: system {
-			label = "system";
 			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
 		wlan5g {
-			label = "wlan5g";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			linux,default-trigger = "phy1radio";
 		};
+
+		wan {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_WAN;
+			gpios = <&switch0 0 GPIO_ACTIVE_LOW>;
+		};
+
+		lan {
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			gpios = <&switch0 3 GPIO_ACTIVE_LOW>;
+		};
 	};
 
 	watchdog {
@@ -131,6 +141,9 @@
 };
 
 &switch0 {
+	gpio-controller;
+	#gpio-cells = <2>;
+
 	ports {
 		port at 0 {
 			status = "okay";
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
index 0daf15dd4d..1bfdbc57d4 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
@@ -162,6 +162,10 @@ xiaomi,redmi-router-ac2100)
 youhua,wr1200js)
 	ucidef_set_led_netdev "internet" "INTERNET" "green:wan" "wan"
 	;;
+yuncore,ax820)
+	ucidef_set_led_netdev "lan" "LAN" "green:lan" "lan"
+	ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
+	;;
 zbtlink,zbt-wg1608-16m)
 	ucidef_set_led_netdev "lan1" "LAN1" "green:lan-1" "lan1"
 	ucidef_set_led_netdev "lan2" "LAN2" "green:lan-2" "lan2"
-- 
2.30.2




More information about the openwrt-devel mailing list