[alsa-devel] [PATCH 3/4 v6] ASoC: fsi: enable .of_xlate_dai_name on struct snd_soc_dai_driver

Lars-Peter Clausen lars at metafoo.de
Wed Feb 20 13:03:56 CET 2013


On 02/20/2013 02:04 AM, Kuninori Morimoto wrote:
> 
> Hi Stephen
> 
>> Hmm. I think that the .of_xlate_dai_name should be something related to
>> the object (e.g. CODEC) that contains the DAIs, rather than the DAIs
>> themselves. The intent is to ask some object (e.g. CODEC) which of its
>> DAIs is represented by the DT DAI specifier, not to ask each DAI whether
>> it is represented by that particular DT DAI specifier.
>>
>> Aside from that, I'd expect the patch above to be something more like:
>>
>> const char *fsi_xlate_dai_name(struct snd_soc_dai *dai,
>> 				const struct of_phandle_args *args)
>> {
>> 	switch (args[0]) {
>> 	case 0:
>> 		return fsi_soc_dai[0].name;
>> 	case 1:
>> 		return fsi_soc_dai[1].name;
>> 	default:
>> 		return NULL;
>> 	}
>> }
> 
> Thank you for pointing it.
> I use this style in next patch.

I don't think this makes any more sense than the current version. You still
iterate over all dai instances and call the xlate function for the first dai
where the _parent_ device's of_node matches. You also pass in the this dai
as the first parameter to the xlate function, which makes even less sense
since you can use it to lookup the correct name, which may either be the
dai's name or any of its siblings.

If you want to use the xlate paradigm you really need to keep track of the
cpu devices and make the xlate callback a property of the cpu device. Well
or use a match paradigm instead of xlate.

- Lars


More information about the Alsa-devel mailing list