aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8731.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-06-13 17:30:18 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-06-13 17:30:18 -0400
commitb3b50b3f31775be5d2e441618bbc1c5cbee4d9f1 (patch)
tree22171b96e3138fcea12f9845bc3f26358c7bfa6a /sound/soc/codecs/wm8731.c
parent831dc0f10f7b2a4856094ff160c018bf19f77527 (diff)
ASoC: Add suspend and resume callbacks to Wolfson CODEC drivers
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8731.c')
-rw-r--r--sound/soc/codecs/wm8731.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 7a205876ef4f..d7f4788f7ace 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -460,6 +460,7 @@ struct snd_soc_dai wm8731_dai = {
460}; 460};
461EXPORT_SYMBOL_GPL(wm8731_dai); 461EXPORT_SYMBOL_GPL(wm8731_dai);
462 462
463#ifdef CONFIG_PM
463static int wm8731_suspend(struct platform_device *pdev, pm_message_t state) 464static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)
464{ 465{
465 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 466 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
@@ -488,6 +489,10 @@ static int wm8731_resume(struct platform_device *pdev)
488 wm8731_set_bias_level(codec, codec->suspend_bias_level); 489 wm8731_set_bias_level(codec, codec->suspend_bias_level);
489 return 0; 490 return 0;
490} 491}
492#else
493#define wm8731_suspend NULL
494#define wm8731_resume NULL
495#endif
491 496
492static int wm8731_probe(struct platform_device *pdev) 497static int wm8731_probe(struct platform_device *pdev)
493{ 498{
@@ -680,6 +685,21 @@ static int __devexit wm8731_spi_remove(struct spi_device *spi)
680 return 0; 685 return 0;
681} 686}
682 687
688#ifdef CONFIG_PM
689static int wm8731_spi_suspend(struct spi_device *spi, pm_message_t msg)
690{
691 return snd_soc_suspend_device(&spi->dev);
692}
693
694static int wm8731_spi_resume(struct spi_device *spi)
695{
696 return snd_soc_resume_device(&spi->dev);
697}
698#else
699#define wm8731_spi_suspend NULL
700#define wm8731_spi_resume NULL
701#endif
702
683static struct spi_driver wm8731_spi_driver = { 703static struct spi_driver wm8731_spi_driver = {
684 .driver = { 704 .driver = {
685 .name = "wm8731", 705 .name = "wm8731",
@@ -687,6 +707,8 @@ static struct spi_driver wm8731_spi_driver = {
687 .owner = THIS_MODULE, 707 .owner = THIS_MODULE,
688 }, 708 },
689 .probe = wm8731_spi_probe, 709 .probe = wm8731_spi_probe,
710 .suspend = wm8731_spi_suspend,
711 .resume = wm8731_spi_resume,
690 .remove = __devexit_p(wm8731_spi_remove), 712 .remove = __devexit_p(wm8731_spi_remove),
691}; 713};
692#endif /* CONFIG_SPI_MASTER */ 714#endif /* CONFIG_SPI_MASTER */
@@ -720,6 +742,21 @@ static __devexit int wm8731_i2c_remove(struct i2c_client *client)
720 return 0; 742 return 0;
721} 743}
722 744
745#ifdef CONFIG_PM
746static int wm8731_i2c_suspend(struct i2c_client *i2c, pm_message_t msg)
747{
748 return snd_soc_suspend_device(&i2c->dev);
749}
750
751static int wm8731_i2c_resume(struct i2c_client *i2c)
752{
753 return snd_soc_resume_device(&i2c->dev);
754}
755#else
756#define wm8731_i2c_suspend NULL
757#define wm8731_i2c_resume NULL
758#endif
759
723static const struct i2c_device_id wm8731_i2c_id[] = { 760static const struct i2c_device_id wm8731_i2c_id[] = {
724 { "wm8731", 0 }, 761 { "wm8731", 0 },
725 { } 762 { }
@@ -733,6 +770,8 @@ static struct i2c_driver wm8731_i2c_driver = {
733 }, 770 },
734 .probe = wm8731_i2c_probe, 771 .probe = wm8731_i2c_probe,
735 .remove = __devexit_p(wm8731_i2c_remove), 772 .remove = __devexit_p(wm8731_i2c_remove),
773 .suspend = wm8731_i2c_suspend,
774 .resume = wm8731_i2c_resume,
736 .id_table = wm8731_i2c_id, 775 .id_table = wm8731_i2c_id,
737}; 776};
738#endif 777#endif