redmi-ax6000: add support for ws2812 leds

This commit is contained in:
hanwckf 2022-12-23 19:34:44 +08:00
parent e048082895
commit f0d4c5e09e
5 changed files with 72 additions and 1 deletions

View File

@ -3,13 +3,22 @@
/dts-v1/; /dts-v1/;
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include "mt7986a.dtsi" #include "mt7986a.dtsi"
#include "mt7986a-pinctrl.dtsi"
/ { / {
model = "Xiaomi Redmi Router AX6000"; model = "Xiaomi Redmi Router AX6000";
compatible = "xiaomi,redmi-router-ax6000", "mediatek,mt7986a"; compatible = "xiaomi,redmi-router-ax6000", "mediatek,mt7986a";
aliases {
led-boot = &led_status_rgb;
led-failsafe = &led_status_rgb;
led-running = &led_status_rgb;
led-upgrade = &led_status_rgb;
};
chosen { chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000"; bootargs = "console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000";
}; };
@ -146,6 +155,32 @@
}; };
}; };
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spic_pins_g2>;
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>;
};
};
};
&wbsys { &wbsys {
status = "okay"; status = "okay";
pinctrl-names = "default", "dbdc"; pinctrl-names = "default", "dbdc";

View File

@ -359,6 +359,7 @@ define Device/xiaomi_redmi-router-ax6000
DEVICE_MODEL := Redmi Router AX6000 DEVICE_MODEL := Redmi Router AX6000
DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000 DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
DEVICE_PACKAGES := kmod-leds-ws2812b
SUPPORTED_DEVICES := xiaomi,redmi-router-ax6000 SUPPORTED_DEVICES := xiaomi,redmi-router-ax6000
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k BLOCKSIZE := 128k
@ -376,6 +377,7 @@ define Device/xiaomi_redmi-router-ax6000-stock
DEVICE_MODEL := Redmi Router AX6000 (stock layout) DEVICE_MODEL := Redmi Router AX6000 (stock layout)
DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000-stock DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000-stock
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
DEVICE_PACKAGES := kmod-leds-ws2812b
SUPPORTED_DEVICES := xiaomi,redmi-router-ax6000-stock SUPPORTED_DEVICES := xiaomi,redmi-router-ax6000-stock
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k BLOCKSIZE := 128k

View File

@ -0,0 +1,19 @@
#!/bin/sh
. /lib/functions.sh
. /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" "eth1"
;;
esac
board_config_flush
exit 0

View File

@ -267,6 +267,7 @@ CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_IRQ_WORK=y CONFIG_IRQ_WORK=y
CONFIG_JUMP_LABEL=y CONFIG_JUMP_LABEL=y
CONFIG_LEDS_CLASS_MULTICOLOR=y
# CONFIG_LEDS_UBNT_LEDBAR is not set # CONFIG_LEDS_UBNT_LEDBAR is not set
CONFIG_LIBFDT=y CONFIG_LIBFDT=y
CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y
@ -282,7 +283,6 @@ CONFIG_MDIO_DEVICE=y
# CONFIG_MEDIATEK_GE_PHY is not set # CONFIG_MEDIATEK_GE_PHY is not set
CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_MT6577_AUXADC=y
CONFIG_MEDIATEK_NETSYS_V2=y CONFIG_MEDIATEK_NETSYS_V2=y
# CONFIG_MEDIATEK_NETSYS_V3 is not set
CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEDIATEK_WATCHDOG=y
CONFIG_MEDIA_SUPPORT=y CONFIG_MEDIA_SUPPORT=y
CONFIG_MEMFD_CREATE=y CONFIG_MEMFD_CREATE=y

View File

@ -0,0 +1,15 @@
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -1156,6 +1156,12 @@ static int mtk_spi_probe(struct platform
goto err_put_master;
}
+ ret = clk_prepare_enable(mdata->sel_clk);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to enable sel_clk (%d)\n", ret);
+ goto err_put_master;
+ }
+
ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
if (ret < 0) {
dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret);