[PATCH] arm64: dts: rockchip: enable SPDIF audio on Rock 5 ITX

Torsten Duwe posted 1 patch 1 week ago
rk3588-rock-5-itx.dts |   23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
[PATCH] arm64: dts: rockchip: enable SPDIF audio on Rock 5 ITX
Posted by Torsten Duwe 1 week ago
The Rock5 ITX has an S/PDIF (TOSLINK) socket in its I/O-shield, whose
TX signal is wired to GPIO4 C1. Activate SPDIF TX unit 1 and select
the proper pinmux (M2).

Signed-off-by: Torsten Duwe <duwe@lst.de>
---

For Linux, activating spdif_tx1 only creates a "component", see
/sys/kernel/debug/asoc/components. ALSA needs a "simple-audio-card"
pseudo device wrapper along with a "dummy transmitter" (?!) in order
to turn it into a functioning audio output. This is not really
intuitive and IMHO does not belong in a hardware description.
But well, so be it.

	Torsten

---
 rk3588-rock-5-itx.dts |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts
index bc8140883de4..6780fbb26efb 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5-itx.dts
@@ -147,6 +147,24 @@ sdio_pwrseq: sdio-pwrseq {
 		reset-gpios = <&gpio0 RK_PC4 GPIO_ACTIVE_LOW>;
 	};
 
+	spdif_dit: spdif-dit {
+		compatible = "linux,spdif-dit";
+		#sound-dai-cells = <0>;
+	};
+
+	spdif_sound: spdif-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "SPDIF";
+
+		simple-audio-card,cpu {
+			sound-dai = <&spdif_tx1>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&spdif_dit>;
+		};
+	};
+
 	typec_vin: regulator-typec-vin {
 		compatible = "regulator-fixed";
 		enable-active-high;
@@ -839,6 +857,11 @@ spi_flash: flash@0 {
 	};
 };
 
+&spdif_tx1 {
+	pinctrl-0 = <&spdif1m2_tx>;
+	status = "okay";
+};
+
 &spi2 {
 	status = "okay";
 	assigned-clocks = <&cru CLK_SPI2>;