More Generic Audio Graph Sound Card idea

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri Sep 25 03:43:59 CEST 2020


Hi

For more generic Auido Graph Sound Card, I'm thinking about
Multi-CPU/Codec now.
(Need to think about Codec-to-Codec later, but it is next task)
I want to know your idea, opinion, etc, etc...

> > Please note that asoc_simple_init_dai_link_params() makes the link
> > codec-to-codec if any component involved has 'non_legacy_dai_naming'
> > flag enabled. It is used by both audio-graph and simple-card. So it is
> > a combination of three (DPCM, normal and codec-to-codec). To avoid all
> > this complication, I am treating all links as DPCM in the series [0] I
> > sent.
> 
> Ahh, we want to consider codec-to-codec..
> And I noticed multi-CPU / multi-Codec case too (= for normal connection).
> Do we have sample code ? > Mark

First idea is using "ports".
In such case, I think multi-CPU side is not big issue,
because "dais" selects "port" (and "ports") instead of "endpoint".
(Note: here have no compatible to "-scu-" of audio-graph)

	CPU0-1 <------> Codec0
	CPU0-2 <---/
	CPU0-3 <---/

	sound {
		compatible = "audio-graph-card2";

=>		dais = <&cpu0>;
	};

	cpu-device {
		/*
		 * use "ports" for Multi-CPU
		 */
=>		cpu0: ports {
			port at 0 { cpu0_1: endpoint { remote-endpoint = <&codec0_1>; }; };
			port at 1 { cpu0_2: endpoint { remote-endpoint = <&codec0_2>; }; };
			port at 2 { cpu0_3: endpoint { remote-endpoint = <&codec0_3>; }; };
		};

		/*
		 * According to graph.txt, 
		 * we can use other "port" and/or "ports" for non multi-CPU.
		 */
		port at x { };
		port at x { };
		ports {
			port { };
			...
		};
	};

	codec-device {
		port {	codec0_1: endpoint at 0 { remote-endpoint = <&cpu0_1>; };
			codec0_2: endpoint at 0 { remote-endpoint = <&cpu0_2>; }; 
			codec0_3: endpoint at 0 { remote-endpoint = <&cpu0_3>; }; };
	};


But multi-Codec side is difficult.
Because it is selected via "endpoint" via CPU.
No way to select it via "port" and/or "ports".

	CPU1 <------> Codec1-1
	        \---> Codec1-2
	        \---> Codec1-3

	sound {
		compatible = "audio-graph-card2";

		dais = <&cpu1>;
	};

	cpu-device {
		/*
		 * CPU selects Codec by "endpoints".
		 */
		cpu1: port {	cpu1_1: endpoint { remote-endpoint = <&codec1_1>; };
				cpu1_2: endpoint { remote-endpoint = <&codec1_2>; };
				cpu1_3: endpoint { remote-endpoint = <&codec1_3>; };
		};
	};

	codec-device {
		/*
		 * Codec is selected via CPU.
		 * It is best if we can select "codec1" (= port / ports) from CPU.
		 * But is selected via "endpoint" in reality,
		 * using "ports" is not enough for Multi-Codec.
		 * because see below
		 */
		codec1: ports {
			port at 0 { codec1_1: endpoint { remote-endpoint = <&dai0_0>; }; };
			port at 1 { codec1_2: endpoint { remote-endpoint = <&dai0_1>; }; };
			port at 2 { codec1_3: endpoint { remote-endpoint = <&dai0_2>; }; };
		};

		/*
		 * Because "ports" is used to for non Multi-xxx too.
		 * How to know the "ports" was for Multi-xxx or not ?
		 */
		ports {
			port at 1 { for device1 };
			port at 2 { for device2 };
			port at 3 { for device3 };
		};
	};

We might want to select Multi-CPU/Codec by using multi deivces ?
in such case, using "ports" idea is not enough.

Using extra device like DSP can be more generic ?

	<--- multi-CPU --->
	            *******
	CPU0-1 <--> *     * <--> Codec0
	CPU0-2 <--> *     *
	CPU0-3 <--> *     *
	            *******

	sound {
		compatible = "audio-graph-card2";

		dais = <&cpu0>;
	};

	cpu-device {
		ports {
			/* for multi-CPU */
			port at 0 { cpu0_1: endpoint { remote-endpoint = <&multi_cpu_1>; }; };
			port at 1 { cpu0_2: endpoint { remote-endpoint = <&multi_cpu_2>; }; };
			port at 2 { cpu0_3: endpoint { remote-endpoint = <&multi_cpu_3>; }; };

			/* for others */
			port at 3 { ... };
		};
	};

	multi-cpu {
		compatible = "audio-graph-card2-multi";

		/* CPU side */
		cpu0: ports at 0 {
			port at 0 { multi_cpu_1: endpoint { remote-endpoint = <&cpu0_1>; }; };
			port at 1 { multi_cpu_2: endpoint { remote-endpoint = <&cpu0_2>; }; };
			port at 2 { multi_cpu_3: endpoint { remote-endpoint = <&cpu0_3>; }; };
		};

		/* Codec side */
		ports at 1 {
			port at 0 { multi_cpu0: endpoint { remote-endpoint = <&codec0>; }; };
		};
	};

	codec-device {
		ports {
			port at 0 { codec0: endpoint { remote-endpoint = <&multi_cpu0>; }; };
			port at 1 { ... };
		};
	};


	          <--- multi-Codec --->
	          *******
	CPU1 <--> *     * <--> Codec1-1
	          *     * <--> Codec1-2
	          *     * <--> Codec1-3
	          *******

	sound {
		compatible = "audio-graph-card2";

		dais = <&cpu1>;
	};

	cpu-device {
		ports {
			cpu1: port at 0 { cpu1_0: endpoint { remote-endpoint = <&multi_codec1>; }; };
			      port at 1 { ... };
		};
	};

	multi-cpu {
		compatible = "audio-graph-card2-multi";

		/* Front End */
		ports at 0 {
			port { multi_codec1: endpoint { remote-endpoint = <&cpu1_0>; }; };
		};

		/* Back End */
		ports at 1 {
			port at 0 { multi_codec1_1: endpoint { remote-endpoint = <&codec1_1>; }; };
			port at 1 { multi_codec1_2: endpoint { remote-endpoint = <&codec1_2>; }; };
			port at 2 { multi_codec1_3: endpoint { remote-endpoint = <&codec1_3>; }; };
		};
	};

	codec-device {
		ports {
			port at 0 { codec1_1: endpoint { remote-endpoint = <&multi_codec1_1>; }; };
			port at 0 { codec1_2: endpoint { remote-endpoint = <&multi_codec1_2>; }; };
			port at 0 { codec1_3: endpoint { remote-endpoint = <&multi_codec1_3>; }; };
			port at 1 { ... };
		};
	};



Thank you for your help !!

Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list