diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8753.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 76a5c7b05dfb..fb41826c4c4c 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -150,7 +150,7 @@ static int wm8753_write(struct snd_soc_codec *codec, unsigned int reg, | |||
150 | data[0] = (reg << 1) | ((value >> 8) & 0x0001); | 150 | data[0] = (reg << 1) | ((value >> 8) & 0x0001); |
151 | data[1] = value & 0x00ff; | 151 | data[1] = value & 0x00ff; |
152 | 152 | ||
153 | wm8753_write_reg_cache (codec, reg, value); | 153 | wm8753_write_reg_cache(codec, reg, value); |
154 | if (codec->hw_write(codec->control_data, data, 2) == 2) | 154 | if (codec->hw_write(codec->control_data, data, 2) == 2) |
155 | return 0; | 155 | return 0; |
156 | else | 156 | else |
@@ -249,7 +249,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, | |||
249 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 249 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
250 | int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); | 250 | int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); |
251 | 251 | ||
252 | if (((mode &0xc) >> 2) == ucontrol->value.integer.value[0]) | 252 | if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | mode &= 0xfff3; | 255 | mode &= 0xfff3; |
@@ -342,7 +342,8 @@ static int wm8753_add_controls(struct snd_soc_codec *codec) | |||
342 | 342 | ||
343 | for (i = 0; i < ARRAY_SIZE(wm8753_snd_controls); i++) { | 343 | for (i = 0; i < ARRAY_SIZE(wm8753_snd_controls); i++) { |
344 | err = snd_ctl_add(codec->card, | 344 | err = snd_ctl_add(codec->card, |
345 | snd_soc_cnew(&wm8753_snd_controls[i],codec, NULL)); | 345 | snd_soc_cnew(&wm8753_snd_controls[i], |
346 | codec, NULL)); | ||
346 | if (err < 0) | 347 | if (err < 0) |
347 | return err; | 348 | return err; |
348 | } | 349 | } |
@@ -722,7 +723,7 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int target, | |||
722 | 723 | ||
723 | if ((Ndiv < 6) || (Ndiv > 12)) | 724 | if ((Ndiv < 6) || (Ndiv > 12)) |
724 | printk(KERN_WARNING | 725 | printk(KERN_WARNING |
725 | "WM8753 N value outwith recommended range! N = %d\n",Ndiv); | 726 | "wm8753: unsupported N = %d\n", Ndiv); |
726 | 727 | ||
727 | pll_div->n = Ndiv; | 728 | pll_div->n = Ndiv; |
728 | Nmod = target % source; | 729 | Nmod = target % source; |
@@ -1300,8 +1301,9 @@ static int wm8753_dapm_event(struct snd_soc_codec *codec, int event) | |||
1300 | } | 1301 | } |
1301 | 1302 | ||
1302 | #define WM8753_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ | 1303 | #define WM8753_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ |
1303 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ | 1304 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ |
1304 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | 1305 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ |
1306 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | ||
1305 | 1307 | ||
1306 | #define WM8753_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 1308 | #define WM8753_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
1307 | SNDRV_PCM_FMTBIT_S24_LE) | 1309 | SNDRV_PCM_FMTBIT_S24_LE) |
@@ -1507,9 +1509,9 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) | |||
1507 | struct snd_soc_codec *codec = socdev->codec; | 1509 | struct snd_soc_codec *codec = socdev->codec; |
1508 | 1510 | ||
1509 | /* we only need to suspend if we are a valid card */ | 1511 | /* we only need to suspend if we are a valid card */ |
1510 | if(!codec->card) | 1512 | if (!codec->card) |
1511 | return 0; | 1513 | return 0; |
1512 | 1514 | ||
1513 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 1515 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); |
1514 | return 0; | 1516 | return 0; |
1515 | } | 1517 | } |
@@ -1523,7 +1525,7 @@ static int wm8753_resume(struct platform_device *pdev) | |||
1523 | u16 *cache = codec->reg_cache; | 1525 | u16 *cache = codec->reg_cache; |
1524 | 1526 | ||
1525 | /* we only need to resume if we are a valid card */ | 1527 | /* we only need to resume if we are a valid card */ |
1526 | if(!codec->card) | 1528 | if (!codec->card) |
1527 | return 0; | 1529 | return 0; |
1528 | 1530 | ||
1529 | /* Sync reg_cache with the hardware */ | 1531 | /* Sync reg_cache with the hardware */ |
@@ -1613,9 +1615,10 @@ static int wm8753_init(struct snd_soc_device *socdev) | |||
1613 | wm8753_add_widgets(codec); | 1615 | wm8753_add_widgets(codec); |
1614 | ret = snd_soc_register_card(socdev); | 1616 | ret = snd_soc_register_card(socdev); |
1615 | if (ret < 0) { | 1617 | if (ret < 0) { |
1616 | printk(KERN_ERR "wm8753: failed to register card\n"); | 1618 | printk(KERN_ERR "wm8753: failed to register card\n"); |
1617 | goto card_err; | 1619 | goto card_err; |
1618 | } | 1620 | } |
1621 | |||
1619 | return ret; | 1622 | return ret; |
1620 | 1623 | ||
1621 | card_err: | 1624 | card_err: |
@@ -1630,7 +1633,7 @@ pcm_err: | |||
1630 | around */ | 1633 | around */ |
1631 | static struct snd_soc_device *wm8753_socdev; | 1634 | static struct snd_soc_device *wm8753_socdev; |
1632 | 1635 | ||
1633 | #if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) | 1636 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
1634 | 1637 | ||
1635 | /* | 1638 | /* |
1636 | * WM8753 2 wire address is determined by GPIO5 | 1639 | * WM8753 2 wire address is determined by GPIO5 |
@@ -1661,7 +1664,7 @@ static int wm8753_codec_probe(struct i2c_adapter *adap, int addr, int kind) | |||
1661 | client_template.addr = addr; | 1664 | client_template.addr = addr; |
1662 | 1665 | ||
1663 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); | 1666 | i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); |
1664 | if (i2c == NULL){ | 1667 | if (!i2c) { |
1665 | kfree(codec); | 1668 | kfree(codec); |
1666 | return -ENOMEM; | 1669 | return -ENOMEM; |
1667 | } | 1670 | } |
@@ -1749,7 +1752,7 @@ static int wm8753_probe(struct platform_device *pdev) | |||
1749 | wm8753_socdev = socdev; | 1752 | wm8753_socdev = socdev; |
1750 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); | 1753 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); |
1751 | 1754 | ||
1752 | #if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) | 1755 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
1753 | if (setup->i2c_address) { | 1756 | if (setup->i2c_address) { |
1754 | normal_i2c[0] = setup->i2c_address; | 1757 | normal_i2c[0] = setup->i2c_address; |
1755 | codec->hw_write = (hw_write_t)i2c_master_send; | 1758 | codec->hw_write = (hw_write_t)i2c_master_send; |
@@ -1793,7 +1796,7 @@ static int wm8753_remove(struct platform_device *pdev) | |||
1793 | run_delayed_work(&codec->delayed_work); | 1796 | run_delayed_work(&codec->delayed_work); |
1794 | snd_soc_free_pcms(socdev); | 1797 | snd_soc_free_pcms(socdev); |
1795 | snd_soc_dapm_free(socdev); | 1798 | snd_soc_dapm_free(socdev); |
1796 | #if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) | 1799 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
1797 | i2c_del_driver(&wm8753_i2c_driver); | 1800 | i2c_del_driver(&wm8753_i2c_driver); |
1798 | #endif | 1801 | #endif |
1799 | kfree(codec->private_data); | 1802 | kfree(codec->private_data); |
@@ -1808,7 +1811,6 @@ struct snd_soc_codec_device soc_codec_dev_wm8753 = { | |||
1808 | .suspend = wm8753_suspend, | 1811 | .suspend = wm8753_suspend, |
1809 | .resume = wm8753_resume, | 1812 | .resume = wm8753_resume, |
1810 | }; | 1813 | }; |
1811 | |||
1812 | EXPORT_SYMBOL_GPL(soc_codec_dev_wm8753); | 1814 | EXPORT_SYMBOL_GPL(soc_codec_dev_wm8753); |
1813 | 1815 | ||
1814 | MODULE_DESCRIPTION("ASoC WM8753 driver"); | 1816 | MODULE_DESCRIPTION("ASoC WM8753 driver"); |