[alsa-devel] [PATCH v4 1/9] ASoC: rt5514: Avoid legacy dai naming

jeffy jeffy.chen at rock-chips.com
Fri Aug 18 17:03:46 CEST 2017


Hi Mark,

On 08/18/2017 07:45 PM, Mark Brown wrote:
> On Fri, Aug 18, 2017 at 11:11:39AM +0800, Jeffy Chen wrote:
>> Currently we are using devm_snd_soc_register_component, which would
>> use legacy dai naming when dai drv id is zero.
>>
>> Set a non-zero dai drv id to use dai drv name for dai name.
>
> Why?  This is clearly not good, we shouldn't be expecting all devices
> with a single DAI to set the DAI number to 1 and the changelog doesn't
> articulate any reason why anything cares what the name is.
>

i was trying to avoid legacy dai naming, because snd_soc_find_dai will 
try to match the dai name:

struct snd_soc_dai *snd_soc_find_dai(
         const struct snd_soc_dai_link_component *dlc)
{
...

                 list_for_each_entry(dai, &component->dai_list, list) {
                         if (dlc->dai_name && strcmp(dai->name, 
dlc->dai_name))
                                 continue;

                         return dai;


if match failed, it would break soc_bind_dai_link:

static int soc_bind_dai_link(struct snd_soc_card *card,
         struct snd_soc_dai_link *dai_link)
{
...
         /* Find CODEC from registered CODECs */
         codec_dais = rtd->codec_dais;
         for (i = 0; i < rtd->num_codecs; i++) {
                 codec_dais[i] = snd_soc_find_dai(&codecs[i]);
                 if (!codec_dais[i]) {
                         dev_err(card->dev, "ASoC: CODEC DAI %s not 
registered\n",
                                 codecs[i].dai_name);
                         goto _err_defer;
                 }




when using legacy dai naming, the dai->name for rt5514-spi would be the 
dev name, which is spi2.0 with my local 4.4 kernel, and would be 
spi32765.0 with upstream kernel.




More information about the Alsa-devel mailing list