alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: dpcm: prevent error for paths including static links
@ 2016-03-15 15:34 Piotr Stankiewicz
  2016-03-29 21:22 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Piotr Stankiewicz @ 2016-03-15 15:34 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: Piotr Stankiewicz, alsa-devel, patches

According to the DPCM documentation using static codec <-> codec links
along dynamic ones is a valid use case, however this causes errors of
the following form to be printed to the kernel log:

ASoC: can't get [playback|caputure] BE for <widget name>
ASoC: no BE found for <widget name>

This happens when setting up, e.g. a route starting with a dynamic
DAI, which passes through a static DAI (say, "Some FE" -> "Some BE"
-> "Codec to Modem link"). All DAPM widgets involved in that path will
be passed to dpcm_add_paths in order to establish FE <-> BE connections,
which will result in dpcm_get_be trying to locate back-ends for dynamic,
as well as static links, causing a spurious error to be logged for the
latter.

This patch changes dpcm_get_be to look up a non front-end runtime
for a stream widget, and renames it accordingly. Like this both dynamic
and static links can be handled properly in dpcm_add_paths, i.e. an actual
missing BE can be distinguished from a normal link.

Signed-off-by: Piotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
---
 sound/soc/soc-pcm.c |   44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 1af4f23..ff5ea7e 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1220,47 +1220,47 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
 	}
 }
 
-/* get BE for DAI widget and stream */
-static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
+/* get runtime for DAI widget and stream */
+static struct snd_soc_pcm_runtime *dpcm_get_rtd(struct snd_soc_card *card,
 		struct snd_soc_dapm_widget *widget, int stream)
 {
-	struct snd_soc_pcm_runtime *be;
+	struct snd_soc_pcm_runtime *rtd;
 	int i;
 
 	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		list_for_each_entry(be, &card->rtd_list, list) {
+		list_for_each_entry(rtd, &card->rtd_list, list) {
 
-			if (!be->dai_link->no_pcm)
+			if (rtd->dai_link->dynamic)
 				continue;
 
-			if (be->cpu_dai->playback_widget == widget)
-				return be;
+			if (rtd->cpu_dai->playback_widget == widget)
+				return rtd;
 
-			for (i = 0; i < be->num_codecs; i++) {
-				struct snd_soc_dai *dai = be->codec_dais[i];
+			for (i = 0; i < rtd->num_codecs; i++) {
+				struct snd_soc_dai *dai = rtd->codec_dais[i];
 				if (dai->playback_widget == widget)
-					return be;
+					return rtd;
 			}
 		}
 	} else {
 
-		list_for_each_entry(be, &card->rtd_list, list) {
+		list_for_each_entry(rtd, &card->rtd_list, list) {
 
-			if (!be->dai_link->no_pcm)
+			if (rtd->dai_link->dynamic)
 				continue;
 
-			if (be->cpu_dai->capture_widget == widget)
-				return be;
+			if (rtd->cpu_dai->capture_widget == widget)
+				return rtd;
 
-			for (i = 0; i < be->num_codecs; i++) {
-				struct snd_soc_dai *dai = be->codec_dais[i];
+			for (i = 0; i < rtd->num_codecs; i++) {
+				struct snd_soc_dai *dai = rtd->codec_dais[i];
 				if (dai->capture_widget == widget)
-					return be;
+					return rtd;
 			}
 		}
 	}
 
-	dev_err(card->dev, "ASoC: can't get %s BE for %s\n",
+	dev_err(card->dev, "ASoC: can't get %s runtime for %s\n",
 		stream ? "capture" : "playback", widget->name);
 	return NULL;
 }
@@ -1367,15 +1367,15 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
 			continue;
 		}
 
-		/* is there a valid BE rtd for this widget */
-		be = dpcm_get_be(card, list->widgets[i], stream);
+		/* is there a valid rtd for this widget */
+		be = dpcm_get_rtd(card, list->widgets[i], stream);
 		if (!be) {
-			dev_err(fe->dev, "ASoC: no BE found for %s\n",
+			dev_err(fe->dev, "ASoC: no runtime found for %s\n",
 					list->widgets[i]->name);
 			continue;
 		}
 
-		/* make sure BE is a real BE */
+		/* check if the runtime is a BE */
 		if (!be->dai_link->no_pcm)
 			continue;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-31  8:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15 15:34 [PATCH] ASoC: dpcm: prevent error for paths including static links Piotr Stankiewicz
2016-03-29 21:22 ` Mark Brown
2016-03-30  8:58   ` Charles Keepax
2016-03-30 16:36     ` Mark Brown
2016-03-30 17:13       ` Charles Keepax
2016-03-30 17:27         ` Mark Brown
2016-03-31  8:17           ` Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).