aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-06-22 08:16:51 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-06-23 18:48:53 -0400
commit517374704da44c1ba77c1600714fe214524af286 (patch)
tree878a914bb5bd383e5f883bffc2e5cbf884366a6e /sound/soc/soc-dapm.c
parent30808ca751c3b8d81e948efb8fed7451a8321010 (diff)
ASoC: Add a shutdown callback
Ensure that the audio subsystem is powered down cleanly when the system shuts down by providing a shutdown operation. This ensures that all the components have been returned to an off state cleanly which should avoid audio issues from partially charged capacitors or noise on digital inputs if the system is restarted quickly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Tested-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 653435930ad8..b9129efeedf3 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2032,6 +2032,35 @@ void snd_soc_dapm_free(struct snd_soc_device *socdev)
2032} 2032}
2033EXPORT_SYMBOL_GPL(snd_soc_dapm_free); 2033EXPORT_SYMBOL_GPL(snd_soc_dapm_free);
2034 2034
2035/*
2036 * snd_soc_dapm_shutdown - callback for system shutdown
2037 */
2038void snd_soc_dapm_shutdown(struct snd_soc_device *socdev)
2039{
2040 struct snd_soc_codec *codec = socdev->card->codec;
2041 struct snd_soc_dapm_widget *w;
2042 LIST_HEAD(down_list);
2043 int powerdown = 0;
2044
2045 list_for_each_entry(w, &codec->dapm_widgets, list) {
2046 if (w->power) {
2047 dapm_seq_insert(w, &down_list, dapm_down_seq);
2048 powerdown = 1;
2049 }
2050 }
2051
2052 /* If there were no widgets to power down we're already in
2053 * standby.
2054 */
2055 if (powerdown) {
2056 snd_soc_dapm_set_bias_level(socdev, SND_SOC_BIAS_PREPARE);
2057 dapm_seq_run(codec, &down_list, 0, dapm_down_seq);
2058 snd_soc_dapm_set_bias_level(socdev, SND_SOC_BIAS_STANDBY);
2059 }
2060
2061 snd_soc_dapm_set_bias_level(socdev, SND_SOC_BIAS_OFF);
2062}
2063
2035/* Module information */ 2064/* Module information */
2036MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk"); 2065MODULE_AUTHOR("Liam Girdwood, lrg@slimlogic.co.uk");
2037MODULE_DESCRIPTION("Dynamic Audio Power Management core for ALSA SoC"); 2066MODULE_DESCRIPTION("Dynamic Audio Power Management core for ALSA SoC");