diff options
author | Liam Girdwood <lrg@ti.com> | 2011-07-20 12:23:33 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-07-20 21:15:51 +0100 |
commit | 4805608ac1d1a60ca926ff81b1ebd3145f7adf78 (patch) | |
tree | 72b8e433b56231e31648759b85991926c68dc450 /sound | |
parent | d7c3e9525ac8e898f1156a1f3a7c5038f6560186 (diff) | |
download | kernel_goldelico_gta04-4805608ac1d1a60ca926ff81b1ebd3145f7adf78.zip kernel_goldelico_gta04-4805608ac1d1a60ca926ff81b1ebd3145f7adf78.tar.gz kernel_goldelico_gta04-4805608ac1d1a60ca926ff81b1ebd3145f7adf78.tar.bz2 |
ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | 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 fbfcda0..7e15914 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) |