aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-12-22 12:57:02 -0500
committerJiri Kosina <jkosina@suse.cz>2010-12-22 12:57:02 -0500
commit4b7bd364700d9ac8372eff48832062b936d0793b (patch)
tree0dbf78c95456a0b02d07fcd473281f04a87e266d /sound
parentc0d8768af260e2cbb4bf659ae6094a262c86b085 (diff)
parent90a8a73c06cc32b609a880d48449d7083327e11a (diff)
Merge branch 'master' into for-next
Conflicts: MAINTAINERS arch/arm/mach-omap2/pm24xx.c drivers/scsi/bfa/bfa_fcpim.c Needed to update to apply fixes for which the old branch was too outdated.
Diffstat (limited to 'sound')
-rw-r--r--sound/atmel/abdac.c4
-rw-r--r--sound/core/info.c1
-rw-r--r--sound/core/oss/pcm_oss.c19
-rw-r--r--sound/core/pcm_lib.c2
-rw-r--r--sound/core/pcm_native.c1
-rw-r--r--sound/core/sound.c1
-rw-r--r--sound/oss/dev_table.c6
-rw-r--r--sound/oss/midibuf.c4
-rw-r--r--sound/oss/pss.c6
-rw-r--r--sound/oss/sequencer.c4
-rw-r--r--sound/pci/asihpi/hpi6000.c2
-rw-r--r--sound/pci/asihpi/hpi6205.c2
-rw-r--r--sound/pci/asihpi/hpicmn.c12
-rw-r--r--sound/pci/asihpi/hpioctl.c2
-rw-r--r--sound/pci/azt3328.c26
-rw-r--r--sound/pci/cs46xx/dsp_spos.c33
-rw-r--r--sound/pci/ctxfi/ctpcm.c16
-rw-r--r--sound/pci/hda/hda_eld.c24
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_cirrus.c1
-rw-r--r--sound/pci/hda/patch_conexant.c37
-rw-r--r--sound/pci/hda/patch_hdmi.c1
-rw-r--r--sound/pci/hda/patch_realtek.c110
-rw-r--r--sound/pci/hda/patch_sigmatel.c20
-rw-r--r--sound/pci/intel8x0.c6
-rw-r--r--sound/pci/lx6464es/lx6464es.c4
-rw-r--r--sound/pci/lx6464es/lx6464es.h2
-rw-r--r--sound/pci/lx6464es/lx_core.c2
-rw-r--r--sound/pci/mixart/mixart_hwdep.h10
-rw-r--r--sound/ppc/pmac.c12
-rw-r--r--sound/soc/atmel/Kconfig5
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c9
-rw-r--r--sound/soc/atmel/snd-soc-afeb9260.c1
-rw-r--r--sound/soc/codecs/Kconfig3
-rw-r--r--sound/soc/codecs/max98088.c14
-rw-r--r--sound/soc/codecs/stac9766.c1
-rw-r--r--sound/soc/codecs/tlv320aic3x.c6
-rw-r--r--sound/soc/codecs/tlv320dac33.c36
-rw-r--r--sound/soc/codecs/tpa6130a2.c10
-rw-r--r--sound/soc/codecs/uda134x.c1
-rw-r--r--sound/soc/codecs/wm8350.c9
-rw-r--r--sound/soc/codecs/wm8523.c1
-rw-r--r--sound/soc/codecs/wm8580.c10
-rw-r--r--sound/soc/codecs/wm8731.c2
-rw-r--r--sound/soc/codecs/wm8776.c1
-rw-r--r--sound/soc/codecs/wm8900.c6
-rw-r--r--sound/soc/codecs/wm8904.c5
-rw-r--r--sound/soc/codecs/wm8955.c3
-rw-r--r--sound/soc/codecs/wm8960.c3
-rw-r--r--sound/soc/codecs/wm8961.c4
-rw-r--r--sound/soc/codecs/wm8962.c7
-rw-r--r--sound/soc/codecs/wm8994.c6
-rw-r--r--sound/soc/codecs/wm_hubs.c4
-rw-r--r--sound/soc/davinci/davinci-evm.c40
-rw-r--r--sound/soc/davinci/davinci-i2s.c15
-rw-r--r--sound/soc/davinci/davinci-mcasp.c13
-rw-r--r--sound/soc/davinci/davinci-sffsdr.c2
-rw-r--r--sound/soc/davinci/davinci-vcif.c16
-rw-r--r--sound/soc/ep93xx/simone.c18
-rw-r--r--sound/soc/fsl/efika-audio-fabric.c1
-rw-r--r--sound/soc/fsl/mpc5200_dma.c1
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c2
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c1
-rw-r--r--sound/soc/fsl/p1022_ds.c1
-rw-r--r--sound/soc/fsl/pcm030-audio-fabric.c1
-rw-r--r--sound/soc/imx/eukrea-tlv320.c8
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c221
-rw-r--r--sound/soc/imx/imx-ssi.c57
-rw-r--r--sound/soc/imx/imx-ssi.h4
-rw-r--r--sound/soc/imx/phycore-ac97.c33
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c17
-rw-r--r--sound/soc/nuc900/nuc900-audio.h2
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c11
-rw-r--r--sound/soc/omap/Kconfig2
-rw-r--r--sound/soc/omap/omap-mcbsp.c8
-rw-r--r--sound/soc/omap/omap3pandora.c1
-rw-r--r--sound/soc/omap/osk5912.c11
-rw-r--r--sound/soc/pxa/Kconfig1
-rw-r--r--sound/soc/pxa/corgi.c5
-rw-r--r--sound/soc/pxa/magician.c4
-rw-r--r--sound/soc/pxa/poodle.c5
-rw-r--r--sound/soc/pxa/spitz.c5
-rw-r--r--sound/soc/pxa/tosa.c7
-rw-r--r--sound/soc/s3c24xx/Kconfig1
-rw-r--r--sound/soc/s3c24xx/rx1950_uda1380.c20
-rw-r--r--sound/soc/s3c24xx/smdk_spdif.c4
-rw-r--r--sound/soc/s6000/s6000-i2s.c2
-rw-r--r--sound/soc/s6000/s6000-pcm.c2
-rw-r--r--sound/soc/s6000/s6105-ipcam.c2
-rw-r--r--sound/soc/sh/fsi.c25
-rw-r--r--sound/soc/sh/ssi.c2
-rw-r--r--sound/soc/soc-core.c28
-rw-r--r--sound/soc/soc-dapm.c7
-rw-r--r--sound/sound_core.c1
-rw-r--r--sound/spi/at73c213.c2
-rw-r--r--sound/usb/mixer_quirks.c15
-rw-r--r--sound/usb/pcm.c4
97 files changed, 708 insertions, 438 deletions
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c
index f2f41c854221..6e2409181895 100644
--- a/sound/atmel/abdac.c
+++ b/sound/atmel/abdac.c
@@ -420,9 +420,9 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev)
420 return PTR_ERR(pclk); 420 return PTR_ERR(pclk);
421 } 421 }
422 sample_clk = clk_get(&pdev->dev, "sample_clk"); 422 sample_clk = clk_get(&pdev->dev, "sample_clk");
423 if (IS_ERR(pclk)) { 423 if (IS_ERR(sample_clk)) {
424 dev_dbg(&pdev->dev, "no sample clock\n"); 424 dev_dbg(&pdev->dev, "no sample clock\n");
425 retval = PTR_ERR(pclk); 425 retval = PTR_ERR(sample_clk);
426 goto out_put_pclk; 426 goto out_put_pclk;
427 } 427 }
428 clk_enable(pclk); 428 clk_enable(pclk);
diff --git a/sound/core/info.c b/sound/core/info.c
index b70564ed8b37..7077f601da5a 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -23,7 +23,6 @@
23#include <linux/time.h> 23#include <linux/time.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/smp_lock.h>
27#include <linux/string.h> 26#include <linux/string.h>
28#include <sound/core.h> 27#include <sound/core.h>
29#include <sound/minors.h> 28#include <sound/minors.h>
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 5c8c7dff8ede..b753ec661fcf 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
1510static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) 1510static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
1511{ 1511{
1512 struct snd_pcm_substream *substream; 1512 struct snd_pcm_substream *substream;
1513 struct snd_pcm_runtime *runtime;
1514 int i;
1513 1515
1514 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 1516 for (i = 0; i < 2; i++) {
1515 if (substream != NULL) { 1517 substream = pcm_oss_file->streams[i];
1516 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); 1518 if (!substream)
1517 substream->runtime->oss.prepare = 1; 1519 continue;
1518 } 1520 runtime = substream->runtime;
1519 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
1520 if (substream != NULL) {
1521 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); 1521 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
1522 substream->runtime->oss.prepare = 1; 1522 runtime->oss.prepare = 1;
1523 runtime->oss.buffer_used = 0;
1524 runtime->oss.prev_hw_ptr_period = 0;
1525 runtime->oss.period_ptr = 0;
1523 } 1526 }
1524 return 0; 1527 return 0;
1525} 1528}
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index a1707cca9c66..b75db8e9cc0f 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -223,7 +223,7 @@ static void xrun_log(struct snd_pcm_substream *substream,
223 entry->jiffies = jiffies; 223 entry->jiffies = jiffies;
224 entry->pos = pos; 224 entry->pos = pos;
225 entry->period_size = runtime->period_size; 225 entry->period_size = runtime->period_size;
226 entry->buffer_size = runtime->buffer_size;; 226 entry->buffer_size = runtime->buffer_size;
227 entry->old_hw_ptr = runtime->status->hw_ptr; 227 entry->old_hw_ptr = runtime->status->hw_ptr;
228 entry->hw_ptr_base = runtime->hw_ptr_base; 228 entry->hw_ptr_base = runtime->hw_ptr_base;
229 log->idx = (log->idx + 1) % XRUN_LOG_CNT; 229 log->idx = (log->idx + 1) % XRUN_LOG_CNT;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 8e022fc70f55..c0ebb5162e95 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -22,7 +22,6 @@
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/file.h> 23#include <linux/file.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/smp_lock.h>
26#include <linux/time.h> 25#include <linux/time.h>
27#include <linux/pm_qos_params.h> 26#include <linux/pm_qos_params.h>
28#include <linux/uio.h> 27#include <linux/uio.h>
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 62a093efb453..66691fe437e6 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/smp_lock.h>
25#include <linux/time.h> 24#include <linux/time.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c
index 727bdb9ba2dc..d8cf3e58dc76 100644
--- a/sound/oss/dev_table.c
+++ b/sound/oss/dev_table.c
@@ -71,7 +71,7 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
71 if (sound_nblocks >= MAX_MEM_BLOCKS) 71 if (sound_nblocks >= MAX_MEM_BLOCKS)
72 sound_nblocks = MAX_MEM_BLOCKS - 1; 72 sound_nblocks = MAX_MEM_BLOCKS - 1;
73 73
74 op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); 74 op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct audio_operations)));
75 sound_nblocks++; 75 sound_nblocks++;
76 if (sound_nblocks >= MAX_MEM_BLOCKS) 76 if (sound_nblocks >= MAX_MEM_BLOCKS)
77 sound_nblocks = MAX_MEM_BLOCKS - 1; 77 sound_nblocks = MAX_MEM_BLOCKS - 1;
@@ -81,7 +81,6 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
81 sound_unload_audiodev(num); 81 sound_unload_audiodev(num);
82 return -(ENOMEM); 82 return -(ENOMEM);
83 } 83 }
84 memset((char *) op, 0, sizeof(struct audio_operations));
85 init_waitqueue_head(&op->in_sleeper); 84 init_waitqueue_head(&op->in_sleeper);
86 init_waitqueue_head(&op->out_sleeper); 85 init_waitqueue_head(&op->out_sleeper);
87 init_waitqueue_head(&op->poll_sleeper); 86 init_waitqueue_head(&op->poll_sleeper);
@@ -128,7 +127,7 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
128 /* FIXME: This leaks a mixer_operations struct every time its called 127 /* FIXME: This leaks a mixer_operations struct every time its called
129 until you unload sound! */ 128 until you unload sound! */
130 129
131 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); 130 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct mixer_operations)));
132 sound_nblocks++; 131 sound_nblocks++;
133 if (sound_nblocks >= MAX_MEM_BLOCKS) 132 if (sound_nblocks >= MAX_MEM_BLOCKS)
134 sound_nblocks = MAX_MEM_BLOCKS - 1; 133 sound_nblocks = MAX_MEM_BLOCKS - 1;
@@ -137,7 +136,6 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
137 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); 136 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name);
138 return -ENOMEM; 137 return -ENOMEM;
139 } 138 }
140 memset((char *) op, 0, sizeof(struct mixer_operations));
141 memcpy((char *) op, (char *) driver, driver_size); 139 memcpy((char *) op, (char *) driver, driver_size);
142 140
143 strlcpy(op->name, name, sizeof(op->name)); 141 strlcpy(op->name, name, sizeof(op->name));
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index 782b3b84dac6..ceedb1eff203 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -178,7 +178,7 @@ int MIDIbuf_open(int dev, struct file *file)
178 return err; 178 return err;
179 179
180 parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT; 180 parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT;
181 midi_in_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf)); 181 midi_in_buf[dev] = vmalloc(sizeof(struct midi_buf));
182 182
183 if (midi_in_buf[dev] == NULL) 183 if (midi_in_buf[dev] == NULL)
184 { 184 {
@@ -188,7 +188,7 @@ int MIDIbuf_open(int dev, struct file *file)
188 } 188 }
189 midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0; 189 midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0;
190 190
191 midi_out_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf)); 191 midi_out_buf[dev] = vmalloc(sizeof(struct midi_buf));
192 192
193 if (midi_out_buf[dev] == NULL) 193 if (midi_out_buf[dev] == NULL)
194 { 194 {
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index e19dd5dcc2de..9b800ce5100e 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -859,7 +859,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg,
859 return 0; 859 return 0;
860 860
861 case SNDCTL_COPR_LOAD: 861 case SNDCTL_COPR_LOAD:
862 buf = (copr_buffer *) vmalloc(sizeof(copr_buffer)); 862 buf = vmalloc(sizeof(copr_buffer));
863 if (buf == NULL) 863 if (buf == NULL)
864 return -ENOSPC; 864 return -ENOSPC;
865 if (copy_from_user(buf, arg, sizeof(copr_buffer))) { 865 if (copy_from_user(buf, arg, sizeof(copr_buffer))) {
@@ -871,7 +871,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg,
871 return err; 871 return err;
872 872
873 case SNDCTL_COPR_SENDMSG: 873 case SNDCTL_COPR_SENDMSG:
874 mbuf = (copr_msg *)vmalloc(sizeof(copr_msg)); 874 mbuf = vmalloc(sizeof(copr_msg));
875 if (mbuf == NULL) 875 if (mbuf == NULL)
876 return -ENOSPC; 876 return -ENOSPC;
877 if (copy_from_user(mbuf, arg, sizeof(copr_msg))) { 877 if (copy_from_user(mbuf, arg, sizeof(copr_msg))) {
@@ -895,7 +895,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg,
895 895
896 case SNDCTL_COPR_RCVMSG: 896 case SNDCTL_COPR_RCVMSG:
897 err = 0; 897 err = 0;
898 mbuf = (copr_msg *)vmalloc(sizeof(copr_msg)); 898 mbuf = vmalloc(sizeof(copr_msg));
899 if (mbuf == NULL) 899 if (mbuf == NULL)
900 return -ENOSPC; 900 return -ENOSPC;
901 data = (unsigned short *)mbuf->data; 901 data = (unsigned short *)mbuf->data;
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index e85789e53816..5ea1098ac427 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -1646,13 +1646,13 @@ void sequencer_init(void)
1646{ 1646{
1647 if (sequencer_ok) 1647 if (sequencer_ok)
1648 return; 1648 return;
1649 queue = (unsigned char *)vmalloc(SEQ_MAX_QUEUE * EV_SZ); 1649 queue = vmalloc(SEQ_MAX_QUEUE * EV_SZ);
1650 if (queue == NULL) 1650 if (queue == NULL)
1651 { 1651 {
1652 printk(KERN_ERR "sequencer: Can't allocate memory for sequencer output queue\n"); 1652 printk(KERN_ERR "sequencer: Can't allocate memory for sequencer output queue\n");
1653 return; 1653 return;
1654 } 1654 }
1655 iqueue = (unsigned char *)vmalloc(SEQ_MAX_QUEUE * IEV_SZ); 1655 iqueue = vmalloc(SEQ_MAX_QUEUE * IEV_SZ);
1656 if (iqueue == NULL) 1656 if (iqueue == NULL)
1657 { 1657 {
1658 printk(KERN_ERR "sequencer: Can't allocate memory for sequencer input queue\n"); 1658 printk(KERN_ERR "sequencer: Can't allocate memory for sequencer input queue\n");
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index f7e374ec4414..1b9bf9395cfe 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -625,6 +625,8 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
625 control_cache_size, (struct hpi_control_cache_info *) 625 control_cache_size, (struct hpi_control_cache_info *)
626 &phw->control_cache[0] 626 &phw->control_cache[0]
627 ); 627 );
628 if (!phw->p_cache)
629 pao->has_control_cache = 0;
628 } else 630 } else
629 pao->has_control_cache = 0; 631 pao->has_control_cache = 0;
630 632
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index 22c5fc625533..2672f6591ceb 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -644,6 +644,8 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao,
644 interface->control_cache.size_in_bytes, 644 interface->control_cache.size_in_bytes,
645 (struct hpi_control_cache_info *) 645 (struct hpi_control_cache_info *)
646 p_control_cache_virtual); 646 p_control_cache_virtual);
647 if (!phw->p_cache)
648 err = HPI_ERROR_MEMORY_ALLOC;
647 } 649 }
648 if (!err) { 650 if (!err) {
649 err = hpios_locked_mem_get_phys_addr(&phw-> 651 err = hpios_locked_mem_get_phys_addr(&phw->
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index dda4f1c6f658..d67f4d3db911 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -571,14 +571,20 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32
571{ 571{
572 struct hpi_control_cache *p_cache = 572 struct hpi_control_cache *p_cache =
573 kmalloc(sizeof(*p_cache), GFP_KERNEL); 573 kmalloc(sizeof(*p_cache), GFP_KERNEL);
574 if (!p_cache)
575 return NULL;
576 p_cache->p_info =
577 kmalloc(sizeof(*p_cache->p_info) * number_of_controls,
578 GFP_KERNEL);
579 if (!p_cache->p_info) {
580 kfree(p_cache);
581 return NULL;
582 }
574 p_cache->cache_size_in_bytes = size_in_bytes; 583 p_cache->cache_size_in_bytes = size_in_bytes;
575 p_cache->control_count = number_of_controls; 584 p_cache->control_count = number_of_controls;
576 p_cache->p_cache = 585 p_cache->p_cache =
577 (struct hpi_control_cache_single *)pDSP_control_buffer; 586 (struct hpi_control_cache_single *)pDSP_control_buffer;
578 p_cache->init = 0; 587 p_cache->init = 0;
579 p_cache->p_info =
580 kmalloc(sizeof(*p_cache->p_info) * p_cache->control_count,
581 GFP_KERNEL);
582 return p_cache; 588 return p_cache;
583} 589}
584 590
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index 62895a719fcb..22dbd91811a4 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -435,7 +435,7 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
435 struct hpi_message hm; 435 struct hpi_message hm;
436 struct hpi_response hr; 436 struct hpi_response hr;
437 struct hpi_adapter *pa; 437 struct hpi_adapter *pa;
438 pa = (struct hpi_adapter *)pci_get_drvdata(pci_dev); 438 pa = pci_get_drvdata(pci_dev);
439 439
440 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, 440 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
441 HPI_SUBSYS_DELETE_ADAPTER); 441 HPI_SUBSYS_DELETE_ADAPTER);
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 4679ed83a43b..2f3cacbd5528 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1129,10 +1129,11 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip,
1129 1129
1130 count_areas = size/2; 1130 count_areas = size/2;
1131 addr_area2 = addr+count_areas; 1131 addr_area2 = addr+count_areas;
1132 count_areas--; /* max. index */
1133 snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n", 1132 snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n",
1134 addr, count_areas, addr_area2, count_areas); 1133 addr, count_areas, addr_area2, count_areas);
1135 1134
1135 count_areas--; /* max. index */
1136
1136 /* build combined I/O buffer length word */ 1137 /* build combined I/O buffer length word */
1137 lengths = (count_areas << 16) | (count_areas); 1138 lengths = (count_areas << 16) | (count_areas);
1138 spin_lock_irqsave(&chip->reg_lock, flags); 1139 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -1740,11 +1741,15 @@ static const struct snd_pcm_hardware snd_azf3328_hardware =
1740 .rate_max = AZF_FREQ_66200, 1741 .rate_max = AZF_FREQ_66200,
1741 .channels_min = 1, 1742 .channels_min = 1,
1742 .channels_max = 2, 1743 .channels_max = 2,
1743 .buffer_bytes_max = 65536, 1744 .buffer_bytes_max = (64*1024),
1744 .period_bytes_min = 64, 1745 .period_bytes_min = 1024,
1745 .period_bytes_max = 65536, 1746 .period_bytes_max = (32*1024),
1746 .periods_min = 1, 1747 /* We simply have two DMA areas (instead of a list of descriptors
1747 .periods_max = 1024, 1748 such as other cards); I believe that this is a fixed hardware
1749 attribute and there isn't much driver magic to be done to expand it.
1750 Thus indicate that we have at least and at most 2 periods. */
1751 .periods_min = 2,
1752 .periods_max = 2,
1748 /* FIXME: maybe that card actually has a FIFO? 1753 /* FIXME: maybe that card actually has a FIFO?
1749 * Hmm, it seems newer revisions do have one, but we still don't know 1754 * Hmm, it seems newer revisions do have one, but we still don't know
1750 * its size... */ 1755 * its size... */
@@ -1980,8 +1985,13 @@ snd_azf3328_timer_stop(struct snd_timer *timer)
1980 chip = snd_timer_chip(timer); 1985 chip = snd_timer_chip(timer);
1981 spin_lock_irqsave(&chip->reg_lock, flags); 1986 spin_lock_irqsave(&chip->reg_lock, flags);
1982 /* disable timer countdown and interrupt */ 1987 /* disable timer countdown and interrupt */
1983 /* FIXME: should we write TIMER_IRQ_ACK here? */ 1988 /* Hmm, should we write TIMER_IRQ_ACK here?
1984 snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0); 1989 YES indeed, otherwise a rogue timer operation - which prompts
1990 ALSA(?) to call repeated stop() in vain, but NOT start() -
1991 will never end (value 0x03 is kept shown in control byte).
1992 Simply manually poking 0x04 _once_ immediately successfully stops
1993 the hardware/ALSA interrupt activity. */
1994 snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x04);
1985 spin_unlock_irqrestore(&chip->reg_lock, flags); 1995 spin_unlock_irqrestore(&chip->reg_lock, flags);
1986 snd_azf3328_dbgcallleave(); 1996 snd_azf3328_dbgcallleave();
1987 return 0; 1997 return 0;
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 3e5ca8fb519f..e377287192aa 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -225,39 +225,25 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
225{ 225{
226 struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL); 226 struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL);
227 227
228 if (ins == NULL) 228 if (ins == NULL)
229 return NULL; 229 return NULL;
230 230
231 /* better to use vmalloc for this big table */ 231 /* better to use vmalloc for this big table */
232 ins->symbol_table.nsymbols = 0;
233 ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) * 232 ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) *
234 DSP_MAX_SYMBOLS); 233 DSP_MAX_SYMBOLS);
235 ins->symbol_table.highest_frag_index = 0; 234 ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);
236 235 ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);
237 if (ins->symbol_table.symbols == NULL) { 236 if (!ins->symbol_table.symbols || !ins->code.data || !ins->modules) {
238 cs46xx_dsp_spos_destroy(chip); 237 cs46xx_dsp_spos_destroy(chip);
239 goto error; 238 goto error;
240 } 239 }
241 240 ins->symbol_table.nsymbols = 0;
241 ins->symbol_table.highest_frag_index = 0;
242 ins->code.offset = 0; 242 ins->code.offset = 0;
243 ins->code.size = 0; 243 ins->code.size = 0;
244 ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);
245
246 if (ins->code.data == NULL) {
247 cs46xx_dsp_spos_destroy(chip);
248 goto error;
249 }
250
251 ins->nscb = 0; 244 ins->nscb = 0;
252 ins->ntask = 0; 245 ins->ntask = 0;
253
254 ins->nmodules = 0; 246 ins->nmodules = 0;
255 ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);
256
257 if (ins->modules == NULL) {
258 cs46xx_dsp_spos_destroy(chip);
259 goto error;
260 }
261 247
262 /* default SPDIF input sample rate 248 /* default SPDIF input sample rate
263 to 48000 khz */ 249 to 48000 khz */
@@ -271,8 +257,8 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
271 257
272 /* set left and right validity bits and 258 /* set left and right validity bits and
273 default channel status */ 259 default channel status */
274 ins->spdif_csuv_default = 260 ins->spdif_csuv_default =
275 ins->spdif_csuv_stream = 261 ins->spdif_csuv_stream =
276 /* byte 0 */ ((unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF & 0xff)) << 24) | 262 /* byte 0 */ ((unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF & 0xff)) << 24) |
277 /* byte 1 */ ((unsigned int)_wrap_all_bits( ((SNDRV_PCM_DEFAULT_CON_SPDIF >> 8) & 0xff)) << 16) | 263 /* byte 1 */ ((unsigned int)_wrap_all_bits( ((SNDRV_PCM_DEFAULT_CON_SPDIF >> 8) & 0xff)) << 16) |
278 /* byte 3 */ (unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF >> 24) & 0xff) | 264 /* byte 3 */ (unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF >> 24) & 0xff) |
@@ -281,6 +267,9 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
281 return ins; 267 return ins;
282 268
283error: 269error:
270 kfree(ins->modules);
271 kfree(ins->code.data);
272 vfree(ins->symbol_table.symbols);
284 kfree(ins); 273 kfree(ins);
285 return NULL; 274 return NULL;
286} 275}
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c
index 85ab43e89212..457d21189b0d 100644
--- a/sound/pci/ctxfi/ctpcm.c
+++ b/sound/pci/ctxfi/ctpcm.c
@@ -129,8 +129,6 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream)
129 129
130 apcm->substream = substream; 130 apcm->substream = substream;
131 apcm->interrupt = ct_atc_pcm_interrupt; 131 apcm->interrupt = ct_atc_pcm_interrupt;
132 runtime->private_data = apcm;
133 runtime->private_free = ct_atc_pcm_free_substream;
134 if (IEC958 == substream->pcm->device) { 132 if (IEC958 == substream->pcm->device) {
135 runtime->hw = ct_spdif_passthru_playback_hw; 133 runtime->hw = ct_spdif_passthru_playback_hw;
136 atc->spdif_out_passthru(atc, 1); 134 atc->spdif_out_passthru(atc, 1);
@@ -155,8 +153,12 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream)
155 } 153 }
156 154
157 apcm->timer = ct_timer_instance_new(atc->timer, apcm); 155 apcm->timer = ct_timer_instance_new(atc->timer, apcm);
158 if (!apcm->timer) 156 if (!apcm->timer) {
157 kfree(apcm);
159 return -ENOMEM; 158 return -ENOMEM;
159 }
160 runtime->private_data = apcm;
161 runtime->private_free = ct_atc_pcm_free_substream;
160 162
161 return 0; 163 return 0;
162} 164}
@@ -278,8 +280,6 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream)
278 apcm->started = 0; 280 apcm->started = 0;
279 apcm->substream = substream; 281 apcm->substream = substream;
280 apcm->interrupt = ct_atc_pcm_interrupt; 282 apcm->interrupt = ct_atc_pcm_interrupt;
281 runtime->private_data = apcm;
282 runtime->private_free = ct_atc_pcm_free_substream;
283 runtime->hw = ct_pcm_capture_hw; 283 runtime->hw = ct_pcm_capture_hw;
284 runtime->hw.rate_max = atc->rsr * atc->msr; 284 runtime->hw.rate_max = atc->rsr * atc->msr;
285 285
@@ -298,8 +298,12 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream)
298 } 298 }
299 299
300 apcm->timer = ct_timer_instance_new(atc->timer, apcm); 300 apcm->timer = ct_timer_instance_new(atc->timer, apcm);
301 if (!apcm->timer) 301 if (!apcm->timer) {
302 kfree(apcm);
302 return -ENOMEM; 303 return -ENOMEM;
304 }
305 runtime->private_data = apcm;
306 runtime->private_free = ct_atc_pcm_free_substream;
303 307
304 return 0; 308 return 0;
305} 309}
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index cb0c23a6b473..4a663471dadc 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -189,6 +189,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,
189 a->channels = GRAB_BITS(buf, 0, 0, 3); 189 a->channels = GRAB_BITS(buf, 0, 0, 3);
190 a->channels++; 190 a->channels++;
191 191
192 a->sample_bits = 0;
193 a->max_bitrate = 0;
194
192 a->format = GRAB_BITS(buf, 0, 3, 4); 195 a->format = GRAB_BITS(buf, 0, 3, 4);
193 switch (a->format) { 196 switch (a->format) {
194 case AUDIO_CODING_TYPE_REF_STREAM_HEADER: 197 case AUDIO_CODING_TYPE_REF_STREAM_HEADER:
@@ -198,7 +201,6 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a,
198 201
199 case AUDIO_CODING_TYPE_LPCM: 202 case AUDIO_CODING_TYPE_LPCM:
200 val = GRAB_BITS(buf, 2, 0, 3); 203 val = GRAB_BITS(buf, 2, 0, 3);
201 a->sample_bits = 0;
202 for (i = 0; i < 3; i++) 204 for (i = 0; i < 3; i++)
203 if (val & (1 << i)) 205 if (val & (1 << i))
204 a->sample_bits |= cea_sample_sizes[i + 1]; 206 a->sample_bits |= cea_sample_sizes[i + 1];
@@ -598,24 +600,19 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
598{ 600{
599 int i; 601 int i;
600 602
601 pcm->rates = 0; 603 /* assume basic audio support (the basic audio flag is not in ELD;
602 pcm->formats = 0; 604 * however, all audio capable sinks are required to support basic
603 pcm->maxbps = 0; 605 * audio) */
604 pcm->channels_min = -1; 606 pcm->rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000;
605 pcm->channels_max = 0; 607 pcm->formats = SNDRV_PCM_FMTBIT_S16_LE;
608 pcm->maxbps = 16;
609 pcm->channels_max = 2;
606 for (i = 0; i < eld->sad_count; i++) { 610 for (i = 0; i < eld->sad_count; i++) {
607 struct cea_sad *a = &eld->sad[i]; 611 struct cea_sad *a = &eld->sad[i];
608 pcm->rates |= a->rates; 612 pcm->rates |= a->rates;
609 if (a->channels < pcm->channels_min)
610 pcm->channels_min = a->channels;
611 if (a->channels > pcm->channels_max) 613 if (a->channels > pcm->channels_max)
612 pcm->channels_max = a->channels; 614 pcm->channels_max = a->channels;
613 if (a->format == AUDIO_CODING_TYPE_LPCM) { 615 if (a->format == AUDIO_CODING_TYPE_LPCM) {
614 if (a->sample_bits & AC_SUPPCM_BITS_16) {
615 pcm->formats |= SNDRV_PCM_FMTBIT_S16_LE;
616 if (pcm->maxbps < 16)
617 pcm->maxbps = 16;
618 }
619 if (a->sample_bits & AC_SUPPCM_BITS_20) { 616 if (a->sample_bits & AC_SUPPCM_BITS_20) {
620 pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; 617 pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE;
621 if (pcm->maxbps < 20) 618 if (pcm->maxbps < 20)
@@ -635,7 +632,6 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
635 /* restrict the parameters by the values the codec provides */ 632 /* restrict the parameters by the values the codec provides */
636 pcm->rates &= codec_pars->rates; 633 pcm->rates &= codec_pars->rates;
637 pcm->formats &= codec_pars->formats; 634 pcm->formats &= codec_pars->formats;
638 pcm->channels_min = max(pcm->channels_min, codec_pars->channels_min);
639 pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); 635 pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max);
640 pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); 636 pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps);
641} 637}
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 21aa9b0e28f6..b030c8eba21f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2296,6 +2296,7 @@ static int azx_dev_free(struct snd_device *device)
2296 */ 2296 */
2297static struct snd_pci_quirk position_fix_list[] __devinitdata = { 2297static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2298 SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB), 2298 SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB),
2299 SND_PCI_QUIRK(0x1025, 0x026f, "Acer Aspire 5538", POS_FIX_LPIB),
2299 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), 2300 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
2300 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), 2301 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
2301 SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), 2302 SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 460fb2ef7e39..18af38ebf757 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -1166,6 +1166,7 @@ static const char *cs420x_models[CS420X_MODELS] = {
1166 1166
1167static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1167static struct snd_pci_quirk cs420x_cfg_tbl[] = {
1168 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), 1168 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53),
1169 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
1169 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1170 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1170 SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), 1171 SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55),
1171 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), 1172 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 6361f752b5f3..76bd58a0e2b6 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -2116,8 +2116,8 @@ static void cxt5066_update_speaker(struct hda_codec *codec)
2116 struct conexant_spec *spec = codec->spec; 2116 struct conexant_spec *spec = codec->spec;
2117 unsigned int pinctl; 2117 unsigned int pinctl;
2118 2118
2119 snd_printdd("CXT5066: update speaker, hp_present=%d\n", 2119 snd_printdd("CXT5066: update speaker, hp_present=%d, cur_eapd=%d\n",
2120 spec->hp_present); 2120 spec->hp_present, spec->cur_eapd);
2121 2121
2122 /* Port A (HP) */ 2122 /* Port A (HP) */
2123 pinctl = ((spec->hp_present & 1) && spec->cur_eapd) ? PIN_HP : 0; 2123 pinctl = ((spec->hp_present & 1) && spec->cur_eapd) ? PIN_HP : 0;
@@ -2125,11 +2125,20 @@ static void cxt5066_update_speaker(struct hda_codec *codec)
2125 pinctl); 2125 pinctl);
2126 2126
2127 /* Port D (HP/LO) */ 2127 /* Port D (HP/LO) */
2128 pinctl = ((spec->hp_present & 2) && spec->cur_eapd) 2128 if (spec->dell_automute) {
2129 ? spec->port_d_mode : 0; 2129 /* DELL AIO Port Rule: PortA> PortD> IntSpk */
2130 /* Mute if Port A is connected on Thinkpad */ 2130 pinctl = (!(spec->hp_present & 1) && spec->cur_eapd)
2131 if (spec->thinkpad && (spec->hp_present & 1)) 2131 ? PIN_OUT : 0;
2132 pinctl = 0; 2132 } else if (spec->thinkpad) {
2133 if (spec->cur_eapd)
2134 pinctl = spec->port_d_mode;
2135 /* Mute dock line-out if Port A (laptop HP) is present */
2136 if (spec->hp_present& 1)
2137 pinctl = 0;
2138 } else {
2139 pinctl = ((spec->hp_present & 2) && spec->cur_eapd)
2140 ? spec->port_d_mode : 0;
2141 }
2133 snd_hda_codec_write(codec, 0x1c, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 2142 snd_hda_codec_write(codec, 0x1c, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
2134 pinctl); 2143 pinctl);
2135 2144
@@ -2137,14 +2146,6 @@ static void cxt5066_update_speaker(struct hda_codec *codec)
2137 pinctl = (!spec->hp_present && spec->cur_eapd) ? PIN_OUT : 0; 2146 pinctl = (!spec->hp_present && spec->cur_eapd) ? PIN_OUT : 0;
2138 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 2147 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
2139 pinctl); 2148 pinctl);
2140
2141 if (spec->dell_automute) {
2142 /* DELL AIO Port Rule: PortA > PortD > IntSpk */
2143 pinctl = (!(spec->hp_present & 1) && spec->cur_eapd)
2144 ? PIN_OUT : 0;
2145 snd_hda_codec_write(codec, 0x1c, 0,
2146 AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl);
2147 }
2148} 2149}
2149 2150
2150/* turn on/off EAPD (+ mute HP) as a master switch */ 2151/* turn on/off EAPD (+ mute HP) as a master switch */
@@ -3095,11 +3096,11 @@ static const char *cxt5066_models[CXT5066_MODELS] = {
3095static struct snd_pci_quirk cxt5066_cfg_tbl[] = { 3096static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3096 SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD), 3097 SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD),
3097 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO), 3098 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO),
3098 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell", 3099 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD),
3099 CXT5066_DELL_LAPTOP),
3100 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), 3100 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
3101 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), 3101 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
3102 SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), 3102 SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
3103 SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP),
3103 SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), 3104 SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD),
3104 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), 3105 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
3105 SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), 3106 SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
@@ -3108,8 +3109,10 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3108 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), 3109 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5),
3109 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), 3110 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD),
3110 SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), 3111 SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD),
3112 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
3111 SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), 3113 SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD),
3112 SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), 3114 SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD),
3115 SND_PCI_QUIRK(0x17aa, 0x21c8, "Thinkpad Edge 11", CXT5066_IDEAPAD),
3113 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 3116 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
3114 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), 3117 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD),
3115 SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), 3118 SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index d3e49aa5b9ec..31df7747990d 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -834,7 +834,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
834 return -ENODEV; 834 return -ENODEV;
835 } else { 835 } else {
836 /* fallback to the codec default */ 836 /* fallback to the codec default */
837 hinfo->channels_min = codec_pars->channels_min;
838 hinfo->channels_max = codec_pars->channels_max; 837 hinfo->channels_max = codec_pars->channels_max;
839 hinfo->rates = codec_pars->rates; 838 hinfo->rates = codec_pars->rates;
840 hinfo->formats = codec_pars->formats; 839 hinfo->formats = codec_pars->formats;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 5f00589cb791..427da45d7906 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1614,6 +1614,7 @@ do_sku:
1614 spec->init_amp = ALC_INIT_GPIO3; 1614 spec->init_amp = ALC_INIT_GPIO3;
1615 break; 1615 break;
1616 case 5: 1616 case 5:
1617 default:
1617 spec->init_amp = ALC_INIT_DEFAULT; 1618 spec->init_amp = ALC_INIT_DEFAULT;
1618 break; 1619 break;
1619 } 1620 }
@@ -2014,6 +2015,36 @@ static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2014}; 2015};
2015 2016
2016/* 2017/*
2018 *ALC888 Acer Aspire 7730G model
2019 */
2020
2021static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2022/* Bias voltage on for external mic port */
2023 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2024/* Front Mic: set to PIN_IN (empty by default) */
2025 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2026/* Unselect Front Mic by default in input mixer 3 */
2027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2028/* Enable unsolicited event for HP jack */
2029 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2030/* Enable speaker output */
2031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2033 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2034/* Enable headphone output */
2035 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2036 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2037 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2038 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2039/*Enable internal subwoofer */
2040 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2041 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2042 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2043 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2044 { }
2045};
2046
2047/*
2017 * ALC889 Acer Aspire 8930G model 2048 * ALC889 Acer Aspire 8930G model
2018 */ 2049 */
2019 2050
@@ -2200,6 +2231,16 @@ static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2200 spec->autocfg.speaker_pins[2] = 0x17; 2231 spec->autocfg.speaker_pins[2] = 0x17;
2201} 2232}
2202 2233
2234static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2235{
2236 struct alc_spec *spec = codec->spec;
2237
2238 spec->autocfg.hp_pins[0] = 0x15;
2239 spec->autocfg.speaker_pins[0] = 0x14;
2240 spec->autocfg.speaker_pins[1] = 0x16;
2241 spec->autocfg.speaker_pins[2] = 0x17;
2242}
2243
2203static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) 2244static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2204{ 2245{
2205 struct alc_spec *spec = codec->spec; 2246 struct alc_spec *spec = codec->spec;
@@ -4554,6 +4595,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
4554 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), 4595 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4555 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), 4596 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4556 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), 4597 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4598 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4557 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), 4599 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4558 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), 4600 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4559 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), 4601 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
@@ -9524,13 +9566,6 @@ static struct hda_verb alc883_acer_eapd_verbs[] = {
9524 { } 9566 { }
9525}; 9567};
9526 9568
9527static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9528 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9529 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9530 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9531 { } /* end */
9532};
9533
9534static void alc888_6st_dell_setup(struct hda_codec *codec) 9569static void alc888_6st_dell_setup(struct hda_codec *codec)
9535{ 9570{
9536 struct alc_spec *spec = codec->spec; 9571 struct alc_spec *spec = codec->spec;
@@ -9831,7 +9866,6 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
9831 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), 9866 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9832 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), 9867 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9833 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), 9868 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9834 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9835 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), 9869 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9836 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), 9870 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9837 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), 9871 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
@@ -10328,7 +10362,7 @@ static struct alc_config_preset alc882_presets[] = {
10328 .const_channel_count = 6, 10362 .const_channel_count = 6,
10329 .input_mux = &alc883_capture_source, 10363 .input_mux = &alc883_capture_source,
10330 .unsol_event = alc_automute_amp_unsol_event, 10364 .unsol_event = alc_automute_amp_unsol_event,
10331 .setup = alc888_acer_aspire_6530g_setup, 10365 .setup = alc888_acer_aspire_7730g_setup,
10332 .init_hook = alc_automute_amp, 10366 .init_hook = alc_automute_amp,
10333 }, 10367 },
10334 [ALC883_MEDION] = { 10368 [ALC883_MEDION] = {
@@ -10796,7 +10830,8 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10796{ 10830{
10797 struct alc_spec *spec = codec->spec; 10831 struct alc_spec *spec = codec->spec;
10798 struct auto_pin_cfg *cfg = &spec->autocfg; 10832 struct auto_pin_cfg *cfg = &spec->autocfg;
10799 int i, err; 10833 int i, err, type;
10834 int type_idx = 0;
10800 hda_nid_t nid; 10835 hda_nid_t nid;
10801 10836
10802 for (i = 0; i < cfg->num_inputs; i++) { 10837 for (i = 0; i < cfg->num_inputs; i++) {
@@ -10805,9 +10840,15 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10805 nid = cfg->inputs[i].pin; 10840 nid = cfg->inputs[i].pin;
10806 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { 10841 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10807 char label[32]; 10842 char label[32];
10843 type = cfg->inputs[i].type;
10844 if (i > 0 && type == cfg->inputs[i - 1].type)
10845 type_idx++;
10846 else
10847 type_idx = 0;
10808 snprintf(label, sizeof(label), "%s Boost", 10848 snprintf(label, sizeof(label), "%s Boost",
10809 hda_get_autocfg_input_label(codec, cfg, i)); 10849 hda_get_autocfg_input_label(codec, cfg, i));
10810 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, 10850 err = add_control(spec, ALC_CTL_WIDGET_VOL, label,
10851 type_idx,
10811 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); 10852 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10812 if (err < 0) 10853 if (err < 0)
10813 return err; 10854 return err;
@@ -14623,7 +14664,10 @@ static int alc275_setup_dual_adc(struct hda_codec *codec)
14623/* different alc269-variants */ 14664/* different alc269-variants */
14624enum { 14665enum {
14625 ALC269_TYPE_NORMAL, 14666 ALC269_TYPE_NORMAL,
14667 ALC269_TYPE_ALC258,
14626 ALC269_TYPE_ALC259, 14668 ALC269_TYPE_ALC259,
14669 ALC269_TYPE_ALC269VB,
14670 ALC269_TYPE_ALC270,
14627 ALC269_TYPE_ALC271X, 14671 ALC269_TYPE_ALC271X,
14628}; 14672};
14629 14673
@@ -14763,6 +14807,8 @@ static int alc269_resume(struct hda_codec *codec)
14763enum { 14807enum {
14764 ALC269_FIXUP_SONY_VAIO, 14808 ALC269_FIXUP_SONY_VAIO,
14765 ALC269_FIXUP_DELL_M101Z, 14809 ALC269_FIXUP_DELL_M101Z,
14810 ALC269_FIXUP_LENOVO_EDGE14,
14811 ALC269_FIXUP_ASUS_G73JW,
14766}; 14812};
14767 14813
14768static const struct alc_fixup alc269_fixups[] = { 14814static const struct alc_fixup alc269_fixups[] = {
@@ -14780,11 +14826,22 @@ static const struct alc_fixup alc269_fixups[] = {
14780 {} 14826 {}
14781 } 14827 }
14782 }, 14828 },
14829 [ALC269_FIXUP_LENOVO_EDGE14] = {
14830 .sku = ALC_FIXUP_SKU_IGNORE,
14831 },
14832 [ALC269_FIXUP_ASUS_G73JW] = {
14833 .pins = (const struct alc_pincfg[]) {
14834 { 0x17, 0x99130111 }, /* subwoofer */
14835 { }
14836 }
14837 },
14783}; 14838};
14784 14839
14785static struct snd_pci_quirk alc269_fixup_tbl[] = { 14840static struct snd_pci_quirk alc269_fixup_tbl[] = {
14786 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14841 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14787 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 14842 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14843 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_LENOVO_EDGE14),
14844 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14788 {} 14845 {}
14789}; 14846};
14790 14847
@@ -15023,7 +15080,7 @@ static int alc269_fill_coef(struct hda_codec *codec)
15023static int patch_alc269(struct hda_codec *codec) 15080static int patch_alc269(struct hda_codec *codec)
15024{ 15081{
15025 struct alc_spec *spec; 15082 struct alc_spec *spec;
15026 int board_config; 15083 int board_config, coef;
15027 int err; 15084 int err;
15028 15085
15029 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 15086 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -15034,14 +15091,23 @@ static int patch_alc269(struct hda_codec *codec)
15034 15091
15035 alc_auto_parse_customize_define(codec); 15092 alc_auto_parse_customize_define(codec);
15036 15093
15037 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ 15094 coef = alc_read_coef_idx(codec, 0);
15095 if ((coef & 0x00f0) == 0x0010) {
15038 if (codec->bus->pci->subsystem_vendor == 0x1025 && 15096 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15039 spec->cdefine.platform_type == 1) { 15097 spec->cdefine.platform_type == 1) {
15040 alc_codec_rename(codec, "ALC271X"); 15098 alc_codec_rename(codec, "ALC271X");
15041 spec->codec_variant = ALC269_TYPE_ALC271X; 15099 spec->codec_variant = ALC269_TYPE_ALC271X;
15042 } else { 15100 } else if ((coef & 0xf000) == 0x1000) {
15101 spec->codec_variant = ALC269_TYPE_ALC270;
15102 } else if ((coef & 0xf000) == 0x2000) {
15043 alc_codec_rename(codec, "ALC259"); 15103 alc_codec_rename(codec, "ALC259");
15044 spec->codec_variant = ALC269_TYPE_ALC259; 15104 spec->codec_variant = ALC269_TYPE_ALC259;
15105 } else if ((coef & 0xf000) == 0x3000) {
15106 alc_codec_rename(codec, "ALC258");
15107 spec->codec_variant = ALC269_TYPE_ALC258;
15108 } else {
15109 alc_codec_rename(codec, "ALC269VB");
15110 spec->codec_variant = ALC269_TYPE_ALC269VB;
15045 } 15111 }
15046 } else 15112 } else
15047 alc_fix_pll_init(codec, 0x20, 0x04, 15); 15113 alc_fix_pll_init(codec, 0x20, 0x04, 15);
@@ -15104,7 +15170,7 @@ static int patch_alc269(struct hda_codec *codec)
15104 spec->stream_digital_capture = &alc269_pcm_digital_capture; 15170 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15105 15171
15106 if (!spec->adc_nids) { /* wasn't filled automatically? use default */ 15172 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15107 if (spec->codec_variant != ALC269_TYPE_NORMAL) { 15173 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15108 spec->adc_nids = alc269_adc_nids; 15174 spec->adc_nids = alc269_adc_nids;
15109 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); 15175 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15110 spec->capsrc_nids = alc269_capsrc_nids; 15176 spec->capsrc_nids = alc269_capsrc_nids;
@@ -16898,7 +16964,7 @@ static struct alc_config_preset alc861vd_presets[] = {
16898static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, 16964static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16899 const struct auto_pin_cfg *cfg) 16965 const struct auto_pin_cfg *cfg)
16900{ 16966{
16901 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); 16967 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
16902} 16968}
16903 16969
16904 16970
@@ -18952,6 +19018,8 @@ static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18952 return 0x02; 19018 return 0x02;
18953 else if (nid >= 0x0c && nid <= 0x0e) 19019 else if (nid >= 0x0c && nid <= 0x0e)
18954 return nid - 0x0c + 0x02; 19020 return nid - 0x0c + 0x02;
19021 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19022 return 0x25;
18955 else 19023 else
18956 return 0; 19024 return 0;
18957} 19025}
@@ -18960,7 +19028,7 @@ static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18960static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, 19028static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18961 hda_nid_t dac) 19029 hda_nid_t dac)
18962{ 19030{
18963 hda_nid_t mix[4]; 19031 hda_nid_t mix[5];
18964 int i, num; 19032 int i, num;
18965 19033
18966 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); 19034 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
@@ -19298,6 +19366,7 @@ static const struct alc_fixup alc662_fixups[] = {
19298 19366
19299static struct snd_pci_quirk alc662_fixup_tbl[] = { 19367static struct snd_pci_quirk alc662_fixup_tbl[] = {
19300 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), 19368 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19369 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19301 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 19370 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19302 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 19371 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19303 {} 19372 {}
@@ -19419,7 +19488,10 @@ static int patch_alc888(struct hda_codec *codec)
19419{ 19488{
19420 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ 19489 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19421 kfree(codec->chip_name); 19490 kfree(codec->chip_name);
19422 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); 19491 if (codec->vendor_id == 0x10ec0887)
19492 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19493 else
19494 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19423 if (!codec->chip_name) { 19495 if (!codec->chip_name) {
19424 alc_free(codec); 19496 alc_free(codec);
19425 return -ENOMEM; 19497 return -ENOMEM;
@@ -19909,7 +19981,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
19909 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", 19981 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19910 .patch = patch_alc882 }, 19982 .patch = patch_alc882 },
19911 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 19983 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19912 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, 19984 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
19913 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", 19985 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19914 .patch = patch_alc882 }, 19986 .patch = patch_alc882 },
19915 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, 19987 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 93fa59cc60ef..efa4225f5fd6 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -389,6 +389,11 @@ static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
389 0x11, 0x20, 0 389 0x11, 0x20, 0
390}; 390};
391 391
392#define STAC92HD87B_NUM_DMICS 1
393static hda_nid_t stac92hd87b_dmic_nids[STAC92HD87B_NUM_DMICS + 1] = {
394 0x11, 0
395};
396
392#define STAC92HD83XXX_NUM_CAPS 2 397#define STAC92HD83XXX_NUM_CAPS 2
393static unsigned long stac92hd83xxx_capvols[] = { 398static unsigned long stac92hd83xxx_capvols[] = {
394 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), 399 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
@@ -1622,6 +1627,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1622static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { 1627static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1623 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, 1628 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1624 "Alienware M17x", STAC_ALIENWARE_M17X), 1629 "Alienware M17x", STAC_ALIENWARE_M17X),
1630 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1631 "Alienware M17x", STAC_ALIENWARE_M17X),
1625 {} /* terminator */ 1632 {} /* terminator */
1626}; 1633};
1627 1634
@@ -3486,10 +3493,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3486 return err; 3493 return err;
3487 } 3494 }
3488 3495
3489 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { 3496 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1)
3490 snd_hda_add_imux_item(imux, label, index, NULL); 3497 snd_hda_add_imux_item(imux, label, index, NULL);
3491 spec->num_analog_muxes++;
3492 }
3493 } 3498 }
3494 3499
3495 return 0; 3500 return 0;
@@ -5452,12 +5457,17 @@ again:
5452 stac92hd83xxx_brd_tbl[spec->board_config]); 5457 stac92hd83xxx_brd_tbl[spec->board_config]);
5453 5458
5454 switch (codec->vendor_id) { 5459 switch (codec->vendor_id) {
5460 case 0x111d76d1:
5461 case 0x111d76d9:
5462 spec->dmic_nids = stac92hd87b_dmic_nids;
5463 spec->num_dmics = stac92xx_connected_ports(codec,
5464 stac92hd87b_dmic_nids,
5465 STAC92HD87B_NUM_DMICS);
5466 /* Fall through */
5455 case 0x111d7666: 5467 case 0x111d7666:
5456 case 0x111d7667: 5468 case 0x111d7667:
5457 case 0x111d7668: 5469 case 0x111d7668:
5458 case 0x111d7669: 5470 case 0x111d7669:
5459 case 0x111d76d1:
5460 case 0x111d76d9:
5461 spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); 5471 spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids);
5462 spec->pin_nids = stac92hd88xxx_pin_nids; 5472 spec->pin_nids = stac92hd88xxx_pin_nids;
5463 spec->mono_nid = 0; 5473 spec->mono_nid = 0;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 400f9ebd243e..629a5494347a 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1866,6 +1866,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1866 }, 1866 },
1867 { 1867 {
1868 .subvendor = 0x1028, 1868 .subvendor = 0x1028,
1869 .subdevice = 0x0182,
1870 .name = "Dell Latitude D610", /* STAC9750/51 */
1871 .type = AC97_TUNE_HP_ONLY
1872 },
1873 {
1874 .subvendor = 0x1028,
1869 .subdevice = 0x0186, 1875 .subdevice = 0x0186,
1870 .name = "Dell Latitude D810", /* cf. Malone #41015 */ 1876 .name = "Dell Latitude D810", /* cf. Malone #41015 */
1871 .type = AC97_TUNE_HP_MUTE_LED 1877 .type = AC97_TUNE_HP_MUTE_LED
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index ef9af3f4ace2..1bd7a540fd49 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -425,7 +425,7 @@ exit:
425static void lx_trigger_start(struct lx6464es *chip, struct lx_stream *lx_stream) 425static void lx_trigger_start(struct lx6464es *chip, struct lx_stream *lx_stream)
426{ 426{
427 struct snd_pcm_substream *substream = lx_stream->stream; 427 struct snd_pcm_substream *substream = lx_stream->stream;
428 const int is_capture = lx_stream->is_capture; 428 const unsigned int is_capture = lx_stream->is_capture;
429 429
430 int err; 430 int err;
431 431
@@ -473,7 +473,7 @@ static void lx_trigger_start(struct lx6464es *chip, struct lx_stream *lx_stream)
473 473
474static void lx_trigger_stop(struct lx6464es *chip, struct lx_stream *lx_stream) 474static void lx_trigger_stop(struct lx6464es *chip, struct lx_stream *lx_stream)
475{ 475{
476 const int is_capture = lx_stream->is_capture; 476 const unsigned int is_capture = lx_stream->is_capture;
477 int err; 477 int err;
478 478
479 snd_printd(LXP "stopping: stopping stream\n"); 479 snd_printd(LXP "stopping: stopping stream\n");
diff --git a/sound/pci/lx6464es/lx6464es.h b/sound/pci/lx6464es/lx6464es.h
index 51afc048961d..aea621eafbb5 100644
--- a/sound/pci/lx6464es/lx6464es.h
+++ b/sound/pci/lx6464es/lx6464es.h
@@ -60,7 +60,7 @@ struct lx_stream {
60 snd_pcm_uframes_t frame_pos; 60 snd_pcm_uframes_t frame_pos;
61 enum lx_stream_status status; /* free, open, running, draining 61 enum lx_stream_status status; /* free, open, running, draining
62 * pause */ 62 * pause */
63 int is_capture:1; 63 unsigned int is_capture:1;
64}; 64};
65 65
66 66
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c
index 3086b751da4a..617f98b0cbae 100644
--- a/sound/pci/lx6464es/lx_core.c
+++ b/sound/pci/lx6464es/lx_core.c
@@ -1152,7 +1152,7 @@ static int lx_interrupt_request_new_buffer(struct lx6464es *chip,
1152 struct lx_stream *lx_stream) 1152 struct lx_stream *lx_stream)
1153{ 1153{
1154 struct snd_pcm_substream *substream = lx_stream->stream; 1154 struct snd_pcm_substream *substream = lx_stream->stream;
1155 int is_capture = lx_stream->is_capture; 1155 const unsigned int is_capture = lx_stream->is_capture;
1156 int err; 1156 int err;
1157 unsigned long flags; 1157 unsigned long flags;
1158 1158
diff --git a/sound/pci/mixart/mixart_hwdep.h b/sound/pci/mixart/mixart_hwdep.h
index a46f5083db99..812e288ef2e7 100644
--- a/sound/pci/mixart/mixart_hwdep.h
+++ b/sound/pci/mixart/mixart_hwdep.h
@@ -25,11 +25,21 @@
25 25
26#include <sound/hwdep.h> 26#include <sound/hwdep.h>
27 27
28#ifndef readl_be
28#define readl_be(x) be32_to_cpu(__raw_readl(x)) 29#define readl_be(x) be32_to_cpu(__raw_readl(x))
30#endif
31
32#ifndef writel_be
29#define writel_be(data,addr) __raw_writel(cpu_to_be32(data),addr) 33#define writel_be(data,addr) __raw_writel(cpu_to_be32(data),addr)
34#endif
30 35
36#ifndef readl_le
31#define readl_le(x) le32_to_cpu(__raw_readl(x)) 37#define readl_le(x) le32_to_cpu(__raw_readl(x))
38#endif
39
40#ifndef writel_le
32#define writel_le(data,addr) __raw_writel(cpu_to_le32(data),addr) 41#define writel_le(data,addr) __raw_writel(cpu_to_le32(data),addr)
42#endif
33 43
34#define MIXART_MEM(mgr,x) ((mgr)->mem[0].virt + (x)) 44#define MIXART_MEM(mgr,x) ((mgr)->mem[0].virt + (x))
35#define MIXART_REG(mgr,x) ((mgr)->mem[1].virt + (x)) 45#define MIXART_REG(mgr,x) ((mgr)->mem[1].virt + (x))
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 85081172403f..b47cfd45b3b9 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -1228,10 +1228,8 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1228 chip->rsrc[i].start + 1, 1228 chip->rsrc[i].start + 1,
1229 rnames[i]) == NULL) { 1229 rnames[i]) == NULL) {
1230 printk(KERN_ERR "snd: can't request rsrc " 1230 printk(KERN_ERR "snd: can't request rsrc "
1231 " %d (%s: 0x%016llx:%016llx)\n", 1231 " %d (%s: %pR)\n",
1232 i, rnames[i], 1232 i, rnames[i], &chip->rsrc[i]);
1233 (unsigned long long)chip->rsrc[i].start,
1234 (unsigned long long)chip->rsrc[i].end);
1235 err = -ENODEV; 1233 err = -ENODEV;
1236 goto __error; 1234 goto __error;
1237 } 1235 }
@@ -1256,10 +1254,8 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1256 chip->rsrc[i].start + 1, 1254 chip->rsrc[i].start + 1,
1257 rnames[i]) == NULL) { 1255 rnames[i]) == NULL) {
1258 printk(KERN_ERR "snd: can't request rsrc " 1256 printk(KERN_ERR "snd: can't request rsrc "
1259 " %d (%s: 0x%016llx:%016llx)\n", 1257 " %d (%s: %pR)\n",
1260 i, rnames[i], 1258 i, rnames[i], &chip->rsrc[i]);
1261 (unsigned long long)chip->rsrc[i].start,
1262 (unsigned long long)chip->rsrc[i].end);
1263 err = -ENODEV; 1259 err = -ENODEV;
1264 goto __error; 1260 goto __error;
1265 } 1261 }
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index e720d5e6f04c..bee3c94f58b0 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -16,7 +16,8 @@ config SND_ATMEL_SOC_SSC
16 16
17config SND_AT91_SOC_SAM9G20_WM8731 17config SND_AT91_SOC_SAM9G20_WM8731
18 tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" 18 tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
19 depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC 19 depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC && \
20 AT91_PROGRAMMABLE_CLOCKS
20 select SND_ATMEL_SOC_SSC 21 select SND_ATMEL_SOC_SSC
21 select SND_SOC_WM8731 22 select SND_SOC_WM8731
22 help 23 help
@@ -25,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731
25 26
26config SND_AT32_SOC_PLAYPAQ 27config SND_AT32_SOC_PLAYPAQ
27 tristate "SoC Audio support for PlayPaq with WM8510" 28 tristate "SoC Audio support for PlayPaq with WM8510"
28 depends on SND_ATMEL_SOC && BOARD_PLAYPAQ 29 depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS
29 select SND_ATMEL_SOC_SSC 30 select SND_ATMEL_SOC_SSC
30 select SND_SOC_WM8510 31 select SND_SOC_WM8510
31 help 32 help
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 293569dfd0ed..e521ada80542 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -222,9 +222,9 @@ static int __init at91sam9g20ek_init(void)
222 } 222 }
223 223
224 pllb = clk_get(NULL, "pllb"); 224 pllb = clk_get(NULL, "pllb");
225 if (IS_ERR(mclk)) { 225 if (IS_ERR(pllb)) {
226 printk(KERN_ERR "ASoC: Failed to get PLLB\n"); 226 printk(KERN_ERR "ASoC: Failed to get PLLB\n");
227 ret = PTR_ERR(mclk); 227 ret = PTR_ERR(pllb);
228 goto err_mclk; 228 goto err_mclk;
229 } 229 }
230 ret = clk_set_parent(mclk, pllb); 230 ret = clk_set_parent(mclk, pllb);
@@ -240,6 +240,7 @@ static int __init at91sam9g20ek_init(void)
240 if (!at91sam9g20ek_snd_device) { 240 if (!at91sam9g20ek_snd_device) {
241 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 241 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
242 ret = -ENOMEM; 242 ret = -ENOMEM;
243 goto err_mclk;
243 } 244 }
244 245
245 platform_set_drvdata(at91sam9g20ek_snd_device, 246 platform_set_drvdata(at91sam9g20ek_snd_device,
@@ -248,11 +249,13 @@ static int __init at91sam9g20ek_init(void)
248 ret = platform_device_add(at91sam9g20ek_snd_device); 249 ret = platform_device_add(at91sam9g20ek_snd_device);
249 if (ret) { 250 if (ret) {
250 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 251 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
251 platform_device_put(at91sam9g20ek_snd_device); 252 goto err_device_add;
252 } 253 }
253 254
254 return ret; 255 return ret;
255 256
257err_device_add:
258 platform_device_put(at91sam9g20ek_snd_device);
256err_mclk: 259err_mclk:
257 clk_put(mclk); 260 clk_put(mclk);
258 mclk = NULL; 261 mclk = NULL;
diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c
index e3d283561c19..86e0f8586dc3 100644
--- a/sound/soc/atmel/snd-soc-afeb9260.c
+++ b/sound/soc/atmel/snd-soc-afeb9260.c
@@ -167,7 +167,6 @@ static int __init afeb9260_soc_init(void)
167 167
168 return 0; 168 return 0;
169err1: 169err1:
170 platform_device_del(afeb9260_snd_device);
171 platform_device_put(afeb9260_snd_device); 170 platform_device_put(afeb9260_snd_device);
172 return err; 171 return err;
173} 172}
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 94a9d06b9027..3b5690d28b8b 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -25,8 +25,9 @@ config SND_SOC_ALL_CODECS
25 select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC 25 select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
26 select SND_SOC_CS42L51 if I2C 26 select SND_SOC_CS42L51 if I2C
27 select SND_SOC_CS4270 if I2C 27 select SND_SOC_CS4270 if I2C
28 select SND_SOC_CX20442
28 select SND_SOC_DA7210 if I2C 29 select SND_SOC_DA7210 if I2C
29 select SND_SOC_JZ4740 if SOC_JZ4740 30 select SND_SOC_JZ4740_CODEC if SOC_JZ4740
30 select SND_SOC_MAX98088 if I2C 31 select SND_SOC_MAX98088 if I2C
31 select SND_SOC_MAX9877 if I2C 32 select SND_SOC_MAX9877 if I2C
32 select SND_SOC_PCM3008 33 select SND_SOC_PCM3008
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 43316a70be05..5182e76e7eb3 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -28,6 +28,11 @@
28#include <sound/max98088.h> 28#include <sound/max98088.h>
29#include "max98088.h" 29#include "max98088.h"
30 30
31enum max98088_type {
32 MAX98088,
33 MAX98089,
34};
35
31struct max98088_cdata { 36struct max98088_cdata {
32 unsigned int rate; 37 unsigned int rate;
33 unsigned int fmt; 38 unsigned int fmt;
@@ -36,6 +41,7 @@ struct max98088_cdata {
36 41
37struct max98088_priv { 42struct max98088_priv {
38 u8 reg_cache[M98088_REG_CNT]; 43 u8 reg_cache[M98088_REG_CNT];
44 enum max98088_type devtype;
39 void *control_data; 45 void *control_data;
40 struct max98088_pdata *pdata; 46 struct max98088_pdata *pdata;
41 unsigned int sysclk; 47 unsigned int sysclk;
@@ -2013,7 +2019,10 @@ err_access:
2013 2019
2014static int max98088_remove(struct snd_soc_codec *codec) 2020static int max98088_remove(struct snd_soc_codec *codec)
2015{ 2021{
2022 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
2023
2016 max98088_set_bias_level(codec, SND_SOC_BIAS_OFF); 2024 max98088_set_bias_level(codec, SND_SOC_BIAS_OFF);
2025 kfree(max98088->eq_texts);
2017 2026
2018 return 0; 2027 return 0;
2019} 2028}
@@ -2040,6 +2049,8 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
2040 if (max98088 == NULL) 2049 if (max98088 == NULL)
2041 return -ENOMEM; 2050 return -ENOMEM;
2042 2051
2052 max98088->devtype = id->driver_data;
2053
2043 i2c_set_clientdata(i2c, max98088); 2054 i2c_set_clientdata(i2c, max98088);
2044 max98088->control_data = i2c; 2055 max98088->control_data = i2c;
2045 max98088->pdata = i2c->dev.platform_data; 2056 max98088->pdata = i2c->dev.platform_data;
@@ -2059,7 +2070,8 @@ static int __devexit max98088_i2c_remove(struct i2c_client *client)
2059} 2070}
2060 2071
2061static const struct i2c_device_id max98088_i2c_id[] = { 2072static const struct i2c_device_id max98088_i2c_id[] = {
2062 { "max98088", 0 }, 2073 { "max98088", MAX98088 },
2074 { "max98089", MAX98089 },
2063 { } 2075 { }
2064}; 2076};
2065MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); 2077MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 00d67cc8e206..061f9e5a497b 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -383,6 +383,7 @@ static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
383 .reg_cache_size = sizeof(stac9766_reg), 383 .reg_cache_size = sizeof(stac9766_reg),
384 .reg_word_size = sizeof(u16), 384 .reg_word_size = sizeof(u16),
385 .reg_cache_step = 2, 385 .reg_cache_step = 2,
386 .reg_cache_default = stac9766_reg,
386}; 387};
387 388
388static __devinit int stac9766_probe(struct platform_device *pdev) 389static __devinit int stac9766_probe(struct platform_device *pdev)
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index fc687790188b..77b8f9ae29be 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1176,7 +1176,7 @@ EXPORT_SYMBOL_GPL(aic3x_set_gpio);
1176int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio) 1176int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio)
1177{ 1177{
1178 u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG; 1178 u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG;
1179 u8 val, bit = gpio ? 2: 1; 1179 u8 val = 0, bit = gpio ? 2 : 1;
1180 1180
1181 aic3x_read(codec, reg, &val); 1181 aic3x_read(codec, reg, &val);
1182 return (val >> bit) & 1; 1182 return (val >> bit) & 1;
@@ -1204,7 +1204,7 @@ EXPORT_SYMBOL_GPL(aic3x_set_headset_detection);
1204 1204
1205int aic3x_headset_detected(struct snd_soc_codec *codec) 1205int aic3x_headset_detected(struct snd_soc_codec *codec)
1206{ 1206{
1207 u8 val; 1207 u8 val = 0;
1208 aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); 1208 aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val);
1209 return (val >> 4) & 1; 1209 return (val >> 4) & 1;
1210} 1210}
@@ -1212,7 +1212,7 @@ EXPORT_SYMBOL_GPL(aic3x_headset_detected);
1212 1212
1213int aic3x_button_pressed(struct snd_soc_codec *codec) 1213int aic3x_button_pressed(struct snd_soc_codec *codec)
1214{ 1214{
1215 u8 val; 1215 u8 val = 0;
1216 aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); 1216 aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val);
1217 return (val >> 5) & 1; 1217 return (val >> 5) & 1;
1218} 1218}
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index d251ff54a2d3..c5ab8c805771 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -58,7 +58,7 @@
58 (1000000000 / ((rate * 1000) / samples)) 58 (1000000000 / ((rate * 1000) / samples))
59 59
60#define US_TO_SAMPLES(rate, us) \ 60#define US_TO_SAMPLES(rate, us) \
61 (rate / (1000000 / us)) 61 (rate / (1000000 / (us < 1000000 ? us : 1000000)))
62 62
63#define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \ 63#define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \
64 ((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate))) 64 ((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate)))
@@ -200,7 +200,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
200 u8 *value) 200 u8 *value)
201{ 201{
202 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); 202 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
203 int val; 203 int val, ret = 0;
204 204
205 *value = reg & 0xff; 205 *value = reg & 0xff;
206 206
@@ -210,6 +210,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
210 if (val < 0) { 210 if (val < 0) {
211 dev_err(codec->dev, "Read failed (%d)\n", val); 211 dev_err(codec->dev, "Read failed (%d)\n", val);
212 value[0] = dac33_read_reg_cache(codec, reg); 212 value[0] = dac33_read_reg_cache(codec, reg);
213 ret = val;
213 } else { 214 } else {
214 value[0] = val; 215 value[0] = val;
215 dac33_write_reg_cache(codec, reg, val); 216 dac33_write_reg_cache(codec, reg, val);
@@ -218,7 +219,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
218 value[0] = dac33_read_reg_cache(codec, reg); 219 value[0] = dac33_read_reg_cache(codec, reg);
219 } 220 }
220 221
221 return 0; 222 return ret;
222} 223}
223 224
224static int dac33_write(struct snd_soc_codec *codec, unsigned int reg, 225static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
@@ -329,13 +330,18 @@ static void dac33_init_chip(struct snd_soc_codec *codec)
329 dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL)); 330 dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL));
330} 331}
331 332
332static inline void dac33_read_id(struct snd_soc_codec *codec) 333static inline int dac33_read_id(struct snd_soc_codec *codec)
333{ 334{
335 int i, ret = 0;
334 u8 reg; 336 u8 reg;
335 337
336 dac33_read(codec, DAC33_DEVICE_ID_MSB, &reg); 338 for (i = 0; i < 3; i++) {
337 dac33_read(codec, DAC33_DEVICE_ID_LSB, &reg); 339 ret = dac33_read(codec, DAC33_DEVICE_ID_MSB + i, &reg);
338 dac33_read(codec, DAC33_DEVICE_REV_ID, &reg); 340 if (ret < 0)
341 break;
342 }
343
344 return ret;
339} 345}
340 346
341static inline void dac33_soft_power(struct snd_soc_codec *codec, int power) 347static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
@@ -1076,6 +1082,9 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
1076 /* Number of samples under i2c latency */ 1082 /* Number of samples under i2c latency */
1077 dac33->alarm_threshold = US_TO_SAMPLES(rate, 1083 dac33->alarm_threshold = US_TO_SAMPLES(rate,
1078 dac33->mode1_latency); 1084 dac33->mode1_latency);
1085 nsample_limit = DAC33_BUFFER_SIZE_SAMPLES -
1086 dac33->alarm_threshold;
1087
1079 if (dac33->auto_fifo_config) { 1088 if (dac33->auto_fifo_config) {
1080 if (period_size <= dac33->alarm_threshold) 1089 if (period_size <= dac33->alarm_threshold)
1081 /* 1090 /*
@@ -1086,6 +1095,8 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
1086 ((dac33->alarm_threshold / period_size) + 1095 ((dac33->alarm_threshold / period_size) +
1087 (dac33->alarm_threshold % period_size ? 1096 (dac33->alarm_threshold % period_size ?
1088 1 : 0)); 1097 1 : 0));
1098 else if (period_size > nsample_limit)
1099 dac33->nsample = nsample_limit;
1089 else 1100 else
1090 dac33->nsample = period_size; 1101 dac33->nsample = period_size;
1091 } else { 1102 } else {
@@ -1097,8 +1108,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
1097 */ 1108 */
1098 dac33->nsample_max = substream->runtime->buffer_size - 1109 dac33->nsample_max = substream->runtime->buffer_size -
1099 period_size; 1110 period_size;
1100 nsample_limit = DAC33_BUFFER_SIZE_SAMPLES - 1111
1101 dac33->alarm_threshold;
1102 if (dac33->nsample_max > nsample_limit) 1112 if (dac33->nsample_max > nsample_limit)
1103 dac33->nsample_max = nsample_limit; 1113 dac33->nsample_max = nsample_limit;
1104 1114
@@ -1414,9 +1424,15 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
1414 dev_err(codec->dev, "Failed to power up codec: %d\n", ret); 1424 dev_err(codec->dev, "Failed to power up codec: %d\n", ret);
1415 goto err_power; 1425 goto err_power;
1416 } 1426 }
1417 dac33_read_id(codec); 1427 ret = dac33_read_id(codec);
1418 dac33_hard_power(codec, 0); 1428 dac33_hard_power(codec, 0);
1419 1429
1430 if (ret < 0) {
1431 dev_err(codec->dev, "Failed to read chip ID: %d\n", ret);
1432 ret = -ENODEV;
1433 goto err_power;
1434 }
1435
1420 /* Check if the IRQ number is valid and request it */ 1436 /* Check if the IRQ number is valid and request it */
1421 if (dac33->irq >= 0) { 1437 if (dac33->irq >= 0) {
1422 ret = request_irq(dac33->irq, dac33_interrupt_handler, 1438 ret = request_irq(dac33->irq, dac33_interrupt_handler,
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 329acc1a2074..d2c243095673 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -78,8 +78,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value)
78 78
79 if (data->power_state) { 79 if (data->power_state) {
80 val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value); 80 val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value);
81 if (val < 0) 81 if (val < 0) {
82 dev_err(&tpa6130a2_client->dev, "Write failed\n"); 82 dev_err(&tpa6130a2_client->dev, "Write failed\n");
83 return val;
84 }
83 } 85 }
84 86
85 /* Either powered on or off, we save the context */ 87 /* Either powered on or off, we save the context */
@@ -119,13 +121,13 @@ static int tpa6130a2_power(int power)
119{ 121{
120 struct tpa6130a2_data *data; 122 struct tpa6130a2_data *data;
121 u8 val; 123 u8 val;
122 int ret; 124 int ret = 0;
123 125
124 BUG_ON(tpa6130a2_client == NULL); 126 BUG_ON(tpa6130a2_client == NULL);
125 data = i2c_get_clientdata(tpa6130a2_client); 127 data = i2c_get_clientdata(tpa6130a2_client);
126 128
127 mutex_lock(&data->mutex); 129 mutex_lock(&data->mutex);
128 if (power) { 130 if (power && !data->power_state) {
129 /* Power on */ 131 /* Power on */
130 if (data->power_gpio >= 0) 132 if (data->power_gpio >= 0)
131 gpio_set_value(data->power_gpio, 1); 133 gpio_set_value(data->power_gpio, 1);
@@ -153,7 +155,7 @@ static int tpa6130a2_power(int power)
153 val = tpa6130a2_read(TPA6130A2_REG_CONTROL); 155 val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
154 val &= ~TPA6130A2_SWS; 156 val &= ~TPA6130A2_SWS;
155 tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val); 157 tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
156 } else { 158 } else if (!power && data->power_state) {
157 /* set SWS */ 159 /* set SWS */
158 val = tpa6130a2_read(TPA6130A2_REG_CONTROL); 160 val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
159 val |= TPA6130A2_SWS; 161 val |= TPA6130A2_SWS;
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 7540a509a6f5..464f0cfa4c7a 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -597,6 +597,7 @@ static struct snd_soc_codec_driver soc_codec_dev_uda134x = {
597 .resume = uda134x_soc_resume, 597 .resume = uda134x_soc_resume,
598 .reg_cache_size = sizeof(uda134x_reg), 598 .reg_cache_size = sizeof(uda134x_reg),
599 .reg_word_size = sizeof(u8), 599 .reg_word_size = sizeof(u8),
600 .reg_cache_default = uda134x_reg,
600 .reg_cache_step = 1, 601 .reg_cache_step = 1,
601 .read = uda134x_read_reg_cache, 602 .read = uda134x_read_reg_cache,
602 .write = uda134x_write, 603 .write = uda134x_write,
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index f4f1fba38eb9..7611add7f8c3 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -831,7 +831,7 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
831 } 831 }
832 832
833 /* MCLK direction */ 833 /* MCLK direction */
834 if (dir == WM8350_MCLK_DIR_OUT) 834 if (dir == SND_SOC_CLOCK_OUT)
835 wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2, 835 wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2,
836 WM8350_MCLK_DIR); 836 WM8350_MCLK_DIR);
837 else 837 else
@@ -1586,6 +1586,13 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1586 wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, 1586 wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME,
1587 WM8350_OUT2_VU | WM8350_OUT2R_MUTE); 1587 WM8350_OUT2_VU | WM8350_OUT2R_MUTE);
1588 1588
1589 /* Make sure AIF tristating is disabled by default */
1590 wm8350_clear_bits(wm8350, WM8350_AI_FORMATING, WM8350_AIF_TRI);
1591
1592 /* Make sure we've got a sane companding setup too */
1593 wm8350_clear_bits(wm8350, WM8350_ADC_DAC_COMP,
1594 WM8350_DAC_COMP | WM8350_LOOPBACK);
1595
1589 /* Make sure jack detect is disabled to start off with */ 1596 /* Make sure jack detect is disabled to start off with */
1590 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, 1597 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
1591 WM8350_JDL_ENA | WM8350_JDR_ENA); 1598 WM8350_JDL_ENA | WM8350_JDR_ENA);
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 712ef7c76f90..9a433a5396cb 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -146,7 +146,6 @@ static int wm8523_startup(struct snd_pcm_substream *substream,
146 return -EINVAL; 146 return -EINVAL;
147 } 147 }
148 148
149 return 0;
150 snd_pcm_hw_constraint_list(substream->runtime, 0, 149 snd_pcm_hw_constraint_list(substream->runtime, 0,
151 SNDRV_PCM_HW_PARAM_RATE, 150 SNDRV_PCM_HW_PARAM_RATE,
152 &wm8523->rate_constraint); 151 &wm8523->rate_constraint);
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index a2e0ed59b376..8725d4e75431 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -161,7 +161,7 @@
161static const u16 wm8580_reg[] = { 161static const u16 wm8580_reg[] = {
162 0x0121, 0x017e, 0x007d, 0x0014, /*R3*/ 162 0x0121, 0x017e, 0x007d, 0x0014, /*R3*/
163 0x0121, 0x017e, 0x007d, 0x0194, /*R7*/ 163 0x0121, 0x017e, 0x007d, 0x0194, /*R7*/
164 0x001c, 0x0002, 0x0002, 0x00c2, /*R11*/ 164 0x0010, 0x0002, 0x0002, 0x00c2, /*R11*/
165 0x0182, 0x0082, 0x000a, 0x0024, /*R15*/ 165 0x0182, 0x0082, 0x000a, 0x0024, /*R15*/
166 0x0009, 0x0000, 0x00ff, 0x0000, /*R19*/ 166 0x0009, 0x0000, 0x00ff, 0x0000, /*R19*/
167 0x00ff, 0x00ff, 0x00ff, 0x00ff, /*R23*/ 167 0x00ff, 0x00ff, 0x00ff, 0x00ff, /*R23*/
@@ -491,16 +491,16 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
491 paifa |= 0x8; 491 paifa |= 0x8;
492 break; 492 break;
493 case SNDRV_PCM_FORMAT_S20_3LE: 493 case SNDRV_PCM_FORMAT_S20_3LE:
494 paifa |= 0x10; 494 paifa |= 0x0;
495 paifb |= WM8580_AIF_LENGTH_20; 495 paifb |= WM8580_AIF_LENGTH_20;
496 break; 496 break;
497 case SNDRV_PCM_FORMAT_S24_LE: 497 case SNDRV_PCM_FORMAT_S24_LE:
498 paifa |= 0x10; 498 paifa |= 0x0;
499 paifb |= WM8580_AIF_LENGTH_24; 499 paifb |= WM8580_AIF_LENGTH_24;
500 break; 500 break;
501 case SNDRV_PCM_FORMAT_S32_LE: 501 case SNDRV_PCM_FORMAT_S32_LE:
502 paifa |= 0x10; 502 paifa |= 0x0;
503 paifb |= WM8580_AIF_LENGTH_24; 503 paifb |= WM8580_AIF_LENGTH_32;
504 break; 504 break;
505 default: 505 default:
506 return -EINVAL; 506 return -EINVAL;
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 631385802eb4..e725c09a3e79 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -526,7 +526,7 @@ static int wm8731_probe(struct snd_soc_codec *codec)
526 snd_soc_update_bits(codec, WM8731_RINVOL, 0x100, 0); 526 snd_soc_update_bits(codec, WM8731_RINVOL, 0x100, 0);
527 527
528 /* Disable bypass path by default */ 528 /* Disable bypass path by default */
529 snd_soc_update_bits(codec, WM8731_APANA, 0x4, 0); 529 snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0);
530 530
531 snd_soc_add_controls(codec, wm8731_snd_controls, 531 snd_soc_add_controls(codec, wm8731_snd_controls,
532 ARRAY_SIZE(wm8731_snd_controls)); 532 ARRAY_SIZE(wm8731_snd_controls));
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index 04182c464e35..0132a27140ae 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -34,7 +34,6 @@
34/* codec private data */ 34/* codec private data */
35struct wm8776_priv { 35struct wm8776_priv {
36 enum snd_soc_control_type control_type; 36 enum snd_soc_control_type control_type;
37 u16 reg_cache[WM8776_CACHEREGNUM];
38 int sysclk[2]; 37 int sysclk[2];
39}; 38};
40 39
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index b4f11724a63f..aca4b1ea10bb 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -186,7 +186,6 @@ static int wm8900_volatile_register(unsigned int reg)
186{ 186{
187 switch (reg) { 187 switch (reg) {
188 case WM8900_REG_ID: 188 case WM8900_REG_ID:
189 case WM8900_REG_POWER1:
190 return 1; 189 return 1;
191 default: 190 default:
192 return 0; 191 return 0;
@@ -1200,11 +1199,6 @@ static int wm8900_probe(struct snd_soc_codec *codec)
1200 return -ENODEV; 1199 return -ENODEV;
1201 } 1200 }
1202 1201
1203 /* Read back from the chip */
1204 reg = snd_soc_read(codec, WM8900_REG_POWER1);
1205 reg = (reg >> 12) & 0xf;
1206 dev_info(codec->dev, "WM8900 revision %d\n", reg);
1207
1208 wm8900_reset(codec); 1202 wm8900_reset(codec);
1209 1203
1210 /* Turn the chip on */ 1204 /* Turn the chip on */
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 33be84e506ea..9001cc48ba13 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -818,7 +818,8 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
818 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 818 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
819 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 819 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
820 820
821 return wm8904->deemph; 821 ucontrol->value.enumerated.item[0] = wm8904->deemph;
822 return 0;
822} 823}
823 824
824static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, 825static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
@@ -2498,6 +2499,8 @@ static int wm8904_remove(struct snd_soc_codec *codec)
2498 2499
2499 wm8904_set_bias_level(codec, SND_SOC_BIAS_OFF); 2500 wm8904_set_bias_level(codec, SND_SOC_BIAS_OFF);
2500 regulator_bulk_free(ARRAY_SIZE(wm8904->supplies), wm8904->supplies); 2501 regulator_bulk_free(ARRAY_SIZE(wm8904->supplies), wm8904->supplies);
2502 kfree(wm8904->retune_mobile_texts);
2503 kfree(wm8904->drc_texts);
2501 2504
2502 return 0; 2505 return 0;
2503} 2506}
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index f89ad6c9a80b..9cbab8e1de01 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -380,7 +380,8 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
380 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 380 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
381 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); 381 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
382 382
383 return wm8955->deemph; 383 ucontrol->value.enumerated.item[0] = wm8955->deemph;
384 return 0;
384} 385}
385 386
386static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, 387static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 8d5efb333c33..21986c42272f 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -138,7 +138,8 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol,
138 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 138 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
139 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); 139 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
140 140
141 return wm8960->deemph; 141 ucontrol->value.enumerated.item[0] = wm8960->deemph;
142 return 0;
142} 143}
143 144
144static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, 145static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index 4f326f604104..8340485c9851 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -711,7 +711,7 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream,
711 if (fs <= 24000) 711 if (fs <= 24000)
712 reg |= WM8961_DACSLOPE; 712 reg |= WM8961_DACSLOPE;
713 else 713 else
714 reg &= WM8961_DACSLOPE; 714 reg &= ~WM8961_DACSLOPE;
715 snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); 715 snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg);
716 716
717 return 0; 717 return 0;
@@ -736,7 +736,7 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id,
736 freq /= 2; 736 freq /= 2;
737 } else { 737 } else {
738 dev_dbg(codec->dev, "Using MCLK/1 for %dHz MCLK\n", freq); 738 dev_dbg(codec->dev, "Using MCLK/1 for %dHz MCLK\n", freq);
739 reg &= WM8961_MCLKDIV; 739 reg &= ~WM8961_MCLKDIV;
740 } 740 }
741 741
742 snd_soc_write(codec, WM8961_CLOCKING1, reg); 742 snd_soc_write(codec, WM8961_CLOCKING1, reg);
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 894d0cd3aa9b..1304ca91a11c 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3339,7 +3339,7 @@ static irqreturn_t wm8962_irq(int irq, void *data)
3339 int mask; 3339 int mask;
3340 int active; 3340 int active;
3341 3341
3342 mask = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2); 3342 mask = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2_MASK);
3343 3343
3344 active = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2); 3344 active = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2);
3345 active &= ~mask; 3345 active &= ~mask;
@@ -3500,8 +3500,11 @@ static ssize_t wm8962_beep_set(struct device *dev,
3500{ 3500{
3501 struct wm8962_priv *wm8962 = dev_get_drvdata(dev); 3501 struct wm8962_priv *wm8962 = dev_get_drvdata(dev);
3502 long int time; 3502 long int time;
3503 int ret;
3503 3504
3504 strict_strtol(buf, 10, &time); 3505 ret = strict_strtol(buf, 10, &time);
3506 if (ret != 0)
3507 return ret;
3505 3508
3506 input_event(wm8962->beep, EV_SND, SND_TONE, time); 3509 input_event(wm8962->beep, EV_SND, SND_TONE, time);
3507 3510
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 0db59c3aa5d4..4d3e6f1ac584 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3903,6 +3903,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3903 return -ENOMEM; 3903 return -ENOMEM;
3904 snd_soc_codec_set_drvdata(codec, wm8994); 3904 snd_soc_codec_set_drvdata(codec, wm8994);
3905 3905
3906 codec->reg_cache = &wm8994->reg_cache;
3907
3906 wm8994->pdata = dev_get_platdata(codec->dev->parent); 3908 wm8994->pdata = dev_get_platdata(codec->dev->parent);
3907 wm8994->codec = codec; 3909 wm8994->codec = codec;
3908 3910
@@ -4059,6 +4061,8 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
4059 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, wm8994); 4061 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, wm8994);
4060 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, wm8994); 4062 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, wm8994);
4061 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_DET, wm8994); 4063 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_DET, wm8994);
4064 kfree(wm8994->retune_mobile_texts);
4065 kfree(wm8994->drc_texts);
4062 kfree(wm8994); 4066 kfree(wm8994);
4063 4067
4064 return 0; 4068 return 0;
@@ -4071,6 +4075,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
4071 .resume = wm8994_resume, 4075 .resume = wm8994_resume,
4072 .read = wm8994_read, 4076 .read = wm8994_read,
4073 .write = wm8994_write, 4077 .write = wm8994_write,
4078 .readable_register = wm8994_readable,
4079 .volatile_register = wm8994_volatile,
4074 .set_bias_level = wm8994_set_bias_level, 4080 .set_bias_level = wm8994_set_bias_level,
4075}; 4081};
4076 4082
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 2cb81538cd91..0e24092722c3 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -123,7 +123,7 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
123 reg_r = reg & WM8993_DCS_DAC_WR_VAL_0_MASK; 123 reg_r = reg & WM8993_DCS_DAC_WR_VAL_0_MASK;
124 break; 124 break;
125 default: 125 default:
126 WARN(1, "Unknown DCS readback method"); 126 WARN(1, "Unknown DCS readback method\n");
127 break; 127 break;
128 } 128 }
129 129
@@ -293,7 +293,7 @@ SOC_DOUBLE_R("Speaker Switch",
293SOC_DOUBLE_R("Speaker ZC Switch", 293SOC_DOUBLE_R("Speaker ZC Switch",
294 WM8993_SPEAKER_VOLUME_LEFT, WM8993_SPEAKER_VOLUME_RIGHT, 294 WM8993_SPEAKER_VOLUME_LEFT, WM8993_SPEAKER_VOLUME_RIGHT,
295 7, 1, 0), 295 7, 1, 0),
296SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 0, 3, 7, 0, 296SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 3, 0, 7, 0,
297 spkboost_tlv), 297 spkboost_tlv),
298SOC_ENUM("Speaker Reference", speaker_ref), 298SOC_ENUM("Speaker Reference", speaker_ref),
299SOC_ENUM("Speaker Mode", speaker_mode), 299SOC_ENUM("Speaker Mode", speaker_mode),
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 2b07b17a6b2d..bc9e6b0b3f6f 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -157,12 +157,23 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
157} 157}
158 158
159/* davinci-evm digital audio interface glue - connects codec <--> CPU */ 159/* davinci-evm digital audio interface glue - connects codec <--> CPU */
160static struct snd_soc_dai_link evm_dai = { 160static struct snd_soc_dai_link dm6446_evm_dai = {
161 .name = "TLV320AIC3X", 161 .name = "TLV320AIC3X",
162 .stream_name = "AIC3X", 162 .stream_name = "AIC3X",
163 .cpu_dai_name = "davinci-mcasp.0", 163 .cpu_dai_name = "davinci-mcbsp",
164 .codec_dai_name = "tlv320aic3x-hifi", 164 .codec_dai_name = "tlv320aic3x-hifi",
165 .codec_name = "tlv320aic3x-codec.0-001a", 165 .codec_name = "tlv320aic3x-codec.1-001b",
166 .platform_name = "davinci-pcm-audio",
167 .init = evm_aic3x_init,
168 .ops = &evm_ops,
169};
170
171static struct snd_soc_dai_link dm355_evm_dai = {
172 .name = "TLV320AIC3X",
173 .stream_name = "AIC3X",
174 .cpu_dai_name = "davinci-mcbsp.1",
175 .codec_dai_name = "tlv320aic3x-hifi",
176 .codec_name = "tlv320aic3x-codec.1-001b",
166 .platform_name = "davinci-pcm-audio", 177 .platform_name = "davinci-pcm-audio",
167 .init = evm_aic3x_init, 178 .init = evm_aic3x_init,
168 .ops = &evm_ops, 179 .ops = &evm_ops,
@@ -172,10 +183,10 @@ static struct snd_soc_dai_link dm365_evm_dai = {
172#ifdef CONFIG_SND_DM365_AIC3X_CODEC 183#ifdef CONFIG_SND_DM365_AIC3X_CODEC
173 .name = "TLV320AIC3X", 184 .name = "TLV320AIC3X",
174 .stream_name = "AIC3X", 185 .stream_name = "AIC3X",
175 .cpu_dai_name = "davinci-i2s", 186 .cpu_dai_name = "davinci-mcbsp",
176 .codec_dai_name = "tlv320aic3x-hifi", 187 .codec_dai_name = "tlv320aic3x-hifi",
177 .init = evm_aic3x_init, 188 .init = evm_aic3x_init,
178 .codec_name = "tlv320aic3x-codec.0-001a", 189 .codec_name = "tlv320aic3x-codec.1-0018",
179 .ops = &evm_ops, 190 .ops = &evm_ops,
180#elif defined(CONFIG_SND_DM365_VOICE_CODEC) 191#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
181 .name = "Voice Codec - CQ93VC", 192 .name = "Voice Codec - CQ93VC",
@@ -219,10 +230,17 @@ static struct snd_soc_dai_link da8xx_evm_dai = {
219 .ops = &evm_ops, 230 .ops = &evm_ops,
220}; 231};
221 232
222/* davinci dm6446, dm355 evm audio machine driver */ 233/* davinci dm6446 evm audio machine driver */
223static struct snd_soc_card snd_soc_card_evm = { 234static struct snd_soc_card dm6446_snd_soc_card_evm = {
224 .name = "DaVinci EVM", 235 .name = "DaVinci DM6446 EVM",
225 .dai_link = &evm_dai, 236 .dai_link = &dm6446_evm_dai,
237 .num_links = 1,
238};
239
240/* davinci dm355 evm audio machine driver */
241static struct snd_soc_card dm355_snd_soc_card_evm = {
242 .name = "DaVinci DM355 EVM",
243 .dai_link = &dm355_evm_dai,
226 .num_links = 1, 244 .num_links = 1,
227}; 245};
228 246
@@ -261,10 +279,10 @@ static int __init evm_init(void)
261 int ret; 279 int ret;
262 280
263 if (machine_is_davinci_evm()) { 281 if (machine_is_davinci_evm()) {
264 evm_snd_dev_data = &snd_soc_card_evm; 282 evm_snd_dev_data = &dm6446_snd_soc_card_evm;
265 index = 0; 283 index = 0;
266 } else if (machine_is_davinci_dm355_evm()) { 284 } else if (machine_is_davinci_dm355_evm()) {
267 evm_snd_dev_data = &snd_soc_card_evm; 285 evm_snd_dev_data = &dm355_snd_soc_card_evm;
268 index = 1; 286 index = 1;
269 } else if (machine_is_davinci_dm365_evm()) { 287 } else if (machine_is_davinci_dm365_evm()) {
270 evm_snd_dev_data = &dm365_snd_soc_card_evm; 288 evm_snd_dev_data = &dm365_snd_soc_card_evm;
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index d46b545d41f4..9e0e565e6ed9 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -426,9 +426,6 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
426 snd_pcm_format_t fmt; 426 snd_pcm_format_t fmt;
427 unsigned element_cnt = 1; 427 unsigned element_cnt = 1;
428 428
429 dai->capture_dma_data = dev->dma_params;
430 dai->playback_dma_data = dev->dma_params;
431
432 /* general line settings */ 429 /* general line settings */
433 spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); 430 spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG);
434 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 431 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
@@ -601,6 +598,15 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
601 return ret; 598 return ret;
602} 599}
603 600
601static int davinci_i2s_startup(struct snd_pcm_substream *substream,
602 struct snd_soc_dai *dai)
603{
604 struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
605
606 snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
607 return 0;
608}
609
604static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, 610static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
605 struct snd_soc_dai *dai) 611 struct snd_soc_dai *dai)
606{ 612{
@@ -612,6 +618,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
612#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 618#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000
613 619
614static struct snd_soc_dai_ops davinci_i2s_dai_ops = { 620static struct snd_soc_dai_ops davinci_i2s_dai_ops = {
621 .startup = davinci_i2s_startup,
615 .shutdown = davinci_i2s_shutdown, 622 .shutdown = davinci_i2s_shutdown,
616 .prepare = davinci_i2s_prepare, 623 .prepare = davinci_i2s_prepare,
617 .trigger = davinci_i2s_trigger, 624 .trigger = davinci_i2s_trigger,
@@ -749,7 +756,7 @@ static struct platform_driver davinci_mcbsp_driver = {
749 .probe = davinci_i2s_probe, 756 .probe = davinci_i2s_probe,
750 .remove = davinci_i2s_remove, 757 .remove = davinci_i2s_remove,
751 .driver = { 758 .driver = {
752 .name = "davinci-i2s", 759 .name = "davinci-mcbsp",
753 .owner = THIS_MODULE, 760 .owner = THIS_MODULE,
754 }, 761 },
755}; 762};
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 86918ee12419..fb55d2c5d704 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -715,9 +715,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
715 int word_length; 715 int word_length;
716 u8 fifo_level; 716 u8 fifo_level;
717 717
718 cpu_dai->capture_dma_data = dev->dma_params;
719 cpu_dai->playback_dma_data = dev->dma_params;
720
721 davinci_hw_common_param(dev, substream->stream); 718 davinci_hw_common_param(dev, substream->stream);
722 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 719 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
723 fifo_level = dev->txnumevt; 720 fifo_level = dev->txnumevt;
@@ -799,7 +796,17 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
799 return ret; 796 return ret;
800} 797}
801 798
799static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
800 struct snd_soc_dai *dai)
801{
802 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
803
804 snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
805 return 0;
806}
807
802static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { 808static struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
809 .startup = davinci_mcasp_startup,
803 .trigger = davinci_mcasp_trigger, 810 .trigger = davinci_mcasp_trigger,
804 .hw_params = davinci_mcasp_hw_params, 811 .hw_params = davinci_mcasp_hw_params,
805 .set_fmt = davinci_mcasp_set_dai_fmt, 812 .set_fmt = davinci_mcasp_set_dai_fmt,
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c
index 009b6521a1bf..6c6666a1f942 100644
--- a/sound/soc/davinci/davinci-sffsdr.c
+++ b/sound/soc/davinci/davinci-sffsdr.c
@@ -84,7 +84,7 @@ static struct snd_soc_ops sffsdr_ops = {
84static struct snd_soc_dai_link sffsdr_dai = { 84static struct snd_soc_dai_link sffsdr_dai = {
85 .name = "PCM3008", /* Codec name */ 85 .name = "PCM3008", /* Codec name */
86 .stream_name = "PCM3008 HiFi", 86 .stream_name = "PCM3008 HiFi",
87 .cpu_dai_name = "davinci-asp.0", 87 .cpu_dai_name = "davinci-mcbsp",
88 .codec_dai_name = "pcm3008-hifi", 88 .codec_dai_name = "pcm3008-hifi",
89 .codec_name = "pcm3008-codec", 89 .codec_name = "pcm3008-codec",
90 .platform_name = "davinci-pcm-audio", 90 .platform_name = "davinci-pcm-audio",
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c
index ea232f6a2c21..9d2afccc3a2d 100644
--- a/sound/soc/davinci/davinci-vcif.c
+++ b/sound/soc/davinci/davinci-vcif.c
@@ -97,9 +97,6 @@ static int davinci_vcif_hw_params(struct snd_pcm_substream *substream,
97 &davinci_vcif_dev->dma_params[substream->stream]; 97 &davinci_vcif_dev->dma_params[substream->stream];
98 u32 w; 98 u32 w;
99 99
100 dai->capture_dma_data = davinci_vcif_dev->dma_params;
101 dai->playback_dma_data = davinci_vcif_dev->dma_params;
102
103 /* Restart the codec before setup */ 100 /* Restart the codec before setup */
104 davinci_vcif_stop(substream); 101 davinci_vcif_stop(substream);
105 davinci_vcif_start(substream); 102 davinci_vcif_start(substream);
@@ -174,9 +171,19 @@ static int davinci_vcif_trigger(struct snd_pcm_substream *substream, int cmd,
174 return ret; 171 return ret;
175} 172}
176 173
174static int davinci_vcif_startup(struct snd_pcm_substream *substream,
175 struct snd_soc_dai *dai)
176{
177 struct davinci_vcif_dev *dev = snd_soc_dai_get_drvdata(dai);
178
179 snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
180 return 0;
181}
182
177#define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 183#define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000
178 184
179static struct snd_soc_dai_ops davinci_vcif_dai_ops = { 185static struct snd_soc_dai_ops davinci_vcif_dai_ops = {
186 .startup = davinci_vcif_startup,
180 .trigger = davinci_vcif_trigger, 187 .trigger = davinci_vcif_trigger,
181 .hw_params = davinci_vcif_hw_params, 188 .hw_params = davinci_vcif_hw_params,
182}; 189};
@@ -240,7 +247,10 @@ fail:
240 247
241static int davinci_vcif_remove(struct platform_device *pdev) 248static int davinci_vcif_remove(struct platform_device *pdev)
242{ 249{
250 struct davinci_vcif_dev *davinci_vcif_dev = dev_get_drvdata(&pdev->dev);
251
243 snd_soc_unregister_dai(&pdev->dev); 252 snd_soc_unregister_dai(&pdev->dev);
253 kfree(davinci_vcif_dev);
244 254
245 return 0; 255 return 0;
246} 256}
diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
index 4b0d19913728..286817946c56 100644
--- a/sound/soc/ep93xx/simone.c
+++ b/sound/soc/ep93xx/simone.c
@@ -54,24 +54,26 @@ static int __init simone_init(void)
54 54
55 ret = platform_device_add(simone_snd_ac97_device); 55 ret = platform_device_add(simone_snd_ac97_device);
56 if (ret) 56 if (ret)
57 goto fail; 57 goto fail1;
58 58
59 simone_snd_device = platform_device_alloc("soc-audio", -1); 59 simone_snd_device = platform_device_alloc("soc-audio", -1);
60 if (!simone_snd_device) { 60 if (!simone_snd_device) {
61 ret = -ENOMEM; 61 ret = -ENOMEM;
62 goto fail; 62 goto fail2;
63 } 63 }
64 64
65 platform_set_drvdata(simone_snd_device, &snd_soc_simone); 65 platform_set_drvdata(simone_snd_device, &snd_soc_simone);
66 ret = platform_device_add(simone_snd_device); 66 ret = platform_device_add(simone_snd_device);
67 if (ret) { 67 if (ret)
68 platform_device_put(simone_snd_device); 68 goto fail3;
69 goto fail;
70 }
71 69
72 return ret; 70 return 0;
73 71
74fail: 72fail3:
73 platform_device_put(simone_snd_device);
74fail2:
75 platform_device_del(simone_snd_ac97_device);
76fail1:
75 platform_device_put(simone_snd_ac97_device); 77 platform_device_put(simone_snd_ac97_device);
76 return ret; 78 return ret;
77} 79}
diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c
index 53251e6b5bd5..108b5d8bd0e9 100644
--- a/sound/soc/fsl/efika-audio-fabric.c
+++ b/sound/soc/fsl/efika-audio-fabric.c
@@ -76,6 +76,7 @@ static __init int efika_fabric_init(void)
76 rc = platform_device_add(pdev); 76 rc = platform_device_add(pdev);
77 if (rc) { 77 if (rc) {
78 pr_err("efika_fabric_init: platform_device_add() failed\n"); 78 pr_err("efika_fabric_init: platform_device_add() failed\n");
79 platform_device_put(pdev);
79 return -ENODEV; 80 return -ENODEV;
80 } 81 }
81 return 0; 82 return 0;
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index dce6b551cd78..f92dca07cd35 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -9,7 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/of_device.h>
13#include <linux/of_platform.h> 12#include <linux/of_platform.h>
14 13
15#include <sound/soc.h> 14#include <sound/soc.h>
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 74ffed41340f..9018fa5bf0db 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -160,7 +160,7 @@ static int __devinit psc_i2s_of_probe(struct platform_device *op,
160 rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); 160 rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai));
161 if (rc != 0) { 161 if (rc != 0) {
162 pr_err("Failed to register DAI\n"); 162 pr_err("Failed to register DAI\n");
163 return 0; 163 return rc;
164 } 164 }
165 165
166 psc_dma = dev_get_drvdata(&op->dev); 166 psc_dma = dev_get_drvdata(&op->dev);
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 0d7dcf1e4863..7d7847a1e66b 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -498,6 +498,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
498 dev_err(&pdev->dev, "platform device add failed\n"); 498 dev_err(&pdev->dev, "platform device add failed\n");
499 goto error; 499 goto error;
500 } 500 }
501 dev_set_drvdata(&pdev->dev, sound_device);
501 502
502 of_node_put(codec_np); 503 of_node_put(codec_np);
503 504
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 63b9eaa1ebc2..026b756961e0 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -498,6 +498,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
498 dev_err(&pdev->dev, "platform device add failed\n"); 498 dev_err(&pdev->dev, "platform device add failed\n");
499 goto error; 499 goto error;
500 } 500 }
501 dev_set_drvdata(&pdev->dev, sound_device);
501 502
502 of_node_put(codec_np); 503 of_node_put(codec_np);
503 504
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 25f27ec1dd6e..ba4d85e317ed 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -76,6 +76,7 @@ static __init int pcm030_fabric_init(void)
76 rc = platform_device_add(pdev); 76 rc = platform_device_add(pdev);
77 if (rc) { 77 if (rc) {
78 pr_err("pcm030_fabric_init: platform_device_add() failed\n"); 78 pr_err("pcm030_fabric_init: platform_device_add() failed\n");
79 platform_device_put(pdev);
79 return -ENODEV; 80 return -ENODEV;
80 } 81 }
81 return 0; 82 return 0;
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c
index b59675257ce5..dd4fffdbd177 100644
--- a/sound/soc/imx/eukrea-tlv320.c
+++ b/sound/soc/imx/eukrea-tlv320.c
@@ -34,8 +34,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
34 struct snd_pcm_hw_params *params) 34 struct snd_pcm_hw_params *params)
35{ 35{
36 struct snd_soc_pcm_runtime *rtd = substream->private_data; 36 struct snd_soc_pcm_runtime *rtd = substream->private_data;
37 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 37 struct snd_soc_dai *codec_dai = rtd->codec_dai;
38 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 38 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
39 int ret; 39 int ret;
40 40
41 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | 41 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
@@ -79,10 +79,10 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = {
79static struct snd_soc_dai_link eukrea_tlv320_dai = { 79static struct snd_soc_dai_link eukrea_tlv320_dai = {
80 .name = "tlv320aic23", 80 .name = "tlv320aic23",
81 .stream_name = "TLV320AIC23", 81 .stream_name = "TLV320AIC23",
82 .codec_dai = "tlv320aic23-hifi", 82 .codec_dai_name = "tlv320aic23-hifi",
83 .platform_name = "imx-pcm-audio.0", 83 .platform_name = "imx-pcm-audio.0",
84 .codec_name = "tlv320aic23-codec.0-001a", 84 .codec_name = "tlv320aic23-codec.0-001a",
85 .cpu_dai = "imx-ssi.0", 85 .cpu_dai_name = "imx-ssi.0",
86 .ops = &eukrea_tlv320_snd_ops, 86 .ops = &eukrea_tlv320_snd_ops,
87}; 87};
88 88
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index fd493ee1428e..671ef8dd524c 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -20,6 +20,7 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/dmaengine.h>
23 24
24#include <sound/core.h> 25#include <sound/core.h>
25#include <sound/initval.h> 26#include <sound/initval.h>
@@ -27,165 +28,146 @@
27#include <sound/pcm_params.h> 28#include <sound/pcm_params.h>
28#include <sound/soc.h> 29#include <sound/soc.h>
29 30
30#include <mach/dma-mx1-mx2.h> 31#include <mach/dma.h>
31 32
32#include "imx-ssi.h" 33#include "imx-ssi.h"
33 34
34struct imx_pcm_runtime_data { 35struct imx_pcm_runtime_data {
35 int sg_count; 36 int period_bytes;
36 struct scatterlist *sg_list;
37 int period;
38 int periods; 37 int periods;
39 unsigned long dma_addr;
40 int dma; 38 int dma;
41 struct snd_pcm_substream *substream;
42 unsigned long offset; 39 unsigned long offset;
43 unsigned long size; 40 unsigned long size;
44 unsigned long period_cnt;
45 void *buf; 41 void *buf;
46 int period_time; 42 int period_time;
43 struct dma_async_tx_descriptor *desc;
44 struct dma_chan *dma_chan;
45 struct imx_dma_data dma_data;
47}; 46};
48 47
49/* Called by the DMA framework when a period has elapsed */ 48static void audio_dma_irq(void *data)
50static void imx_ssi_dma_progression(int channel, void *data,
51 struct scatterlist *sg)
52{ 49{
53 struct snd_pcm_substream *substream = data; 50 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data;
54 struct snd_pcm_runtime *runtime = substream->runtime; 51 struct snd_pcm_runtime *runtime = substream->runtime;
55 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 52 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
56 53
57 if (!sg) 54 iprtd->offset += iprtd->period_bytes;
58 return; 55 iprtd->offset %= iprtd->period_bytes * iprtd->periods;
59
60 runtime = iprtd->substream->runtime;
61 56
62 iprtd->offset = sg->dma_address - runtime->dma_addr; 57 snd_pcm_period_elapsed(substream);
63
64 snd_pcm_period_elapsed(iprtd->substream);
65} 58}
66 59
67static void imx_ssi_dma_callback(int channel, void *data) 60static bool filter(struct dma_chan *chan, void *param)
68{ 61{
69 pr_err("%s shouldn't be called\n", __func__); 62 struct imx_pcm_runtime_data *iprtd = param;
70}
71 63
72static void snd_imx_dma_err_callback(int channel, void *data, int err) 64 if (!imx_dma_is_general_purpose(chan))
73{ 65 return false;
74 struct snd_pcm_substream *substream = data;
75 struct snd_soc_pcm_runtime *rtd = substream->private_data;
76 struct imx_pcm_dma_params *dma_params =
77 snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);
78 struct snd_pcm_runtime *runtime = substream->runtime;
79 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
80 int ret;
81 66
82 pr_err("DMA timeout on channel %d -%s%s%s%s\n", 67 chan->private = &iprtd->dma_data;
83 channel,
84 err & IMX_DMA_ERR_BURST ? " burst" : "",
85 err & IMX_DMA_ERR_REQUEST ? " request" : "",
86 err & IMX_DMA_ERR_TRANSFER ? " transfer" : "",
87 err & IMX_DMA_ERR_BUFFER ? " buffer" : "");
88 68
89 imx_dma_disable(iprtd->dma); 69 return true;
90 ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count,
91 IMX_DMA_LENGTH_LOOP, dma_params->dma_addr,
92 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
93 DMA_MODE_WRITE : DMA_MODE_READ);
94 if (!ret)
95 imx_dma_enable(iprtd->dma);
96} 70}
97 71
98static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) 72static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
73 struct snd_pcm_hw_params *params)
99{ 74{
100 struct snd_soc_pcm_runtime *rtd = substream->private_data; 75 struct snd_soc_pcm_runtime *rtd = substream->private_data;
101 struct imx_pcm_dma_params *dma_params; 76 struct imx_pcm_dma_params *dma_params;
102 struct snd_pcm_runtime *runtime = substream->runtime; 77 struct snd_pcm_runtime *runtime = substream->runtime;
103 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 78 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
79 struct dma_slave_config slave_config;
80 dma_cap_mask_t mask;
81 enum dma_slave_buswidth buswidth;
104 int ret; 82 int ret;
105 83
106 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 84 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
107 85
108 iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); 86 iprtd->dma_data.peripheral_type = IMX_DMATYPE_SSI;
109 if (iprtd->dma < 0) { 87 iprtd->dma_data.priority = DMA_PRIO_HIGH;
110 pr_err("Failed to claim the audio DMA\n"); 88 iprtd->dma_data.dma_request = dma_params->dma;
111 return -ENODEV;
112 }
113 89
114 ret = imx_dma_setup_handlers(iprtd->dma, 90 /* Try to grab a DMA channel */
115 imx_ssi_dma_callback, 91 dma_cap_zero(mask);
116 snd_imx_dma_err_callback, substream); 92 dma_cap_set(DMA_SLAVE, mask);
117 if (ret) 93 iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
118 goto out; 94 if (!iprtd->dma_chan)
95 return -EINVAL;
119 96
120 ret = imx_dma_setup_progression_handler(iprtd->dma, 97 switch (params_format(params)) {
121 imx_ssi_dma_progression); 98 case SNDRV_PCM_FORMAT_S16_LE:
122 if (ret) { 99 buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
123 pr_err("Failed to setup the DMA handler\n"); 100 break;
124 goto out; 101 case SNDRV_PCM_FORMAT_S20_3LE:
102 case SNDRV_PCM_FORMAT_S24_LE:
103 buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
104 break;
105 default:
106 return 0;
125 } 107 }
126 108
127 ret = imx_dma_config_channel(iprtd->dma, 109 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
128 IMX_DMA_MEMSIZE_16 | IMX_DMA_TYPE_FIFO, 110 slave_config.direction = DMA_TO_DEVICE;
129 IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR, 111 slave_config.dst_addr = dma_params->dma_addr;
130 dma_params->dma, 1); 112 slave_config.dst_addr_width = buswidth;
131 if (ret < 0) { 113 slave_config.dst_maxburst = dma_params->burstsize;
132 pr_err("Cannot configure DMA channel: %d\n", ret); 114 } else {
133 goto out; 115 slave_config.direction = DMA_FROM_DEVICE;
116 slave_config.src_addr = dma_params->dma_addr;
117 slave_config.src_addr_width = buswidth;
118 slave_config.src_maxburst = dma_params->burstsize;
134 } 119 }
135 120
136 imx_dma_config_burstlen(iprtd->dma, dma_params->burstsize * 2); 121 ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config);
122 if (ret)
123 return ret;
137 124
138 return 0; 125 return 0;
139out:
140 imx_dma_free(iprtd->dma);
141 return ret;
142} 126}
143 127
144static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, 128static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
145 struct snd_pcm_hw_params *params) 129 struct snd_pcm_hw_params *params)
146{ 130{
131 struct snd_soc_pcm_runtime *rtd = substream->private_data;
147 struct snd_pcm_runtime *runtime = substream->runtime; 132 struct snd_pcm_runtime *runtime = substream->runtime;
148 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 133 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
149 int i;
150 unsigned long dma_addr; 134 unsigned long dma_addr;
135 struct dma_chan *chan;
136 struct imx_pcm_dma_params *dma_params;
137 int ret;
151 138
152 imx_ssi_dma_alloc(substream); 139 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
140 ret = imx_ssi_dma_alloc(substream, params);
141 if (ret)
142 return ret;
143 chan = iprtd->dma_chan;
153 144
154 iprtd->size = params_buffer_bytes(params); 145 iprtd->size = params_buffer_bytes(params);
155 iprtd->periods = params_periods(params); 146 iprtd->periods = params_periods(params);
156 iprtd->period = params_period_bytes(params); 147 iprtd->period_bytes = params_period_bytes(params);
157 iprtd->offset = 0; 148 iprtd->offset = 0;
158 iprtd->period_time = HZ / (params_rate(params) / 149 iprtd->period_time = HZ / (params_rate(params) /
159 params_period_size(params)); 150 params_period_size(params));
160 151
161 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 152 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
162 153
163 if (iprtd->sg_count != iprtd->periods) {
164 kfree(iprtd->sg_list);
165
166 iprtd->sg_list = kcalloc(iprtd->periods + 1,
167 sizeof(struct scatterlist), GFP_KERNEL);
168 if (!iprtd->sg_list)
169 return -ENOMEM;
170 iprtd->sg_count = iprtd->periods + 1;
171 }
172
173 sg_init_table(iprtd->sg_list, iprtd->sg_count);
174 dma_addr = runtime->dma_addr; 154 dma_addr = runtime->dma_addr;
175 155
176 for (i = 0; i < iprtd->periods; i++) { 156 iprtd->buf = (unsigned int *)substream->dma_buffer.area;
177 iprtd->sg_list[i].page_link = 0; 157
178 iprtd->sg_list[i].offset = 0; 158 iprtd->desc = chan->device->device_prep_dma_cyclic(chan, dma_addr,
179 iprtd->sg_list[i].dma_address = dma_addr; 159 iprtd->period_bytes * iprtd->periods,
180 iprtd->sg_list[i].length = iprtd->period; 160 iprtd->period_bytes,
181 dma_addr += iprtd->period; 161 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
162 DMA_TO_DEVICE : DMA_FROM_DEVICE);
163 if (!iprtd->desc) {
164 dev_err(&chan->dev->device, "cannot prepare slave dma\n");
165 return -EINVAL;
182 } 166 }
183 167
184 /* close the loop */ 168 iprtd->desc->callback = audio_dma_irq;
185 iprtd->sg_list[iprtd->sg_count - 1].offset = 0; 169 iprtd->desc->callback_param = substream;
186 iprtd->sg_list[iprtd->sg_count - 1].length = 0; 170
187 iprtd->sg_list[iprtd->sg_count - 1].page_link =
188 ((unsigned long) iprtd->sg_list | 0x01) & ~0x02;
189 return 0; 171 return 0;
190} 172}
191 173
@@ -194,41 +176,21 @@ static int snd_imx_pcm_hw_free(struct snd_pcm_substream *substream)
194 struct snd_pcm_runtime *runtime = substream->runtime; 176 struct snd_pcm_runtime *runtime = substream->runtime;
195 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 177 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
196 178
197 if (iprtd->dma >= 0) { 179 if (iprtd->dma_chan) {
198 imx_dma_free(iprtd->dma); 180 dma_release_channel(iprtd->dma_chan);
199 iprtd->dma = -EINVAL; 181 iprtd->dma_chan = NULL;
200 } 182 }
201 183
202 kfree(iprtd->sg_list);
203 iprtd->sg_list = NULL;
204
205 return 0; 184 return 0;
206} 185}
207 186
208static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) 187static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
209{ 188{
210 struct snd_pcm_runtime *runtime = substream->runtime;
211 struct snd_soc_pcm_runtime *rtd = substream->private_data; 189 struct snd_soc_pcm_runtime *rtd = substream->private_data;
212 struct imx_pcm_dma_params *dma_params; 190 struct imx_pcm_dma_params *dma_params;
213 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
214 int err;
215 191
216 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 192 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
217 193
218 iprtd->substream = substream;
219 iprtd->buf = (unsigned int *)substream->dma_buffer.area;
220 iprtd->period_cnt = 0;
221
222 pr_debug("%s: buf: %p period: %d periods: %d\n",
223 __func__, iprtd->buf, iprtd->period, iprtd->periods);
224
225 err = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count,
226 IMX_DMA_LENGTH_LOOP, dma_params->dma_addr,
227 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
228 DMA_MODE_WRITE : DMA_MODE_READ);
229 if (err)
230 return err;
231
232 return 0; 194 return 0;
233} 195}
234 196
@@ -241,14 +203,14 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
241 case SNDRV_PCM_TRIGGER_START: 203 case SNDRV_PCM_TRIGGER_START:
242 case SNDRV_PCM_TRIGGER_RESUME: 204 case SNDRV_PCM_TRIGGER_RESUME:
243 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 205 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
244 imx_dma_enable(iprtd->dma); 206 dmaengine_submit(iprtd->desc);
245 207
246 break; 208 break;
247 209
248 case SNDRV_PCM_TRIGGER_STOP: 210 case SNDRV_PCM_TRIGGER_STOP:
249 case SNDRV_PCM_TRIGGER_SUSPEND: 211 case SNDRV_PCM_TRIGGER_SUSPEND:
250 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 212 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
251 imx_dma_disable(iprtd->dma); 213 dmaengine_terminate_all(iprtd->dma_chan);
252 214
253 break; 215 break;
254 default: 216 default:
@@ -263,6 +225,9 @@ static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream
263 struct snd_pcm_runtime *runtime = substream->runtime; 225 struct snd_pcm_runtime *runtime = substream->runtime;
264 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 226 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
265 227
228 pr_debug("%s: %ld %ld\n", __func__, iprtd->offset,
229 bytes_to_frames(substream->runtime, iprtd->offset));
230
266 return bytes_to_frames(substream->runtime, iprtd->offset); 231 return bytes_to_frames(substream->runtime, iprtd->offset);
267} 232}
268 233
@@ -279,7 +244,7 @@ static struct snd_pcm_hardware snd_imx_hardware = {
279 .channels_max = 2, 244 .channels_max = 2,
280 .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, 245 .buffer_bytes_max = IMX_SSI_DMABUF_SIZE,
281 .period_bytes_min = 128, 246 .period_bytes_min = 128,
282 .period_bytes_max = 16 * 1024, 247 .period_bytes_max = 65535, /* Limited by SDMA engine */
283 .periods_min = 2, 248 .periods_min = 2,
284 .periods_max = 255, 249 .periods_max = 255,
285 .fifo_size = 0, 250 .fifo_size = 0,
@@ -304,11 +269,23 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
304 } 269 }
305 270
306 snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); 271 snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
272
273 return 0;
274}
275
276static int snd_imx_close(struct snd_pcm_substream *substream)
277{
278 struct snd_pcm_runtime *runtime = substream->runtime;
279 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
280
281 kfree(iprtd);
282
307 return 0; 283 return 0;
308} 284}
309 285
310static struct snd_pcm_ops imx_pcm_ops = { 286static struct snd_pcm_ops imx_pcm_ops = {
311 .open = snd_imx_open, 287 .open = snd_imx_open,
288 .close = snd_imx_close,
312 .ioctl = snd_pcm_lib_ioctl, 289 .ioctl = snd_pcm_lib_ioctl,
313 .hw_params = snd_imx_pcm_hw_params, 290 .hw_params = snd_imx_pcm_hw_params,
314 .hw_free = snd_imx_pcm_hw_free, 291 .hw_free = snd_imx_pcm_hw_free,
@@ -340,7 +317,6 @@ static struct platform_driver imx_pcm_driver = {
340 .name = "imx-pcm-audio", 317 .name = "imx-pcm-audio",
341 .owner = THIS_MODULE, 318 .owner = THIS_MODULE,
342 }, 319 },
343
344 .probe = imx_soc_platform_probe, 320 .probe = imx_soc_platform_probe,
345 .remove = __devexit_p(imx_soc_platform_remove), 321 .remove = __devexit_p(imx_soc_platform_remove),
346}; 322};
@@ -356,4 +332,3 @@ static void __exit snd_imx_pcm_exit(void)
356 platform_driver_unregister(&imx_pcm_driver); 332 platform_driver_unregister(&imx_pcm_driver);
357} 333}
358module_exit(snd_imx_pcm_exit); 334module_exit(snd_imx_pcm_exit);
359
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index d4bd345b0a8d..390b6ffc2658 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm)
439} 439}
440EXPORT_SYMBOL_GPL(imx_pcm_free); 440EXPORT_SYMBOL_GPL(imx_pcm_free);
441 441
442static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
443{
444 struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
445 uint32_t val;
446
447 snd_soc_dai_set_drvdata(dai, ssi);
448
449 val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
450 SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
451 writel(val, ssi->base + SSI_SFCSR);
452
453 return 0;
454}
455
442static struct snd_soc_dai_driver imx_ssi_dai = { 456static struct snd_soc_dai_driver imx_ssi_dai = {
457 .probe = imx_ssi_dai_probe,
443 .playback = { 458 .playback = {
444 .channels_min = 2, 459 .channels_min = 2,
445 .channels_max = 2, 460 .channels_max = 2,
@@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = {
455 .ops = &imx_ssi_pcm_dai_ops, 470 .ops = &imx_ssi_pcm_dai_ops,
456}; 471};
457 472
458static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
459{
460 struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
461 uint32_t val;
462
463 snd_soc_dai_set_drvdata(dai, ssi);
464
465 val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
466 SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
467 writel(val, ssi->base + SSI_SFCSR);
468
469 return 0;
470}
471
472static struct snd_soc_dai_driver imx_ac97_dai = { 473static struct snd_soc_dai_driver imx_ac97_dai = {
473 .probe = imx_ssi_dai_probe, 474 .probe = imx_ssi_dai_probe,
474 .ac97_control = 1, 475 .ac97_control = 1,
@@ -677,9 +678,25 @@ static int imx_ssi_probe(struct platform_device *pdev)
677 goto failed_register; 678 goto failed_register;
678 } 679 }
679 680
680 ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); 681 ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
681 if (!ssi->soc_platform_pdev) 682 if (!ssi->soc_platform_pdev_fiq) {
683 ret = -ENOMEM;
684 goto failed_pdev_fiq_alloc;
685 }
686
687 platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
688 ret = platform_device_add(ssi->soc_platform_pdev_fiq);
689 if (ret) {
690 dev_err(&pdev->dev, "failed to add platform device\n");
691 goto failed_pdev_fiq_add;
692 }
693
694 ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
695 if (!ssi->soc_platform_pdev) {
696 ret = -ENOMEM;
682 goto failed_pdev_alloc; 697 goto failed_pdev_alloc;
698 }
699
683 platform_set_drvdata(ssi->soc_platform_pdev, ssi); 700 platform_set_drvdata(ssi->soc_platform_pdev, ssi);
684 ret = platform_device_add(ssi->soc_platform_pdev); 701 ret = platform_device_add(ssi->soc_platform_pdev);
685 if (ret) { 702 if (ret) {
@@ -692,6 +709,10 @@ static int imx_ssi_probe(struct platform_device *pdev)
692failed_pdev_add: 709failed_pdev_add:
693 platform_device_put(ssi->soc_platform_pdev); 710 platform_device_put(ssi->soc_platform_pdev);
694failed_pdev_alloc: 711failed_pdev_alloc:
712 platform_device_del(ssi->soc_platform_pdev_fiq);
713failed_pdev_fiq_add:
714 platform_device_put(ssi->soc_platform_pdev_fiq);
715failed_pdev_fiq_alloc:
695 snd_soc_unregister_dai(&pdev->dev); 716 snd_soc_unregister_dai(&pdev->dev);
696failed_register: 717failed_register:
697failed_ac97: 718failed_ac97:
@@ -712,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
712 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 733 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
713 struct imx_ssi *ssi = platform_get_drvdata(pdev); 734 struct imx_ssi *ssi = platform_get_drvdata(pdev);
714 735
715 platform_device_del(ssi->soc_platform_pdev); 736 platform_device_unregister(ssi->soc_platform_pdev);
716 platform_device_put(ssi->soc_platform_pdev); 737 platform_device_unregister(ssi->soc_platform_pdev_fiq);
717 738
718 snd_soc_unregister_dai(&pdev->dev); 739 snd_soc_unregister_dai(&pdev->dev);
719 740
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h
index 53b780d9b2b0..a4406a134892 100644
--- a/sound/soc/imx/imx-ssi.h
+++ b/sound/soc/imx/imx-ssi.h
@@ -185,6 +185,9 @@
185 185
186#define DRV_NAME "imx-ssi" 186#define DRV_NAME "imx-ssi"
187 187
188#include <linux/dmaengine.h>
189#include <mach/dma.h>
190
188struct imx_pcm_dma_params { 191struct imx_pcm_dma_params {
189 int dma; 192 int dma;
190 unsigned long dma_addr; 193 unsigned long dma_addr;
@@ -212,6 +215,7 @@ struct imx_ssi {
212 int enabled; 215 int enabled;
213 216
214 struct platform_device *soc_platform_pdev; 217 struct platform_device *soc_platform_pdev;
218 struct platform_device *soc_platform_pdev_fiq;
215}; 219};
216 220
217struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, 221struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev,
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
index 6a65dd705519..9eabc28667e6 100644
--- a/sound/soc/imx/phycore-ac97.c
+++ b/sound/soc/imx/phycore-ac97.c
@@ -20,9 +20,6 @@
20#include <sound/soc-dapm.h> 20#include <sound/soc-dapm.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22 22
23#include "../codecs/wm9712.h"
24#include "imx-ssi.h"
25
26static struct snd_soc_card imx_phycore; 23static struct snd_soc_card imx_phycore;
27 24
28static struct snd_soc_ops imx_phycore_hifi_ops = { 25static struct snd_soc_ops imx_phycore_hifi_ops = {
@@ -41,11 +38,12 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
41}; 38};
42 39
43static struct snd_soc_card imx_phycore = { 40static struct snd_soc_card imx_phycore = {
44 .name = "PhyCORE-audio", 41 .name = "PhyCORE-ac97-audio",
45 .dai_link = imx_phycore_dai_ac97, 42 .dai_link = imx_phycore_dai_ac97,
46 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), 43 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
47}; 44};
48 45
46static struct platform_device *imx_phycore_snd_ac97_device;
49static struct platform_device *imx_phycore_snd_device; 47static struct platform_device *imx_phycore_snd_device;
50 48
51static int __init imx_phycore_init(void) 49static int __init imx_phycore_init(void)
@@ -56,29 +54,42 @@ static int __init imx_phycore_init(void)
56 /* return happy. We might run on a totally different machine */ 54 /* return happy. We might run on a totally different machine */
57 return 0; 55 return 0;
58 56
59 imx_phycore_snd_device = platform_device_alloc("soc-audio", -1); 57 imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
60 if (!imx_phycore_snd_device) 58 if (!imx_phycore_snd_ac97_device)
61 return -ENOMEM; 59 return -ENOMEM;
62 60
63 platform_set_drvdata(imx_phycore_snd_device, &imx_phycore); 61 platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
64 ret = platform_device_add(imx_phycore_snd_device); 62 ret = platform_device_add(imx_phycore_snd_ac97_device);
63 if (ret)
64 goto fail1;
65 65
66 imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1); 66 imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
67 if (!imx_phycore_snd_device) 67 if (!imx_phycore_snd_device) {
68 return -ENOMEM; 68 ret = -ENOMEM;
69 goto fail2;
70 }
69 ret = platform_device_add(imx_phycore_snd_device); 71 ret = platform_device_add(imx_phycore_snd_device);
70 72
71 if (ret) { 73 if (ret) {
72 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 74 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
73 platform_device_put(imx_phycore_snd_device); 75 goto fail3;
74 } 76 }
75 77
78 return 0;
79
80fail3:
81 platform_device_put(imx_phycore_snd_device);
82fail2:
83 platform_device_del(imx_phycore_snd_ac97_device);
84fail1:
85 platform_device_put(imx_phycore_snd_ac97_device);
76 return ret; 86 return ret;
77} 87}
78 88
79static void __exit imx_phycore_exit(void) 89static void __exit imx_phycore_exit(void)
80{ 90{
81 platform_device_unregister(imx_phycore_snd_device); 91 platform_device_unregister(imx_phycore_snd_device);
92 platform_device_unregister(imx_phycore_snd_ac97_device);
82} 93}
83 94
84late_initcall(imx_phycore_init); 95late_initcall(imx_phycore_init);
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index 293dc748797c..dac6732da969 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -49,7 +49,7 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97,
49 mutex_lock(&ac97_mutex); 49 mutex_lock(&ac97_mutex);
50 50
51 val = nuc900_checkready(); 51 val = nuc900_checkready();
52 if (!!val) { 52 if (val) {
53 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); 53 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
54 goto out; 54 goto out;
55 } 55 }
@@ -102,7 +102,7 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
102 mutex_lock(&ac97_mutex); 102 mutex_lock(&ac97_mutex);
103 103
104 tmp = nuc900_checkready(); 104 tmp = nuc900_checkready();
105 if (!!tmp) 105 if (tmp)
106 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); 106 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
107 107
108 /* clear the R_WB bit and write register index */ 108 /* clear the R_WB bit and write register index */
@@ -149,7 +149,7 @@ static void nuc900_ac97_warm_reset(struct snd_ac97 *ac97)
149 udelay(100); 149 udelay(100);
150 150
151 val = nuc900_checkready(); 151 val = nuc900_checkready();
152 if (!!val) 152 if (val)
153 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); 153 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
154 154
155 mutex_unlock(&ac97_mutex); 155 mutex_unlock(&ac97_mutex);
@@ -263,8 +263,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream,
263 return ret; 263 return ret;
264} 264}
265 265
266static int nuc900_ac97_probe(struct platform_device *pdev, 266static int nuc900_ac97_probe(struct snd_soc_dai *dai)
267 struct snd_soc_dai *dai)
268{ 267{
269 struct nuc900_audio *nuc900_audio = nuc900_ac97_data; 268 struct nuc900_audio *nuc900_audio = nuc900_ac97_data;
270 unsigned long val; 269 unsigned long val;
@@ -284,12 +283,12 @@ static int nuc900_ac97_probe(struct platform_device *pdev,
284 return 0; 283 return 0;
285} 284}
286 285
287static void nuc900_ac97_remove(struct platform_device *pdev, 286static int nuc900_ac97_remove(struct snd_soc_dai *dai)
288 struct snd_soc_dai *dai)
289{ 287{
290 struct nuc900_audio *nuc900_audio = nuc900_ac97_data; 288 struct nuc900_audio *nuc900_audio = nuc900_ac97_data;
291 289
292 clk_disable(nuc900_audio->clk); 290 clk_disable(nuc900_audio->clk);
291 return 0;
293} 292}
294 293
295static struct snd_soc_dai_ops nuc900_ac97_dai_ops = { 294static struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
@@ -313,7 +312,7 @@ static struct snd_soc_dai_driver nuc900_ac97_dai = {
313 .channels_max = 2, 312 .channels_max = 2,
314 }, 313 },
315 .ops = &nuc900_ac97_dai_ops, 314 .ops = &nuc900_ac97_dai_ops,
316} 315};
317 316
318static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) 317static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev)
319{ 318{
@@ -384,7 +383,6 @@ out0:
384 383
385static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev) 384static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev)
386{ 385{
387
388 snd_soc_unregister_dai(&pdev->dev); 386 snd_soc_unregister_dai(&pdev->dev);
389 387
390 clk_put(nuc900_ac97_data->clk); 388 clk_put(nuc900_ac97_data->clk);
@@ -392,6 +390,7 @@ static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev)
392 release_mem_region(nuc900_ac97_data->res->start, 390 release_mem_region(nuc900_ac97_data->res->start,
393 resource_size(nuc900_ac97_data->res)); 391 resource_size(nuc900_ac97_data->res));
394 392
393 kfree(nuc900_ac97_data);
395 nuc900_ac97_data = NULL; 394 nuc900_ac97_data = NULL;
396 395
397 return 0; 396 return 0;
diff --git a/sound/soc/nuc900/nuc900-audio.h b/sound/soc/nuc900/nuc900-audio.h
index aeed8ead2b2b..59f7e8ed1a68 100644
--- a/sound/soc/nuc900/nuc900-audio.h
+++ b/sound/soc/nuc900/nuc900-audio.h
@@ -110,4 +110,6 @@ struct nuc900_audio {
110 110
111}; 111};
112 112
113extern struct nuc900_audio *nuc900_ac97_data;
114
113#endif /*end _NUC900_AUDIO_H */ 115#endif /*end _NUC900_AUDIO_H */
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index 195d1ac94771..8263f56dc665 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -50,12 +50,12 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
50 unsigned long flags; 50 unsigned long flags;
51 int ret = 0; 51 int ret = 0;
52 52
53 spin_lock_irqsave(&nuc900_audio->lock, flags);
54
55 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); 53 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
56 if (ret < 0) 54 if (ret < 0)
57 return ret; 55 return ret;
58 56
57 spin_lock_irqsave(&nuc900_audio->lock, flags);
58
59 nuc900_audio->substream = substream; 59 nuc900_audio->substream = substream;
60 nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr; 60 nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr;
61 nuc900_audio->buffersize[substream->stream] = 61 nuc900_audio->buffersize[substream->stream] =
@@ -169,6 +169,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
169 struct snd_pcm_runtime *runtime = substream->runtime; 169 struct snd_pcm_runtime *runtime = substream->runtime;
170 struct nuc900_audio *nuc900_audio = runtime->private_data; 170 struct nuc900_audio *nuc900_audio = runtime->private_data;
171 unsigned long flags, val; 171 unsigned long flags, val;
172 int ret = 0;
172 173
173 spin_lock_irqsave(&nuc900_audio->lock, flags); 174 spin_lock_irqsave(&nuc900_audio->lock, flags);
174 175
@@ -197,10 +198,10 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
197 AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); 198 AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val);
198 break; 199 break;
199 default: 200 default:
200 return -EINVAL; 201 ret = -EINVAL;
201 } 202 }
202 spin_unlock_irqrestore(&nuc900_audio->lock, flags); 203 spin_unlock_irqrestore(&nuc900_audio->lock, flags);
203 return 0; 204 return ret;
204} 205}
205 206
206static int nuc900_dma_trigger(struct snd_pcm_substream *substream, int cmd) 207static int nuc900_dma_trigger(struct snd_pcm_substream *substream, int cmd)
@@ -332,7 +333,7 @@ static struct snd_soc_platform_driver nuc900_soc_platform = {
332 .ops = &nuc900_dma_ops, 333 .ops = &nuc900_dma_ops,
333 .pcm_new = nuc900_dma_new, 334 .pcm_new = nuc900_dma_new,
334 .pcm_free = nuc900_dma_free_dma_buffers, 335 .pcm_free = nuc900_dma_free_dma_buffers,
335} 336};
336 337
337static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev) 338static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev)
338{ 339{
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index d542ea2ff6be..a088db6d5091 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -12,8 +12,8 @@ config SND_OMAP_SOC_MCPDM
12config SND_OMAP_SOC_N810 12config SND_OMAP_SOC_N810
13 tristate "SoC Audio support for Nokia N810" 13 tristate "SoC Audio support for Nokia N810"
14 depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C 14 depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C
15 depends on OMAP_MUX
15 select SND_OMAP_SOC_MCBSP 16 select SND_OMAP_SOC_MCBSP
16 select OMAP_MUX
17 select SND_SOC_TLV320AIC3X 17 select SND_SOC_TLV320AIC3X
18 help 18 help
19 Say Y if you want to add support for SoC audio on Nokia N810. 19 Say Y if you want to add support for SoC audio on Nokia N810.
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index d211c9fa5a91..7e84f24b9a88 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -644,15 +644,23 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
644 644
645 645
646 case OMAP_MCBSP_CLKR_SRC_CLKR: 646 case OMAP_MCBSP_CLKR_SRC_CLKR:
647 if (cpu_class_is_omap1())
648 break;
647 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); 649 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR);
648 break; 650 break;
649 case OMAP_MCBSP_CLKR_SRC_CLKX: 651 case OMAP_MCBSP_CLKR_SRC_CLKX:
652 if (cpu_class_is_omap1())
653 break;
650 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); 654 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX);
651 break; 655 break;
652 case OMAP_MCBSP_FSR_SRC_FSR: 656 case OMAP_MCBSP_FSR_SRC_FSR:
657 if (cpu_class_is_omap1())
658 break;
653 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); 659 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR);
654 break; 660 break;
655 case OMAP_MCBSP_FSR_SRC_FSX: 661 case OMAP_MCBSP_FSR_SRC_FSX:
662 if (cpu_class_is_omap1())
663 break;
656 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); 664 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX);
657 break; 665 break;
658 default: 666 default:
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index dbd9d96b5f92..4ee33ce2cb98 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -306,6 +306,7 @@ static int __init omap3pandora_soc_init(void)
306 pr_err(PREFIX "Failed to get DAC regulator from %s: %ld\n", 306 pr_err(PREFIX "Failed to get DAC regulator from %s: %ld\n",
307 dev_name(&omap3pandora_snd_device->dev), 307 dev_name(&omap3pandora_snd_device->dev),
308 PTR_ERR(omap3pandora_dac_reg)); 308 PTR_ERR(omap3pandora_dac_reg));
309 ret = PTR_ERR(omap3pandora_dac_reg);
309 goto fail3; 310 goto fail3;
310 } 311 }
311 312
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index f0e662556428..65ae00e976ef 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -177,7 +177,8 @@ static int __init osk_soc_init(void)
177 tlv320aic23_mclk = clk_get(dev, "mclk"); 177 tlv320aic23_mclk = clk_get(dev, "mclk");
178 if (IS_ERR(tlv320aic23_mclk)) { 178 if (IS_ERR(tlv320aic23_mclk)) {
179 printk(KERN_ERR "Could not get mclk clock\n"); 179 printk(KERN_ERR "Could not get mclk clock\n");
180 return -ENODEV; 180 err = PTR_ERR(tlv320aic23_mclk);
181 goto err2;
181 } 182 }
182 183
183 /* 184 /*
@@ -188,7 +189,7 @@ static int __init osk_soc_init(void)
188 if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) { 189 if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
189 printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n"); 190 printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
190 err = -ECANCELED; 191 err = -ECANCELED;
191 goto err1; 192 goto err3;
192 } 193 }
193 } 194 }
194 195
@@ -196,9 +197,12 @@ static int __init osk_soc_init(void)
196 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK); 197 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);
197 198
198 return 0; 199 return 0;
199err1: 200
201err3:
200 clk_put(tlv320aic23_mclk); 202 clk_put(tlv320aic23_mclk);
203err2:
201 platform_device_del(osk_snd_device); 204 platform_device_del(osk_snd_device);
205err1:
202 platform_device_put(osk_snd_device); 206 platform_device_put(osk_snd_device);
203 207
204 return err; 208 return err;
@@ -207,6 +211,7 @@ err1:
207 211
208static void __exit osk_soc_exit(void) 212static void __exit osk_soc_exit(void)
209{ 213{
214 clk_put(tlv320aic23_mclk);
210 platform_device_unregister(osk_snd_device); 215 platform_device_unregister(osk_snd_device);
211} 216}
212 217
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 37f191bbfdd9..580f48571303 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -1,6 +1,7 @@
1config SND_PXA2XX_SOC 1config SND_PXA2XX_SOC
2 tristate "SoC Audio for the Intel PXA2xx chip" 2 tristate "SoC Audio for the Intel PXA2xx chip"
3 depends on ARCH_PXA 3 depends on ARCH_PXA
4 select SND_ARM
4 select SND_PXA2XX_LIB 5 select SND_PXA2XX_LIB
5 help 6 help
6 Say Y or M if you want to add support for codecs attached to 7 Say Y or M if you want to add support for codecs attached to
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 97e9423615c9..f451acd4935b 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -100,8 +100,13 @@ static int corgi_startup(struct snd_pcm_substream *substream)
100 struct snd_soc_pcm_runtime *rtd = substream->private_data; 100 struct snd_soc_pcm_runtime *rtd = substream->private_data;
101 struct snd_soc_codec *codec = rtd->codec; 101 struct snd_soc_codec *codec = rtd->codec;
102 102
103 mutex_lock(&codec->mutex);
104
103 /* check the jack status at stream startup */ 105 /* check the jack status at stream startup */
104 corgi_ext_control(codec); 106 corgi_ext_control(codec);
107
108 mutex_unlock(&codec->mutex);
109
105 return 0; 110 return 0;
106} 111}
107 112
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index b8207ced4072..5ef0526924b9 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -72,9 +72,13 @@ static int magician_startup(struct snd_pcm_substream *substream)
72 struct snd_soc_pcm_runtime *rtd = substream->private_data; 72 struct snd_soc_pcm_runtime *rtd = substream->private_data;
73 struct snd_soc_codec *codec = rtd->codec; 73 struct snd_soc_codec *codec = rtd->codec;
74 74
75 mutex_lock(&codec->mutex);
76
75 /* check the jack status at stream startup */ 77 /* check the jack status at stream startup */
76 magician_ext_control(codec); 78 magician_ext_control(codec);
77 79
80 mutex_unlock(&codec->mutex);
81
78 return 0; 82 return 0;
79} 83}
80 84
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index af84ee9c5e11..84edd0385a21 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -77,8 +77,13 @@ static int poodle_startup(struct snd_pcm_substream *substream)
77 struct snd_soc_pcm_runtime *rtd = substream->private_data; 77 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_codec *codec = rtd->codec; 78 struct snd_soc_codec *codec = rtd->codec;
79 79
80 mutex_lock(&codec->mutex);
81
80 /* check the jack status at stream startup */ 82 /* check the jack status at stream startup */
81 poodle_ext_control(codec); 83 poodle_ext_control(codec);
84
85 mutex_unlock(&codec->mutex);
86
82 return 0; 87 return 0;
83} 88}
84 89
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index f470f360f4dd..0b30d7de24ec 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -108,8 +108,13 @@ static int spitz_startup(struct snd_pcm_substream *substream)
108 struct snd_soc_pcm_runtime *rtd = substream->private_data; 108 struct snd_soc_pcm_runtime *rtd = substream->private_data;
109 struct snd_soc_codec *codec = rtd->codec; 109 struct snd_soc_codec *codec = rtd->codec;
110 110
111 mutex_lock(&codec->mutex);
112
111 /* check the jack status at stream startup */ 113 /* check the jack status at stream startup */
112 spitz_ext_control(codec); 114 spitz_ext_control(codec);
115
116 mutex_unlock(&codec->mutex);
117
113 return 0; 118 return 0;
114} 119}
115 120
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index a3bfb2e8b70f..7b983f935454 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -79,10 +79,15 @@ static void tosa_ext_control(struct snd_soc_codec *codec)
79static int tosa_startup(struct snd_pcm_substream *substream) 79static int tosa_startup(struct snd_pcm_substream *substream)
80{ 80{
81 struct snd_soc_pcm_runtime *rtd = substream->private_data; 81 struct snd_soc_pcm_runtime *rtd = substream->private_data;
82 struct snd_soc_codec *codec = rtd->card->codec; 82 struct snd_soc_codec *codec = rtd->codec;
83
84 mutex_lock(&codec->mutex);
83 85
84 /* check the jack status at stream startup */ 86 /* check the jack status at stream startup */
85 tosa_ext_control(codec); 87 tosa_ext_control(codec);
88
89 mutex_unlock(&codec->mutex);
90
86 return 0; 91 return 0;
87} 92}
88 93
diff --git a/sound/soc/s3c24xx/Kconfig b/sound/soc/s3c24xx/Kconfig
index 8a6b53ccd203..d85bf8a0abb2 100644
--- a/sound/soc/s3c24xx/Kconfig
+++ b/sound/soc/s3c24xx/Kconfig
@@ -2,6 +2,7 @@ config SND_S3C24XX_SOC
2 tristate "SoC Audio for the Samsung S3CXXXX chips" 2 tristate "SoC Audio for the Samsung S3CXXXX chips"
3 depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 3 depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210
4 select S3C64XX_DMA if ARCH_S3C64XX 4 select S3C64XX_DMA if ARCH_S3C64XX
5 select S3C2410_DMA if ARCH_S3C2410
5 help 6 help
6 Say Y or M if you want to add support for codecs attached to 7 Say Y or M if you want to add support for codecs attached to
7 the S3C24XX AC97 or I2S interfaces. You will also need to 8 the S3C24XX AC97 or I2S interfaces. You will also need to
diff --git a/sound/soc/s3c24xx/rx1950_uda1380.c b/sound/soc/s3c24xx/rx1950_uda1380.c
index ffd5cf2fb0a9..468cc11fdf47 100644
--- a/sound/soc/s3c24xx/rx1950_uda1380.c
+++ b/sound/soc/s3c24xx/rx1950_uda1380.c
@@ -50,7 +50,6 @@ static unsigned int rates[] = {
50 16000, 50 16000,
51 44100, 51 44100,
52 48000, 52 48000,
53 88200,
54}; 53};
55 54
56static struct snd_pcm_hw_constraint_list hw_rates = { 55static struct snd_pcm_hw_constraint_list hw_rates = {
@@ -130,7 +129,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
130}; 129};
131 130
132static struct platform_device *s3c24xx_snd_device; 131static struct platform_device *s3c24xx_snd_device;
133static struct clk *xtal;
134 132
135static int rx1950_startup(struct snd_pcm_substream *substream) 133static int rx1950_startup(struct snd_pcm_substream *substream)
136{ 134{
@@ -179,10 +177,8 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
179 case 44100: 177 case 44100:
180 case 88200: 178 case 88200:
181 clk_source = S3C24XX_CLKSRC_MPLL; 179 clk_source = S3C24XX_CLKSRC_MPLL;
182 fs_mode = S3C2410_IISMOD_256FS; 180 fs_mode = S3C2410_IISMOD_384FS;
183 div = clk_get_rate(xtal) / (256 * rate); 181 div = 1;
184 if (clk_get_rate(xtal) % (256 * rate) > (128 * rate))
185 div++;
186 break; 182 break;
187 default: 183 default:
188 printk(KERN_ERR "%s: rate %d is not supported\n", 184 printk(KERN_ERR "%s: rate %d is not supported\n",
@@ -210,7 +206,7 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream,
210 206
211 /* set MCLK division for sample rate */ 207 /* set MCLK division for sample rate */
212 ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, 208 ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK,
213 S3C2410_IISMOD_384FS); 209 fs_mode);
214 if (ret < 0) 210 if (ret < 0)
215 return ret; 211 return ret;
216 212
@@ -295,17 +291,8 @@ static int __init rx1950_init(void)
295 goto err_plat_add; 291 goto err_plat_add;
296 } 292 }
297 293
298 xtal = clk_get(&s3c24xx_snd_device->dev, "xtal");
299
300 if (IS_ERR(xtal)) {
301 ret = PTR_ERR(xtal);
302 platform_device_unregister(s3c24xx_snd_device);
303 goto err_clk;
304 }
305
306 return 0; 294 return 0;
307 295
308err_clk:
309err_plat_add: 296err_plat_add:
310err_plat_alloc: 297err_plat_alloc:
311err_gpio_conf: 298err_gpio_conf:
@@ -320,7 +307,6 @@ static void __exit rx1950_exit(void)
320 platform_device_unregister(s3c24xx_snd_device); 307 platform_device_unregister(s3c24xx_snd_device);
321 snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), 308 snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios),
322 hp_jack_gpios); 309 hp_jack_gpios);
323 clk_put(xtal);
324 gpio_free(S3C2410_GPA(1)); 310 gpio_free(S3C2410_GPA(1));
325} 311}
326 312
diff --git a/sound/soc/s3c24xx/smdk_spdif.c b/sound/soc/s3c24xx/smdk_spdif.c
index 11c88b13dd2e..761e02b4a6e0 100644
--- a/sound/soc/s3c24xx/smdk_spdif.c
+++ b/sound/soc/s3c24xx/smdk_spdif.c
@@ -38,7 +38,7 @@ static int set_audio_clock_heirachy(struct platform_device *pdev)
38 } 38 }
39 39
40 mout_epll = clk_get(NULL, "mout_epll"); 40 mout_epll = clk_get(NULL, "mout_epll");
41 if (IS_ERR(fout_epll)) { 41 if (IS_ERR(mout_epll)) {
42 printk(KERN_WARNING "%s: Cannot find mout_epll.\n", 42 printk(KERN_WARNING "%s: Cannot find mout_epll.\n",
43 __func__); 43 __func__);
44 ret = -EINVAL; 44 ret = -EINVAL;
@@ -54,7 +54,7 @@ static int set_audio_clock_heirachy(struct platform_device *pdev)
54 } 54 }
55 55
56 sclk_spdif = clk_get(NULL, "sclk_spdif"); 56 sclk_spdif = clk_get(NULL, "sclk_spdif");
57 if (IS_ERR(fout_epll)) { 57 if (IS_ERR(sclk_spdif)) {
58 printk(KERN_WARNING "%s: Cannot find sclk_spdif.\n", 58 printk(KERN_WARNING "%s: Cannot find sclk_spdif.\n",
59 __func__); 59 __func__);
60 ret = -EINVAL; 60 ret = -EINVAL;
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c
index 8778faa174a6..3052f64b2403 100644
--- a/sound/soc/s6000/s6000-i2s.c
+++ b/sound/soc/s6000/s6000-i2s.c
@@ -434,7 +434,7 @@ static struct snd_soc_dai_driver s6000_i2s_dai = {
434 .rate_max = 1562500, 434 .rate_max = 1562500,
435 }, 435 },
436 .ops = &s6000_i2s_dai_ops, 436 .ops = &s6000_i2s_dai_ops,
437} 437};
438 438
439static int __devinit s6000_i2s_probe(struct platform_device *pdev) 439static int __devinit s6000_i2s_probe(struct platform_device *pdev)
440{ 440{
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c
index 271fd222bf19..ab3ccaec72d2 100644
--- a/sound/soc/s6000/s6000-pcm.c
+++ b/sound/soc/s6000/s6000-pcm.c
@@ -473,7 +473,7 @@ static int s6000_pcm_new(struct snd_card *card,
473 } 473 }
474 474
475 res = request_irq(params->irq, s6000_pcm_irq, IRQF_SHARED, 475 res = request_irq(params->irq, s6000_pcm_irq, IRQF_SHARED,
476 s6000_soc_platform.name, pcm); 476 "s6000-audio", pcm);
477 if (res) { 477 if (res) {
478 printk(KERN_ERR "s6000-pcm couldn't get IRQ\n"); 478 printk(KERN_ERR "s6000-pcm couldn't get IRQ\n");
479 return res; 479 return res;
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 96c05e137538..c1244c5bc730 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -167,7 +167,7 @@ static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd)
167 167
168 snd_soc_dapm_sync(codec); 168 snd_soc_dapm_sync(codec);
169 169
170 snd_ctl_add(codec->snd_card, snd_ctl_new1(&audio_out_mux, codec)); 170 snd_ctl_add(codec->card->snd_card, snd_ctl_new1(&audio_out_mux, codec));
171 171
172 return 0; 172 return 0;
173} 173}
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 507e709f2807..4c2404b1b862 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -132,6 +132,8 @@ struct fsi_priv {
132 struct fsi_stream playback; 132 struct fsi_stream playback;
133 struct fsi_stream capture; 133 struct fsi_stream capture;
134 134
135 long rate;
136
135 u32 mst_ctrl; 137 u32 mst_ctrl;
136}; 138};
137 139
@@ -854,10 +856,17 @@ static void fsi_dai_shutdown(struct snd_pcm_substream *substream,
854{ 856{
855 struct fsi_priv *fsi = fsi_get_priv(substream); 857 struct fsi_priv *fsi = fsi_get_priv(substream);
856 int is_play = fsi_is_play(substream); 858 int is_play = fsi_is_play(substream);
859 struct fsi_master *master = fsi_get_master(fsi);
860 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
857 861
858 fsi_irq_disable(fsi, is_play); 862 fsi_irq_disable(fsi, is_play);
859 fsi_clk_ctrl(fsi, 0); 863 fsi_clk_ctrl(fsi, 0);
860 864
865 set_rate = master->info->set_rate;
866 if (set_rate && fsi->rate)
867 set_rate(dai->dev, fsi_is_port_a(fsi), fsi->rate, 0);
868 fsi->rate = 0;
869
861 pm_runtime_put_sync(dai->dev); 870 pm_runtime_put_sync(dai->dev);
862} 871}
863 872
@@ -891,20 +900,20 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
891{ 900{
892 struct fsi_priv *fsi = fsi_get_priv(substream); 901 struct fsi_priv *fsi = fsi_get_priv(substream);
893 struct fsi_master *master = fsi_get_master(fsi); 902 struct fsi_master *master = fsi_get_master(fsi);
894 int (*set_rate)(int is_porta, int rate) = master->info->set_rate; 903 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
895 int fsi_ver = master->core->ver; 904 int fsi_ver = master->core->ver;
896 int is_play = fsi_is_play(substream); 905 long rate = params_rate(params);
897 int ret; 906 int ret;
898 907
899 /* if slave mode, set_rate is not needed */ 908 set_rate = master->info->set_rate;
900 if (!fsi_is_master_mode(fsi, is_play)) 909 if (!set_rate)
901 return 0; 910 return 0;
902 911
903 /* it is error if no set_rate */ 912 ret = set_rate(dai->dev, fsi_is_port_a(fsi), rate, 1);
904 if (!set_rate) 913 if (ret < 0) /* error */
905 return -EIO; 914 return ret;
906 915
907 ret = set_rate(fsi_is_port_a(fsi), params_rate(params)); 916 fsi->rate = rate;
908 if (ret > 0) { 917 if (ret > 0) {
909 u32 data = 0; 918 u32 data = 0;
910 919
diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c
index 40bbdf1591dc..05192d97b377 100644
--- a/sound/soc/sh/ssi.c
+++ b/sound/soc/sh/ssi.c
@@ -387,7 +387,7 @@ static int __devinit sh4_soc_dai_probe(struct platform_device *pdev)
387 387
388static int __devexit sh4_soc_dai_remove(struct platform_device *pdev) 388static int __devexit sh4_soc_dai_remove(struct platform_device *pdev)
389{ 389{
390 snd_soc_unregister_dai(&pdev->dev, ARRAY_SIZE(sh4_ssi_dai)); 390 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(sh4_ssi_dai));
391 return 0; 391 return 0;
392} 392}
393 393
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1c8f3f507f54..85b7d548f167 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -165,8 +165,11 @@ static ssize_t pmdown_time_set(struct device *dev,
165{ 165{
166 struct snd_soc_pcm_runtime *rtd = 166 struct snd_soc_pcm_runtime *rtd =
167 container_of(dev, struct snd_soc_pcm_runtime, dev); 167 container_of(dev, struct snd_soc_pcm_runtime, dev);
168 int ret;
168 169
169 strict_strtol(buf, 10, &rtd->pmdown_time); 170 ret = strict_strtol(buf, 10, &rtd->pmdown_time);
171 if (ret)
172 return ret;
170 173
171 return count; 174 return count;
172} 175}
@@ -1616,12 +1619,14 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
1616#ifdef CONFIG_SND_SOC_AC97_BUS 1619#ifdef CONFIG_SND_SOC_AC97_BUS
1617 /* register any AC97 codecs */ 1620 /* register any AC97 codecs */
1618 for (i = 0; i < card->num_rtd; i++) { 1621 for (i = 0; i < card->num_rtd; i++) {
1619 ret = soc_register_ac97_dai_link(&card->rtd[i]); 1622 ret = soc_register_ac97_dai_link(&card->rtd[i]);
1620 if (ret < 0) { 1623 if (ret < 0) {
1621 printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); 1624 printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name);
1622 goto probe_dai_err; 1625 while (--i >= 0)
1623 } 1626 soc_unregister_ac97_dai_link(&card->rtd[i]);
1627 goto probe_dai_err;
1624 } 1628 }
1629 }
1625#endif 1630#endif
1626 1631
1627 card->instantiated = 1; 1632 card->instantiated = 1;
@@ -3040,8 +3045,10 @@ int snd_soc_register_dais(struct device *dev,
3040 for (i = 0; i < count; i++) { 3045 for (i = 0; i < count; i++) {
3041 3046
3042 dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); 3047 dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL);
3043 if (dai == NULL) 3048 if (dai == NULL) {
3044 return -ENOMEM; 3049 ret = -ENOMEM;
3050 goto err;
3051 }
3045 3052
3046 /* create DAI component name */ 3053 /* create DAI component name */
3047 dai->name = fmt_multiple_name(dev, &dai_drv[i]); 3054 dai->name = fmt_multiple_name(dev, &dai_drv[i]);
@@ -3067,7 +3074,9 @@ int snd_soc_register_dais(struct device *dev,
3067 pr_debug("Registered DAI '%s'\n", dai->name); 3074 pr_debug("Registered DAI '%s'\n", dai->name);
3068 } 3075 }
3069 3076
3077 mutex_lock(&client_mutex);
3070 snd_soc_instantiate_cards(); 3078 snd_soc_instantiate_cards();
3079 mutex_unlock(&client_mutex);
3071 return 0; 3080 return 0;
3072 3081
3073err: 3082err:
@@ -3260,9 +3269,6 @@ int snd_soc_register_codec(struct device *dev,
3260 return 0; 3269 return 0;
3261 3270
3262error: 3271error:
3263 for (i--; i >= 0; i--)
3264 snd_soc_unregister_dai(dev);
3265
3266 if (codec->reg_cache) 3272 if (codec->reg_cache)
3267 kfree(codec->reg_cache); 3273 kfree(codec->reg_cache);
3268 kfree(codec->name); 3274 kfree(codec->name);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7d85c6496afa..c721502833bc 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -683,12 +683,12 @@ static int dapm_seq_compare(struct snd_soc_dapm_widget *a,
683 struct snd_soc_dapm_widget *b, 683 struct snd_soc_dapm_widget *b,
684 int sort[]) 684 int sort[])
685{ 685{
686 if (a->codec != b->codec)
687 return (unsigned long)a - (unsigned long)b;
688 if (sort[a->id] != sort[b->id]) 686 if (sort[a->id] != sort[b->id])
689 return sort[a->id] - sort[b->id]; 687 return sort[a->id] - sort[b->id];
690 if (a->reg != b->reg) 688 if (a->reg != b->reg)
691 return a->reg - b->reg; 689 return a->reg - b->reg;
690 if (a->codec != b->codec)
691 return (unsigned long)a->codec - (unsigned long)b->codec;
692 692
693 return 0; 693 return 0;
694} 694}
@@ -944,6 +944,9 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
944 case SND_SOC_DAPM_STREAM_RESUME: 944 case SND_SOC_DAPM_STREAM_RESUME:
945 sys_power = 1; 945 sys_power = 1;
946 break; 946 break;
947 case SND_SOC_DAPM_STREAM_STOP:
948 sys_power = !!codec->active;
949 break;
947 case SND_SOC_DAPM_STREAM_SUSPEND: 950 case SND_SOC_DAPM_STREAM_SUSPEND:
948 sys_power = 0; 951 sys_power = 0;
949 break; 952 break;
diff --git a/sound/sound_core.c b/sound/sound_core.c
index c03bbaefdbc3..5580aced8730 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -104,7 +104,6 @@ module_exit(cleanup_soundcore);
104 104
105#include <linux/init.h> 105#include <linux/init.h>
106#include <linux/slab.h> 106#include <linux/slab.h>
107#include <linux/smp_lock.h>
108#include <linux/types.h> 107#include <linux/types.h>
109#include <linux/kernel.h> 108#include <linux/kernel.h>
110#include <linux/sound.h> 109#include <linux/sound.h>
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index 1bc56b2b94e2..337a00241a1f 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -155,7 +155,7 @@ static int snd_at73c213_set_bitrate(struct snd_at73c213 *chip)
155 if (max_tries < 1) 155 if (max_tries < 1)
156 max_tries = 1; 156 max_tries = 1;
157 157
158 /* ssc_div must be a power of 2. */ 158 /* ssc_div must be even. */
159 ssc_div = (ssc_div + 1) & ~1UL; 159 ssc_div = (ssc_div + 1) & ~1UL;
160 160
161 if ((ssc_rate / (ssc_div * 2 * 16)) < BITRATE_MIN) { 161 if ((ssc_rate / (ssc_div * 2 * 16)) < BITRATE_MIN) {
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 7dae05d8783e..782f741cd00a 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -60,7 +60,7 @@ static const struct rc_config {
60 { USB_ID(0x041e, 0x3000), 0, 1, 2, 1, 18, 0x0013 }, /* Extigy */ 60 { USB_ID(0x041e, 0x3000), 0, 1, 2, 1, 18, 0x0013 }, /* Extigy */
61 { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */ 61 { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */
62 { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ 62 { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */
63 { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi */ 63 { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */
64 { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ 64 { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */
65}; 65};
66 66
@@ -183,7 +183,13 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
183 if (value > 1) 183 if (value > 1)
184 return -EINVAL; 184 return -EINVAL;
185 changed = value != mixer->audigy2nx_leds[index]; 185 changed = value != mixer->audigy2nx_leds[index];
186 err = snd_usb_ctl_msg(mixer->chip->dev, 186 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
187 err = snd_usb_ctl_msg(mixer->chip->dev,
188 usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
189 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
190 !value, 0, NULL, 0, 100);
191 else
192 err = snd_usb_ctl_msg(mixer->chip->dev,
187 usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, 193 usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
188 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, 194 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
189 value, index + 2, NULL, 0, 100); 195 value, index + 2, NULL, 0, 100);
@@ -225,8 +231,12 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
225 int i, err; 231 int i, err;
226 232
227 for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) { 233 for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) {
234 /* USB X-Fi S51 doesn't have a CMSS LED */
235 if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0)
236 continue;
228 if (i > 1 && /* Live24ext has 2 LEDs only */ 237 if (i > 1 && /* Live24ext has 2 LEDs only */
229 (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || 238 (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
239 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
230 mixer->chip->usb_id == USB_ID(0x041e, 0x3048))) 240 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)))
231 break; 241 break;
232 err = snd_ctl_add(mixer->chip->card, 242 err = snd_ctl_add(mixer->chip->card,
@@ -365,6 +375,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
365 375
366 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) || 376 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
367 mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || 377 mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
378 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
368 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) { 379 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) {
369 if ((err = snd_audigy2nx_controls_create(mixer)) < 0) 380 if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
370 return err; 381 return err;
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index cff3a3c465d7..4132522ac90f 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -676,8 +676,10 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
676 if (!needs_knot) 676 if (!needs_knot)
677 return 0; 677 return 0;
678 678
679 subs->rate_list.count = count;
680 subs->rate_list.list = kmalloc(sizeof(int) * count, GFP_KERNEL); 679 subs->rate_list.list = kmalloc(sizeof(int) * count, GFP_KERNEL);
680 if (!subs->rate_list.list)
681 return -ENOMEM;
682 subs->rate_list.count = count;
681 subs->rate_list.mask = 0; 683 subs->rate_list.mask = 0;
682 count = 0; 684 count = 0;
683 list_for_each_entry(fp, &subs->fmt_list, list) { 685 list_for_each_entry(fp, &subs->fmt_list, list) {