[alsa-devel] [PATCH] ASoC: ti: Allocate dais dynamically for TDM and audio graph card

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Feb 17 06:25:22 CET 2020


Hi

> I confirmed attached patch on my local platform (= Renesas ULCB + KF board),
> and it works well for me on at least v5.5 kernel.

Maybe my DT patch was not good for port vs endpoint.
I attached new one.

--------------------------
From a222375f826f650d1181646cc79b8b89b364da2a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Date: Fri, 14 Dec 2018 09:47:47 +0900
Subject: [PATCH 1/2] Local v5.4: ulcb-kf: add TDM Split support

	CPU0 ------ ak4613
	CPU1 ------ PCM3168A-p	/* 1ch/2ch */
	CPU2 --/		/* 3ch/4ch */
	CPU3 --/		/* 5ch/6ch */
	CPU4 --/		/* 7ch/8ch */
	CPU5 ------ PCM3168A-c	/* 1ch/2ch */
	CPU6 --/		/* 3ch/4ch */
	CPU7 --/		/* 5ch/6ch */

aplay   -D plughw:0,0 xxx.wav // ak4613
aplay   -D plughw:0,1 xxx.wav // PCM3168A playback 1ch/2ch
aplay   -D plughw:0,2 xxx.wav // PCM3168A playback 3ch/4ch
aplay   -D plughw:0,3 xxx.wav // PCM3168A playback 5ch/6ch
aplay   -D plughw:0,4 xxx.wav // PCM3168A playback 7ch/8ch
arecord -D plughw:0,5 xxx     // PCM8168A capture  1ch/2ch
arecord -D plughw:0,6 xxx     // PCM8168A capture  3ch/4ch
arecord -D plughw:0,7 xxx     // PCM8168A capture  5ch/6ch

It seems 1 sound card DAI number is limited by SNDRV_MINOR().
Because of this size limit, total 8 DAI seems maximam.
So, this patch removes HDMI so far.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 arch/arm64/boot/dts/renesas/ulcb-kf.dtsi | 116 ++++++++++++++++++++---
 1 file changed, 105 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
index 202177706cde..2c3bd62d13ff 100644
--- a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
@@ -115,18 +115,39 @@
 					#size-cells = <0>;
 					mclk-fs = <512>;
 					port at 0 {
+						prefix = "pcm3168a";
+						convert-channels = <8>; /* TDM Split */
 						reg = <0>;
-						pcm3168a_endpoint_p: endpoint {
+						pcm3168a_endpoint_p: endpoint at 0 {
 							remote-endpoint = <&rsnd_for_pcm3168a_play>;
 							clocks = <&clksndsel>;
 						};
+						pcm3168a_endpoint_p2: endpoint at 1 {
+							remote-endpoint = <&rsnd_for_pcm3168a_play2>;
+						};
+						pcm3168a_endpoint_p3: endpoint at 2 {
+							remote-endpoint = <&rsnd_for_pcm3168a_play3>;
+						};
+						pcm3168a_endpoint_p4: endpoint at 3 {
+							remote-endpoint = <&rsnd_for_pcm3168a_play4>;
+						};
 					};
 					port at 1 {
+						prefix = "pcm3168a";
+						convert-channels = <6>; /* TDM Split */
 						reg = <1>;
-						pcm3168a_endpoint_c: endpoint {
+						pcm3168a_endpoint_c: endpoint at 0 {
 							remote-endpoint = <&rsnd_for_pcm3168a_capture>;
 							clocks = <&clksndsel>;
 						};
+						pcm3168a_endpoint_c2: endpoint at 1 {
+							remote-endpoint = <&rsnd_for_pcm3168a_capture2>;
+							clocks = <&clksndsel>;
+						};
+						pcm3168a_endpoint_c3: endpoint at 2 {
+							remote-endpoint = <&rsnd_for_pcm3168a_capture3>;
+							clocks = <&clksndsel>;
+						};
 					};
 				};
 			};
