Browse Source

ramips: use function/color syntax for some dlink dir routers

Abandoning the label and using the function/color syntax for some dlink
dir series routers: dir-1960-a1, dir-2660-a1, dir-2640-a1, dir-3040-a1
and dir-3060-a1

Signed-off-by: Mieczyslaw Nalewaj <[email protected]>
Mieczyslaw Nalewaj 1 year ago
parent
commit
d646ea8a00

+ 0 - 2
target/linux/ramips/dts/mt7621_dlink_dir-1960-a1.dts

@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
 
-#include <dt-bindings/leds/common.h>
-
 #include "mt7621_dlink_dir_nand_128m.dtsi"
 #include "mt7621_dlink_dir_nand_128m.dtsi"
 
 
 / {
 / {

+ 8 - 4
target/linux/ramips/dts/mt7621_dlink_dir-2640-a1.dts

@@ -8,15 +8,19 @@
 };
 };
 
 
 &leds {
 &leds {
-	usb2_white {
-		label = "white:usb2";
+	led-4 {
+		function = LED_FUNCTION_USB;
+		color = <LED_COLOR_ID_WHITE>;
+		function-enumerator = <2>;
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&ehci_port2>;
 		trigger-sources = <&ehci_port2>;
 		linux,default-trigger = "usbport";
 		linux,default-trigger = "usbport";
 	};
 	};
 
 
-	usb3_white {
-		label = "white:usb3";
+	led-5 {
+		function = LED_FUNCTION_USB;
+		color = <LED_COLOR_ID_WHITE>;
+		function-enumerator = <3>;
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&xhci_ehci_port1>;
 		trigger-sources = <&xhci_ehci_port1>;
 		linux,default-trigger = "usbport";
 		linux,default-trigger = "usbport";

+ 8 - 4
target/linux/ramips/dts/mt7621_dlink_dir-2660-a1.dts

@@ -8,15 +8,19 @@
 };
 };
 
 
 &leds {
 &leds {
-	usb2_white {
-		label = "white:usb2";
+	led-4 {
+		function = LED_FUNCTION_USB;
+		color = <LED_COLOR_ID_WHITE>;
+		function-enumerator = <2>;
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&ehci_port2>;
 		trigger-sources = <&ehci_port2>;
 		linux,default-trigger = "usbport";
 		linux,default-trigger = "usbport";
 	};
 	};
 
 
-	usb3_white {
-		label = "white:usb3";
+	led-5 {
+		function = LED_FUNCTION_USB;
+		color = <LED_COLOR_ID_WHITE>;
+		function-enumerator = <3>;
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&xhci_ehci_port1>;
 		trigger-sources = <&xhci_ehci_port1>;
 		linux,default-trigger = "usbport";
 		linux,default-trigger = "usbport";

+ 7 - 7
target/linux/ramips/dts/mt7621_dlink_dir-3040-a1.dts

@@ -12,32 +12,32 @@
 };
 };
 
 
 &leds {
 &leds {
-	usb2_white {
+	led-4 {
 		function = LED_FUNCTION_USB;
 		function = LED_FUNCTION_USB;
 		color = <LED_COLOR_ID_WHITE>;
 		color = <LED_COLOR_ID_WHITE>;
-		function-enumerator = <0>;
+		function-enumerator = <2>;
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&ehci_port2>;
 		trigger-sources = <&ehci_port2>;
 		linux,default-trigger = "usbport";
 		linux,default-trigger = "usbport";
 	};
 	};
 
 
-	usb3_white {
+	led-5 {
 		function = LED_FUNCTION_USB;
 		function = LED_FUNCTION_USB;
 		color = <LED_COLOR_ID_WHITE>;
 		color = <LED_COLOR_ID_WHITE>;
-		function-enumerator = <1>;
+		function-enumerator = <3>;
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 		trigger-sources = <&xhci_ehci_port1>;
 		trigger-sources = <&xhci_ehci_port1>;
 		linux,default-trigger = "usbport";
 		linux,default-trigger = "usbport";
 	};
 	};
 
 
-	wlan2g {
+	led-6 {
 		function = LED_FUNCTION_WLAN_2GHZ;
 		function = LED_FUNCTION_WLAN_2GHZ;
 		color = <LED_COLOR_ID_WHITE>;
 		color = <LED_COLOR_ID_WHITE>;
 		gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 		linux,default-trigger = "phy0radio";
 		linux,default-trigger = "phy0radio";
 	};
 	};
 
 
-	wlan5glb {
+	led-7 {
 		function = LED_FUNCTION_WLAN_5GHZ;
 		function = LED_FUNCTION_WLAN_5GHZ;
 		color = <LED_COLOR_ID_WHITE>;
 		color = <LED_COLOR_ID_WHITE>;
 		function-enumerator = <0>;
 		function-enumerator = <0>;
@@ -45,7 +45,7 @@
 		linux,default-trigger = "phy1radio";
 		linux,default-trigger = "phy1radio";
 	};
 	};
 
 
-	wlan5ghb {
+	led-8 {
 		function = LED_FUNCTION_WLAN_5GHZ;
 		function = LED_FUNCTION_WLAN_5GHZ;
 		color = <LED_COLOR_ID_WHITE>;
 		color = <LED_COLOR_ID_WHITE>;
 		function-enumerator = <1>;
 		function-enumerator = <1>;

+ 27 - 16
target/linux/ramips/dts/mt7621_dlink_dir-3060-a1.dts

@@ -37,56 +37,67 @@
 	leds {
 	leds {
 		compatible = "gpio-leds";
 		compatible = "gpio-leds";
 
 
-		led_power_orange: power_orange {
+		led_power_orange: led-0 {
 			function = LED_FUNCTION_POWER;
 			function = LED_FUNCTION_POWER;
 			color = <LED_COLOR_ID_ORANGE>;
 			color = <LED_COLOR_ID_ORANGE>;
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		led_power_white: power_white {
+		led_power_white: led-1 {
 			function = LED_FUNCTION_POWER;
 			function = LED_FUNCTION_POWER;
 			color = <LED_COLOR_ID_WHITE>;
 			color = <LED_COLOR_ID_WHITE>;
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		led_net_orange: net_orange {
-			label = "orange:net";
+		led_net_orange: led-2 {
+			function = LED_FUNCTION_WAN;
+			color = <LED_COLOR_ID_ORANGE>;
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		net_white {
-			label = "white:net";
+		led-3 {
+			function = LED_FUNCTION_WAN;
+			color = <LED_COLOR_ID_WHITE>;
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		usb2_white {
-			label = "white:usb2";
+		led-4 {
+			function = LED_FUNCTION_USB;
+			color = <LED_COLOR_ID_WHITE>;
+			function-enumerator = <2>;
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&ehci_port2>;
 			trigger-sources = <&ehci_port2>;
 			linux,default-trigger = "usbport";
 			linux,default-trigger = "usbport";
 		};
 		};
 
 
-		usb3_white {
-			label = "white:usb3";
+		led-5 {
+			function = LED_FUNCTION_USB;
+			color = <LED_COLOR_ID_WHITE>;
+			function-enumerator = <3>;
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
 			trigger-sources = <&xhci_ehci_port1>;
 			trigger-sources = <&xhci_ehci_port1>;
 			linux,default-trigger = "usbport";
 			linux,default-trigger = "usbport";
 		};
 		};
 
 
-		wlan2g {
-			label = "white:wlan2g";
+		led-6 {
+			function = LED_FUNCTION_WLAN_2GHZ;
+			color = <LED_COLOR_ID_WHITE>;
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy0radio";
 			linux,default-trigger = "phy0radio";
 		};
 		};
 
 
-		wlan5glb {
-			label = "white:wlan5glb";
+		led-7 {
+			function = LED_FUNCTION_WLAN_5GHZ;
+			color = <LED_COLOR_ID_WHITE>;
+			function-enumerator = <0>;
 			gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
 			gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy1radio";
 			linux,default-trigger = "phy1radio";
 		};
 		};
 
 
-		wlan5ghb {
-			label = "white:wlan5ghb";
+		led-8 {
+			function = LED_FUNCTION_WLAN_5GHZ;
+			color = <LED_COLOR_ID_WHITE>;
+			function-enumerator = <1>;
 			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
 			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
 			linux,default-trigger = "phy2radio";
 			linux,default-trigger = "phy2radio";
 		};
 		};

+ 8 - 6
target/linux/ramips/dts/mt7621_dlink_dir_nand_128m.dtsi

@@ -34,25 +34,27 @@
 	leds: leds {
 	leds: leds {
 		compatible = "gpio-leds";
 		compatible = "gpio-leds";
 
 
-		led_power_orange: power_orange {
+		led_power_orange: led-0 {
 			function = LED_FUNCTION_POWER;
 			function = LED_FUNCTION_POWER;
 			color = <LED_COLOR_ID_ORANGE>;
 			color = <LED_COLOR_ID_ORANGE>;
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		led_power_white: power_white {
+		led_power_white: led-1 {
 			function = LED_FUNCTION_POWER;
 			function = LED_FUNCTION_POWER;
 			color = <LED_COLOR_ID_WHITE>;
 			color = <LED_COLOR_ID_WHITE>;
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		led_net_orange: net_orange {
-			label = "orange:net";
+		led_net_orange: led-2 {
+			function = LED_FUNCTION_WAN;
+			color = <LED_COLOR_ID_ORANGE>;
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
 		};
 		};
 
 
-		net_white {
-			label = "white:net";
+		led-3 {
+			function = LED_FUNCTION_WAN;
+			color = <LED_COLOR_ID_WHITE>;
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 		};
 	};
 	};

+ 3 - 3
target/linux/ramips/mt7621/base-files/etc/board.d/01_leds

@@ -94,12 +94,12 @@ dlink,dap-x1860-a1)
 dlink,dir-1960-a1|\
 dlink,dir-1960-a1|\
 dlink,dir-2640-a1|\
 dlink,dir-2640-a1|\
 dlink,dir-2660-a1)
 dlink,dir-2660-a1)
-	ucidef_set_led_netdev "wan" "wan" "white:net" "wan"
+	ucidef_set_led_netdev "wan" "wan" "white:wan" "wan"
 	;;
 	;;
 dlink,dir-3040-a1|\
 dlink,dir-3040-a1|\
 dlink,dir-3060-a1)
 dlink,dir-3060-a1)
-	ucidef_set_led_netdev "net_white" "WAN Link" "white:net" "wan" "link"
-	ucidef_set_led_netdev "net_orange" "WAN Activity" "orange:net" "wan" "tx rx"
+	ucidef_set_led_netdev "net_white" "WAN Link" "white:wan" "wan" "link"
+	ucidef_set_led_netdev "net_orange" "WAN Activity" "orange:wan" "wan" "tx rx"
 	;;
 	;;
 dlink,dir-853-a1|\
 dlink,dir-853-a1|\
 dlink,dir-853-a3)
 dlink,dir-853-a3)

+ 7 - 0
target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration

@@ -4,6 +4,13 @@
 board=$(board_name)
 board=$(board_name)
 
 
 case "$board" in
 case "$board" in
+dlink,dir-1960-a1|\
+dlink,dir-2640-a1|\
+dlink,dir-2660-a1|\
+dlink,dir-3040-a1|\
+dlink,dir-3060-a1)
+	migrate_leds ':net=:wan'
+	;;
 tplink,archer-a6-v3|\
 tplink,archer-a6-v3|\
 tplink,archer-c6-v3)
 tplink,archer-c6-v3)
 	migrate_leds ':wifi2g$=:wlan-2' ':wifi5g$=:wlan-5'
 	migrate_leds ':wifi2g$=:wlan-2' ':wifi5g$=:wlan-5'