From d4c6005f8e90da10067c35e1182f533582d01a69 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 6 Jun 2011 19:13:23 +0100 Subject: [PATCH] ASoC: Add context parameter to card DAPM callbacks The card callback will get called for each DAPM context in the card so it can be useful for it to know which device is currently undergoing a transition. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/sound/soc.h | 2 ++ sound/soc/atmel/sam9g20_wm8731.c | 1 + sound/soc/omap/ams-delta.c | 3 ++- sound/soc/samsung/speyside.c | 4 ++++ sound/soc/soc-dapm.c | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 0f297006f5b2..f55efc1a63a2 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -726,8 +726,10 @@ struct snd_soc_card { /* callbacks */ int (*set_bias_level)(struct snd_soc_card *, + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); int (*set_bias_level_post)(struct snd_soc_card *, + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); long pmdown_time; diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index 95572d290c27..bad3aa14d5b3 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c @@ -92,6 +92,7 @@ static struct snd_soc_ops at91sam9g20ek_ops = { }; static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) { static int mclk_on; diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 462cbcbea74a..b40095a19883 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -427,7 +427,8 @@ static struct snd_soc_ops ams_delta_ops = { /* Board specific codec bias level control */ static int ams_delta_set_bias_level(struct snd_soc_card *card, - enum snd_soc_bias_level level) + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) { struct snd_soc_codec *codec = card->rtd->codec; diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index 93078b15a8f9..99fb0337ba5d 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c @@ -20,11 +20,15 @@ #define WM8915_HPSEL_GPIO 214 static int speyside_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) { struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; int ret; + if (dapm->dev != codec_dai->dev) + return 0; + switch (level) { case SND_SOC_BIAS_STANDBY: ret = snd_soc_dai_set_sysclk(codec_dai, WM8915_SYSCLK_MCLK2, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d989dd71e3ac..1682834f8c38 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -142,7 +142,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, trace_snd_soc_bias_level_start(card, level); if (card && card->set_bias_level) - ret = card->set_bias_level(card, level); + ret = card->set_bias_level(card, dapm, level); if (ret != 0) goto out; @@ -154,7 +154,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, goto out; if (card && card->set_bias_level_post) - ret = card->set_bias_level_post(card, level); + ret = card->set_bias_level_post(card, dapm, level); out: trace_snd_soc_bias_level_done(card, level); -- GitLab