Commit 5fdd022c authored by Piotr Stankiewicz's avatar Piotr Stankiewicz Committed by Mark Brown

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: default avatarPiotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6742064a
...@@ -1287,6 +1287,46 @@ static int widget_in_list(struct snd_soc_dapm_widget_list *list, ...@@ -1287,6 +1287,46 @@ static int widget_in_list(struct snd_soc_dapm_widget_list *list,
return 0; return 0;
} }
static bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget,
enum snd_soc_dapm_direction dir)
{
struct snd_soc_card *card = widget->dapm->card;
struct snd_soc_pcm_runtime *rtd;
int i;
if (dir == SND_SOC_DAPM_DIR_OUT) {
list_for_each_entry(rtd, &card->rtd_list, list) {
if (!rtd->dai_link->no_pcm)
continue;
if (rtd->cpu_dai->playback_widget == widget)
return true;
for (i = 0; i < rtd->num_codecs; ++i) {
struct snd_soc_dai *dai = rtd->codec_dais[i];
if (dai->playback_widget == widget)
return true;
}
}
} else { /* SND_SOC_DAPM_DIR_IN */
list_for_each_entry(rtd, &card->rtd_list, list) {
if (!rtd->dai_link->no_pcm)
continue;
if (rtd->cpu_dai->capture_widget == widget)
return true;
for (i = 0; i < rtd->num_codecs; ++i) {
struct snd_soc_dai *dai = rtd->codec_dais[i];
if (dai->capture_widget == widget)
return true;
}
}
}
return false;
}
int dpcm_path_get(struct snd_soc_pcm_runtime *fe, int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
int stream, struct snd_soc_dapm_widget_list **list) int stream, struct snd_soc_dapm_widget_list **list)
{ {
...@@ -1295,7 +1335,7 @@ int dpcm_path_get(struct snd_soc_pcm_runtime *fe, ...@@ -1295,7 +1335,7 @@ int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
/* get number of valid DAI paths and their widgets */ /* get number of valid DAI paths and their widgets */
paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list, paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list,
NULL); dpcm_end_walk_at_be);
dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths, dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
stream ? "capture" : "playback"); stream ? "capture" : "playback");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment