Commit b3b50b3f31775be5d2e441618bbc1c5cbee4d9f1
1 parent
831dc0f10f
Exists in
master
and in
4 other branches
ASoC: Add suspend and resume callbacks to Wolfson CODEC drivers
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Showing 11 changed files with 244 additions and 0 deletions Side-by-side Diff
sound/soc/codecs/wm8350.c
... | ... | @@ -1671,6 +1671,21 @@ |
1671 | 1671 | return 0; |
1672 | 1672 | } |
1673 | 1673 | |
1674 | +#ifdef CONFIG_PM | |
1675 | +static int wm8350_codec_suspend(struct platform_device *pdev, pm_message_t m) | |
1676 | +{ | |
1677 | + return snd_soc_suspend_device(&pdev->dev); | |
1678 | +} | |
1679 | + | |
1680 | +static int wm8350_codec_resume(struct platform_device *pdev) | |
1681 | +{ | |
1682 | + return snd_soc_resume_device(&pdev->dev); | |
1683 | +} | |
1684 | +#else | |
1685 | +#define wm8350_codec_suspend NULL | |
1686 | +#define wm8350_codec_resume NULL | |
1687 | +#endif | |
1688 | + | |
1674 | 1689 | static struct platform_driver wm8350_codec_driver = { |
1675 | 1690 | .driver = { |
1676 | 1691 | .name = "wm8350-codec", |
... | ... | @@ -1678,6 +1693,8 @@ |
1678 | 1693 | }, |
1679 | 1694 | .probe = wm8350_codec_probe, |
1680 | 1695 | .remove = __devexit_p(wm8350_codec_remove), |
1696 | + .suspend = wm8350_codec_suspend, | |
1697 | + .resume = wm8350_codec_resume, | |
1681 | 1698 | }; |
1682 | 1699 | |
1683 | 1700 | static __init int wm8350_init(void) |
sound/soc/codecs/wm8400.c
... | ... | @@ -1553,6 +1553,21 @@ |
1553 | 1553 | return 0; |
1554 | 1554 | } |
1555 | 1555 | |
1556 | +#ifdef CONFIG_PM | |
1557 | +static int wm8400_pdev_suspend(struct platform_device *pdev, pm_message_t msg) | |
1558 | +{ | |
1559 | + return snd_soc_suspend_device(&pdev->dev); | |
1560 | +} | |
1561 | + | |
1562 | +static int wm8400_pdev_resume(struct platform_device *pdev) | |
1563 | +{ | |
1564 | + return snd_soc_resume_device(&pdev->dev); | |
1565 | +} | |
1566 | +#else | |
1567 | +#define wm8400_pdev_suspend NULL | |
1568 | +#define wm8400_pdev_resume NULL | |
1569 | +#endif | |
1570 | + | |
1556 | 1571 | static struct platform_driver wm8400_codec_driver = { |
1557 | 1572 | .driver = { |
1558 | 1573 | .name = "wm8400-codec", |
... | ... | @@ -1560,6 +1575,8 @@ |
1560 | 1575 | }, |
1561 | 1576 | .probe = wm8400_codec_probe, |
1562 | 1577 | .remove = __exit_p(wm8400_codec_remove), |
1578 | + .suspend = wm8400_pdev_suspend, | |
1579 | + .resume = wm8400_pdev_resume, | |
1563 | 1580 | }; |
1564 | 1581 | |
1565 | 1582 | static int __init wm8400_codec_init(void) |
sound/soc/codecs/wm8580.c
... | ... | @@ -995,6 +995,21 @@ |
995 | 995 | return 0; |
996 | 996 | } |
997 | 997 | |
998 | +#ifdef CONFIG_PM | |
999 | +static int wm8580_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
1000 | +{ | |
1001 | + return snd_soc_suspend_device(&client->dev); | |
1002 | +} | |
1003 | + | |
1004 | +static int wm8580_i2c_resume(struct i2c_client *client) | |
1005 | +{ | |
1006 | + return snd_soc_resume_device(&client->dev); | |
1007 | +} | |
1008 | +#else | |
1009 | +#define wm8580_i2c_suspend NULL | |
1010 | +#define wm8580_i2c_resume NULL | |
1011 | +#endif | |
1012 | + | |
998 | 1013 | static const struct i2c_device_id wm8580_i2c_id[] = { |
999 | 1014 | { "wm8580", 0 }, |
1000 | 1015 | { } |
... | ... | @@ -1008,6 +1023,8 @@ |
1008 | 1023 | }, |
1009 | 1024 | .probe = wm8580_i2c_probe, |
1010 | 1025 | .remove = wm8580_i2c_remove, |
1026 | + .suspend = wm8580_i2c_suspend, | |
1027 | + .resume = wm8580_i2c_resume, | |
1011 | 1028 | .id_table = wm8580_i2c_id, |
1012 | 1029 | }; |
1013 | 1030 | #endif |
sound/soc/codecs/wm8731.c
... | ... | @@ -460,6 +460,7 @@ |
460 | 460 | }; |
461 | 461 | EXPORT_SYMBOL_GPL(wm8731_dai); |
462 | 462 | |
463 | +#ifdef CONFIG_PM | |
463 | 464 | static int wm8731_suspend(struct platform_device *pdev, pm_message_t state) |
464 | 465 | { |
465 | 466 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
... | ... | @@ -488,6 +489,10 @@ |
488 | 489 | wm8731_set_bias_level(codec, codec->suspend_bias_level); |
489 | 490 | return 0; |
490 | 491 | } |
492 | +#else | |
493 | +#define wm8731_suspend NULL | |
494 | +#define wm8731_resume NULL | |
495 | +#endif | |
491 | 496 | |
492 | 497 | static int wm8731_probe(struct platform_device *pdev) |
493 | 498 | { |
... | ... | @@ -680,6 +685,21 @@ |
680 | 685 | return 0; |
681 | 686 | } |
682 | 687 | |
688 | +#ifdef CONFIG_PM | |
689 | +static int wm8731_spi_suspend(struct spi_device *spi, pm_message_t msg) | |
690 | +{ | |
691 | + return snd_soc_suspend_device(&spi->dev); | |
692 | +} | |
693 | + | |
694 | +static 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 | + | |
683 | 703 | static struct spi_driver wm8731_spi_driver = { |
684 | 704 | .driver = { |
685 | 705 | .name = "wm8731", |
... | ... | @@ -687,6 +707,8 @@ |
687 | 707 | .owner = THIS_MODULE, |
688 | 708 | }, |
689 | 709 | .probe = wm8731_spi_probe, |
710 | + .suspend = wm8731_spi_suspend, | |
711 | + .resume = wm8731_spi_resume, | |
690 | 712 | .remove = __devexit_p(wm8731_spi_remove), |
691 | 713 | }; |
692 | 714 | #endif /* CONFIG_SPI_MASTER */ |
... | ... | @@ -720,6 +742,21 @@ |
720 | 742 | return 0; |
721 | 743 | } |
722 | 744 | |
745 | +#ifdef CONFIG_PM | |
746 | +static int wm8731_i2c_suspend(struct i2c_client *i2c, pm_message_t msg) | |
747 | +{ | |
748 | + return snd_soc_suspend_device(&i2c->dev); | |
749 | +} | |
750 | + | |
751 | +static 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 | + | |
723 | 760 | static const struct i2c_device_id wm8731_i2c_id[] = { |
724 | 761 | { "wm8731", 0 }, |
725 | 762 | { } |
... | ... | @@ -733,6 +770,8 @@ |
733 | 770 | }, |
734 | 771 | .probe = wm8731_i2c_probe, |
735 | 772 | .remove = __devexit_p(wm8731_i2c_remove), |
773 | + .suspend = wm8731_i2c_suspend, | |
774 | + .resume = wm8731_i2c_resume, | |
736 | 775 | .id_table = wm8731_i2c_id, |
737 | 776 | }; |
738 | 777 | #endif |
sound/soc/codecs/wm8753.c
... | ... | @@ -1766,6 +1766,21 @@ |
1766 | 1766 | return 0; |
1767 | 1767 | } |
1768 | 1768 | |
1769 | +#ifdef CONFIG_PM | |
1770 | +static int wm8753_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
1771 | +{ | |
1772 | + return snd_soc_suspend_device(&client->dev); | |
1773 | +} | |
1774 | + | |
1775 | +static int wm8753_i2c_resume(struct i2c_client *client) | |
1776 | +{ | |
1777 | + return snd_soc_resume_device(&client->dev); | |
1778 | +} | |
1779 | +#else | |
1780 | +#define wm8753_i2c_suspend NULL | |
1781 | +#define wm8753_i2c_resume NULL | |
1782 | +#endif | |
1783 | + | |
1769 | 1784 | static const struct i2c_device_id wm8753_i2c_id[] = { |
1770 | 1785 | { "wm8753", 0 }, |
1771 | 1786 | { } |
... | ... | @@ -1779,6 +1794,8 @@ |
1779 | 1794 | }, |
1780 | 1795 | .probe = wm8753_i2c_probe, |
1781 | 1796 | .remove = wm8753_i2c_remove, |
1797 | + .suspend = wm8753_i2c_suspend, | |
1798 | + .resume = wm8753_i2c_resume, | |
1782 | 1799 | .id_table = wm8753_i2c_id, |
1783 | 1800 | }; |
1784 | 1801 | #endif |
... | ... | @@ -1834,6 +1851,22 @@ |
1834 | 1851 | return 0; |
1835 | 1852 | } |
1836 | 1853 | |
1854 | +#ifdef CONFIG_PM | |
1855 | +static int wm8753_spi_suspend(struct spi_device *spi, pm_message_t msg) | |
1856 | +{ | |
1857 | + return snd_soc_suspend_device(&spi->dev); | |
1858 | +} | |
1859 | + | |
1860 | +static int wm8753_spi_resume(struct spi_device *spi) | |
1861 | +{ | |
1862 | + return snd_soc_resume_device(&spi->dev); | |
1863 | +} | |
1864 | + | |
1865 | +#else | |
1866 | +#define wm8753_spi_suspend NULL | |
1867 | +#define wm8753_spi_resume NULL | |
1868 | +#endif | |
1869 | + | |
1837 | 1870 | static struct spi_driver wm8753_spi_driver = { |
1838 | 1871 | .driver = { |
1839 | 1872 | .name = "wm8753", |
... | ... | @@ -1842,6 +1875,8 @@ |
1842 | 1875 | }, |
1843 | 1876 | .probe = wm8753_spi_probe, |
1844 | 1877 | .remove = __devexit_p(wm8753_spi_remove), |
1878 | + .suspend = wm8753_spi_suspend, | |
1879 | + .resume = wm8753_spi_resume, | |
1845 | 1880 | }; |
1846 | 1881 | #endif |
1847 | 1882 |
sound/soc/codecs/wm8900.c
... | ... | @@ -1399,6 +1399,21 @@ |
1399 | 1399 | return 0; |
1400 | 1400 | } |
1401 | 1401 | |
1402 | +#ifdef CONFIG_PM | |
1403 | +static int wm8900_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
1404 | +{ | |
1405 | + return snd_soc_suspend_device(&client->dev); | |
1406 | +} | |
1407 | + | |
1408 | +static int wm8900_i2c_resume(struct i2c_client *client) | |
1409 | +{ | |
1410 | + return snd_soc_resume_device(&client->dev); | |
1411 | +} | |
1412 | +#else | |
1413 | +#define wm8900_i2c_suspend NULL | |
1414 | +#define wm8900_i2c_resume NULL | |
1415 | +#endif | |
1416 | + | |
1402 | 1417 | static const struct i2c_device_id wm8900_i2c_id[] = { |
1403 | 1418 | { "wm8900", 0 }, |
1404 | 1419 | { } |
... | ... | @@ -1412,6 +1427,8 @@ |
1412 | 1427 | }, |
1413 | 1428 | .probe = wm8900_i2c_probe, |
1414 | 1429 | .remove = __devexit_p(wm8900_i2c_remove), |
1430 | + .suspend = wm8900_i2c_suspend, | |
1431 | + .resume = wm8900_i2c_resume, | |
1415 | 1432 | .id_table = wm8900_i2c_id, |
1416 | 1433 | }; |
1417 | 1434 |
sound/soc/codecs/wm8903.c
... | ... | @@ -1731,6 +1731,21 @@ |
1731 | 1731 | return 0; |
1732 | 1732 | } |
1733 | 1733 | |
1734 | +#ifdef CONFIG_PM | |
1735 | +static int wm8903_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
1736 | +{ | |
1737 | + return snd_soc_suspend_device(&client->dev); | |
1738 | +} | |
1739 | + | |
1740 | +static int wm8903_i2c_resume(struct i2c_client *client) | |
1741 | +{ | |
1742 | + return snd_soc_resume_device(&client->dev); | |
1743 | +} | |
1744 | +#else | |
1745 | +#define wm8903_i2c_suspend NULL | |
1746 | +#define wm8903_i2c_resume NULL | |
1747 | +#endif | |
1748 | + | |
1734 | 1749 | /* i2c codec control layer */ |
1735 | 1750 | static const struct i2c_device_id wm8903_i2c_id[] = { |
1736 | 1751 | { "wm8903", 0 }, |
... | ... | @@ -1745,6 +1760,8 @@ |
1745 | 1760 | }, |
1746 | 1761 | .probe = wm8903_i2c_probe, |
1747 | 1762 | .remove = __devexit_p(wm8903_i2c_remove), |
1763 | + .suspend = wm8903_i2c_suspend, | |
1764 | + .resume = wm8903_i2c_resume, | |
1748 | 1765 | .id_table = wm8903_i2c_id, |
1749 | 1766 | }; |
1750 | 1767 |
sound/soc/codecs/wm8940.c
... | ... | @@ -916,6 +916,21 @@ |
916 | 916 | return 0; |
917 | 917 | } |
918 | 918 | |
919 | +#ifdef CONFIG_PM | |
920 | +static int wm8940_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
921 | +{ | |
922 | + return snd_soc_suspend_device(&client->dev); | |
923 | +} | |
924 | + | |
925 | +static int wm8940_i2c_resume(struct i2c_client *client) | |
926 | +{ | |
927 | + return snd_soc_resume_device(&client->dev); | |
928 | +} | |
929 | +#else | |
930 | +#define wm8940_i2c_suspend NULL | |
931 | +#define wm8940_i2c_resume NULL | |
932 | +#endif | |
933 | + | |
919 | 934 | static const struct i2c_device_id wm8940_i2c_id[] = { |
920 | 935 | { "wm8940", 0 }, |
921 | 936 | { } |
... | ... | @@ -929,6 +944,8 @@ |
929 | 944 | }, |
930 | 945 | .probe = wm8940_i2c_probe, |
931 | 946 | .remove = __devexit_p(wm8940_i2c_remove), |
947 | + .suspend = wm8940_i2c_suspend, | |
948 | + .resume = wm8940_i2c_resume, | |
932 | 949 | .id_table = wm8940_i2c_id, |
933 | 950 | }; |
934 | 951 |
sound/soc/codecs/wm8960.c
... | ... | @@ -927,6 +927,21 @@ |
927 | 927 | return 0; |
928 | 928 | } |
929 | 929 | |
930 | +#ifdef CONFIG_PM | |
931 | +static int wm8960_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
932 | +{ | |
933 | + return snd_soc_suspend_device(&client->dev); | |
934 | +} | |
935 | + | |
936 | +static int wm8960_i2c_resume(struct i2c_client *client) | |
937 | +{ | |
938 | + return snd_soc_resume_device(&client->dev); | |
939 | +} | |
940 | +#else | |
941 | +#define wm8960_i2c_suspend NULL | |
942 | +#define wm8960_i2c_resume NULL | |
943 | +#endif | |
944 | + | |
930 | 945 | static const struct i2c_device_id wm8960_i2c_id[] = { |
931 | 946 | { "wm8960", 0 }, |
932 | 947 | { } |
... | ... | @@ -940,6 +955,8 @@ |
940 | 955 | }, |
941 | 956 | .probe = wm8960_i2c_probe, |
942 | 957 | .remove = __devexit_p(wm8960_i2c_remove), |
958 | + .suspend = wm8960_i2c_suspend, | |
959 | + .resume = wm8960_i2c_resume, | |
943 | 960 | .id_table = wm8960_i2c_id, |
944 | 961 | }; |
945 | 962 |
sound/soc/codecs/wm8988.c
... | ... | @@ -981,6 +981,21 @@ |
981 | 981 | return 0; |
982 | 982 | } |
983 | 983 | |
984 | +#ifdef CONFIG_PM | |
985 | +static int wm8988_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
986 | +{ | |
987 | + return snd_soc_suspend_device(&client->dev); | |
988 | +} | |
989 | + | |
990 | +static int wm8988_i2c_resume(struct i2c_client *client) | |
991 | +{ | |
992 | + return snd_soc_resume_device(&client->dev); | |
993 | +} | |
994 | +#else | |
995 | +#define wm8988_i2c_suspend NULL | |
996 | +#define wm8988_i2c_resume NULL | |
997 | +#endif | |
998 | + | |
984 | 999 | static const struct i2c_device_id wm8988_i2c_id[] = { |
985 | 1000 | { "wm8988", 0 }, |
986 | 1001 | { } |
... | ... | @@ -994,6 +1009,8 @@ |
994 | 1009 | }, |
995 | 1010 | .probe = wm8988_i2c_probe, |
996 | 1011 | .remove = wm8988_i2c_remove, |
1012 | + .suspend = wm8988_i2c_suspend, | |
1013 | + .resume = wm8988_i2c_resume, | |
997 | 1014 | .id_table = wm8988_i2c_id, |
998 | 1015 | }; |
999 | 1016 | #endif |
... | ... | @@ -1051,6 +1068,21 @@ |
1051 | 1068 | return 0; |
1052 | 1069 | } |
1053 | 1070 | |
1071 | +#ifdef CONFIG_PM | |
1072 | +static int wm8988_spi_suspend(struct spi_device *spi, pm_message_t msg) | |
1073 | +{ | |
1074 | + return snd_soc_suspend_device(&spi->dev); | |
1075 | +} | |
1076 | + | |
1077 | +static int wm8988_spi_resume(struct spi_device *spi) | |
1078 | +{ | |
1079 | + return snd_soc_resume_device(&spi->dev); | |
1080 | +} | |
1081 | +#else | |
1082 | +#define wm8988_spi_suspend NULL | |
1083 | +#define wm8988_spi_resume NULL | |
1084 | +#endif | |
1085 | + | |
1054 | 1086 | static struct spi_driver wm8988_spi_driver = { |
1055 | 1087 | .driver = { |
1056 | 1088 | .name = "wm8988", |
... | ... | @@ -1059,6 +1091,8 @@ |
1059 | 1091 | }, |
1060 | 1092 | .probe = wm8988_spi_probe, |
1061 | 1093 | .remove = __devexit_p(wm8988_spi_remove), |
1094 | + .suspend = wm8988_spi_suspend, | |
1095 | + .resume = wm8988_spi_resume, | |
1062 | 1096 | }; |
1063 | 1097 | #endif |
1064 | 1098 |
sound/soc/codecs/wm9081.c
... | ... | @@ -1492,6 +1492,21 @@ |
1492 | 1492 | return 0; |
1493 | 1493 | } |
1494 | 1494 | |
1495 | +#ifdef CONFIG_PM | |
1496 | +static int wm9081_i2c_suspend(struct i2c_client *client, pm_message_t msg) | |
1497 | +{ | |
1498 | + return snd_soc_suspend_device(&client->dev); | |
1499 | +} | |
1500 | + | |
1501 | +static int wm9081_i2c_resume(struct i2c_client *client) | |
1502 | +{ | |
1503 | + return snd_soc_resume_device(&client->dev); | |
1504 | +} | |
1505 | +#else | |
1506 | +#define wm9081_i2c_suspend NULL | |
1507 | +#define wm9081_i2c_resume NULL | |
1508 | +#endif | |
1509 | + | |
1495 | 1510 | static const struct i2c_device_id wm9081_i2c_id[] = { |
1496 | 1511 | { "wm9081", 0 }, |
1497 | 1512 | { } |
... | ... | @@ -1505,6 +1520,8 @@ |
1505 | 1520 | }, |
1506 | 1521 | .probe = wm9081_i2c_probe, |
1507 | 1522 | .remove = __devexit_p(wm9081_i2c_remove), |
1523 | + .suspend = wm9081_i2c_suspend, | |
1524 | + .resume = wm9081_i2c_resume, | |
1508 | 1525 | .id_table = wm9081_i2c_id, |
1509 | 1526 | }; |
1510 | 1527 |