All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.
@ 2011-07-20 11:23 Liam Girdwood
  2011-07-20 20:16 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Girdwood @ 2011-07-20 11:23 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

In preparation for ASoC Dynamic PCM (AKA DSP) support.

Provide convenience methods to retrieve the soc_card or snd_card from a DAPM context.

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 sound/soc/soc-dapm.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 4205a97..aaef0ef 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -124,6 +124,36 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
 	return kmemdup(_widget, sizeof(*_widget), GFP_KERNEL);
 }
 
+/* get snd_card from DAPM context */
+static inline struct snd_card *dapm_get_snd_card(
+	struct snd_soc_dapm_context *dapm)
+{
+	if (dapm->codec)
+		return dapm->codec->card->snd_card;
+	else if (dapm->platform)
+		return dapm->platform->card->snd_card;
+	else
+		BUG();
+
+	/* unreachable */
+	return NULL;
+}
+
+/* get soc_card from DAPM context */
+static inline struct snd_soc_card *dapm_get_soc_card(
+		struct snd_soc_dapm_context *dapm)
+{
+	if (dapm->codec)
+		return dapm->codec->card;
+	else if (dapm->platform)
+		return dapm->platform->card;
+	else
+		BUG();
+
+	/* unreachable */
+	return NULL;
+}
+
 static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
 {
 	if (w->codec)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.
  2011-07-20 11:23 [PATCH] ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context Liam Girdwood
@ 2011-07-20 20:16 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-07-20 20:16 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel

On Wed, Jul 20, 2011 at 12:23:33PM +0100, Liam Girdwood wrote:
> In preparation for ASoC Dynamic PCM (AKA DSP) support.
> 
> Provide convenience methods to retrieve the soc_card or snd_card from a DAPM context.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-20 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20 11:23 [PATCH] ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context Liam Girdwood
2011-07-20 20:16 ` Mark Brown

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.