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@0 { cpu0_1: endpoint { remote-endpoint = <&codec0_1>; }; }; port@1 { cpu0_2: endpoint { remote-endpoint = <&codec0_2>; }; }; port@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@x { }; port@x { }; ports { port { }; ... }; };
codec-device { port { codec0_1: endpoint@0 { remote-endpoint = <&cpu0_1>; }; codec0_2: endpoint@0 { remote-endpoint = <&cpu0_2>; }; codec0_3: endpoint@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@0 { codec1_1: endpoint { remote-endpoint = <&dai0_0>; }; }; port@1 { codec1_2: endpoint { remote-endpoint = <&dai0_1>; }; }; port@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@1 { for device1 }; port@2 { for device2 }; port@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@0 { cpu0_1: endpoint { remote-endpoint = <&multi_cpu_1>; }; }; port@1 { cpu0_2: endpoint { remote-endpoint = <&multi_cpu_2>; }; }; port@2 { cpu0_3: endpoint { remote-endpoint = <&multi_cpu_3>; }; };
/* for others */ port@3 { ... }; }; };
multi-cpu { compatible = "audio-graph-card2-multi";
/* CPU side */ cpu0: ports@0 { port@0 { multi_cpu_1: endpoint { remote-endpoint = <&cpu0_1>; }; }; port@1 { multi_cpu_2: endpoint { remote-endpoint = <&cpu0_2>; }; }; port@2 { multi_cpu_3: endpoint { remote-endpoint = <&cpu0_3>; }; }; };
/* Codec side */ ports@1 { port@0 { multi_cpu0: endpoint { remote-endpoint = <&codec0>; }; }; }; };
codec-device { ports { port@0 { codec0: endpoint { remote-endpoint = <&multi_cpu0>; }; }; port@1 { ... }; }; };
<--- multi-Codec ---> ******* CPU1 <--> * * <--> Codec1-1 * * <--> Codec1-2 * * <--> Codec1-3 *******
sound { compatible = "audio-graph-card2";
dais = <&cpu1>; };
cpu-device { ports { cpu1: port@0 { cpu1_0: endpoint { remote-endpoint = <&multi_codec1>; }; }; port@1 { ... }; }; };
multi-cpu { compatible = "audio-graph-card2-multi";
/* Front End */ ports@0 { port { multi_codec1: endpoint { remote-endpoint = <&cpu1_0>; }; }; };
/* Back End */ ports@1 { port@0 { multi_codec1_1: endpoint { remote-endpoint = <&codec1_1>; }; }; port@1 { multi_codec1_2: endpoint { remote-endpoint = <&codec1_2>; }; }; port@2 { multi_codec1_3: endpoint { remote-endpoint = <&codec1_3>; }; }; }; };
codec-device { ports { port@0 { codec1_1: endpoint { remote-endpoint = <&multi_codec1_1>; }; }; port@0 { codec1_2: endpoint { remote-endpoint = <&multi_codec1_2>; }; }; port@0 { codec1_3: endpoint { remote-endpoint = <&multi_codec1_3>; }; }; port@1 { ... }; }; };
Thank you for your help !!
Best regards --- Kuninori Morimoto