Re: [RFC PATCH] ASoC: simple-card: Use dai_id from node description

From: Daniel Baluta
Date: Tue Nov 21 2023 - 09:03:01 EST


On Tue, Nov 21, 2023 at 1:04 AM Kuninori Morimoto
<kuninori.morimoto.gx@xxxxxxxxxxx> wrote:
>
> Hi Daniel, Mark
>
> > > > - args.args_count = (of_graph_get_endpoint_count(node) > 1);
> > > > + args.args_count = (of_graph_get_endpoint_count(node) >= 1);
> > >
> > > If my understanding was correct, for example you want to use 2nd DAI
> > > but your DT has only 1 port (thus, it is using reg property) ?
> >
> > Yes.
>
> But hmm... in your case, you need to setup 2ports, and use 2nd port
> is assumed approach.
> Why you don't setup full port ? Do you have some reason ??

I'm not sure I understand what is a full port setup. But let me
describe my scenario so that we have a common ground.

I want to use audio-graph-card2 machine driver to setup Sound Open
Firrmware cards.

Here we start with a normal link with the following components:

Component 0 (DAI) : 3b6e8000.dsp (See sound/soc/sof/core.c: 280)
-> for imx8m this has 3 statically
defined DAIs
See sound/soc/sof/imx/imx8m.c:

static struct snd_soc_dai_driver imx8m_dai[] = {
{ // DAI with index 0
» .name = "sai1",
},
{ // DAI with index 1
» .name = "sai3",
},
{ / // DAI with index 2
» .name = "micfil",
},
};

Component 1 (Codec): wm8960-hifi
-> with 1 DAI

static struct snd_soc_dai_driver wm8960_dai = {
» .name = "wm8960-hifi",
};

Now, I want to write a DTS description where my DAI link uses
Component 0 (CPU) (with its DAI index 1) connected with Component 1
(codec) (with its DAI index 0).

So, for this I use the following dts snippet:

sof-sound-wm8960 {
» » compatible = "audio-graph-card2";
» » links = <&cpu>;
}

dsp: dsp@3b6e8000 {
cpu: port@1 {
» » reg = <1>;
» » cpu_ep: endpoint { remote-endpoint = <&codec_ep>; };
» };
}

wm8960 {

» port {
» » codec_ep: endpoint { remote-endpoint = <&cpu_ep>; };
» };
}

So, property reg = <1> refferes to DAI with index 1 associated with
component DSP.