From: Shreyas NC <shreyas.nc@intel.com>
To: alsa-devel@alsa-project.org
Cc: lars@metafoo.de, ckeepax@opensource.cirrus.com,
kuninori.morimoto.gx@renesas.com, patches.audio@intel.com,
liam.r.girdwood@linux.intel.com, broonie@kernel.org,
Shreyas NC <shreyas.nc@intel.com>
Subject: [PATCH v2 3/3] ASoC: Add Multi CPU DAI support in DAPM
Date: Tue, 27 Mar 2018 16:03:31 +0530 [thread overview]
Message-ID: <1522146811-29951-4-git-send-email-shreyas.nc@intel.com> (raw)
In-Reply-To: <1522146811-29951-1-git-send-email-shreyas.nc@intel.com>
Extend the multi CPU support in DAPM functions to check for
valid widgets and connected widgets.
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
prev parent reply other threads:[~2018-03-27 10:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 10:33 [PATCH v2 0/3] ASoC: Add Multi CPU DAI support Shreyas NC
2018-03-27 10:33 ` [PATCH v2 1/3] ASoC: Add initial support for multiple CPU DAIs Shreyas NC
2018-03-27 10:33 ` [PATCH v2 2/3] ASoC: Add Multi CPU DAI support for PCM ops Shreyas NC
2018-03-27 10:33 ` Shreyas NC [this message]
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=1522146811-29951-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=kuninori.morimoto.gx@renesas.com \
--cc=lars@metafoo.de \
--cc=liam.r.girdwood@linux.intel.com \
--cc=patches.audio@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 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).