From: Liam Girdwood <lrg@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lrg@ti.com>
Subject: [PATCH 5/5] ASoC: dpcm: Add API for DAI link substream and runtime lookup
Date: Wed, 25 Apr 2012 12:12:53 +0100 [thread overview]
Message-ID: <1335352373-5237-5-git-send-email-lrg@ti.com> (raw)
In-Reply-To: <1335352373-5237-1-git-send-email-lrg@ti.com>
Some component drivers will need to be able to look up their
DAI link substream and RTD data. Provide a mechanism for this.
Signed-off-by: Liam Girdwood <lrg@ti.com>
---
include/sound/soc.h | 5 +++++
sound/soc/soc-core.c | 29 +++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a7f62d5..c573a87 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -349,6 +349,11 @@ int snd_soc_platform_write(struct snd_soc_platform *platform,
unsigned int reg, unsigned int val);
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
+struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
+ const char *dai_link, int stream);
+struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
+ const char *dai_link);
+
/* Utility functions to get clock rates from various things */
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a25ba6f..511e70b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -465,6 +465,35 @@ static inline void soc_cleanup_card_debugfs(struct snd_soc_card *card)
}
#endif
+struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
+ const char *dai_link, int stream)
+{
+ int i;
+
+ for (i = 0; i < card->num_links; i++) {
+ if (card->rtd[i].dai_link->no_pcm &&
+ !strcmp(card->rtd[i].dai_link->name, dai_link))
+ return card->rtd[i].pcm->streams[stream].substream;
+ }
+ dev_dbg(card->dev, "failed to find dai link %s\n", dai_link);
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_get_dai_substream);
+
+struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
+ const char *dai_link)
+{
+ int i;
+
+ for (i = 0; i < card->num_links; i++) {
+ if (!strcmp(card->rtd[i].dai_link->name, dai_link))
+ return &card->rtd[i];
+ }
+ dev_dbg(card->dev, "failed to find rtd %s\n", dai_link);
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_get_pcm_runtime);
+
#ifdef CONFIG_SND_SOC_AC97_BUS
/* unregister ac97 codec */
static int soc_ac97_dev_unregister(struct snd_soc_codec *codec)
--
1.7.5.4
next prev parent reply other threads:[~2012-04-25 11:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 11:12 [PATCH 1/5] ASoC: dpcm: Add Dynamic PCM core operations Liam Girdwood
2012-04-25 11:12 ` [PATCH 2/5] ASoC: dpcm: Add debugFS support for DPCM Liam Girdwood
2012-04-26 16:44 ` Mark Brown
2012-04-26 16:57 ` Liam Girdwood
2012-04-25 11:12 ` [PATCH 3/5] ASoC: dpcm: Add runtime dynamic route update Liam Girdwood
2012-04-25 11:12 ` [PATCH 4/5] ASoC: dpcm: Add bespoke trigger() Liam Girdwood
2012-04-25 11:12 ` Liam Girdwood [this message]
2012-04-26 16:54 ` [PATCH 1/5] ASoC: dpcm: Add Dynamic PCM core operations Mark Brown
2012-04-26 17:04 ` Liam Girdwood
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=1335352373-5237-5-git-send-email-lrg@ti.com \
--to=lrg@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.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.