Re: [PATCH v4 1/9] ASoC: rt5514: Avoid legacy dai naming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark,

thanks for your reply.

On 08/22/2017 01:31 AM, Mark Brown wrote:
On Fri, Aug 18, 2017 at 11:03:46PM +0800, jeffy wrote:

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.

It would be better to fix the code to not need a name if the device by
itself is unambiguous.


right...

i'm not familiar with the soc core codes, would these make sense?

1/ consider match when the of nodes are the same:

@@ -978,9 +978,10 @@ struct snd_soc_dai *snd_soc_find_dai(
                if (dlc->name && strcmp(component->name, dlc->name))
                        continue;
                list_for_each_entry(dai, &component->dai_list, list) {
+ if (dlc->of_node && dai->dev->of_node == dlc->of_node)
+                               return dai;

or
2/ return the first dai when there's only one:

@@ -977,10 +977,11 @@ struct snd_soc_dai *snd_soc_find_dai(
                        continue;
                if (dlc->name && strcmp(component->name, dlc->name))
                        continue;
+               if (component->num_dai == 1)
+                       return &component->dai_list[0];
                list_for_each_entry(dai, &component->dai_list, list) {

or
3/ also check for dai driver name:

@@ -978,9 +978,10 @@ struct snd_soc_dai *snd_soc_find_dai(
                if (dlc->name && strcmp(component->name, dlc->name))
                        continue;
                list_for_each_entry(dai, &component->dai_list, list) {
- if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) + if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
+                           && strcmp(dai->driver->name, dlc->dai_name))
                                continue;



_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux