Skip to content

Commit 6052f05

Browse files
kv2019ibroonie
authored andcommitted
ASoc: SOF: topology: connect DAI to a single DAI link
The partial matching of DAI widget to link names, can cause problems if one of the widget names is a substring of another. E.g. with names "Foo1" and Foo10", it's not possible to correctly link up "Foo1". Modify the logic so that if multiple DAI links match the widget stream name, prioritize a full match if one is found. Fixes: fe88788 ("ASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget") Link: thesofproject#5308 Signed-off-by: Kai Vehmanen <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Cc: [email protected] Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4e70108 commit 6052f05

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

sound/soc/sof/topology.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
10631063
struct snd_sof_dai *dai)
10641064
{
10651065
struct snd_soc_card *card = scomp->card;
1066-
struct snd_soc_pcm_runtime *rtd;
1066+
struct snd_soc_pcm_runtime *rtd, *full, *partial;
10671067
struct snd_soc_dai *cpu_dai;
10681068
int stream;
10691069
int i;
@@ -1080,12 +1080,22 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
10801080
else
10811081
goto end;
10821082

1083+
full = NULL;
1084+
partial = NULL;
10831085
list_for_each_entry(rtd, &card->rtd_list, list) {
10841086
/* does stream match DAI link ? */
1085-
if (!rtd->dai_link->stream_name ||
1086-
!strstr(rtd->dai_link->stream_name, w->sname))
1087-
continue;
1087+
if (rtd->dai_link->stream_name) {
1088+
if (!strcmp(rtd->dai_link->stream_name, w->sname)) {
1089+
full = rtd;
1090+
break;
1091+
} else if (strstr(rtd->dai_link->stream_name, w->sname)) {
1092+
partial = rtd;
1093+
}
1094+
}
1095+
}
10881096

1097+
rtd = full ? full : partial;
1098+
if (rtd) {
10891099
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
10901100
/*
10911101
* Please create DAI widget in the right order

0 commit comments

Comments
 (0)