mediatek: add LED support for Xiaomi Redmi AX6000
authorFurong Xu <xfr@outlook.com>
Fri, 16 Dec 2022 13:21:33 +0000 (21:21 +0800)
committerChuanhong Guo <gch981213@gmail.com>
Fri, 16 Dec 2022 13:42:02 +0000 (21:42 +0800)
add DT nodes and default package for the LEDs on Redmi AX6000

Signed-off-by: Furong Xu <xfr@outlook.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts
target/linux/mediatek/filogic/base-files/etc/board.d/01_leds [new file with mode: 0644]
target/linux/mediatek/image/filogic.mk

index 7c590d22e22f894c4482ac0dcc4fb4335ab2a9fb..31112664c2e13653bbc32275448921a481370fb9 100644 (file)
@@ -3,6 +3,7 @@
 /dts-v1/;
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 
 #include "mt7986a.dtsi"
 
 
        aliases {
                serial0 = &uart0;
+               led-boot = &led_status_rgb;
+               led-failsafe = &led_status_rgb;
+               led-running = &led_status_rgb;
+               led-upgrade = &led_status_rgb;
        };
 
        chosen {
                };
        };
 
+       spi_led_pins: spic-pins-29-to-32 {
+               mux {
+                       function = "spi";
+                       groups = "spi1_2";
+               };
+       };
+
        wf_2g_5g_pins: wf_2g_5g-pins {
                mux {
                        function = "wifi";
        };
 };
 
+&spi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi_led_pins>;
+       status = "okay";
+
+       ws2812b@0 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "worldsemi,ws2812b";
+               reg = <0>;
+               spi-max-frequency = <3000000>;
+
+               led_status_rgb: led@0 {
+                       reg = <0>;
+                       label = "rgb:status";
+                       color-index = <LED_COLOR_ID_RED LED_COLOR_ID_GREEN LED_COLOR_ID_BLUE>;
+               };
+
+               led_network_rgb: led@1 {
+                       reg = <1>;
+                       label = "rgb:network";
+                       color-index = <LED_COLOR_ID_RED LED_COLOR_ID_GREEN LED_COLOR_ID_BLUE>;
+               };
+       };
+};
+
 &switch {
        ports {
                #address-cells = <1>;
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
new file mode 100644 (file)
index 0000000..f851c7e
--- /dev/null
@@ -0,0 +1,16 @@
+. /lib/functions/leds.sh
+. /lib/functions/uci-defaults.sh
+
+board=$(board_name)
+
+board_config_update
+
+case $board in
+xiaomi,redmi-router-ax6000)
+       ucidef_set_led_netdev "wan" "wan" "rgb:network" "wan"
+       ;;
+esac
+
+board_config_flush
+
+exit 0
index 1ece1465c23983aab9c9aa609a868b19183733e2..5dbeedb64c7d59b1d3cd6cbbd107569348086407 100644 (file)
@@ -130,6 +130,7 @@ define Device/xiaomi_redmi-router-ax6000
   DEVICE_MODEL := Redmi Router AX6000
   DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000
   DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := kmod-leds-ws2812b
   KERNEL_LOADADDR := 0x48000000
   UBINIZE_OPTS := -E 5
   BLOCKSIZE := 128k