summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2011-07-24 20:59:38 +0100
committerAndy Green <andy.green@linaro.org>2011-08-25 07:37:54 +0100
commit0ee5266fad22107531ba987600bdabb44a4de5e5 (patch)
treef8a6858bd09a9a2bd6a3b65b84917499aa9f1551 /sound
parent65a6570fb2c33f871d0395ee2401963170d8acb3 (diff)
Subject: [PATCH 055/104] ASoC: dapm - add methods to get snd and soc card from dapm
In preparation for dynamic PCM support (AKA ASoC DSP) Add methods to get the soc_card and snd_card from a dapm context. Signed-off-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-dapm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b8673ebee04..bcb31656daa 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -124,6 +124,31 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
return kmemdup(_widget, sizeof(*_widget), GFP_KERNEL);
}
+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;
+
+ dev_err(dapm->dev, "no snd_card for dapm context\n");
+ return NULL;
+}
+
+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;
+
+ dev_err(dapm->dev, "no soc_card for dapm context\n");
+ return NULL;
+}
+
+
static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
{
if (w->codec)