All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	tiwai@suse.de,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	broonie@kernel.org, Bard Liao <yung-chuan.liao@linux.intel.com>
Subject: [PATCH 01/24] ASoC: SOF: topology: fix: handle DAI widget connections properly with multiple CPU DAI's
Date: Wed, 15 Apr 2020 15:27:53 -0500	[thread overview]
Message-ID: <20200415202816.934-2-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20200415202816.934-1-pierre-louis.bossart@linux.intel.com>

From: Bard Liao <yung-chuan.liao@linux.intel.com>

Currently, when connecting a DAI widget to the BE CPU DAI, we overwrite
the previous connections. This worked because we only ever had 1 CPU DAI
for each rtd until now. But with multiple CPU DAI's, a new connection
between a BE CPU DAI and the DAI widget should be established without
affecting the previous connections. So, modify the loop to set the
playback/capture widget for the first BE CPU DAI that does not have a
connection established previously.

Fixes: 4a7e26a4d833 ("ASoC: SOF: topology: connect dai widget to all
cpu-dais")

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/topology.c | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index fe8ba3e05e08..3386886fd743 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1257,15 +1257,45 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
 
 		switch (w->id) {
 		case snd_soc_dapm_dai_out:
-			for_each_rtd_cpu_dais(rtd, i, cpu_dai)
-				cpu_dai->capture_widget = w;
+			for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
+				/*
+				 * Please create DAI widget in the right order
+				 * to ensure BE will connect to the right DAI
+				 * widget.
+				 */
+				if (!cpu_dai->capture_widget) {
+					cpu_dai->capture_widget = w;
+					break;
+				}
+			}
+			if (i == rtd->num_cpus) {
+				dev_err(scomp->dev, "error: can't find BE for DAI %s\n",
+					w->name);
+
+				return -EINVAL;
+			}
 			dai->name = rtd->dai_link->name;
 			dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
 				w->name, rtd->dai_link->name);
 			break;
 		case snd_soc_dapm_dai_in:
-			for_each_rtd_cpu_dais(rtd, i, cpu_dai)
-				cpu_dai->playback_widget = w;
+			for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
+				/*
+				 * Please create DAI widget in the right order
+				 * to ensure BE will connect to the right DAI
+				 * widget.
+				 */
+				if (!cpu_dai->playback_widget) {
+					cpu_dai->playback_widget = w;
+					break;
+				}
+			}
+			if (i == rtd->num_cpus) {
+				dev_err(scomp->dev, "error: can't find BE for DAI %s\n",
+					w->name);
+
+				return -EINVAL;
+			}
 			dai->name = rtd->dai_link->name;
 			dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
 				w->name, rtd->dai_link->name);
-- 
2.20.1


  reply	other threads:[~2020-04-15 20:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 20:27 [PATCH 00/24] ASoC: SOF: topology and firmware IPC updates for 5.8 Pierre-Louis Bossart
2020-04-15 20:27 ` Pierre-Louis Bossart [this message]
2020-04-15 20:27 ` [PATCH 02/24] ASoC: SOF: Mark get_ext* function ext_hdr arguments as const Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 03/24] ASoC: SOF: Introduce offset in firmware data Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 04/24] ASoC: SOF: Introduce extended manifest Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 05/24] ASoC: SOF: ext_manifest: parse firmware version Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 06/24] ASoC: SOF: ext_manifest: parse windows Pierre-Louis Bossart
2020-04-15 20:27 ` [PATCH 07/24] ASoC: SOF: ext_manifest: parse compiler version Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 08/24] ASoC: SOF: topology: Add support for DC Blocker Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 09/24] ASoC: SOF: add probe support extend data Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 10/24] ASoC: SOF: add debug ABI version Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 11/24] ASoC: SOF: change type char to uint8_t in info.h Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 12/24] ASoC: SOF: change type char to uint8_t in trace.h Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 13/24] ASoC: SOF: change type char to uint8_t in topology.h Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 14/24] ASoC: SOF: make sof_ipc_cc_version to fixed length Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 15/24] ASoC: SOF: Add XRUN flags field to struct sof_ipc_buffer Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 16/24] ASoC: SOF: Intel: Fix typo in header file comment text Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 17/24] ASoC: SOF: Intel: Change DMIC load IPC to fixed length Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 18/24] ASoC: SOF: Intel: Rename deprecated DMIC IPC struct field Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 19/24] ASoC: SOF: align sof_ipc_dai_alh_params with FW Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 20/24] ASoC: SOF: topology: Get ALH rate amd channels from topology Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 21/24] ASoC: SOF: topology: fix: parse hda_tokens to &config->hda Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 22/24] ASoC: SOF: topology: Get HDA rate and channels from topology Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 23/24] ASoC: SOF: topology: stop parsing when all tokens have been found Pierre-Louis Bossart
2020-04-15 20:28 ` [PATCH 24/24] ASoC: SOF: topology: handle multiple sets of tuple arrays Pierre-Louis Bossart
2020-04-15 23:36 ` [PATCH 00/24] ASoC: SOF: topology and firmware IPC updates for 5.8 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200415202816.934-2-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=guennadi.liakhovetski@linux.intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.