[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <599BB104.4020600@rock-chips.com>
Date: Tue, 22 Aug 2017 12:20:20 +0800
From: jeffy <jeffy.chen@...k-chips.com>
To: Mark Brown <broonie@...nel.org>
CC: linux-kernel@...r.kernel.org, dgreid@...omium.org, heiko@...ech.de,
briannorris@...omium.org, mka@...omium.org, dianders@...omium.org,
Jaroslav Kysela <perex@...ex.cz>, alsa-devel@...a-project.org,
Oder Chiou <oder_chiou@...ltek.com>,
Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>,
Bard Liao <bardliao@...ltek.com>,
Lars-Peter Clausen <lars@...afoo.de>
Subject: Re: [PATCH v4 1/9] ASoC: rt5514: Avoid legacy dai naming
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;
Powered by blists - more mailing lists