@@ -299,28 +320,86 @@
 		/* rsnd_port0/1 are on salvator-common */
 		rsnd_port2: port at 2 {
 			reg = <2>;
-			rsnd_for_pcm3168a_play: endpoint {
+			rsnd_for_pcm3168a_play: endpoint at 2 {
 				remote-endpoint = <&pcm3168a_endpoint_p>;
 
 				dai-format = "i2s";
 				bitclock-master = <&rsnd_for_pcm3168a_play>;
 				frame-master = <&rsnd_for_pcm3168a_play>;
-				dai-tdm-slot-num = <8>;
 
-				playback = <&ssi3>;
+				playback = <&ssiu30 &ssi3>;
 			};
 		};
 		rsnd_port3: port at 3 {
 			reg = <3>;
-			rsnd_for_pcm3168a_capture: endpoint {
+			rsnd_for_pcm3168a_play2: endpoint at 3 {
+				remote-endpoint = <&pcm3168a_endpoint_p2>;
+
+				dai-format = "i2s";
+				bitclock-master = <&rsnd_for_pcm3168a_play2>;
+				frame-master = <&rsnd_for_pcm3168a_play2>;
+
+				playback = <&ssiu31 &ssi3>;
+			};
+		};
+		rsnd_port4: port at 4 {
+			reg = <4>;
+			rsnd_for_pcm3168a_play3: endpoint at 4 {
+				remote-endpoint = <&pcm3168a_endpoint_p3>;
+
+				dai-format = "i2s";
+				bitclock-master = <&rsnd_for_pcm3168a_play3>;
+				frame-master = <&rsnd_for_pcm3168a_play3>;
+
+				playback = <&ssiu32 &ssi3>;
+			};
+		};
+		rsnd_port5: port at 5 {
+			reg = <5>;
+			rsnd_for_pcm3168a_play4: endpoint at 5 {
+				remote-endpoint = <&pcm3168a_endpoint_p4>;
+
+				dai-format = "i2s";
+				bitclock-master = <&rsnd_for_pcm3168a_play4>;
+				frame-master = <&rsnd_for_pcm3168a_play4>;
+
+				playback = <&ssiu33 &ssi3>;
+			};
+		};
+		rsnd_port6: port at 6 {
+			reg = <6>;
+			rsnd_for_pcm3168a_capture: endpoint at 6 {
 				remote-endpoint = <&pcm3168a_endpoint_c>;
 
 				dai-format = "i2s";
 				bitclock-master = <&rsnd_for_pcm3168a_capture>;
 				frame-master = <&rsnd_for_pcm3168a_capture>;
-				dai-tdm-slot-num = <6>;
 
-				capture  = <&ssi4>;
+				capture  = <&ssiu40 &ssi4>;
+			};
+		};
+		rsnd_port7: port at 7 {
+			reg = <7>;
+			rsnd_for_pcm3168a_capture2: endpoint at 7 {
+				remote-endpoint = <&pcm3168a_endpoint_c2>;
+
+				dai-format = "i2s";
+				bitclock-master = <&rsnd_for_pcm3168a_capture2>;
+				frame-master = <&rsnd_for_pcm3168a_capture2>;
+
+				capture  = <&ssiu41 &ssi4>;
+			};
+		};
+		rsnd_port8: port at 8 {
+			reg = <8>;
+			rsnd_for_pcm3168a_capture3: endpoint at 8 {
+				remote-endpoint = <&pcm3168a_endpoint_c3>;
+
+				dai-format = "i2s";
+				bitclock-master = <&rsnd_for_pcm3168a_capture3>;
+				frame-master = <&rsnd_for_pcm3168a_capture3>;
+
+				capture  = <&ssiu42 &ssi4>;
 			};
 		};
 	};
@@ -359,10 +438,25 @@
 };
 
 &sound_card {
+	compatible = "audio-graph-scu-card";
+
+	routing =	"pcm3168a Playback", "DAI2 Playback",
+			"pcm3168a Playback", "DAI3 Playback",
+			"pcm3168a Playback", "DAI4 Playback",
+			"pcm3168a Playback", "DAI5 Playback",
+			"DAI6 Capture", "pcm3168a Capture",
+			"DAI7 Capture", "pcm3168a Capture",
+			"DAI8 Capture", "pcm3168a Capture";
+
 	dais = <&rsnd_port0	/* ak4613 */
-		&rsnd_port1	/* HDMI0  */
-		&rsnd_port2	/* pcm3168a playback */
-		&rsnd_port3	/* pcm3168a capture  */
+//		&rsnd_port1	/* HDMI0  */
+		&rsnd_port2	/* pcm3168a playback	1ch/2ch */
+		&rsnd_port3	/*			3ch/4ch */
+		&rsnd_port4	/*			5ch/6ch */
+		&rsnd_port5	/*			7ch/8ch */
+		&rsnd_port6	/* pcm3168a capture	1ch/2ch */
+		&rsnd_port7	/*			3ch/4ch */
+		&rsnd_port8	/*			5ch/6ch */
 		>;
 };
 
-- 
2.17.1



Thank you for your help !!
Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list