[Sound-open-firmware] Platform vs CPU component driver

Daniel Baluta daniel.baluta at gmail.com
Tue Jun 30 20:23:49 CEST 2020


On Tue, Jun 30, 2020 at 8:58 PM Sridharan, Ranjani
<ranjani.sridharan at intel.com> wrote:
>
> On Tue, 2020-06-30 at 10:56 +0300, Daniel Baluta wrote:
> > Hi Ranjani,
> >
> > In sound/soc/sof/core.c there is this code
> >
> > »       /* set up platform component driver */
> > »       snd_sof_new_platform_drv(sdev);
> >
> > Components in ALSA are of type: CPU, platform and codec.
> >
> > So, my question is that ignoring some language semantics
> > isn't this function setting up the CPU component driver?
>
> Hi Daniel,
>
> Im not sure I understand your question here.  Are you asking if the
> comment above is correct?

Yes, I'm asking if the comment is correct.

>
> Take for example, the DAI link definition in one of the Intel machine
> drivers:
>
> SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform),
>
> The ssp1_pin refers to the CPU component, ssp1_codec refers to the
> codec component and platform refers to the platform component. The
> platform component's name is fixed-up a with the name that is passed to
> the machine driver when it is registered by the SOF driver (ie the
> platform driver).
>
> So whats we're setting up in snd_sof_new_platform_drv() is the platform
> component and not the CPU component. Does that make sense?

Yes, it makes sense. But then who creates the CPU component for SOF?

I'm confused about num_drv and drv members of snd_sof_dsp_ops.

Lets look at:

       /* now register audio DSP platform driver and dai */
»       ret = devm_snd_soc_register_component(sdev->dev,
&sdev->plat_drv,
»       »       »       »       »             sof_ops(sdev)->drv,
»       »       »       »       »             sof_ops(sdev)->num_drv);

For BDW for example, drv is:

static struct snd_soc_dai_driver bdw_dai[] = {
»       .name = "ssp0-port",
};

But then lets take for example the machine driver for boards/bdw-rt5650.c
Here one BE DAI link is defined as:

static struct snd_soc_dai_link bdw_rt5650_dais[] = {
»       /* Back End DAI links */
»       {
»       »       /* SSP0 - Codec */
»       »       .name = "Codec",
»       »       .id = 0,
»       »       .no_pcm = 1,
»       »       SND_SOC_DAILINK_REG(ssp0_port, be, platform),
}

And ssp0_port is

SND_SOC_DAILINK_DEF(ssp0_port,
»           DAILINK_COMP_ARRAY(COMP_CPU("ssp0-port")));

So, it looks like ssp0-port CPU DAI link end points to platform DAI
link defined in sof bdw Intel specific file.

I try to model this behavior using device trees and simple-card driver.

thanks,
Daniel.


More information about the Sound-open-firmware mailing list