aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wm9705.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 08:53:38 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 08:53:38 -0700
commit81d91acf8c093565f65383ae0349b9255fbb2d0d (patch)
tree4e72f779a88ab87b76afb3fb16adf053e7044071 /sound/soc/codecs/wm9705.c
parent132ea5e9aa9ce13f62ba45db8e43ec887d1106e9 (diff)
parent0dd7b0cbb2e426553f184f5aeba40a2203f33700 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (36 commits) ALSA: hda - Add VREF powerdown sequence for another board ALSA: oss - volume control for CSWITCH and CROUTE ALSA: hda - add missing comma in ad1884_slave_vols sound: usb-audio: allow period sizes less than 1 ms sound: usb-audio: save data packet interval in audioformat structure sound: usb-audio: remove check_hw_params_convention() sound: usb-audio: show sample format width in proc file ASoC: fsl_dma: Pass the proper device for dma mapping routines ASoC: Fix null dereference in ak4535_remove() ALSA: hda - enable SPDIF output for Intel DX58SO board ALSA: snd-atmel-abdac: increase periods_min to 6 instead of 4 ALSA: snd-atmel-abdac: replace bus_id with dev_name() ALSA: snd-atmel-ac97c: replace bus_id with dev_name() ALSA: snd-atmel-ac97c: cleanup registers when removing driver ALSA: snd-atmel-ac97c: do a proper reset of the external codec ALSA: snd-atmel-ac97c: enable interrupts to catch events for error reporting ALSA: snd-atmel-ac97c: set correct size for buffer hardware parameter ALSA: snd-atmel-ac97c: do not overwrite OCA and ICA when assigning channels ALSA: snd-atmel-ac97c: remove dead break statements after return in switch case ALSA: snd-atmel-ac97c: cleanup register definitions ...
Diffstat (limited to 'sound/soc/codecs/wm9705.c')
-rw-r--r--sound/soc/codecs/wm9705.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index 3265817c5c2..6e23a81dba7 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -317,6 +317,41 @@ static int wm9705_reset(struct snd_soc_codec *codec)
return -EIO;
}
+#ifdef CONFIG_PM
+static int wm9705_soc_suspend(struct platform_device *pdev)
+{
+ struct snd_soc_device *socdev = platform_get_drvdata(pdev);
+ struct snd_soc_codec *codec = socdev->card->codec;
+
+ soc_ac97_ops.write(codec->ac97, AC97_POWERDOWN, 0xffff);
+
+ return 0;
+}
+
+static int wm9705_soc_resume(struct platform_device *pdev)
+{
+ struct snd_soc_device *socdev = platform_get_drvdata(pdev);
+ struct snd_soc_codec *codec = socdev->card->codec;
+ int i, ret;
+ u16 *cache = codec->reg_cache;
+
+ ret = wm9705_reset(codec);
+ if (ret < 0) {
+ printk(KERN_ERR "could not reset AC97 codec\n");
+ return ret;
+ }
+
+ for (i = 2; i < ARRAY_SIZE(wm9705_reg) << 1; i += 2) {
+ soc_ac97_ops.write(codec->ac97, i, cache[i>>1]);
+ }
+
+ return 0;
+}
+#else
+#define wm9705_soc_suspend NULL
+#define wm9705_soc_resume NULL
+#endif
+
static int wm9705_soc_probe(struct platform_device *pdev)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
@@ -407,6 +442,8 @@ static int wm9705_soc_remove(struct platform_device *pdev)
struct snd_soc_codec_device soc_codec_dev_wm9705 = {
.probe = wm9705_soc_probe,
.remove = wm9705_soc_remove,
+ .suspend = wm9705_soc_suspend,
+ .resume = wm9705_soc_resume,
};
EXPORT_SYMBOL_GPL(soc_codec_dev_wm9705);