ipq806x: add LEDs definition for non-standard qca8k LEDs
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 26 Sep 2023 12:10:42 +0000 (14:10 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Sat, 30 Sep 2023 11:51:20 +0000 (13:51 +0200)
Add LEDs definition for devices that use a non-standard qca8k LEDs
configuration.

This is to restore original setup of the LED and be on par with swconfig
old configuration.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/ipq806x/base-files/etc/board.d/01_leds
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts

index 950b7ad9688ca37429a480029b6b370ca60f27d5..0b64bbb4206e7e96e24fe3a987878eb5ebf0b85c 100644 (file)
@@ -9,6 +9,18 @@ board_config_update
 board=$(board_name)
 
 case "$board" in
+askey,rt4230w-rev6)
+       ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "qca8k-0.0:00:green:wan" "wan" "link-10 link-100 link-1000"
+       ucidef_set_led_netdev "wan-port-activity" "WAN-PORT-ACTIVITY" "qca8k-0.0:00:amber:wan" "wan" "tx rx"
+       ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "qca8k-0.0:01:green:lan" "lan1" "link-10 link-100 link-1000"
+       ucidef_set_led_netdev "lan1-port-activity" "LAN1-PORT-ACTIVITY" "qca8k-0.0:01:amber:lan" "lan1" "tx rx"
+       ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "qca8k-0.0:02:green:lan" "lan2" "link-10 link-100 link-1000"
+       ucidef_set_led_netdev "lan2-port-activity" "LAN2-PORT-ACTIVITY" "qca8k-0.0:02:amber:lan" "lan2" "tx rx"
+       ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "qca8k-0.0:03:green:lan" "lan3" "link-10 link-100 link-1000"
+       ucidef_set_led_netdev "lan3-port-activity" "LAN3-PORT-ACTIVITY" "qca8k-0.0:03:amber:lan" "lan3" "tx rx"
+       ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "qca8k-0.0:04:green:lan" "lan4" "link-10 link-100 link-1000"
+       ucidef_set_led_netdev "lan4-port-activity" "LAN4-PORT-ACTIVITY" "qca8k-0.0:04:amber:lan" "lan4" "tx rx"
+       ;;
 buffalo,wxr-2533dhp)
        ucidef_set_led_wlan "wlan" "WLAN" "white:wireless" "phy0tpt"
        ucidef_set_led_netdev "wan" "WAN" "white:internet" "wan"
@@ -32,6 +44,21 @@ nec,wg2600hp)
        ;;
 nec,wg2600hp3)
        ucidef_set_led_netdev "wan" "WAN" "green:active" "wan"
+       ucidef_set_led_netdev "wan-port-10" "WAN-PORT-10" "qca8k-0.0:00:green:wan-1" "wan" "tx rx link-10"
+       ucidef_set_led_netdev "wan-port-100" "WAN-PORT-100" "qca8k-0.0:00:green:wan-2" "wan" "tx rx link-100"
+       ucidef_set_led_netdev "wan-port-1000" "WAN-PORT-1000" "qca8k-0.0:00:green:wan-3" "wan" "tx rx link-1000"
+       ucidef_set_led_netdev "lan1-port-10" "LAN1-PORT-10" "qca8k-0.0:01:green:lan-1" "lan1" "tx rx link-10"
+       ucidef_set_led_netdev "lan1-port-100" "LAN1-PORT-100" "qca8k-0.0:01:green:lan-2" "lan1" "tx rx link-100"
+       ucidef_set_led_netdev "lan1-port-1000" "LAN1-PORT-1000" "qca8k-0.0:01:green:lan-3" "lan1" "tx rx link-1000"
+       ucidef_set_led_netdev "lan2-port-10" "LAN2-PORT-10" "qca8k-0.0:02:green:lan-1" "lan2" "tx rx link-10"
+       ucidef_set_led_netdev "lan2-port-100" "LAN2-PORT-100" "qca8k-0.0:02:green:lan-2" "lan2" "tx rx link-100"
+       ucidef_set_led_netdev "lan2-port-1000" "LAN2-PORT-1000" "qca8k-0.0:02:green:lan-3" "lan2" "tx rx link-1000"
+       ucidef_set_led_netdev "lan3-port-10" "LAN3-PORT-10" "qca8k-0.0:03:green:lan-1" "lan3" "tx rx link-10"
+       ucidef_set_led_netdev "lan3-port-100" "LAN3-PORT-100" "qca8k-0.0:03:green:lan-2" "lan3" "tx rx link-100"
+       ucidef_set_led_netdev "lan3-port-1000" "LAN3-PORT-1000" "qca8k-0.0:03:green:lan-3" "lan3" "tx rx link-1000"
+       ucidef_set_led_netdev "lan4-port-10" "LAN4-PORT-10" "qca8k-0.0:04:green:lan-1" "lan4" "tx rx link-10"
+       ucidef_set_led_netdev "lan4-port-100" "LAN4-PORT-100" "qca8k-0.0:04:green:lan-2" "lan4" "tx rx link-100"
+       ucidef_set_led_netdev "lan4-port-1000" "LAN4-PORT-1000" "qca8k-0.0:04:green:lan-3" "lan4" "tx rx link-1000"
        ;;
 netgear,d7800 |\
 netgear,r7500 |\
index 5f78d91b9ea95dd091cd1d660c666dd5ef90689a..2c181bd8830843eb9fddd831a6d1ca46c7ea93aa 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "qcom-ipq8062-smb208.dtsi"
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
        model = "NEC Platforms Aterm WG2600HP3";
                                label = "wan";
                                phy-mode = "internal";
                                phy-handle = <&phy_port1>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_WAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_WAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@2 {
                                label = "lan1";
                                phy-mode = "internal";
                                phy-handle = <&phy_port2>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@3 {
                                label = "lan2";
                                phy-mode = "internal";
                                phy-handle = <&phy_port3>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@4 {
                                label = "lan3";
                                phy-mode = "internal";
                                phy-handle = <&phy_port4>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@5 {
                                label = "lan4";
                                phy-mode = "internal";
                                phy-handle = <&phy_port5>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@6 {
index 6bf2cfe128ac3d55d6241792c0c5e1b0794a1c11..5453f9fcb3cbbccdcbe312aaec602c9bea85afcb 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "qcom-ipq8065-smb208.dtsi"
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
        model = "Askey RT4230W REV6";
                                label = "wan";
                                phy-mode = "internal";
                                phy-handle = <&phy_port1>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_WAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_WAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@2 {
                                label = "lan1";
                                phy-mode = "internal";
                                phy-handle = <&phy_port2>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@3 {
                                label = "lan2";
                                phy-mode = "internal";
                                phy-handle = <&phy_port3>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@4 {
                                label = "lan3";
                                phy-mode = "internal";
                                phy-handle = <&phy_port4>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@5 {
                                label = "lan4";
                                phy-mode = "internal";
                                phy-handle = <&phy_port5>;
+
+                               leds {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       led@0 {
+                                               reg = <0>;
+                                               color = <LED_COLOR_ID_GREEN>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+
+                                       led@1 {
+                                               reg = <1>;
+                                               color = <LED_COLOR_ID_AMBER>;
+                                               function = LED_FUNCTION_LAN;
+                                               default-state = "keep";
+                                       };
+                               };
                        };
 
                        port@6 {