aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8753.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8753.c')
-rw-r--r--sound/soc/codecs/wm8753.c58
1 files changed, 3 insertions, 55 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 5ad677ce80da..613199a0f799 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -40,6 +40,7 @@
40#include <linux/i2c.h> 40#include <linux/i2c.h>
41#include <linux/platform_device.h> 41#include <linux/platform_device.h>
42#include <linux/spi/spi.h> 42#include <linux/spi/spi.h>
43#include <linux/slab.h>
43#include <sound/core.h> 44#include <sound/core.h>
44#include <sound/pcm.h> 45#include <sound/pcm.h>
45#include <sound/pcm_params.h> 46#include <sound/pcm_params.h>
@@ -673,7 +674,6 @@ static int wm8753_add_widgets(struct snd_soc_codec *codec)
673 674
674 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 675 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
675 676
676 snd_soc_dapm_new_widgets(codec);
677 return 0; 677 return 0;
678} 678}
679 679
@@ -724,8 +724,8 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int target,
724 pll_div->k = K; 724 pll_div->k = K;
725} 725}
726 726
727static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, 727static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
728 int pll_id, unsigned int freq_in, unsigned int freq_out) 728 int source, unsigned int freq_in, unsigned int freq_out)
729{ 729{
730 u16 reg, enable; 730 u16 reg, enable;
731 int offset; 731 int offset;
@@ -1508,10 +1508,6 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state)
1508 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1508 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1509 struct snd_soc_codec *codec = socdev->card->codec; 1509 struct snd_soc_codec *codec = socdev->card->codec;
1510 1510
1511 /* we only need to suspend if we are a valid card */
1512 if (!codec->card)
1513 return 0;
1514
1515 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); 1511 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1516 return 0; 1512 return 0;
1517} 1513}
@@ -1524,10 +1520,6 @@ static int wm8753_resume(struct platform_device *pdev)
1524 u8 data[2]; 1520 u8 data[2];
1525 u16 *cache = codec->reg_cache; 1521 u16 *cache = codec->reg_cache;
1526 1522
1527 /* we only need to resume if we are a valid card */
1528 if (!codec->card)
1529 return 0;
1530
1531 /* Sync reg_cache with the hardware */ 1523 /* Sync reg_cache with the hardware */
1532 for (i = 0; i < ARRAY_SIZE(wm8753_reg); i++) { 1524 for (i = 0; i < ARRAY_SIZE(wm8753_reg); i++) {
1533 if (i + 1 == WM8753_RESET) 1525 if (i + 1 == WM8753_RESET)
@@ -1583,18 +1575,9 @@ static int wm8753_probe(struct platform_device *pdev)
1583 snd_soc_add_controls(codec, wm8753_snd_controls, 1575 snd_soc_add_controls(codec, wm8753_snd_controls,
1584 ARRAY_SIZE(wm8753_snd_controls)); 1576 ARRAY_SIZE(wm8753_snd_controls));
1585 wm8753_add_widgets(codec); 1577 wm8753_add_widgets(codec);
1586 ret = snd_soc_init_card(socdev);
1587 if (ret < 0) {
1588 printk(KERN_ERR "wm8753: failed to register card\n");
1589 goto card_err;
1590 }
1591 1578
1592 return 0; 1579 return 0;
1593 1580
1594card_err:
1595 snd_soc_free_pcms(socdev);
1596 snd_soc_dapm_free(socdev);
1597
1598pcm_err: 1581pcm_err:
1599 return ret; 1582 return ret;
1600} 1583}
@@ -1767,21 +1750,6 @@ static int wm8753_i2c_remove(struct i2c_client *client)
1767 return 0; 1750 return 0;
1768} 1751}
1769 1752
1770#ifdef CONFIG_PM
1771static int wm8753_i2c_suspend(struct i2c_client *client, pm_message_t msg)
1772{
1773 return snd_soc_suspend_device(&client->dev);
1774}
1775
1776static int wm8753_i2c_resume(struct i2c_client *client)
1777{
1778 return snd_soc_resume_device(&client->dev);
1779}
1780#else
1781#define wm8753_i2c_suspend NULL
1782#define wm8753_i2c_resume NULL
1783#endif
1784
1785static const struct i2c_device_id wm8753_i2c_id[] = { 1753static const struct i2c_device_id wm8753_i2c_id[] = {
1786 { "wm8753", 0 }, 1754 { "wm8753", 0 },
1787 { } 1755 { }
@@ -1795,8 +1763,6 @@ static struct i2c_driver wm8753_i2c_driver = {
1795 }, 1763 },
1796 .probe = wm8753_i2c_probe, 1764 .probe = wm8753_i2c_probe,
1797 .remove = wm8753_i2c_remove, 1765 .remove = wm8753_i2c_remove,
1798 .suspend = wm8753_i2c_suspend,
1799 .resume = wm8753_i2c_resume,
1800 .id_table = wm8753_i2c_id, 1766 .id_table = wm8753_i2c_id,
1801}; 1767};
1802#endif 1768#endif
@@ -1852,22 +1818,6 @@ static int __devexit wm8753_spi_remove(struct spi_device *spi)
1852 return 0; 1818 return 0;
1853} 1819}
1854 1820
1855#ifdef CONFIG_PM
1856static int wm8753_spi_suspend(struct spi_device *spi, pm_message_t msg)
1857{
1858 return snd_soc_suspend_device(&spi->dev);
1859}
1860
1861static int wm8753_spi_resume(struct spi_device *spi)
1862{
1863 return snd_soc_resume_device(&spi->dev);
1864}
1865
1866#else
1867#define wm8753_spi_suspend NULL
1868#define wm8753_spi_resume NULL
1869#endif
1870
1871static struct spi_driver wm8753_spi_driver = { 1821static struct spi_driver wm8753_spi_driver = {
1872 .driver = { 1822 .driver = {
1873 .name = "wm8753", 1823 .name = "wm8753",
@@ -1876,8 +1826,6 @@ static struct spi_driver wm8753_spi_driver = {
1876 }, 1826 },
1877 .probe = wm8753_spi_probe, 1827 .probe = wm8753_spi_probe,
1878 .remove = __devexit_p(wm8753_spi_remove), 1828 .remove = __devexit_p(wm8753_spi_remove),
1879 .suspend = wm8753_spi_suspend,
1880 .resume = wm8753_spi_resume,
1881}; 1829};
1882#endif 1830#endif
1883 1831