aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-10 12:19:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-10 12:19:44 -0400
commite7990d45bb88c2f0565b5ee4c32eefe81653faff (patch)
tree852ab6988b7226083fefa0e0e851dbff0e7ec7f2 /sound
parent190a3998be3ede25d6145e187d6d321f504d28fb (diff)
parenta5065eb6da55b226661456e6a7435f605df98111 (diff)
Merge tag 'sound-fix-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Here is a bunch of small fixes that have been collected since the previous pull request. In addition to various misc fixes, the following are included: - HD-audio quirks for Dell, HP, Chromebook, and ALC28x codecs - HD-audio AMD HDMI regression fix - Continued PM support/fixes for ice1712 driver - Multiplatform fixes for ASoC samsung drivers - Addition of device id tables to a few ASoC drivers - Bit clock polarity config and error flag fixes in ASoC fsl_sai" * tag 'sound-fix-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (32 commits) ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() ALSA: hda - Make full_reset boolean ALSA: hda - add headset mic detect quirk for a Dell laptop sound: dmasound: use module_platform_driver_probe() ALSA: au1x00: use module_platform_driver() ALSA: hda - Use runtime helper to check active state. ALSA: ice1712: Fix boundary checks in PCM pointer ops ASoC: davinci-mcasp: Fix bit clock polarity settings ASoC: samsung: Fix build on multiplatform ASoC: fsl_sai: Fix Bit Clock Polarity configurations ALSA: hda - Do not assign streams in reverse order ALSA: hda/realtek - Add eapd shutup to ALC283 ALSA: hda/realtek - Change model name alias for ChromeOS ASoC: da732x: Print correct major id ALSA: hda/realtek - Improve HP depop when system change power state on Chromebook ASoC: cs42l52: Fix mask for REVID sound/oss: Remove uncompilable DBG macro use ALSA: ice1712: Save/restore routing and rate registers ALSA: ice1712: restore AK4xxx volumes on resume ASoC: alc56(23|32): fix undefined return value of probing code ...
Diffstat (limited to 'sound')
-rw-r--r--sound/i2c/cs8427.c57
-rw-r--r--sound/mips/au1x00.c13
-rw-r--r--sound/oss/ad1848.c4
-rw-r--r--sound/oss/dmasound/dmasound_paula.c14
-rw-r--r--sound/oss/opl3.c3
-rw-r--r--sound/oss/pas2_mixer.c9
-rw-r--r--sound/oss/pas2_pcm.c18
-rw-r--r--sound/oss/sb_common.c4
-rw-r--r--sound/oss/sb_ess.c4
-rw-r--r--sound/oss/sequencer.c6
-rw-r--r--sound/oss/sound_config.h4
-rw-r--r--sound/oss/soundcard.c6
-rw-r--r--sound/oss/uart401.c11
-rw-r--r--sound/pci/hda/hda_controller.c19
-rw-r--r--sound/pci/hda/hda_controller.h2
-rw-r--r--sound/pci/hda/hda_intel.c4
-rw-r--r--sound/pci/hda/patch_realtek.c23
-rw-r--r--sound/pci/ice1712/delta.c31
-rw-r--r--sound/pci/ice1712/ice1712.c47
-rw-r--r--sound/soc/codecs/alc5623.c3
-rw-r--r--sound/soc/codecs/alc5632.c10
-rw-r--r--sound/soc/codecs/cs42l52.c2
-rw-r--r--sound/soc/codecs/cs42l52.h2
-rw-r--r--sound/soc/codecs/cs42xx8.c11
-rw-r--r--sound/soc/codecs/da732x.c3
-rw-r--r--sound/soc/codecs/max98090.c7
-rw-r--r--sound/soc/codecs/rt5640.c9
-rw-r--r--sound/soc/codecs/tlv320aic23-i2c.c7
-rw-r--r--sound/soc/davinci/davinci-mcasp.c6
-rw-r--r--sound/soc/fsl/fsl_sai.c93
-rw-r--r--sound/soc/fsl/fsl_sai.h15
-rw-r--r--sound/soc/samsung/ac97.c6
-rw-r--r--sound/soc/samsung/dma.h6
-rw-r--r--sound/soc/samsung/i2s.c6
-rw-r--r--sound/soc/samsung/pcm.c5
-rw-r--r--sound/soc/samsung/s3c2412-i2s.c4
-rw-r--r--sound/soc/samsung/s3c24xx-i2s.c4
-rw-r--r--sound/soc/samsung/spdif.c3
-rw-r--r--sound/usb/pcm.c3
39 files changed, 310 insertions, 174 deletions
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c
index 6c2dc3863ac0..7e21621e492a 100644
--- a/sound/i2c/cs8427.c
+++ b/sound/i2c/cs8427.c
@@ -150,10 +150,8 @@ static void snd_cs8427_free(struct snd_i2c_device *device)
150 kfree(device->private_data); 150 kfree(device->private_data);
151} 151}
152 152
153int snd_cs8427_create(struct snd_i2c_bus *bus, 153int snd_cs8427_init(struct snd_i2c_bus *bus,
154 unsigned char addr, 154 struct snd_i2c_device *device)
155 unsigned int reset_timeout,
156 struct snd_i2c_device **r_cs8427)
157{ 155{
158 static unsigned char initvals1[] = { 156 static unsigned char initvals1[] = {
159 CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC, 157 CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC,
@@ -200,22 +198,10 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
200 Inhibit E->F transfers. */ 198 Inhibit E->F transfers. */
201 CS8427_UD | CS8427_EFTUI | CS8427_DETUI, 199 CS8427_UD | CS8427_EFTUI | CS8427_DETUI,
202 }; 200 };
201 struct cs8427 *chip = device->private_data;
203 int err; 202 int err;
204 struct cs8427 *chip;
205 struct snd_i2c_device *device;
206 unsigned char buf[24]; 203 unsigned char buf[24];
207 204
208 if ((err = snd_i2c_device_create(bus, "CS8427",
209 CS8427_ADDR | (addr & 7),
210 &device)) < 0)
211 return err;
212 chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
213 if (chip == NULL) {
214 snd_i2c_device_free(device);
215 return -ENOMEM;
216 }
217 device->private_free = snd_cs8427_free;
218
219 snd_i2c_lock(bus); 205 snd_i2c_lock(bus);
220 err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER); 206 err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER);
221 if (err != CS8427_VER8427A) { 207 if (err != CS8427_VER8427A) {
@@ -264,10 +250,44 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
264 snd_i2c_unlock(bus); 250 snd_i2c_unlock(bus);
265 251
266 /* turn on run bit and rock'n'roll */ 252 /* turn on run bit and rock'n'roll */
253 snd_cs8427_reset(device);
254
255 return 0;
256
257__fail:
258 snd_i2c_unlock(bus);
259
260 return err;
261}
262EXPORT_SYMBOL(snd_cs8427_init);
263
264int snd_cs8427_create(struct snd_i2c_bus *bus,
265 unsigned char addr,
266 unsigned int reset_timeout,
267 struct snd_i2c_device **r_cs8427)
268{
269 int err;
270 struct cs8427 *chip;
271 struct snd_i2c_device *device;
272
273 err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7),
274 &device);
275 if (err < 0)
276 return err;
277 chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
278 if (chip == NULL) {
279 snd_i2c_device_free(device);
280 return -ENOMEM;
281 }
282 device->private_free = snd_cs8427_free;
283
267 if (reset_timeout < 1) 284 if (reset_timeout < 1)
268 reset_timeout = 1; 285 reset_timeout = 1;
269 chip->reset_timeout = reset_timeout; 286 chip->reset_timeout = reset_timeout;
270 snd_cs8427_reset(device); 287
288 err = snd_cs8427_init(bus, device);
289 if (err)
290 goto __fail;
271 291
272#if 0 // it's nice for read tests 292#if 0 // it's nice for read tests
273 { 293 {
@@ -286,7 +306,6 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
286 return 0; 306 return 0;
287 307
288 __fail: 308 __fail:
289 snd_i2c_unlock(bus);
290 snd_i2c_device_free(device); 309 snd_i2c_device_free(device);
291 return err < 0 ? err : -EIO; 310 return err < 0 ? err : -EIO;
292} 311}
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index a7cc49e96068..d10ef7675268 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -725,15 +725,4 @@ struct platform_driver au1000_ac97c_driver = {
725 .remove = au1000_ac97_remove, 725 .remove = au1000_ac97_remove,
726}; 726};
727 727
728static int __init au1000_ac97_load(void) 728module_platform_driver(au1000_ac97c_driver);
729{
730 return platform_driver_register(&au1000_ac97c_driver);
731}
732
733static void __exit au1000_ac97_unload(void)
734{
735 platform_driver_unregister(&au1000_ac97c_driver);
736}
737
738module_init(au1000_ac97_load);
739module_exit(au1000_ac97_unload);
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
index 4918b7145b73..ec1ee07df59d 100644
--- a/sound/oss/ad1848.c
+++ b/sound/oss/ad1848.c
@@ -50,8 +50,6 @@
50#include <linux/pnp.h> 50#include <linux/pnp.h>
51#include <linux/spinlock.h> 51#include <linux/spinlock.h>
52 52
53#define DEB(x)
54#define DEB1(x)
55#include "sound_config.h" 53#include "sound_config.h"
56 54
57#include "ad1848.h" 55#include "ad1848.h"
@@ -1016,8 +1014,6 @@ static void ad1848_close(int dev)
1016 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; 1014 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc;
1017 ad1848_port_info *portc = (ad1848_port_info *) audio_devs[dev]->portc; 1015 ad1848_port_info *portc = (ad1848_port_info *) audio_devs[dev]->portc;
1018 1016
1019 DEB(printk("ad1848_close(void)\n"));
1020
1021 devc->intr_active = 0; 1017 devc->intr_active = 0;
1022 ad1848_halt(dev); 1018 ad1848_halt(dev);
1023 1019
diff --git a/sound/oss/dmasound/dmasound_paula.c b/sound/oss/dmasound/dmasound_paula.c
index 87910e992133..c2d45a5848bc 100644
--- a/sound/oss/dmasound/dmasound_paula.c
+++ b/sound/oss/dmasound/dmasound_paula.c
@@ -733,19 +733,7 @@ static struct platform_driver amiga_audio_driver = {
733 }, 733 },
734}; 734};
735 735
736static int __init amiga_audio_init(void) 736module_platform_driver_probe(amiga_audio_driver, amiga_audio_probe);
737{
738 return platform_driver_probe(&amiga_audio_driver, amiga_audio_probe);
739}
740
741module_init(amiga_audio_init);
742
743static void __exit amiga_audio_exit(void)
744{
745 platform_driver_unregister(&amiga_audio_driver);
746}
747
748module_exit(amiga_audio_exit);
749 737
750MODULE_LICENSE("GPL"); 738MODULE_LICENSE("GPL");
751MODULE_ALIAS("platform:amiga-audio"); 739MODULE_ALIAS("platform:amiga-audio");
diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c
index c5c24409ceb0..4709e592e2cc 100644
--- a/sound/oss/opl3.c
+++ b/sound/oss/opl3.c
@@ -275,7 +275,6 @@ static int opl3_kill_note (int devno, int voice, int note, int velocity)
275 devc->v_alloc->map[voice] = 0; 275 devc->v_alloc->map[voice] = 0;
276 276
277 map = &pv_map[devc->lv_map[voice]]; 277 map = &pv_map[devc->lv_map[voice]];
278 DEB(printk("Kill note %d\n", voice));
279 278
280 if (map->voice_mode == 0) 279 if (map->voice_mode == 0)
281 return 0; 280 return 0;
@@ -873,8 +872,6 @@ static void opl3_aftertouch(int dev, int voice, int pressure)
873 872
874 map = &pv_map[devc->lv_map[voice]]; 873 map = &pv_map[devc->lv_map[voice]];
875 874
876 DEB(printk("Aftertouch %d\n", voice));
877
878 if (map->voice_mode == 0) 875 if (map->voice_mode == 0)
879 return; 876 return;
880 877
diff --git a/sound/oss/pas2_mixer.c b/sound/oss/pas2_mixer.c
index a0bcb85c3904..50b5bd501247 100644
--- a/sound/oss/pas2_mixer.c
+++ b/sound/oss/pas2_mixer.c
@@ -21,10 +21,6 @@
21 21
22#include "pas2.h" 22#include "pas2.h"
23 23
24#ifndef DEB
25#define DEB(what) /* (what) */
26#endif
27
28extern int pas_translate_code; 24extern int pas_translate_code;
29extern char pas_model; 25extern char pas_model;
30extern int *pas_osp; 26extern int *pas_osp;
@@ -120,8 +116,6 @@ pas_mixer_set(int whichDev, unsigned int level)
120{ 116{
121 int left, right, devmask, changed, i, mixer = 0; 117 int left, right, devmask, changed, i, mixer = 0;
122 118
123 DEB(printk("static int pas_mixer_set(int whichDev = %d, unsigned int level = %X)\n", whichDev, level));
124
125 left = level & 0x7f; 119 left = level & 0x7f;
126 right = (level & 0x7f00) >> 8; 120 right = (level & 0x7f00) >> 8;
127 121
@@ -207,8 +201,6 @@ pas_mixer_reset(void)
207{ 201{
208 int foo; 202 int foo;
209 203
210 DEB(printk("pas2_mixer.c: void pas_mixer_reset(void)\n"));
211
212 for (foo = 0; foo < SOUND_MIXER_NRDEVICES; foo++) 204 for (foo = 0; foo < SOUND_MIXER_NRDEVICES; foo++)
213 pas_mixer_set(foo, levels[foo]); 205 pas_mixer_set(foo, levels[foo]);
214 206
@@ -220,7 +212,6 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
220 int level,v ; 212 int level,v ;
221 int __user *p = (int __user *)arg; 213 int __user *p = (int __user *)arg;
222 214
223 DEB(printk("pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
224 if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */ 215 if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */
225 if (get_user(level, p)) 216 if (get_user(level, p))
226 return -EFAULT; 217 return -EFAULT;
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 6f13ab4afc6b..474803b52f7d 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -22,10 +22,6 @@
22 22
23#include "pas2.h" 23#include "pas2.h"
24 24
25#ifndef DEB
26#define DEB(WHAT)
27#endif
28
29#define PAS_PCM_INTRBITS (0x08) 25#define PAS_PCM_INTRBITS (0x08)
30/* 26/*
31 * Sample buffer timer interrupt enable 27 * Sample buffer timer interrupt enable
@@ -156,8 +152,6 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
156 int val, ret; 152 int val, ret;
157 int __user *p = arg; 153 int __user *p = arg;
158 154
159 DEB(printk("pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
160
161 switch (cmd) 155 switch (cmd)
162 { 156 {
163 case SOUND_PCM_WRITE_RATE: 157 case SOUND_PCM_WRITE_RATE:
@@ -204,8 +198,6 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
204 198
205static void pas_audio_reset(int dev) 199static void pas_audio_reset(int dev)
206{ 200{
207 DEB(printk("pas2_pcm.c: static void pas_audio_reset(void)\n"));
208
209 pas_write(pas_read(0xF8A) & ~0x40, 0xF8A); /* Disable PCM */ 201 pas_write(pas_read(0xF8A) & ~0x40, 0xF8A); /* Disable PCM */
210} 202}
211 203
@@ -214,8 +206,6 @@ static int pas_audio_open(int dev, int mode)
214 int err; 206 int err;
215 unsigned long flags; 207 unsigned long flags;
216 208
217 DEB(printk("pas2_pcm.c: static int pas_audio_open(int mode = %X)\n", mode));
218
219 spin_lock_irqsave(&pas_lock, flags); 209 spin_lock_irqsave(&pas_lock, flags);
220 if (pcm_busy) 210 if (pcm_busy)
221 { 211 {
@@ -239,8 +229,6 @@ static void pas_audio_close(int dev)
239{ 229{
240 unsigned long flags; 230 unsigned long flags;
241 231
242 DEB(printk("pas2_pcm.c: static void pas_audio_close(void)\n"));
243
244 spin_lock_irqsave(&pas_lock, flags); 232 spin_lock_irqsave(&pas_lock, flags);
245 233
246 pas_audio_reset(dev); 234 pas_audio_reset(dev);
@@ -256,8 +244,6 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count,
256{ 244{
257 unsigned long flags, cnt; 245 unsigned long flags, cnt;
258 246
259 DEB(printk("pas2_pcm.c: static void pas_audio_output_block(char *buf = %P, int count = %X)\n", buf, count));
260
261 cnt = count; 247 cnt = count;
262 if (audio_devs[dev]->dmap_out->dma > 3) 248 if (audio_devs[dev]->dmap_out->dma > 3)
263 cnt >>= 1; 249 cnt >>= 1;
@@ -303,8 +289,6 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count,
303 unsigned long flags; 289 unsigned long flags;
304 int cnt; 290 int cnt;
305 291
306 DEB(printk("pas2_pcm.c: static void pas_audio_start_input(char *buf = %P, int count = %X)\n", buf, count));
307
308 cnt = count; 292 cnt = count;
309 if (audio_devs[dev]->dmap_out->dma > 3) 293 if (audio_devs[dev]->dmap_out->dma > 3)
310 cnt >>= 1; 294 cnt >>= 1;
@@ -388,8 +372,6 @@ static struct audio_driver pas_audio_driver =
388 372
389void __init pas_pcm_init(struct address_info *hw_config) 373void __init pas_pcm_init(struct address_info *hw_config)
390{ 374{
391 DEB(printk("pas2_pcm.c: long pas_pcm_init()\n"));
392
393 pcm_bitsok = 8; 375 pcm_bitsok = 8;
394 if (pas_read(0xEF8B) & 0x08) 376 if (pas_read(0xEF8B) & 0x08)
395 pcm_bitsok |= 16; 377 pcm_bitsok |= 16;
diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c
index 851a1da46be1..3d50fb4236ed 100644
--- a/sound/oss/sb_common.c
+++ b/sound/oss/sb_common.c
@@ -226,8 +226,6 @@ int sb_dsp_reset(sb_devc * devc)
226{ 226{
227 int loopc; 227 int loopc;
228 228
229 DEB(printk("Entered sb_dsp_reset()\n"));
230
231 if (devc->model == MDL_ESS) return ess_dsp_reset (devc); 229 if (devc->model == MDL_ESS) return ess_dsp_reset (devc);
232 230
233 /* This is only for non-ESS chips */ 231 /* This is only for non-ESS chips */
@@ -246,8 +244,6 @@ int sb_dsp_reset(sb_devc * devc)
246 return 0; /* Sorry */ 244 return 0; /* Sorry */
247 } 245 }
248 246
249 DEB(printk("sb_dsp_reset() OK\n"));
250
251 return 1; 247 return 1;
252} 248}
253 249
diff --git a/sound/oss/sb_ess.c b/sound/oss/sb_ess.c
index 0e7254bde4c2..b47a69026f1b 100644
--- a/sound/oss/sb_ess.c
+++ b/sound/oss/sb_ess.c
@@ -865,8 +865,6 @@ printk(KERN_INFO "FKS: ess_dsp_reset 1\n");
865ess_show_mixerregs (devc); 865ess_show_mixerregs (devc);
866#endif 866#endif
867 867
868 DEB(printk("Entered ess_dsp_reset()\n"));
869
870 outb(3, DSP_RESET); /* Reset FIFO too */ 868 outb(3, DSP_RESET); /* Reset FIFO too */
871 869
872 udelay(10); 870 udelay(10);
@@ -881,8 +879,6 @@ ess_show_mixerregs (devc);
881 } 879 }
882 ess_extended (devc); 880 ess_extended (devc);
883 881
884 DEB(printk("sb_dsp_reset() OK\n"));
885
886#ifdef FKS_LOGGING 882#ifdef FKS_LOGGING
887printk(KERN_INFO "FKS: dsp_reset 2\n"); 883printk(KERN_INFO "FKS: dsp_reset 2\n");
888ess_show_mixerregs (devc); 884ess_show_mixerregs (devc);
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 9b9f7d385134..c0eea1dfe90f 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -216,8 +216,6 @@ int sequencer_write(int dev, struct file *file, const char __user *buf, int coun
216 216
217 dev = dev >> 4; 217 dev = dev >> 4;
218 218
219 DEB(printk("sequencer_write(dev=%d, count=%d)\n", dev, count));
220
221 if (mode == OPEN_READ) 219 if (mode == OPEN_READ)
222 return -EIO; 220 return -EIO;
223 221
@@ -959,8 +957,6 @@ int sequencer_open(int dev, struct file *file)
959 dev = dev >> 4; 957 dev = dev >> 4;
960 mode = translate_mode(file); 958 mode = translate_mode(file);
961 959
962 DEB(printk("sequencer_open(dev=%d)\n", dev));
963
964 if (!sequencer_ok) 960 if (!sequencer_ok)
965 { 961 {
966/* printk("Sound card: sequencer not initialized\n");*/ 962/* printk("Sound card: sequencer not initialized\n");*/
@@ -1133,8 +1129,6 @@ void sequencer_release(int dev, struct file *file)
1133 1129
1134 dev = dev >> 4; 1130 dev = dev >> 4;
1135 1131
1136 DEB(printk("sequencer_release(dev=%d)\n", dev));
1137
1138 /* 1132 /*
1139 * Wait until the queue is empty (if we don't have nonblock) 1133 * Wait until the queue is empty (if we don't have nonblock)
1140 */ 1134 */
diff --git a/sound/oss/sound_config.h b/sound/oss/sound_config.h
index 9d35c4c65b9b..f2554ab78f5e 100644
--- a/sound/oss/sound_config.h
+++ b/sound/oss/sound_config.h
@@ -123,10 +123,6 @@ static inline int translate_mode(struct file *file)
123#include "sound_calls.h" 123#include "sound_calls.h"
124#include "dev_table.h" 124#include "dev_table.h"
125 125
126#ifndef DEB
127#define DEB(x)
128#endif
129
130#ifndef DDB 126#ifndef DDB
131#define DDB(x) do {} while (0) 127#define DDB(x) do {} while (0)
132#endif 128#endif
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index e7780349cc55..b70c7c8f9c5d 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -154,7 +154,6 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof
154 154
155 mutex_lock(&soundcard_mutex); 155 mutex_lock(&soundcard_mutex);
156 156
157 DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count));
158 switch (dev & 0x0f) { 157 switch (dev & 0x0f) {
159 case SND_DEV_DSP: 158 case SND_DEV_DSP:
160 case SND_DEV_DSP16: 159 case SND_DEV_DSP16:
@@ -180,7 +179,6 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou
180 int ret = -EINVAL; 179 int ret = -EINVAL;
181 180
182 mutex_lock(&soundcard_mutex); 181 mutex_lock(&soundcard_mutex);
183 DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count));
184 switch (dev & 0x0f) { 182 switch (dev & 0x0f) {
185 case SND_DEV_SEQ: 183 case SND_DEV_SEQ:
186 case SND_DEV_SEQ2: 184 case SND_DEV_SEQ2:
@@ -206,7 +204,6 @@ static int sound_open(struct inode *inode, struct file *file)
206 int dev = iminor(inode); 204 int dev = iminor(inode);
207 int retval; 205 int retval;
208 206
209 DEB(printk("sound_open(dev=%d)\n", dev));
210 if ((dev >= SND_NDEVS) || (dev < 0)) { 207 if ((dev >= SND_NDEVS) || (dev < 0)) {
211 printk(KERN_ERR "Invalid minor device %d\n", dev); 208 printk(KERN_ERR "Invalid minor device %d\n", dev);
212 return -ENXIO; 209 return -ENXIO;
@@ -257,7 +254,6 @@ static int sound_release(struct inode *inode, struct file *file)
257 int dev = iminor(inode); 254 int dev = iminor(inode);
258 255
259 mutex_lock(&soundcard_mutex); 256 mutex_lock(&soundcard_mutex);
260 DEB(printk("sound_release(dev=%d)\n", dev));
261 switch (dev & 0x0f) { 257 switch (dev & 0x0f) {
262 case SND_DEV_CTL: 258 case SND_DEV_CTL:
263 module_put(mixer_devs[dev >> 4]->owner); 259 module_put(mixer_devs[dev >> 4]->owner);
@@ -351,7 +347,6 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
351 if (!access_ok(VERIFY_WRITE, p, len)) 347 if (!access_ok(VERIFY_WRITE, p, len))
352 return -EFAULT; 348 return -EFAULT;
353 } 349 }
354 DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
355 if (cmd == OSS_GETVERSION) 350 if (cmd == OSS_GETVERSION)
356 return __put_user(SOUND_VERSION, (int __user *)p); 351 return __put_user(SOUND_VERSION, (int __user *)p);
357 352
@@ -409,7 +404,6 @@ static unsigned int sound_poll(struct file *file, poll_table * wait)
409 struct inode *inode = file_inode(file); 404 struct inode *inode = file_inode(file);
410 int dev = iminor(inode); 405 int dev = iminor(inode);
411 406
412 DEB(printk("sound_poll(dev=%d)\n", dev));
413 switch (dev & 0x0f) { 407 switch (dev & 0x0f) {
414 case SND_DEV_SEQ: 408 case SND_DEV_SEQ:
415 case SND_DEV_SEQ2: 409 case SND_DEV_SEQ2:
diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c
index 5433c6f5eca2..62b8869f5a4c 100644
--- a/sound/oss/uart401.c
+++ b/sound/oss/uart401.c
@@ -274,19 +274,12 @@ static int reset_uart401(uart401_devc * devc)
274 } 274 }
275 } 275 }
276 276
277 277 /* Flush input before enabling interrupts */
278 if (ok) 278 if (ok)
279 { 279 uart401_input_loop(devc);
280 DEB(printk("Reset UART401 OK\n"));
281 }
282 else 280 else
283 DDB(printk("Reset UART401 failed - No hardware detected.\n")); 281 DDB(printk("Reset UART401 failed - No hardware detected.\n"));
284 282
285 if (ok)
286 uart401_input_loop(devc); /*
287 * Flush input before enabling interrupts
288 */
289
290 return ok; 283 return ok;
291} 284}
292 285
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 97993e17f46a..248b90abb882 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -187,13 +187,14 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
187 struct azx_dev *azx_dev = &chip->azx_dev[dev]; 187 struct azx_dev *azx_dev = &chip->azx_dev[dev];
188 dsp_lock(azx_dev); 188 dsp_lock(azx_dev);
189 if (!azx_dev->opened && !dsp_is_locked(azx_dev)) { 189 if (!azx_dev->opened && !dsp_is_locked(azx_dev)) {
190 res = azx_dev; 190 if (azx_dev->assigned_key == key) {
191 if (res->assigned_key == key) { 191 azx_dev->opened = 1;
192 res->opened = 1; 192 azx_dev->assigned_key = key;
193 res->assigned_key = key;
194 dsp_unlock(azx_dev); 193 dsp_unlock(azx_dev);
195 return azx_dev; 194 return azx_dev;
196 } 195 }
196 if (!res)
197 res = azx_dev;
197 } 198 }
198 dsp_unlock(azx_dev); 199 dsp_unlock(azx_dev);
199 } 200 }
@@ -1604,7 +1605,7 @@ static void azx_exit_link_reset(struct azx *chip)
1604} 1605}
1605 1606
1606/* reset codec link */ 1607/* reset codec link */
1607static int azx_reset(struct azx *chip, int full_reset) 1608static int azx_reset(struct azx *chip, bool full_reset)
1608{ 1609{
1609 if (!full_reset) 1610 if (!full_reset)
1610 goto __skip; 1611 goto __skip;
@@ -1701,7 +1702,7 @@ static void azx_int_clear(struct azx *chip)
1701/* 1702/*
1702 * reset and start the controller registers 1703 * reset and start the controller registers
1703 */ 1704 */
1704void azx_init_chip(struct azx *chip, int full_reset) 1705void azx_init_chip(struct azx *chip, bool full_reset)
1705{ 1706{
1706 if (chip->initialized) 1707 if (chip->initialized)
1707 return; 1708 return;
@@ -1758,7 +1759,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
1758 1759
1759#ifdef CONFIG_PM_RUNTIME 1760#ifdef CONFIG_PM_RUNTIME
1760 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) 1761 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
1761 if (chip->card->dev->power.runtime_status != RPM_ACTIVE) 1762 if (!pm_runtime_active(chip->card->dev))
1762 return IRQ_NONE; 1763 return IRQ_NONE;
1763#endif 1764#endif
1764 1765
@@ -1841,7 +1842,7 @@ static void azx_bus_reset(struct hda_bus *bus)
1841 1842
1842 bus->in_reset = 1; 1843 bus->in_reset = 1;
1843 azx_stop_chip(chip); 1844 azx_stop_chip(chip);
1844 azx_init_chip(chip, 1); 1845 azx_init_chip(chip, true);
1845#ifdef CONFIG_PM 1846#ifdef CONFIG_PM
1846 if (chip->initialized) { 1847 if (chip->initialized) {
1847 struct azx_pcm *p; 1848 struct azx_pcm *p;
@@ -1948,7 +1949,7 @@ int azx_codec_create(struct azx *chip, const char *model,
1948 * get back to the sanity state. 1949 * get back to the sanity state.
1949 */ 1950 */
1950 azx_stop_chip(chip); 1951 azx_stop_chip(chip);
1951 azx_init_chip(chip, 1); 1952 azx_init_chip(chip, true);
1952 } 1953 }
1953 } 1954 }
1954 } 1955 }
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 1d2e3be2bae6..baf0e77330af 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -37,7 +37,7 @@ int azx_alloc_stream_pages(struct azx *chip);
37void azx_free_stream_pages(struct azx *chip); 37void azx_free_stream_pages(struct azx *chip);
38 38
39/* Low level azx interface */ 39/* Low level azx interface */
40void azx_init_chip(struct azx *chip, int full_reset); 40void azx_init_chip(struct azx *chip, bool full_reset);
41void azx_stop_chip(struct azx *chip); 41void azx_stop_chip(struct azx *chip);
42void azx_enter_link_reset(struct azx *chip); 42void azx_enter_link_reset(struct azx *chip);
43irqreturn_t azx_interrupt(int irq, void *dev_id); 43irqreturn_t azx_interrupt(int irq, void *dev_id);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 77ca894f8284..d6bca62ef387 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -636,7 +636,7 @@ static int azx_resume(struct device *dev)
636 return -EIO; 636 return -EIO;
637 azx_init_pci(chip); 637 azx_init_pci(chip);
638 638
639 azx_init_chip(chip, 1); 639 azx_init_chip(chip, true);
640 640
641 snd_hda_resume(chip->bus); 641 snd_hda_resume(chip->bus);
642 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 642 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -689,7 +689,7 @@ static int azx_runtime_resume(struct device *dev)
689 status = azx_readw(chip, STATESTS); 689 status = azx_readw(chip, STATESTS);
690 690
691 azx_init_pci(chip); 691 azx_init_pci(chip);
692 azx_init_chip(chip, 1); 692 azx_init_chip(chip, true);
693 693
694 bus = chip->bus; 694 bus = chip->bus;
695 if (status && bus) { 695 if (status && bus) {
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ea2351d119f0..14ae979a92ea 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3026,6 +3026,11 @@ static void alc283_init(struct hda_codec *codec)
3026 bool hp_pin_sense; 3026 bool hp_pin_sense;
3027 int val; 3027 int val;
3028 3028
3029 if (!spec->gen.autocfg.hp_outs) {
3030 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3031 hp_pin = spec->gen.autocfg.line_out_pins[0];
3032 }
3033
3029 alc283_restore_default_value(codec); 3034 alc283_restore_default_value(codec);
3030 3035
3031 if (!hp_pin) 3036 if (!hp_pin)
@@ -3062,6 +3067,11 @@ static void alc283_shutup(struct hda_codec *codec)
3062 bool hp_pin_sense; 3067 bool hp_pin_sense;
3063 int val; 3068 int val;
3064 3069
3070 if (!spec->gen.autocfg.hp_outs) {
3071 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3072 hp_pin = spec->gen.autocfg.line_out_pins[0];
3073 }
3074
3065 if (!hp_pin) { 3075 if (!hp_pin) {
3066 alc269_shutup(codec); 3076 alc269_shutup(codec);
3067 return; 3077 return;
@@ -3085,6 +3095,7 @@ static void alc283_shutup(struct hda_codec *codec)
3085 3095
3086 if (hp_pin_sense) 3096 if (hp_pin_sense)
3087 msleep(100); 3097 msleep(100);
3098 alc_auto_setup_eapd(codec, false);
3088 snd_hda_shutup_pins(codec); 3099 snd_hda_shutup_pins(codec);
3089 alc_write_coef_idx(codec, 0x43, 0x9614); 3100 alc_write_coef_idx(codec, 0x43, 0x9614);
3090} 3101}
@@ -3361,8 +3372,9 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3361 3372
3362 if (spec->mute_led_polarity) 3373 if (spec->mute_led_polarity)
3363 enabled = !enabled; 3374 enabled = !enabled;
3364 pinval = AC_PINCTL_IN_EN | 3375 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3365 (enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80); 3376 pinval &= ~AC_PINCTL_VREFEN;
3377 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3366 if (spec->mute_led_nid) 3378 if (spec->mute_led_nid)
3367 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); 3379 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3368} 3380}
@@ -3994,6 +4006,10 @@ static void alc283_fixup_chromebook(struct hda_codec *codec,
3994 spec->gen.mixer_nid = 0; 4006 spec->gen.mixer_nid = 0;
3995 break; 4007 break;
3996 case HDA_FIXUP_ACT_INIT: 4008 case HDA_FIXUP_ACT_INIT:
4009 /* MIC2-VREF control */
4010 /* Set to manual mode */
4011 val = alc_read_coef_idx(codec, 0x06);
4012 alc_write_coef_idx(codec, 0x06, val & ~0x000c);
3997 /* Enable Line1 input control by verb */ 4013 /* Enable Line1 input control by verb */
3998 val = alc_read_coef_idx(codec, 0x1a); 4014 val = alc_read_coef_idx(codec, 0x1a);
3999 alc_write_coef_idx(codec, 0x1a, val | (1 << 4)); 4015 alc_write_coef_idx(codec, 0x1a, val | (1 << 4));
@@ -4602,6 +4618,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4602 SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4618 SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4603 SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4619 SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4604 SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4620 SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4621 SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4605 SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), 4622 SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4606 SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), 4623 SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4607 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4624 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
@@ -4768,7 +4785,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
4768 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, 4785 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
4769 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, 4786 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
4770 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, 4787 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
4771 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-chrome"}, 4788 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
4772 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, 4789 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
4773 {} 4790 {}
4774}; 4791};
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index ed2144eee38a..496dbd0ad5db 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -579,12 +579,37 @@ static struct snd_ak4xxx_private akm_vx442_priv = {
579#ifdef CONFIG_PM_SLEEP 579#ifdef CONFIG_PM_SLEEP
580static int snd_ice1712_delta_resume(struct snd_ice1712 *ice) 580static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
581{ 581{
582 unsigned char akm_backup[AK4XXX_IMAGE_SIZE]; 582 unsigned char akm_img_bak[AK4XXX_IMAGE_SIZE];
583 unsigned char akm_vol_bak[AK4XXX_IMAGE_SIZE];
584
585 /* init spdif */
586 switch (ice->eeprom.subvendor) {
587 case ICE1712_SUBDEVICE_AUDIOPHILE:
588 case ICE1712_SUBDEVICE_DELTA410:
589 case ICE1712_SUBDEVICE_DELTA1010E:
590 case ICE1712_SUBDEVICE_DELTA1010LT:
591 case ICE1712_SUBDEVICE_VX442:
592 case ICE1712_SUBDEVICE_DELTA66E:
593 snd_cs8427_init(ice->i2c, ice->cs8427);
594 break;
595 case ICE1712_SUBDEVICE_DELTA1010:
596 case ICE1712_SUBDEVICE_MEDIASTATION:
597 /* nothing */
598 break;
599 case ICE1712_SUBDEVICE_DELTADIO2496:
600 case ICE1712_SUBDEVICE_DELTA66:
601 /* Set spdif defaults */
602 snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits);
603 break;
604 }
605
583 /* init codec and restore registers */ 606 /* init codec and restore registers */
584 if (ice->akm_codecs) { 607 if (ice->akm_codecs) {
585 memcpy(akm_backup, ice->akm->images, sizeof(akm_backup)); 608 memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak));
609 memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak));
586 snd_akm4xxx_init(ice->akm); 610 snd_akm4xxx_init(ice->akm);
587 memcpy(ice->akm->images, akm_backup, sizeof(akm_backup)); 611 memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak));
612 memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak));
588 snd_akm4xxx_reset(ice->akm, 0); 613 snd_akm4xxx_reset(ice->akm, 0);
589 } 614 }
590 615
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 291672fc4a99..d9b9e4595f17 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -685,9 +685,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream *
685 if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1)) 685 if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1))
686 return 0; 686 return 0;
687 ptr = runtime->buffer_size - inw(ice->ddma_port + 4); 687 ptr = runtime->buffer_size - inw(ice->ddma_port + 4);
688 ptr = bytes_to_frames(substream->runtime, ptr);
688 if (ptr == runtime->buffer_size) 689 if (ptr == runtime->buffer_size)
689 ptr = 0; 690 ptr = 0;
690 return bytes_to_frames(substream->runtime, ptr); 691 return ptr;
691} 692}
692 693
693static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream) 694static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream)
@@ -704,9 +705,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substrea
704 addr = ICE1712_DSC_ADDR0; 705 addr = ICE1712_DSC_ADDR0;
705 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - 706 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) -
706 ice->playback_con_virt_addr[substream->number]; 707 ice->playback_con_virt_addr[substream->number];
708 ptr = bytes_to_frames(substream->runtime, ptr);
707 if (ptr == substream->runtime->buffer_size) 709 if (ptr == substream->runtime->buffer_size)
708 ptr = 0; 710 ptr = 0;
709 return bytes_to_frames(substream->runtime, ptr); 711 return ptr;
710} 712}
711 713
712static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream) 714static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream)
@@ -717,9 +719,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s
717 if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1)) 719 if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1))
718 return 0; 720 return 0;
719 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; 721 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr;
722 ptr = bytes_to_frames(substream->runtime, ptr);
720 if (ptr == substream->runtime->buffer_size) 723 if (ptr == substream->runtime->buffer_size)
721 ptr = 0; 724 ptr = 0;
722 return bytes_to_frames(substream->runtime, ptr); 725 return ptr;
723} 726}
724 727
725static const struct snd_pcm_hardware snd_ice1712_playback = { 728static const struct snd_pcm_hardware snd_ice1712_playback = {
@@ -1048,6 +1051,8 @@ __out:
1048 old = inb(ICEMT(ice, RATE)); 1051 old = inb(ICEMT(ice, RATE));
1049 if (!force && old == val) 1052 if (!force && old == val)
1050 goto __out; 1053 goto __out;
1054
1055 ice->cur_rate = rate;
1051 outb(val, ICEMT(ice, RATE)); 1056 outb(val, ICEMT(ice, RATE));
1052 spin_unlock_irqrestore(&ice->reg_lock, flags); 1057 spin_unlock_irqrestore(&ice->reg_lock, flags);
1053 1058
@@ -1114,9 +1119,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substre
1114 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START)) 1119 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START))
1115 return 0; 1120 return 0;
1116 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); 1121 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2);
1122 ptr = bytes_to_frames(substream->runtime, ptr);
1117 if (ptr == substream->runtime->buffer_size) 1123 if (ptr == substream->runtime->buffer_size)
1118 ptr = 0; 1124 ptr = 0;
1119 return bytes_to_frames(substream->runtime, ptr); 1125 return ptr;
1120} 1126}
1121 1127
1122static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream) 1128static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream)
@@ -1127,9 +1133,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea
1127 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW)) 1133 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW))
1128 return 0; 1134 return 0;
1129 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); 1135 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2);
1136 ptr = bytes_to_frames(substream->runtime, ptr);
1130 if (ptr == substream->runtime->buffer_size) 1137 if (ptr == substream->runtime->buffer_size)
1131 ptr = 0; 1138 ptr = 0;
1132 return bytes_to_frames(substream->runtime, ptr); 1139 return ptr;
1133} 1140}
1134 1141
1135static const struct snd_pcm_hardware snd_ice1712_playback_pro = { 1142static const struct snd_pcm_hardware snd_ice1712_playback_pro = {
@@ -2832,6 +2839,12 @@ static int snd_ice1712_suspend(struct device *dev)
2832 snd_pcm_suspend_all(ice->pcm_ds); 2839 snd_pcm_suspend_all(ice->pcm_ds);
2833 snd_ac97_suspend(ice->ac97); 2840 snd_ac97_suspend(ice->ac97);
2834 2841
2842 spin_lock_irq(&ice->reg_lock);
2843 ice->pm_saved_is_spdif_master = is_spdif_master(ice);
2844 ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT));
2845 ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03));
2846 spin_unlock_irq(&ice->reg_lock);
2847
2835 if (ice->pm_suspend) 2848 if (ice->pm_suspend)
2836 ice->pm_suspend(ice); 2849 ice->pm_suspend(ice);
2837 2850
@@ -2846,6 +2859,7 @@ static int snd_ice1712_resume(struct device *dev)
2846 struct pci_dev *pci = to_pci_dev(dev); 2859 struct pci_dev *pci = to_pci_dev(dev);
2847 struct snd_card *card = dev_get_drvdata(dev); 2860 struct snd_card *card = dev_get_drvdata(dev);
2848 struct snd_ice1712 *ice = card->private_data; 2861 struct snd_ice1712 *ice = card->private_data;
2862 int rate;
2849 2863
2850 if (!ice->pm_suspend_enabled) 2864 if (!ice->pm_suspend_enabled)
2851 return 0; 2865 return 0;
@@ -2860,14 +2874,37 @@ static int snd_ice1712_resume(struct device *dev)
2860 2874
2861 pci_set_master(pci); 2875 pci_set_master(pci);
2862 2876
2877 if (ice->cur_rate)
2878 rate = ice->cur_rate;
2879 else
2880 rate = PRO_RATE_DEFAULT;
2881
2863 if (snd_ice1712_chip_init(ice) < 0) { 2882 if (snd_ice1712_chip_init(ice) < 0) {
2864 snd_card_disconnect(card); 2883 snd_card_disconnect(card);
2865 return -EIO; 2884 return -EIO;
2866 } 2885 }
2867 2886
2887 ice->cur_rate = rate;
2888
2868 if (ice->pm_resume) 2889 if (ice->pm_resume)
2869 ice->pm_resume(ice); 2890 ice->pm_resume(ice);
2870 2891
2892 if (ice->pm_saved_is_spdif_master) {
2893 /* switching to external clock via SPDIF */
2894 spin_lock_irq(&ice->reg_lock);
2895 outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER,
2896 ICEMT(ice, RATE));
2897 spin_unlock_irq(&ice->reg_lock);
2898 snd_ice1712_set_input_clock_source(ice, 1);
2899 } else {
2900 /* internal on-card clock */
2901 snd_ice1712_set_pro_rate(ice, rate, 1);
2902 snd_ice1712_set_input_clock_source(ice, 0);
2903 }
2904
2905 outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT));
2906 outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03));
2907
2871 if (ice->ac97) 2908 if (ice->ac97)
2872 snd_ac97_resume(ice->ac97); 2909 snd_ac97_resume(ice->ac97);
2873 2910
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index 09f7e773bafb..f500905e9373 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -902,7 +902,6 @@ static int alc5623_probe(struct snd_soc_codec *codec)
902{ 902{
903 struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec); 903 struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec);
904 struct snd_soc_dapm_context *dapm = &codec->dapm; 904 struct snd_soc_dapm_context *dapm = &codec->dapm;
905 int ret;
906 905
907 alc5623_reset(codec); 906 alc5623_reset(codec);
908 907
@@ -961,7 +960,7 @@ static int alc5623_probe(struct snd_soc_codec *codec)
961 return -EINVAL; 960 return -EINVAL;
962 } 961 }
963 962
964 return ret; 963 return 0;
965} 964}
966 965
967/* power down chip */ 966/* power down chip */
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c
index ec071a6306ef..85942ca36cbf 100644
--- a/sound/soc/codecs/alc5632.c
+++ b/sound/soc/codecs/alc5632.c
@@ -1061,7 +1061,6 @@ static int alc5632_resume(struct snd_soc_codec *codec)
1061static int alc5632_probe(struct snd_soc_codec *codec) 1061static int alc5632_probe(struct snd_soc_codec *codec)
1062{ 1062{
1063 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); 1063 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
1064 int ret;
1065 1064
1066 /* power on device */ 1065 /* power on device */
1067 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1066 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -1075,7 +1074,7 @@ static int alc5632_probe(struct snd_soc_codec *codec)
1075 return -EINVAL; 1074 return -EINVAL;
1076 } 1075 }
1077 1076
1078 return ret; 1077 return 0;
1079} 1078}
1080 1079
1081/* power down chip */ 1080/* power down chip */
@@ -1191,11 +1190,18 @@ static const struct i2c_device_id alc5632_i2c_table[] = {
1191}; 1190};
1192MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); 1191MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
1193 1192
1193static const struct of_device_id alc5632_of_match[] = {
1194 { .compatible = "realtek,alc5632", },
1195 { }
1196};
1197MODULE_DEVICE_TABLE(of, alc5632_of_match);
1198
1194/* i2c codec control layer */ 1199/* i2c codec control layer */
1195static struct i2c_driver alc5632_i2c_driver = { 1200static struct i2c_driver alc5632_i2c_driver = {
1196 .driver = { 1201 .driver = {
1197 .name = "alc5632", 1202 .name = "alc5632",
1198 .owner = THIS_MODULE, 1203 .owner = THIS_MODULE,
1204 .of_match_table = of_match_ptr(alc5632_of_match),
1199 }, 1205 },
1200 .probe = alc5632_i2c_probe, 1206 .probe = alc5632_i2c_probe,
1201 .remove = alc5632_i2c_remove, 1207 .remove = alc5632_i2c_remove,
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index f0ca6bee6771..460d35547a68 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -1259,7 +1259,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
1259 } 1259 }
1260 1260
1261 dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n", 1261 dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n",
1262 reg & 0xFF); 1262 reg & CS42L52_CHIP_REV_MASK);
1263 1263
1264 /* Set Platform Data */ 1264 /* Set Platform Data */
1265 if (cs42l52->pdata.mica_diff_cfg) 1265 if (cs42l52->pdata.mica_diff_cfg)
diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h
index 6fb8f00f4191..ac445993e6bf 100644
--- a/sound/soc/codecs/cs42l52.h
+++ b/sound/soc/codecs/cs42l52.h
@@ -37,7 +37,7 @@
37#define CS42L52_CHIP_REV_A0 0x00 37#define CS42L52_CHIP_REV_A0 0x00
38#define CS42L52_CHIP_REV_A1 0x01 38#define CS42L52_CHIP_REV_A1 0x01
39#define CS42L52_CHIP_REV_B0 0x02 39#define CS42L52_CHIP_REV_B0 0x02
40#define CS42L52_CHIP_REV_MASK 0x03 40#define CS42L52_CHIP_REV_MASK 0x07
41 41
42#define CS42L52_PWRCTL1 0x02 42#define CS42L52_PWRCTL1 0x02
43#define CS42L52_PWRCTL1_PDN_ALL 0x9F 43#define CS42L52_PWRCTL1_PDN_ALL 0x9F
diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index 082299a4e2fa..85020322eee7 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -495,17 +495,16 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
495 regcache_cache_bypass(cs42xx8->regmap, true); 495 regcache_cache_bypass(cs42xx8->regmap, true);
496 496
497 /* Validate the chip ID */ 497 /* Validate the chip ID */
498 regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); 498 ret = regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val);
499 if (val < 0) { 499 if (ret < 0) {
500 dev_err(dev, "failed to get device ID: %x", val); 500 dev_err(dev, "failed to get device ID, ret = %d", ret);
501 ret = -EINVAL;
502 goto err_enable; 501 goto err_enable;
503 } 502 }
504 503
505 /* The top four bits of the chip ID should be 0000 */ 504 /* The top four bits of the chip ID should be 0000 */
506 if ((val & CS42XX8_CHIPID_CHIP_ID_MASK) != 0x00) { 505 if (((val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4) != 0x00) {
507 dev_err(dev, "unmatched chip ID: %d\n", 506 dev_err(dev, "unmatched chip ID: %d\n",
508 val & CS42XX8_CHIPID_CHIP_ID_MASK); 507 (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4);
509 ret = -EINVAL; 508 ret = -EINVAL;
510 goto err_enable; 509 goto err_enable;
511 } 510 }
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c
index 7d168ec71cd7..48f3fef68484 100644
--- a/sound/soc/codecs/da732x.c
+++ b/sound/soc/codecs/da732x.c
@@ -1571,7 +1571,8 @@ static int da732x_i2c_probe(struct i2c_client *i2c,
1571 } 1571 }
1572 1572
1573 dev_info(&i2c->dev, "Revision: %d.%d\n", 1573 dev_info(&i2c->dev, "Revision: %d.%d\n",
1574 (reg & DA732X_ID_MAJOR_MASK), (reg & DA732X_ID_MINOR_MASK)); 1574 (reg & DA732X_ID_MAJOR_MASK) >> 4,
1575 (reg & DA732X_ID_MINOR_MASK));
1575 1576
1576 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da732x, 1577 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da732x,
1577 da732x_dai, ARRAY_SIZE(da732x_dai)); 1578 da732x_dai, ARRAY_SIZE(da732x_dai));
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 98c6e104357c..f7b0b37aa858 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2399,11 +2399,18 @@ static const struct i2c_device_id max98090_i2c_id[] = {
2399}; 2399};
2400MODULE_DEVICE_TABLE(i2c, max98090_i2c_id); 2400MODULE_DEVICE_TABLE(i2c, max98090_i2c_id);
2401 2401
2402static const struct of_device_id max98090_of_match[] = {
2403 { .compatible = "maxim,max98090", },
2404 { }
2405};
2406MODULE_DEVICE_TABLE(of, max98090_of_match);
2407
2402static struct i2c_driver max98090_i2c_driver = { 2408static struct i2c_driver max98090_i2c_driver = {
2403 .driver = { 2409 .driver = {
2404 .name = "max98090", 2410 .name = "max98090",
2405 .owner = THIS_MODULE, 2411 .owner = THIS_MODULE,
2406 .pm = &max98090_pm, 2412 .pm = &max98090_pm,
2413 .of_match_table = of_match_ptr(max98090_of_match),
2407 }, 2414 },
2408 .probe = max98090_i2c_probe, 2415 .probe = max98090_i2c_probe,
2409 .remove = max98090_i2c_remove, 2416 .remove = max98090_i2c_remove,
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 0061ae6b6716..68b4dd622b87 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2074,6 +2074,14 @@ static const struct i2c_device_id rt5640_i2c_id[] = {
2074}; 2074};
2075MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id); 2075MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
2076 2076
2077#if defined(CONFIG_OF)
2078static const struct of_device_id rt5640_of_match[] = {
2079 { .compatible = "realtek,rt5640", },
2080 {},
2081};
2082MODULE_DEVICE_TABLE(of, rt5640_of_match);
2083#endif
2084
2077#ifdef CONFIG_ACPI 2085#ifdef CONFIG_ACPI
2078static struct acpi_device_id rt5640_acpi_match[] = { 2086static struct acpi_device_id rt5640_acpi_match[] = {
2079 { "INT33CA", 0 }, 2087 { "INT33CA", 0 },
@@ -2203,6 +2211,7 @@ static struct i2c_driver rt5640_i2c_driver = {
2203 .name = "rt5640", 2211 .name = "rt5640",
2204 .owner = THIS_MODULE, 2212 .owner = THIS_MODULE,
2205 .acpi_match_table = ACPI_PTR(rt5640_acpi_match), 2213 .acpi_match_table = ACPI_PTR(rt5640_acpi_match),
2214 .of_match_table = of_match_ptr(rt5640_of_match),
2206 }, 2215 },
2207 .probe = rt5640_i2c_probe, 2216 .probe = rt5640_i2c_probe,
2208 .remove = rt5640_i2c_remove, 2217 .remove = rt5640_i2c_remove,
diff --git a/sound/soc/codecs/tlv320aic23-i2c.c b/sound/soc/codecs/tlv320aic23-i2c.c
index 20fc46092c2c..b73c94ebcc2a 100644
--- a/sound/soc/codecs/tlv320aic23-i2c.c
+++ b/sound/soc/codecs/tlv320aic23-i2c.c
@@ -43,9 +43,16 @@ static const struct i2c_device_id tlv320aic23_id[] = {
43 43
44MODULE_DEVICE_TABLE(i2c, tlv320aic23_id); 44MODULE_DEVICE_TABLE(i2c, tlv320aic23_id);
45 45
46static const struct of_device_id tlv320aic23_of_match[] = {
47 { .compatible = "ti,tlv320aic23", },
48 { }
49};
50MODULE_DEVICE_TABLE(of, tlv320aic23_of_match);
51
46static struct i2c_driver tlv320aic23_i2c_driver = { 52static struct i2c_driver tlv320aic23_i2c_driver = {
47 .driver = { 53 .driver = {
48 .name = "tlv320aic23-codec", 54 .name = "tlv320aic23-codec",
55 .of_match_table = of_match_ptr(tlv320aic23_of_match),
49 }, 56 },
50 .probe = tlv320aic23_i2c_probe, 57 .probe = tlv320aic23_i2c_probe,
51 .remove = __exit_p(tlv320aic23_i2c_remove), 58 .remove = __exit_p(tlv320aic23_i2c_remove),
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index a01ae97c90aa..4f75cac462d1 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -336,7 +336,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
336 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); 336 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
337 mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); 337 mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
338 338
339 mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); 339 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
340 mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); 340 mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
341 break; 341 break;
342 342
@@ -344,7 +344,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
344 mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); 344 mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
345 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); 345 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
346 346
347 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); 347 mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
348 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); 348 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
349 break; 349 break;
350 350
@@ -352,7 +352,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
352 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); 352 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
353 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); 353 mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
354 354
355 mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); 355 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
356 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); 356 mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
357 break; 357 break;
358 358
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index c4a423111673..56da8c8c5960 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -23,6 +23,71 @@
23 23
24#include "fsl_sai.h" 24#include "fsl_sai.h"
25 25
26#define FSL_SAI_FLAGS (FSL_SAI_CSR_SEIE |\
27 FSL_SAI_CSR_FEIE)
28
29static irqreturn_t fsl_sai_isr(int irq, void *devid)
30{
31 struct fsl_sai *sai = (struct fsl_sai *)devid;
32 struct device *dev = &sai->pdev->dev;
33 u32 xcsr, mask;
34
35 /* Only handle those what we enabled */
36 mask = (FSL_SAI_FLAGS >> FSL_SAI_CSR_xIE_SHIFT) << FSL_SAI_CSR_xF_SHIFT;
37
38 /* Tx IRQ */
39 regmap_read(sai->regmap, FSL_SAI_TCSR, &xcsr);
40 xcsr &= mask;
41
42 if (xcsr & FSL_SAI_CSR_WSF)
43 dev_dbg(dev, "isr: Start of Tx word detected\n");
44
45 if (xcsr & FSL_SAI_CSR_SEF)
46 dev_warn(dev, "isr: Tx Frame sync error detected\n");
47
48 if (xcsr & FSL_SAI_CSR_FEF) {
49 dev_warn(dev, "isr: Transmit underrun detected\n");
50 /* FIFO reset for safety */
51 xcsr |= FSL_SAI_CSR_FR;
52 }
53
54 if (xcsr & FSL_SAI_CSR_FWF)
55 dev_dbg(dev, "isr: Enabled transmit FIFO is empty\n");
56
57 if (xcsr & FSL_SAI_CSR_FRF)
58 dev_dbg(dev, "isr: Transmit FIFO watermark has been reached\n");
59
60 regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
61 FSL_SAI_CSR_xF_W_MASK | FSL_SAI_CSR_FR, xcsr);
62
63 /* Rx IRQ */
64 regmap_read(sai->regmap, FSL_SAI_RCSR, &xcsr);
65 xcsr &= mask;
66
67 if (xcsr & FSL_SAI_CSR_WSF)
68 dev_dbg(dev, "isr: Start of Rx word detected\n");
69
70 if (xcsr & FSL_SAI_CSR_SEF)
71 dev_warn(dev, "isr: Rx Frame sync error detected\n");
72
73 if (xcsr & FSL_SAI_CSR_FEF) {
74 dev_warn(dev, "isr: Receive overflow detected\n");
75 /* FIFO reset for safety */
76 xcsr |= FSL_SAI_CSR_FR;
77 }
78
79 if (xcsr & FSL_SAI_CSR_FWF)
80 dev_dbg(dev, "isr: Enabled receive FIFO is full\n");
81
82 if (xcsr & FSL_SAI_CSR_FRF)
83 dev_dbg(dev, "isr: Receive FIFO watermark has been reached\n");
84
85 regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
86 FSL_SAI_CSR_xF_W_MASK | FSL_SAI_CSR_FR, xcsr);
87
88 return IRQ_HANDLED;
89}
90
26static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai, 91static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai,
27 int clk_id, unsigned int freq, int fsl_dir) 92 int clk_id, unsigned int freq, int fsl_dir)
28{ 93{
@@ -114,7 +179,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
114 * that is, together with the last bit of the previous 179 * that is, together with the last bit of the previous
115 * data word. 180 * data word.
116 */ 181 */
117 val_cr2 &= ~FSL_SAI_CR2_BCP; 182 val_cr2 |= FSL_SAI_CR2_BCP;
118 val_cr4 |= FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP; 183 val_cr4 |= FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP;
119 break; 184 break;
120 case SND_SOC_DAIFMT_LEFT_J: 185 case SND_SOC_DAIFMT_LEFT_J:
@@ -122,7 +187,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
122 * Frame high, one word length for frame sync, 187 * Frame high, one word length for frame sync,
123 * frame sync asserts with the first bit of the frame. 188 * frame sync asserts with the first bit of the frame.
124 */ 189 */
125 val_cr2 &= ~FSL_SAI_CR2_BCP; 190 val_cr2 |= FSL_SAI_CR2_BCP;
126 val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP); 191 val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP);
127 break; 192 break;
128 case SND_SOC_DAIFMT_DSP_A: 193 case SND_SOC_DAIFMT_DSP_A:
@@ -132,7 +197,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
132 * that is, together with the last bit of the previous 197 * that is, together with the last bit of the previous
133 * data word. 198 * data word.
134 */ 199 */
135 val_cr2 &= ~FSL_SAI_CR2_BCP; 200 val_cr2 |= FSL_SAI_CR2_BCP;
136 val_cr4 &= ~FSL_SAI_CR4_FSP; 201 val_cr4 &= ~FSL_SAI_CR4_FSP;
137 val_cr4 |= FSL_SAI_CR4_FSE; 202 val_cr4 |= FSL_SAI_CR4_FSE;
138 sai->is_dsp_mode = true; 203 sai->is_dsp_mode = true;
@@ -142,7 +207,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
142 * Frame high, one bit for frame sync, 207 * Frame high, one bit for frame sync,
143 * frame sync asserts with the first bit of the frame. 208 * frame sync asserts with the first bit of the frame.
144 */ 209 */
145 val_cr2 &= ~FSL_SAI_CR2_BCP; 210 val_cr2 |= FSL_SAI_CR2_BCP;
146 val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP); 211 val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP);
147 sai->is_dsp_mode = true; 212 sai->is_dsp_mode = true;
148 break; 213 break;
@@ -373,8 +438,8 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
373{ 438{
374 struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev); 439 struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
375 440
376 regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, 0x0); 441 regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, FSL_SAI_FLAGS);
377 regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, 0x0); 442 regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, FSL_SAI_FLAGS);
378 regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK, 443 regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK,
379 FSL_SAI_MAXBURST_TX * 2); 444 FSL_SAI_MAXBURST_TX * 2);
380 regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK, 445 regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK,
@@ -490,12 +555,14 @@ static int fsl_sai_probe(struct platform_device *pdev)
490 struct fsl_sai *sai; 555 struct fsl_sai *sai;
491 struct resource *res; 556 struct resource *res;
492 void __iomem *base; 557 void __iomem *base;
493 int ret; 558 int irq, ret;
494 559
495 sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); 560 sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
496 if (!sai) 561 if (!sai)
497 return -ENOMEM; 562 return -ENOMEM;
498 563
564 sai->pdev = pdev;
565
499 sai->big_endian_regs = of_property_read_bool(np, "big-endian-regs"); 566 sai->big_endian_regs = of_property_read_bool(np, "big-endian-regs");
500 if (sai->big_endian_regs) 567 if (sai->big_endian_regs)
501 fsl_sai_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG; 568 fsl_sai_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG;
@@ -514,6 +581,18 @@ static int fsl_sai_probe(struct platform_device *pdev)
514 return PTR_ERR(sai->regmap); 581 return PTR_ERR(sai->regmap);
515 } 582 }
516 583
584 irq = platform_get_irq(pdev, 0);
585 if (irq < 0) {
586 dev_err(&pdev->dev, "no irq for node %s\n", np->full_name);
587 return irq;
588 }
589
590 ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, 0, np->name, sai);
591 if (ret) {
592 dev_err(&pdev->dev, "failed to claim irq %u\n", irq);
593 return ret;
594 }
595
517 sai->dma_params_rx.addr = res->start + FSL_SAI_RDR; 596 sai->dma_params_rx.addr = res->start + FSL_SAI_RDR;
518 sai->dma_params_tx.addr = res->start + FSL_SAI_TDR; 597 sai->dma_params_tx.addr = res->start + FSL_SAI_TDR;
519 sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; 598 sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX;
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index e432260be598..a264185c7138 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -37,7 +37,21 @@
37 37
38/* SAI Transmit/Recieve Control Register */ 38/* SAI Transmit/Recieve Control Register */
39#define FSL_SAI_CSR_TERE BIT(31) 39#define FSL_SAI_CSR_TERE BIT(31)
40#define FSL_SAI_CSR_FR BIT(25)
41#define FSL_SAI_CSR_xF_SHIFT 16
42#define FSL_SAI_CSR_xF_W_SHIFT 18
43#define FSL_SAI_CSR_xF_MASK (0x1f << FSL_SAI_CSR_xF_SHIFT)
44#define FSL_SAI_CSR_xF_W_MASK (0x7 << FSL_SAI_CSR_xF_W_SHIFT)
45#define FSL_SAI_CSR_WSF BIT(20)
46#define FSL_SAI_CSR_SEF BIT(19)
47#define FSL_SAI_CSR_FEF BIT(18)
40#define FSL_SAI_CSR_FWF BIT(17) 48#define FSL_SAI_CSR_FWF BIT(17)
49#define FSL_SAI_CSR_FRF BIT(16)
50#define FSL_SAI_CSR_xIE_SHIFT 8
51#define FSL_SAI_CSR_WSIE BIT(12)
52#define FSL_SAI_CSR_SEIE BIT(11)
53#define FSL_SAI_CSR_FEIE BIT(10)
54#define FSL_SAI_CSR_FWIE BIT(9)
41#define FSL_SAI_CSR_FRIE BIT(8) 55#define FSL_SAI_CSR_FRIE BIT(8)
42#define FSL_SAI_CSR_FRDE BIT(0) 56#define FSL_SAI_CSR_FRDE BIT(0)
43 57
@@ -99,6 +113,7 @@
99#define FSL_SAI_MAXBURST_RX 6 113#define FSL_SAI_MAXBURST_RX 6
100 114
101struct fsl_sai { 115struct fsl_sai {
116 struct platform_device *pdev;
102 struct regmap *regmap; 117 struct regmap *regmap;
103 118
104 bool big_endian_regs; 119 bool big_endian_regs;
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 4a88e36c82ec..76b072bd4ba2 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -39,15 +39,15 @@ struct s3c_ac97_info {
39}; 39};
40static struct s3c_ac97_info s3c_ac97; 40static struct s3c_ac97_info s3c_ac97;
41 41
42static struct s3c2410_dma_client s3c_dma_client_out = { 42static struct s3c_dma_client s3c_dma_client_out = {
43 .name = "AC97 PCMOut" 43 .name = "AC97 PCMOut"
44}; 44};
45 45
46static struct s3c2410_dma_client s3c_dma_client_in = { 46static struct s3c_dma_client s3c_dma_client_in = {
47 .name = "AC97 PCMIn" 47 .name = "AC97 PCMIn"
48}; 48};
49 49
50static struct s3c2410_dma_client s3c_dma_client_micin = { 50static struct s3c_dma_client s3c_dma_client_micin = {
51 .name = "AC97 MicIn" 51 .name = "AC97 MicIn"
52}; 52};
53 53
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index 225e5378014e..ad7c0f04f00d 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -14,8 +14,12 @@
14 14
15#include <sound/dmaengine_pcm.h> 15#include <sound/dmaengine_pcm.h>
16 16
17struct s3c_dma_client {
18 char *name;
19};
20
17struct s3c_dma_params { 21struct s3c_dma_params {
18 struct s3c2410_dma_client *client; /* stream identifier */ 22 struct s3c_dma_client *client; /* stream identifier */
19 int channel; /* Channel ID */ 23 int channel; /* Channel ID */
20 dma_addr_t dma_addr; 24 dma_addr_t dma_addr;
21 int dma_size; /* Size of the DMA transfer */ 25 int dma_size; /* Size of the DMA transfer */
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 0a9b44c940ce..048ead967199 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1211,10 +1211,10 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1211 pri_dai->dma_playback.dma_addr = regs_base + I2STXD; 1211 pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
1212 pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; 1212 pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
1213 pri_dai->dma_playback.client = 1213 pri_dai->dma_playback.client =
1214 (struct s3c2410_dma_client *)&pri_dai->dma_playback; 1214 (struct s3c_dma_client *)&pri_dai->dma_playback;
1215 pri_dai->dma_playback.ch_name = "tx"; 1215 pri_dai->dma_playback.ch_name = "tx";
1216 pri_dai->dma_capture.client = 1216 pri_dai->dma_capture.client =
1217 (struct s3c2410_dma_client *)&pri_dai->dma_capture; 1217 (struct s3c_dma_client *)&pri_dai->dma_capture;
1218 pri_dai->dma_capture.ch_name = "rx"; 1218 pri_dai->dma_capture.ch_name = "rx";
1219 pri_dai->dma_playback.dma_size = 4; 1219 pri_dai->dma_playback.dma_size = 4;
1220 pri_dai->dma_capture.dma_size = 4; 1220 pri_dai->dma_capture.dma_size = 4;
@@ -1233,7 +1233,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1233 } 1233 }
1234 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; 1234 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
1235 sec_dai->dma_playback.client = 1235 sec_dai->dma_playback.client =
1236 (struct s3c2410_dma_client *)&sec_dai->dma_playback; 1236 (struct s3c_dma_client *)&sec_dai->dma_playback;
1237 sec_dai->dma_playback.ch_name = "tx-sec"; 1237 sec_dai->dma_playback.ch_name = "tx-sec";
1238 1238
1239 if (!np) { 1239 if (!np) {
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 6a5e4bf6ac96..ab54e297957c 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -20,7 +20,6 @@
20#include <sound/pcm_params.h> 20#include <sound/pcm_params.h>
21 21
22#include <linux/platform_data/asoc-s3c.h> 22#include <linux/platform_data/asoc-s3c.h>
23#include <mach/dma.h>
24 23
25#include "dma.h" 24#include "dma.h"
26#include "pcm.h" 25#include "pcm.h"
@@ -132,11 +131,11 @@ struct s3c_pcm_info {
132 struct s3c_dma_params *dma_capture; 131 struct s3c_dma_params *dma_capture;
133}; 132};
134 133
135static struct s3c2410_dma_client s3c_pcm_dma_client_out = { 134static struct s3c_dma_client s3c_pcm_dma_client_out = {
136 .name = "PCM Stereo out" 135 .name = "PCM Stereo out"
137}; 136};
138 137
139static struct s3c2410_dma_client s3c_pcm_dma_client_in = { 138static struct s3c_dma_client s3c_pcm_dma_client_in = {
140 .name = "PCM Stereo in" 139 .name = "PCM Stereo in"
141}; 140};
142 141
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index d0794458963a..e9bb5d7a71ee 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -33,11 +33,11 @@
33#include "regs-i2s-v2.h" 33#include "regs-i2s-v2.h"
34#include "s3c2412-i2s.h" 34#include "s3c2412-i2s.h"
35 35
36static struct s3c2410_dma_client s3c2412_dma_client_out = { 36static struct s3c_dma_client s3c2412_dma_client_out = {
37 .name = "I2S PCM Stereo out" 37 .name = "I2S PCM Stereo out"
38}; 38};
39 39
40static struct s3c2410_dma_client s3c2412_dma_client_in = { 40static struct s3c_dma_client s3c2412_dma_client_in = {
41 .name = "I2S PCM Stereo in" 41 .name = "I2S PCM Stereo in"
42}; 42};
43 43
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index f31e916dd8c4..d7b8457b5650 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -31,11 +31,11 @@
31#include "dma.h" 31#include "dma.h"
32#include "s3c24xx-i2s.h" 32#include "s3c24xx-i2s.h"
33 33
34static struct s3c2410_dma_client s3c24xx_dma_client_out = { 34static struct s3c_dma_client s3c24xx_dma_client_out = {
35 .name = "I2S PCM Stereo out" 35 .name = "I2S PCM Stereo out"
36}; 36};
37 37
38static struct s3c2410_dma_client s3c24xx_dma_client_in = { 38static struct s3c_dma_client s3c24xx_dma_client_in = {
39 .name = "I2S PCM Stereo in" 39 .name = "I2S PCM Stereo in"
40}; 40};
41 41
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index 28487dcc4538..cfe63b7bcc9f 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -18,7 +18,6 @@
18#include <sound/pcm_params.h> 18#include <sound/pcm_params.h>
19 19
20#include <linux/platform_data/asoc-s3c.h> 20#include <linux/platform_data/asoc-s3c.h>
21#include <mach/dma.h>
22 21
23#include "dma.h" 22#include "dma.h"
24#include "spdif.h" 23#include "spdif.h"
@@ -94,7 +93,7 @@ struct samsung_spdif_info {
94 struct s3c_dma_params *dma_playback; 93 struct s3c_dma_params *dma_playback;
95}; 94};
96 95
97static struct s3c2410_dma_client spdif_dma_client_out = { 96static struct s3c_dma_client spdif_dma_client_out = {
98 .name = "S/PDIF Stereo out", 97 .name = "S/PDIF Stereo out",
99}; 98};
100 99
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 49de5c1284f6..131336d40492 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1501,7 +1501,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
1501 * The error should be lower than 2ms since the estimate relies 1501 * The error should be lower than 2ms since the estimate relies
1502 * on two reads of a counter updated every ms. 1502 * on two reads of a counter updated every ms.
1503 */ 1503 */
1504 if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) 1504 if (printk_ratelimit() &&
1505 abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
1505 dev_dbg(&subs->dev->dev, 1506 dev_dbg(&subs->dev->dev,
1506 "delay: estimated %d, actual %d\n", 1507 "delay: estimated %d, actual %d\n",
1507 est_delay, subs->last_delay); 1508 est_delay, subs->last_delay);