ASoC: Add context parameter to card DAPM callbacks
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 6 Jun 2011 18:13:23 +0000 (19:13 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 6 Jun 2011 20:46:45 +0000 (21:46 +0100)
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 <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
include/sound/soc.h
sound/soc/atmel/sam9g20_wm8731.c
sound/soc/omap/ams-delta.c
sound/soc/samsung/speyside.c
sound/soc/soc-dapm.c

index 0f297006f5b250a34b6d34b9858d5c3fc5021c58..f55efc1a63a28def83e14bd64a4165169d090d21 100644 (file)
@@ -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;
index 95572d290c2740a1aa146d053327028ca598d371..bad3aa14d5b39cad30bfc877b51dfd0deaf45bf9 100644 (file)
@@ -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;
index 462cbcbea74a2dc4e5094cef04e09f942a3e235c..b40095a198835dd9f2dc38a28ea40a49b4d84949 100644 (file)
@@ -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;
 
index 93078b15a8f9d6b54a29a9ec3deedb91d68102a2..99fb0337ba5de1e15e167e6ffd26055f63847220 100644 (file)
 #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,
index d989dd71e3ac77e5d32b9eb1f8e1fa57f0695c48..1682834f8c380217453f4da62b6b0a98b00d4c3a 100644 (file)
@@ -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);