From: Benoit Cousson <bcousson@baylibre.com>
To: broonie@kernel.org, lgirdwood@gmail.com, lars@metafoo.de
Cc: Fabien Parent <fparent@baylibre.com>,
misael.lopez@ti.com, alsa-devel@alsa-project.org,
Benoit Cousson <bcousson@baylibre.com>
Subject: [PATCH v5 3/5] ASoC: dapm: Add support for DAI multicodec
Date: Fri, 4 Jul 2014 18:07:53 +0200 [thread overview]
Message-ID: <1404490075-24997-4-git-send-email-bcousson@baylibre.com> (raw)
In-Reply-To: <1404490075-24997-1-git-send-email-bcousson@baylibre.com>
Add multicodec support in soc-dapm.c
Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/soc-dapm.c | 67 ++++++++++++++++++++++++++++++++++++----------------
1 file changed, 47 insertions(+), 20 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 4bf08cf..5c63c3b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2084,12 +2084,8 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power);
-/* show dapm widget status in sys fs */
-static ssize_t dapm_widget_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t dapm_widget_show_codec(struct snd_soc_codec *codec, char *buf)
{
- struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
- struct snd_soc_codec *codec =rtd->codec;
struct snd_soc_dapm_widget *w;
int count = 0;
char *state = "not set";
@@ -2142,6 +2138,21 @@ static ssize_t dapm_widget_show(struct device *dev,
return count;
}
+/* show dapm widget status in sys fs */
+static ssize_t dapm_widget_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
+ int i, count = 0;
+
+ for (i = 0; i < rtd->num_codecs; i++) {
+ struct snd_soc_codec *codec = rtd->codec_dais[i]->codec;
+ count += dapm_widget_show_codec(codec, buf + count);
+ }
+
+ return count;
+}
+
static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL);
int snd_soc_dapm_sys_add(struct device *dev)
@@ -3395,25 +3406,18 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
return 0;
}
-void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
+static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
+ struct snd_soc_pcm_runtime *rtd)
{
- struct snd_soc_pcm_runtime *rtd = card->rtd;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dapm_widget *sink, *source;
- struct snd_soc_dai *cpu_dai, *codec_dai;
+ struct snd_soc_dapm_route r;
int i;
- /* for each BE DAI link... */
- for (i = 0; i < card->num_rtd; i++) {
- rtd = &card->rtd[i];
- cpu_dai = rtd->cpu_dai;
- codec_dai = rtd->codec_dai;
+ memset(&r, 0, sizeof(r));
- /*
- * dynamic FE links have no fixed DAI mapping.
- * CODEC<->CODEC links have no direct connection.
- */
- if (rtd->dai_link->dynamic || rtd->dai_link->params)
- continue;
+ for (i = 0; i < rtd->num_codecs; i++) {
+ struct snd_soc_dai *codec_dai = rtd->codec_dais[i];
/* there is no point in connecting BE DAI links with dummies */
if (snd_soc_dai_is_dummy(codec_dai) ||
@@ -3475,11 +3479,34 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
}
}
+void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
+{
+ struct snd_soc_pcm_runtime *rtd = card->rtd;
+ int i;
+
+ /* for each BE DAI link... */
+ for (i = 0; i < card->num_rtd; i++) {
+ rtd = &card->rtd[i];
+
+ /*
+ * dynamic FE links have no fixed DAI mapping.
+ * CODEC<->CODEC links have no direct connection.
+ */
+ if (rtd->dai_link->dynamic || rtd->dai_link->params)
+ continue;
+
+ dapm_connect_dai_link_widgets(card, rtd);
+ }
+}
+
static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
int event)
{
+ int i;
+
soc_dapm_dai_stream_event(rtd->cpu_dai, stream, event);
- soc_dapm_dai_stream_event(rtd->codec_dai, stream, event);
+ for (i = 0; i < rtd->num_codecs; i++)
+ soc_dapm_dai_stream_event(rtd->codec_dais[i], stream, event);
dapm_power_widgets(rtd->card, event);
}
--
1.9.1
next prev parent reply other threads:[~2014-07-04 16:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 16:07 [PATCH v5 0/5] ASoC: core: Add support for DAI multicodec Benoit Cousson
2014-07-04 16:07 ` [PATCH v5 1/5] ASoC: core: Add initial " Benoit Cousson
2014-07-04 16:07 ` [PATCH v5 2/5] ASoC: pcm: Add " Benoit Cousson
2014-07-06 14:18 ` Lars-Peter Clausen
2014-07-06 20:23 ` Benoit Cousson
2014-07-04 16:07 ` Benoit Cousson [this message]
2014-07-04 16:07 ` [PATCH v5 4/5] ASoC: compress: Prevent multicodec for compressed stream Benoit Cousson
2014-07-07 8:50 ` Vinod Koul
2014-07-04 16:07 ` [PATCH v5 5/5] ASoC: pcm: Add soc_dai_hw_params helper Benoit Cousson
2014-07-06 14:16 ` [PATCH v5 0/5] ASoC: core: Add support for DAI multicodec Lars-Peter Clausen
2014-07-06 14:20 ` Lars-Peter Clausen
2014-07-06 20:49 ` Benoit Cousson
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=1404490075-24997-4-git-send-email-bcousson@baylibre.com \
--to=bcousson@baylibre.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=fparent@baylibre.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=misael.lopez@ti.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