From: Shreyas NC <shreyas.nc@intel.com>
To: alsa-devel@alsa-project.org
Cc: ckeepax@opensource.cirrus.com, patches.audio@intel.com,
liam.r.girdwood@linux.intel.com, Vinod Koul <vkoul@kernel.org>,
broonie@kernel.org, Shreyas NC <shreyas.nc@intel.com>
Subject: [PATCH v5 3/3] ASoC: Add multiple CPU DAI support in DAPM
Date: Tue, 22 May 2018 16:10:23 +0530 [thread overview]
Message-ID: <1526985623-2606-4-git-send-email-shreyas.nc@intel.com> (raw)
In-Reply-To: <1526985623-2606-1-git-send-email-shreyas.nc@intel.com>
DAPM handles DAIs during soc_dapm_stream_event() and during addition
and creation of DAI widgets i.e., dapm_add_valid_dai_widget() and
dapm_connect_dai_link_widgets().
Extend these functions to handle multiple cpu dai.
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
---
sound/soc/soc-dapm.c | 71 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 46 insertions(+), 25 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2d97091..79f5f61 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -4108,38 +4108,57 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
return 0;
}
-static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
- struct snd_soc_pcm_runtime *rtd)
+static void dapm_add_valid_dai_widget(struct snd_soc_card *card,
+ struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_dai *codec_dai,
+ struct snd_soc_dai *cpu_dai)
{
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dapm_widget *sink, *source;
- int i;
- for (i = 0; i < rtd->num_codecs; i++) {
- struct snd_soc_dai *codec_dai = rtd->codec_dais[i];
+ /* connect BE DAI playback if widgets are valid */
+ if (codec_dai->playback_widget && cpu_dai->playback_widget) {
+ source = cpu_dai->playback_widget;
+ sink = codec_dai->playback_widget;
+ dev_err(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
+ cpu_dai->component->name,
+ source->name,
+ codec_dai->component->name,
+ sink->name);
+
+ snd_soc_dapm_add_path(&card->dapm, source, sink,
+ NULL, NULL);
+ }
- /* connect BE DAI playback if widgets are valid */
- if (codec_dai->playback_widget && cpu_dai->playback_widget) {
- source = cpu_dai->playback_widget;
- sink = codec_dai->playback_widget;
- dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
- cpu_dai->component->name, source->name,
- codec_dai->component->name, sink->name);
+ /* connect BE DAI capture if widgets are valid */
+ if (codec_dai->capture_widget && cpu_dai->capture_widget) {
+ source = codec_dai->capture_widget;
+ sink = cpu_dai->capture_widget;
+ dev_err(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
+ codec_dai->component->name,
+ source->name,
+ cpu_dai->component->name,
+ sink->name);
- snd_soc_dapm_add_path(&card->dapm, source, sink,
+ snd_soc_dapm_add_path(&card->dapm, source, sink,
NULL, NULL);
- }
+ }
+
+}
- /* connect BE DAI capture if widgets are valid */
- if (codec_dai->capture_widget && cpu_dai->capture_widget) {
- source = codec_dai->capture_widget;
- sink = cpu_dai->capture_widget;
- dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
- codec_dai->component->name, source->name,
- cpu_dai->component->name, sink->name);
+static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
+ struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *cpu_dai;
+ int i, j;
- snd_soc_dapm_add_path(&card->dapm, source, sink,
- NULL, NULL);
+ for (i = 0; i < rtd->num_codecs; i++) {
+ struct snd_soc_dai *codec_dai = rtd->codec_dais[i];
+
+ for (j = 0; j < rtd->num_cpu_dai; j++) {
+ cpu_dai = rtd->cpu_dais[j];
+
+ dapm_add_valid_dai_widget(card, rtd,
+ codec_dai, cpu_dai);
}
}
}
@@ -4206,7 +4225,9 @@ static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
{
int i;
- soc_dapm_dai_stream_event(rtd->cpu_dai, stream, event);
+ for (i = 0; i < rtd->num_cpu_dai; i++)
+ soc_dapm_dai_stream_event(rtd->cpu_dais[i], stream, event);
+
for (i = 0; i < rtd->num_codecs; i++)
soc_dapm_dai_stream_event(rtd->codec_dais[i], stream, event);
--
2.7.4
next prev parent reply other threads:[~2018-05-22 10:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-22 10:40 [PATCH v5 0/3] ASoC: Add Multi CPU DAI support Shreyas NC
2018-05-22 10:40 ` [PATCH v5 1/3] ASoC: Add initial support for multiple CPU DAIs Shreyas NC
2018-05-23 21:38 ` Pierre-Louis Bossart
2018-05-24 5:34 ` Shreyas NC
2018-05-24 20:45 ` Pierre-Louis Bossart
2018-05-25 2:16 ` Shreyas NC
2018-05-22 10:40 ` [PATCH v5 2/3] ASoC: Add multiple CPU DAI support for PCM ops Shreyas NC
2018-05-23 9:22 ` Charles Keepax
2018-05-24 21:29 ` Pierre-Louis Bossart
2018-05-25 4:46 ` Shreyas NC
2018-05-22 10:40 ` Shreyas NC [this message]
2018-05-24 21:37 ` [PATCH v5 3/3] ASoC: Add multiple CPU DAI support in DAPM Pierre-Louis Bossart
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=1526985623-2606-4-git-send-email-shreyas.nc@intel.com \
--to=shreyas.nc@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=patches.audio@intel.com \
--cc=vkoul@kernel.org \
/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 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).