ASoC: Fix handling of bias levels for non-DAPM codecs
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 17 Aug 2009 10:55:38 +0000 (11:55 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 17 Aug 2009 11:57:59 +0000 (12:57 +0100)
If the system doesn't have any DAPM widgets then we can't use their
state to check if the bias level for the codec should be up.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-dapm.c

index c68c204a48ad9e5c57f2294d2bd2163a5cbb2a7c..8997fb34dddd96223a1bb4555fb3dacda1db09ff 100644 (file)
@@ -966,6 +966,22 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
                }
        }
 
+       /* If there are no DAPM widgets then try to figure out power from the
+        * event type.
+        */
+       if (list_empty(&codec->dapm_widgets)) {
+               switch (event) {
+               case SND_SOC_DAPM_STREAM_START:
+               case SND_SOC_DAPM_STREAM_RESUME:
+                       sys_power = 1;
+                       break;
+               case SND_SOC_DAPM_STREAM_NOP:
+                       sys_power = codec->bias_level != SND_SOC_BIAS_STANDBY;
+               default:
+                       break;
+               }
+       }
+
        /* If we're changing to all on or all off then prepare */
        if ((sys_power && codec->bias_level == SND_SOC_BIAS_STANDBY) ||
            (!sys_power && codec->bias_level == SND_SOC_BIAS_ON)) {