]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - sound/soc/soc-dapm.c
ASoC: Support leaving paths enabled over system suspend
[net-next-2.6.git] / sound / soc / soc-dapm.c
index 8c8b291320a87839801effbbe7a5a09c9cf03a6c..fefb6c44fc81dd398496e6c50d3f57b90376d2b9 100644 (file)
@@ -441,7 +441,9 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
        switch (snd_power_get_state(codec->card)) {
        case SNDRV_CTL_POWER_D3hot:
        case SNDRV_CTL_POWER_D3cold:
-               return 0;
+               if (widget->ignore_suspend)
+                       pr_debug("%s ignoring suspend\n", widget->name);
+               return widget->ignore_suspend;
        default:
                return 1;
        }
@@ -2136,6 +2138,33 @@ int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin)
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_get_pin_status);
 
+/**
+ * snd_soc_dapm_ignore_suspend - ignore suspend status for DAPM endpoint
+ * @codec: audio codec
+ * @pin: audio signal pin endpoint (or start point)
+ *
+ * Mark the given endpoint or pin as ignoring suspend.  When the
+ * system is disabled a path between two endpoints flagged as ignoring
+ * suspend will not be disabled.  The path must already be enabled via
+ * normal means at suspend time, it will not be turned on if it was not
+ * already enabled.
+ */
+int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin)
+{
+       struct snd_soc_dapm_widget *w;
+
+       list_for_each_entry(w, &codec->dapm_widgets, list) {
+               if (!strcmp(w->name, pin)) {
+                       w->ignore_suspend = 1;
+                       return 0;
+               }
+       }
+
+       pr_err("Unknown DAPM pin: %s\n", pin);
+       return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
+
 /**
  * snd_soc_dapm_free - free dapm resources
  * @socdev: SoC device