[alsa-devel] [PATCH 1/4 v6] ASoC: add .of_xlate_dai_name callback on struct snd_soc_dai_driver

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Feb 20 01:59:59 CET 2013

Hi Stephen

> >> +const char *snd_soc_of_get_port_dai_name(struct device_node *of_node,
> >> +					 const char *prop)
> >> +{
> >> +	struct snd_soc_dai *dai;
> >> +	struct of_phandle_args args;
> >> +	const char *name;
> >> +	int ret;
> >> +
> >> +	ret = of_parse_phandle_with_args(of_node, prop,
> >> +					 "#sound-dai-cells", 0, &args);
> >> +	if (ret)
> >> +		return NULL;
> >> +	of_node_put(args.np);
> >> +
> >> +	list_for_each_entry(dai, &dai_list, list) {
> > 
> > I think this should iterate over the list of CODEC drivers that are
> > registered, and then ask the driver to translate from the args to the
> > DAI name. Here, you're iterating over the list of registered DAIs, which
> > is something entirely different.
> Ah. I guess here is the issue:
> For CODECs, ASoC actually knows about a CODEC object, so you can imagine
> asking the CODEC object to translate from some a DT DAI specifier to a
> DAI name, and then look up the DAI using the combination of CODEC plus
> DAI name.
> However, the CPU DAIs, there is no object that contains the DAIs; only
> the DAIs exist. Thus, there's nothing to ask "which of your DAIs does
> this DT DAI specifier correspond to?".
> Now presumably there is a platform device for the FSI device, just like
> there's a platform device for the AK4642 CODEC. Can we create an ASoC
> "CPU" device for the FSI device too, to act as the DAI container? Or can
> we alter this patch series to query the platform device rather than some
> ASoC device in order to do the DT DAI specifier to DAI name translation?
> As an aside, I now recall this lack of symmetry from when I was working
> on enhancing the Tegra30 ASoC driver to support DPCM and similar; I
> ended up pretending that the CPU I2S interface was actually a CODEC with
> 1 DAI in order to model the CPU DAIs and real CODEC DAIs in a more
> similar fashion.

Thank you for understanding my last resort :)

I don't want to create new feature (= snd_soc_register_cpu)
on ASoC only for simple-card.
But now, simple-card is assuming CPU device and Platform device is same one.

If my understanding was correct,
struct snd_soc_platform_driver
struct snd_soc_codec_driver
will have new ".of_xlate_dai_name".

Best regards
Kuninori Morimoto

More information about the Alsa-devel mailing list