[alsa-devel] ASoC: AC97 codec PM

Manuel Lauss mano at roarinelk.homelinux.net
Thu Jul 3 09:33:10 CEST 2008


Hi Liam,

This simple patch adds suspend/resume support to the ASoC AC97 codec.
Tested on Au1200, works fine for me(TM).

Thanks!
	Manuel Lauss

---
From: Manuel Lauss <mano at roarinelk.homelinux.net>

Simple suspend/resume for AC97 ASoC codec.

Signed-off-by: Manuel Lauss <mano at roarinelk.homelinux.net>
---
 sound/soc/codecs/ac97.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 2a1ffe3..fb9ac9f 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -146,9 +146,34 @@ static int ac97_soc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int ac97_soc_suspend(struct platform_device *pdev, pm_message_t msg)
+{
+	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
+
+	snd_ac97_suspend(socdev->codec->ac97);
+
+	return 0;
+}
+
+static int ac97_soc_resume(struct platform_device *pdev)
+{
+	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
+
+	snd_ac97_resume(socdev->codec->ac97);
+
+	return 0;
+}
+#else
+#define ac97_soc_suspend NULL
+#define ac97_soc_resume NULL
+#endif
+
 struct snd_soc_codec_device soc_codec_dev_ac97 = {
 	.probe = 	ac97_soc_probe,
 	.remove = 	ac97_soc_remove,
+	.suspend =	ac97_soc_suspend,
+	.resume =	ac97_soc_resume,
 };
 EXPORT_SYMBOL_GPL(soc_codec_dev_ac97);
 
-- 
1.5.6.1



More information about the Alsa-devel mailing list