From d9e13625810edf7ca8353ec5c23b47fb59606a3d Mon Sep 17 00:00:00 2001 From: Furong Xu Date: Fri, 16 Dec 2022 21:21:33 +0800 Subject: mediatek: add LED support for Xiaomi Redmi AX6000 add DT nodes and default package for the LEDs on Redmi AX6000 Signed-off-by: Furong Xu Signed-off-by: Chuanhong Guo --- .../dts/mt7986a-xiaomi-redmi-router-ax6000.dts | 38 ++++++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 16 +++++++++ target/linux/mediatek/image/filogic.mk | 1 + 3 files changed, 55 insertions(+) create mode 100644 target/linux/mediatek/filogic/base-files/etc/board.d/01_leds (limited to 'target') diff --git a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts index 7c590d22e2..31112664c2 100644 --- a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts @@ -3,6 +3,7 @@ /dts-v1/; #include #include +#include #include "mt7986a.dtsi" @@ -12,6 +13,10 @@ aliases { serial0 = &uart0; + led-boot = &led_status_rgb; + led-failsafe = &led_status_rgb; + led-running = &led_status_rgb; + led-upgrade = &led_status_rgb; }; chosen { @@ -95,6 +100,13 @@ }; }; + 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"; @@ -202,6 +214,32 @@ }; }; +&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_network_rgb: led@1 { + reg = <1>; + label = "rgb:network"; + color-index = ; + }; + }; +}; + &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 index 0000000000..f851c7ed54 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -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 diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 1ece1465c2..5dbeedb64c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -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 -- cgit v1.2.3