On Tue, 2020-06-30 at 21:23 +0300, Daniel Baluta wrote:
On Tue, Jun 30, 2020 at 8:58 PM Sridharan, Ranjani ranjani.sridharan@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?
Oh, I understand your confusion now. When the SOf registers the component, it does 2 things: initialize the component driver and registers the CPU dai for the the BE DAI's. Th
A component is So for the example below, the codec dai for SSP0 is register by the codec component driver (defined and registered in rt5645.c) and the cpu dai for the SSP0 is registered when the SOF component driver is registered.
I'm confused about num_drv and drv members of snd_sof_dsp_ops.
This is what defines which CPU DAI's should be registered when the component driver is registered.
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.
The CPU component specified in the machine driver should have the same dai_name as the dai_name specified by the name field for the dai drv in the SOF dai drv array.
Thanks, Ranjani