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 <namiltd@yahoo.com>
This commit is contained in:
Mieczyslaw Nalewaj 2024-05-08 20:32:03 +02:00 committed by Hauke Mehrtens
parent 8d7fa09181
commit d646ea8a00
8 changed files with 68 additions and 42 deletions

View File

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

View File

@ -8,15 +8,19 @@
};
&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>;
trigger-sources = <&ehci_port2>;
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>;
trigger-sources = <&xhci_ehci_port1>;
linux,default-trigger = "usbport";

View File

@ -8,15 +8,19 @@
};
&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>;
trigger-sources = <&ehci_port2>;
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>;
trigger-sources = <&xhci_ehci_port1>;
linux,default-trigger = "usbport";

View File

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

View File

@ -37,56 +37,67 @@
leds {
compatible = "gpio-leds";
led_power_orange: power_orange {
led_power_orange: led-0 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_ORANGE>;
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
led_power_white: power_white {
led_power_white: led-1 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_WHITE>;
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>;
};
net_white {
label = "white:net";
led-3 {
function = LED_FUNCTION_WAN;
color = <LED_COLOR_ID_WHITE>;
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>;
trigger-sources = <&ehci_port2>;
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>;
trigger-sources = <&xhci_ehci_port1>;
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>;
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>;
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>;
linux,default-trigger = "phy2radio";
};

View File

@ -34,25 +34,27 @@
leds: leds {
compatible = "gpio-leds";
led_power_orange: power_orange {
led_power_orange: led-0 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_ORANGE>;
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
led_power_white: power_white {
led_power_white: led-1 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_WHITE>;
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>;
};
net_white {
label = "white:net";
led-3 {
function = LED_FUNCTION_WAN;
color = <LED_COLOR_ID_WHITE>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
};

View File

@ -94,12 +94,12 @@ dlink,dap-x1860-a1)
dlink,dir-1960-a1|\
dlink,dir-2640-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-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-a3)

View File

@ -4,6 +4,13 @@
board=$(board_name)
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-c6-v3)
migrate_leds ':wifi2g$=:wlan-2' ':wifi5g$=:wlan-5'