CAINIAO CNIoT-CORE: add spidev to control WS2812 LEDs in user space

This commit is contained in:
retro98boy
2025-06-09 20:37:46 +08:00
committed by Igor
parent fb8f189130
commit f1354108fb
3 changed files with 71 additions and 2 deletions

View File

@@ -128,10 +128,10 @@ index 00000000..345d9b86
+CONFIG_ZSTD=y
diff --git a/dts/upstream/src/arm64/amlogic/meson-g12b-a311d-cainiao-cniot-core.dts b/dts/upstream/src/arm64/amlogic/meson-g12b-a311d-cainiao-cniot-core.dts
new file mode 100644
index 00000000..e1deb707
index 00000000..767b6e71
--- /dev/null
+++ b/dts/upstream/src/arm64/amlogic/meson-g12b-a311d-cainiao-cniot-core.dts
@@ -0,0 +1,483 @@
@@ -0,0 +1,506 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
@@ -567,6 +567,29 @@ index 00000000..e1deb707
+ vqmmc-supply = <&vddao_1v8>;
+};
+
+/*
+ * GPIOH_4 is connected to 6 WS2812 LEDs.
+ * Reusing GPIOH_4 as SPI MOSI to control the WS2812 offers superior performance compared to the GPIO method.
+ */
+&spicc1_pins {
+ mux {
+ groups = "spi1_mosi";
+ };
+};
+
+/* Controlling WS2812 LEDs via spidev in user space. */
+&spicc1 {
+ status = "okay";
+ pinctrl-0 = <&spicc1_pins>;
+ pinctrl-names = "default";
+
+ spidev@0 {
+ compatible = "rohm,dh2228fv";
+ reg = <0>;
+ spi-max-frequency = <3340000>;
+ };
+};
+
+&tdmif_b {
+ status = "okay";
+};