[alsa-devel] [PATCH 1/2] ASoC: utils: Add internal call to determine if DAI is dummy.
Provide a quick way to tell if a DAI is a dummy DAI or a regular DAI. This is for internal DAPM usage only and is used to determe whether to insert a DAI link connection into the DAPM graph.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- include/sound/soc-dai.h | 2 ++ sound/soc/soc-utils.c | 7 +++++++ 2 files changed, 9 insertions(+)
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 243d3b6..71f27c4 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -123,6 +123,8 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction);
+int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); + struct snd_soc_dai_ops { /* * DAI clocking configuration, all optional. diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 6ebdfd9..7f22ca3 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -119,6 +119,13 @@ static struct snd_soc_dai_driver dummy_dai = { }, };
+int snd_soc_dai_is_dummy(struct snd_soc_dai *dai) +{ + if (dai->driver == &dummy_dai) + return 1; + return 0; +} + static int snd_soc_dummy_probe(struct platform_device *pdev) { int ret;
Connect the DAPM graph through each BE DAI link to the componnent(s) on the other side of the BE DAI link. This allows the graph to be walked on both sides of the link when graph changes are made.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- include/sound/soc-dapm.h | 1 + sound/soc/soc-core.c | 1 + sound/soc/soc-dapm.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+)
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 2037c45..a5de124 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -411,6 +411,7 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, struct snd_soc_dai *dai); int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); +void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); int snd_soc_dapm_new_pcm(struct snd_soc_card *card, const struct snd_soc_pcm_stream *params, struct snd_soc_dapm_widget *source, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 03c779e..a391665 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1728,6 +1728,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) }
snd_soc_dapm_link_dai_widgets(card); + snd_soc_dapm_connect_dai_link_widgets(card);
if (card->controls) snd_soc_add_card_controls(card, card->controls, card->num_controls); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dcade13..9176e6d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3614,6 +3614,55 @@ 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) +{ + struct snd_soc_pcm_runtime *rtd = card->rtd; + struct snd_soc_dai *cpu_dai, *codec_dai; + struct snd_soc_dapm_route r; + int i; + + memset(&r, 0, sizeof(r)); + + /* 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; + + /* dynamic FE links have no fixed DAI mapping */ + if (rtd->dai_link->dynamic) + continue; + + /* there is no point in connecting BE DAI links with dummies */ + if (snd_soc_dai_is_dummy(codec_dai) || + snd_soc_dai_is_dummy(cpu_dai)) + continue; + + /* connect BE DAI playback if widgets are valid */ + if (codec_dai->playback_widget && cpu_dai->playback_widget) { + r.source = cpu_dai->playback_widget->name; + r.sink = codec_dai->playback_widget->name; + dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", + cpu_dai->codec->name, r.source, + codec_dai->platform->name, r.sink); + + snd_soc_dapm_add_route(&card->dapm, &r); + } + + /* connect BE DAI capture if widgets are valid */ + if (codec_dai->capture_widget && cpu_dai->capture_widget) { + r.source = codec_dai->capture_widget->name; + r.sink = cpu_dai->capture_widget->name; + dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", + codec_dai->codec->name, r.source, + cpu_dai->platform->name, r.sink); + + snd_soc_dapm_add_route(&card->dapm, &r); + } + + } +} + static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, int event) {
At Wed, 8 Jan 2014 10:40:18 +0000, Liam Girdwood wrote:
Provide a quick way to tell if a DAI is a dummy DAI or a regular DAI. This is for internal DAPM usage only and is used to determe whether to
determine?
insert a DAI link connection into the DAPM graph.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com
include/sound/soc-dai.h | 2 ++ sound/soc/soc-utils.c | 7 +++++++ 2 files changed, 9 insertions(+)
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 243d3b6..71f27c4 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -123,6 +123,8 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction);
+int snd_soc_dai_is_dummy(struct snd_soc_dai *dai);
Better to use bool.
struct snd_soc_dai_ops { /* * DAI clocking configuration, all optional. diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 6ebdfd9..7f22ca3 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -119,6 +119,13 @@ static struct snd_soc_dai_driver dummy_dai = { }, };
+int snd_soc_dai_is_dummy(struct snd_soc_dai *dai) +{
- if (dai->driver == &dummy_dai)
return 1;
- return 0;
+}
No need for EXPORT_SYMBOL since it's for internal use only, or just forgotten?
Takashi
static int snd_soc_dummy_probe(struct platform_device *pdev) { int ret; -- 1.8.3.2
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Wed, 2014-01-08 at 11:55 +0100, Takashi Iwai wrote:
At Wed, 8 Jan 2014 10:40:18 +0000, Liam Girdwood wrote:
struct snd_soc_dai_ops { /* * DAI clocking configuration, all optional. diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 6ebdfd9..7f22ca3 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -119,6 +119,13 @@ static struct snd_soc_dai_driver dummy_dai = { }, };
+int snd_soc_dai_is_dummy(struct snd_soc_dai *dai) +{
- if (dai->driver == &dummy_dai)
return 1;
- return 0;
+}
No need for EXPORT_SYMBOL since it's for internal use only, or just forgotten?
No need for the EXPORT_SYMBOL as the core soc-*.c files are linked into the same module and it's for internal use only.
Liam
On Wed, Jan 08, 2014 at 10:40:18AM +0000, Liam Girdwood wrote:
Provide a quick way to tell if a DAI is a dummy DAI or a regular DAI. This is for internal DAPM usage only and is used to determe whether to insert a DAI link connection into the DAPM graph.
Applied both, thanks (with the spelling fixed).
participants (3)
-
Liam Girdwood
-
Mark Brown
-
Takashi Iwai