More Generic Audio Graph Sound Card idea
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Oct 13 06:50:25 CEST 2020
Hi ALSA ML
> I'm thinking below style as new audio-graph-card2.
> It is not tricky, thus connection judgement for normal vs DSP is easy.
> Then, code can be more readable (= no guaranty :P) ?
I have proposed DPCM connection idea for audio-card2 before,
and proposed Multi-CPU/Codec connection idea later.
I'm not yet implemented these, but I want to merge / reuse these
idea to keep simple code.
By this mail, I want to propose Codec2Codec idea.
It is almost same idea with DPCM, Multi-CPU/Codec,
and is last parts for missing feature.
I think this idea can be generic and easy to update
in the future (if needed).
But, I want feedback, opinion.
I wonder does it works for your use-case ?
-- Image ---
Codec2Codec
Codec1 <--> Codec2
-- DT Image --
+--+
=> | |<--> Codec1
| |<--> Codec2
+--+
-- DT Sample --
sound {
compatible = "audio-graph-card2";
dais = <&codec2codec>;
};
CODEC2CODEC {
compatible = "audio-graph-card2-codec2codec";
ports {
codec2codec: port at 0 { fe_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
port at 1 { be_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
};
};
Codec1 {
port at 0 { codec1_ep: endpoint { remote-endpoint = <&fe_ep>; }; };
};
Codec2 {
port at 0 { codec2_ep: endpoint { remote-endpoint = <&be_ep>; }; };
};
-- Image ---
*******
PCM0 <--> * * <--> DAI0: Codec Headset
PCM1 <--> * * <--> DAI1: Codec Speakers
PCM2 <--> * DSP * <--> DAI2: MODEM
PCM3 <--> * * <--> DAI3: BT
* * <--> DAI4: DMIC
* * <--> DAI5: FM
*******
-- DT Image --
+--+ **** +--+
=> | |<--> PCM0 * * <-- (dummy) --> | | <=
| |<-- (dummy) --> * * DAI0 <--> | |
+--+ * * +--+
* *
+--+ * * +--+
=> | |<--> PCM1 * * <-- (dummy) --> | | <=
| |<-- (dummy) --> * * DAI1 <--> | |
+--+ * * +--+
... ... ...
-- DT Sample --
sound {
compatible = "audio-graph-card2";
/* indicate all Front-End, Back-End in DPCM case */
dais = <&dsp_fe0, &dsp_fe1, &dsp_fe2, &dsp_fe3,
&dsp_be0, &dsp_be1, &dsp_be2, &dsp_be3, &dsp_be4, &dsp_be5>;
};
DSP {
compatible = "audio-graph-card2-dsp";
ports at 0 {
/* Front-End is pcm0_ep, Back-End is dummy */
dsp_fe0: port at 0 { dsp_fe0_ep: endpoint { remote-endpoint = <&pcm0_ep>; }; };
port at 1 { };
};
...
ports at 4 {
/* Front-End is dummy, Back-End is dai_ep */
dsp_be0: port at 0 { };
port at 1 { dsp_be0_ep: endpoint { remote-endpoint = <&dai0_ep>; }; };
};
...
};
CPU {
ports {
port at 0 { pcm0_ep: endpoint { remote-endpoint = <&dsp_fe0_ep>; }; };
port at 1 { pcm1_ep: endpoint { remote-endpoint = <&dsp_fe1_ep>; }; };
port at 2 { pcm2_ep: endpoint { remote-endpoint = <&dsp_fe2_ep>; }; };
port at 3 { pcm3_ep: endpoint { remote-endpoint = <&dsp_fe3_ep>; }; };
...
};
};
Codec {
ports {
port at 0 { dai0_ep: endpoint { remote-endpoint = <&dsp_be0_ep>; }; };
port at 1 { dai1_ep: endpoint { remote-endpoint = <&dsp_be1_ep>; }; };
port at 2 { dai2_ep: endpoint { remote-endpoint = <&dsp_be2_ep>; }; };
port at 3 { dai3_ep: endpoint { remote-endpoint = <&dsp_be3_ep>; }; };
port at 4 { dai4_ep: endpoint { remote-endpoint = <&dsp_be4_ep>; }; };
port at 5 { dai5_ep: endpoint { remote-endpoint = <&dsp_be5_ep>; }; };
...
};
};
-- Image ---
As Sample, Normal Audio-Graph
CPU <---> Codec (Same as before)
-- DT Sample --
sound {
compatible = "audio-graph-card2";
dais = <&cpu>;
};
CPU {
cpu: port { cpu_ep: endpoint { remote-endpoint = <&codec_ep>; }; };
};
Codec {
codec: port { codec_ep: endpoint { remote-endpoint = <&cpu_ep>; }; };
};
-- Image ---
Multi-CPU/Codec
(complex connection as sample)
<- multi_CPU_0 ->
******
CPU01 <--> * * <--> Codec0
\-> * *
CPU02 <--> * *
******
<-- multi_codec_1 -->
******
CPU1 <--> * * <--> Codec11
* * <-/
* * <--> Codec12
******
-- DT Image --
+--+ +--+
=> | | <--> CPU01_1 => | | <--> CPU1
| | <--> CPU01_2 | |
| | <--> CPU02 | | <--> Codec11_1
| | | | <--> Codec11_2
| | <--> Codec0 | | <--> Codec12
+--+ +--+
-- DT Sample --
sound {
compatible = "audio-graph-card2";
dais = <&cpu_0,
&cpu_1>;
};
MULTI0 {
compatible = "audio-graph-card2-multi";
cpu_0: ports at 0 {
port at 0 { fe0_1_ep: endpoint { remote-endpoint = <&cpu01_1_ep>; }; };
port at 1 { fe0_2_ep: endpoint { remote-endpoint = <&cpu01_2_ep>; }; };
port at 2 { fe0_3_ep: endpoint { remote-endpoint = <&cpu02_ep>; }; };
};
ports at 1 {
port at 0 { be0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
};
};
MULTI1 {
compatible = "audio-graph-card2-multi";
cpu_1: ports at 0 {
port at 0 { fe1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
};
ports at 1 {
port at 0 { be1_1_ep: endpoint { remote-endpoint = <&codec11_1_ep>; }; };
port at 1 { be1_2_ep: endpoint { remote-endpoint = <&codec11_2_ep>; }; };
port at 2 { be1_3_ep: endpoint { remote-endpoint = <&codec12_ep>; }; };
};
};
CPU01 {
ports {
port at 0 { cpu01_1_ep: endpoint { remote-endpoint = <&fe0_1_ep>; }; };
port at 1 { cpu01_2_ep: endpoint { remote-endpoint = <&fe0_2_ep>; }; };
...
};
};
CPU02 {
ports {
port at 0 { cpu02_ep: endpoint { remote-endpoint = <&fe0_3_ep>; }; };
...
};
};
CPU1 {
ports {
port at 0 { cpu1_ep: endpoint { remote-endpoint = <&fe1_ep>; }; };
...
};
};
Codec0 {
ports {
port at 0 { codec0_ep: endpoint { remote-endpoint = <&be0_ep>; }; };
port at 1 { ... };
};
};
Codec11 {
ports {
port at 0 { codec11_1_ep: endpoint { remote-endpoint = <&be1_1_ep>; }; };
port at 1 { codec11_2_ep: endpoint { remote-endpoint = <&be1_2_ep>; }; };
port at 2 { ... };
};
};
Codec12 {
ports {
port at 0 { codec12_ep: endpoint { remote-endpoint = <&be1_3_ep>; }; };
port at 1 { ... };
};
};
More information about the Alsa-devel
mailing list