Skip to content

Commit 5fdd022

Browse files
Piotr Stankiewiczbroonie
authored andcommitted
ASoC: dpcm: play nice with CODEC<->CODEC links
Currently in situations where a normal CODEC to CODEC link follows a DPCM DAI, an error in the following form will be logged: ASoC: can't get [playback|capture] BE for <widget name> ASoC: no BE found for <widget name> This happens because all widgets in a path containing a DPCM DAI will be passed to dpcm_add_paths, which will try to interpret the CODEC<->CODEC as if it were a DPCM DAI, in turn causing the error. This patch aims to resolve the described issue by stopping the DPCM graph walk, initiated from dpcm_path_get, at the first widget associated with a DPCM BE. Signed-off-by: Piotr Stankiewicz <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 6742064 commit 5fdd022

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

sound/soc/soc-pcm.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,46 @@ static int widget_in_list(struct snd_soc_dapm_widget_list *list,
12871287
return 0;
12881288
}
12891289

1290+
static bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget,
1291+
enum snd_soc_dapm_direction dir)
1292+
{
1293+
struct snd_soc_card *card = widget->dapm->card;
1294+
struct snd_soc_pcm_runtime *rtd;
1295+
int i;
1296+
1297+
if (dir == SND_SOC_DAPM_DIR_OUT) {
1298+
list_for_each_entry(rtd, &card->rtd_list, list) {
1299+
if (!rtd->dai_link->no_pcm)
1300+
continue;
1301+
1302+
if (rtd->cpu_dai->playback_widget == widget)
1303+
return true;
1304+
1305+
for (i = 0; i < rtd->num_codecs; ++i) {
1306+
struct snd_soc_dai *dai = rtd->codec_dais[i];
1307+
if (dai->playback_widget == widget)
1308+
return true;
1309+
}
1310+
}
1311+
} else { /* SND_SOC_DAPM_DIR_IN */
1312+
list_for_each_entry(rtd, &card->rtd_list, list) {
1313+
if (!rtd->dai_link->no_pcm)
1314+
continue;
1315+
1316+
if (rtd->cpu_dai->capture_widget == widget)
1317+
return true;
1318+
1319+
for (i = 0; i < rtd->num_codecs; ++i) {
1320+
struct snd_soc_dai *dai = rtd->codec_dais[i];
1321+
if (dai->capture_widget == widget)
1322+
return true;
1323+
}
1324+
}
1325+
}
1326+
1327+
return false;
1328+
}
1329+
12901330
int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
12911331
int stream, struct snd_soc_dapm_widget_list **list)
12921332
{
@@ -1295,7 +1335,7 @@ int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
12951335

12961336
/* get number of valid DAI paths and their widgets */
12971337
paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list,
1298-
NULL);
1338+
dpcm_end_walk_at_be);
12991339

13001340
dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
13011341
stream ? "capture" : "playback");

0 commit comments

Comments
 (0)