Skip to content

Commit

Permalink
ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Liam Girdwood authored and Mark Brown committed Jul 20, 2011
1 parent d7c3e95 commit 4805608
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4805608

Please sign in to comment.