aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-02-08 02:55:43 -0500
committerIngo Molnar <mingo@elte.hu>2010-02-08 02:55:46 -0500
commit6d3e0907b8b239d16720d144e2675ecf10d3bc3b (patch)
treee0b0743b5f6f82b057cafc4f3687396a6e01a0b4 /sound
parent23577256953c870de9b724c3a2611ce7be6a1e4e (diff)
parent50200df462023b187d80a99a52f5f2cfe3c86c26 (diff)
Merge branch 'sched/urgent' into sched/core
Merge reason: Merge dependent fix, update to latest -rc. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c3
-rw-r--r--sound/core/pcm_native.c8
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/sound_oss.c2
-rw-r--r--sound/isa/sb/emu8000.c11
-rw-r--r--sound/oss/dev_table.c16
-rw-r--r--sound/oss/sound_config.h2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/ac97/ac97_codec.c10
-rw-r--r--sound/pci/ac97/ac97_id.h2
-rw-r--r--sound/pci/ac97/ac97_patch.c1
-rw-r--r--sound/pci/atiixp.c1
-rw-r--r--sound/pci/ctxfi/ctatc.c15
-rw-r--r--sound/pci/ctxfi/ctvmem.c38
-rw-r--r--sound/pci/ctxfi/ctvmem.h8
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_intel.c43
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_realtek.c133
-rw-r--r--sound/pci/hda/patch_sigmatel.c79
-rw-r--r--sound/pci/ice1712/aureon.c12
-rw-r--r--sound/pci/riptide/riptide.c2
-rw-r--r--sound/soc/codecs/ac97.c6
-rw-r--r--sound/soc/codecs/tlv320aic23.c2
-rw-r--r--sound/soc/codecs/wm8350.c2
-rw-r--r--sound/soc/codecs/wm8510.c14
-rw-r--r--sound/soc/codecs/wm8903.c3
-rw-r--r--sound/soc/codecs/wm8940.c14
-rw-r--r--sound/soc/codecs/wm8974.c14
-rw-r--r--sound/soc/omap/Makefile2
-rw-r--r--sound/soc/omap/omap3pandora.c1
-rw-r--r--sound/soc/sh/fsi-ak4642.c30
-rw-r--r--sound/sound_core.c2
-rw-r--r--sound/usb/usbaudio.c2
36 files changed, 338 insertions, 191 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index c5699863643b..656e474dca47 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -441,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
441 struct snd_pcm_hw_params *params) 441 struct snd_pcm_hw_params *params)
442{ 442{
443 int err; 443 int err;
444 struct aaci *aaci = substream->private_data;
444 445
445 aaci_pcm_hw_free(substream); 446 aaci_pcm_hw_free(substream);
446 if (aacirun->pcm_open) { 447 if (aacirun->pcm_open) {
@@ -560,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
560static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, 561static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
561 struct snd_pcm_hw_params *params) 562 struct snd_pcm_hw_params *params)
562{ 563{
563 struct aaci *aaci = substream->private_data;
564 struct aaci_runtime *aacirun = substream->runtime->private_data; 564 struct aaci_runtime *aacirun = substream->runtime->private_data;
565 unsigned int channels = params_channels(params); 565 unsigned int channels = params_channels(params);
566 int ret; 566 int ret;
@@ -659,7 +659,6 @@ static struct snd_pcm_ops aaci_playback_ops = {
659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
660 struct snd_pcm_hw_params *params) 660 struct snd_pcm_hw_params *params)
661{ 661{
662 struct aaci *aaci = substream->private_data;
663 struct aaci_runtime *aacirun = substream->runtime->private_data; 662 struct aaci_runtime *aacirun = substream->runtime->private_data;
664 int ret; 663 int ret;
665 664
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 29ab46a12e11..25b0641e6b8c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1918,13 +1918,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1918 1918
1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
1920 hw->rate_min, hw->rate_max); 1920 hw->rate_min, hw->rate_max);
1921 if (err < 0) 1921 if (err < 0)
1922 return err; 1922 return err;
1923 1923
1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1925 hw->period_bytes_min, hw->period_bytes_max); 1925 hw->period_bytes_min, hw->period_bytes_max);
1926 if (err < 0) 1926 if (err < 0)
1927 return err; 1927 return err;
1928 1928
1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
1930 hw->periods_min, hw->periods_max); 1930 hw->periods_min, hw->periods_max);
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 7872a02f6ca9..563d1967a0ad 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -468,5 +468,5 @@ static void __exit alsa_sound_exit(void)
468 unregister_chrdev(major, "alsa"); 468 unregister_chrdev(major, "alsa");
469} 469}
470 470
471module_init(alsa_sound_init) 471subsys_initcall(alsa_sound_init);
472module_exit(alsa_sound_exit) 472module_exit(alsa_sound_exit);
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index 7fe12264ff80..0c164e5e4322 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -93,7 +93,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
93 default: 93 default:
94 return -EINVAL; 94 return -EINVAL;
95 } 95 }
96 if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OSS_MINORS)) 96 if (minor < 0 || minor >= SNDRV_OSS_MINORS)
97 return -EINVAL; 97 return -EINVAL;
98 return minor; 98 return minor;
99} 99}
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 751762f1c59a..0c40951b6523 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -377,12 +377,13 @@ init_arrays(struct snd_emu8000 *emu)
377static void __devinit 377static void __devinit
378size_dram(struct snd_emu8000 *emu) 378size_dram(struct snd_emu8000 *emu)
379{ 379{
380 int i, size; 380 int i, size, detected_size;
381 381
382 if (emu->dram_checked) 382 if (emu->dram_checked)
383 return; 383 return;
384 384
385 size = 0; 385 size = 0;
386 detected_size = 0;
386 387
387 /* write out a magic number */ 388 /* write out a magic number */
388 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); 389 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE);
@@ -393,6 +394,8 @@ size_dram(struct snd_emu8000 *emu)
393 394
394 while (size < EMU8000_MAX_DRAM) { 395 while (size < EMU8000_MAX_DRAM) {
395 396
397 size += 512 * 1024; /* increment 512kbytes */
398
396 /* Write a unique data on the test address. 399 /* Write a unique data on the test address.
397 * if the address is out of range, the data is written on 400 * if the address is out of range, the data is written on
398 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is 401 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is
@@ -414,7 +417,7 @@ size_dram(struct snd_emu8000 *emu)
414 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 417 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
415 break; /* no memory at this address */ 418 break; /* no memory at this address */
416 419
417 size += 512 * 1024; /* increment 512kbytes */ 420 detected_size = size;
418 421
419 snd_emu8000_read_wait(emu); 422 snd_emu8000_read_wait(emu);
420 423
@@ -442,9 +445,9 @@ size_dram(struct snd_emu8000 *emu)
442 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 445 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE);
443 446
444 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n",
445 emu->port1, size/1024); 448 emu->port1, detected_size/1024);
446 449
447 emu->mem_size = size; 450 emu->mem_size = detected_size;
448 emu->dram_checked = 1; 451 emu->dram_checked = 1;
449} 452}
450 453
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c
index 08274c995d06..727bdb9ba2dc 100644
--- a/sound/oss/dev_table.c
+++ b/sound/oss/dev_table.c
@@ -67,14 +67,15 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
67 return -(EBUSY); 67 return -(EBUSY);
68 } 68 }
69 d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver))); 69 d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver)));
70 70 sound_nblocks++;
71 if (sound_nblocks < 1024) 71 if (sound_nblocks >= MAX_MEM_BLOCKS)
72 sound_nblocks++; 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] = vmalloc(sizeof(struct audio_operations)));
75 sound_nblocks++;
76 if (sound_nblocks >= MAX_MEM_BLOCKS)
77 sound_nblocks = MAX_MEM_BLOCKS - 1;
75 78
76 if (sound_nblocks < 1024)
77 sound_nblocks++;
78 if (d == NULL || op == NULL) { 79 if (d == NULL || op == NULL) {
79 printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name); 80 printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name);
80 sound_unload_audiodev(num); 81 sound_unload_audiodev(num);
@@ -128,9 +129,10 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
128 until you unload sound! */ 129 until you unload sound! */
129 130
130 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); 131 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations)));
132 sound_nblocks++;
133 if (sound_nblocks >= MAX_MEM_BLOCKS)
134 sound_nblocks = MAX_MEM_BLOCKS - 1;
131 135
132 if (sound_nblocks < 1024)
133 sound_nblocks++;
134 if (op == NULL) { 136 if (op == NULL) {
135 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); 137 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name);
136 return -ENOMEM; 138 return -ENOMEM;
diff --git a/sound/oss/sound_config.h b/sound/oss/sound_config.h
index 55271fbe7f49..9d35c4c65b9b 100644
--- a/sound/oss/sound_config.h
+++ b/sound/oss/sound_config.h
@@ -142,4 +142,6 @@ static inline int translate_mode(struct file *file)
142#define TIMER_ARMED 121234 142#define TIMER_ARMED 121234
143#define TIMER_NOT_ARMED 1 143#define TIMER_NOT_ARMED 1
144 144
145#define MAX_MEM_BLOCKS 1024
146
145#endif 147#endif
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 61aaedae6b7e..c62530943888 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -56,7 +56,7 @@
56/* 56/*
57 * Table for permanently allocated memory (used when unloading the module) 57 * Table for permanently allocated memory (used when unloading the module)
58 */ 58 */
59void * sound_mem_blocks[1024]; 59void * sound_mem_blocks[MAX_MEM_BLOCKS];
60int sound_nblocks = 0; 60int sound_nblocks = 0;
61 61
62/* Persistent DMA buffers */ 62/* Persistent DMA buffers */
@@ -574,7 +574,7 @@ static int __init oss_init(void)
574 NULL, "%s%d", dev_list[i].name, j); 574 NULL, "%s%d", dev_list[i].name, j);
575 } 575 }
576 576
577 if (sound_nblocks >= 1024) 577 if (sound_nblocks >= MAX_MEM_BLOCKS - 1)
578 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n"); 578 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n");
579 579
580 return 0; 580 return 0;
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index c11920623009..a7630e9edf8a 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -83,6 +83,7 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL }, 83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL },
84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL }, 84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL },
85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL }, 85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL },
86{ 0x53544d00, 0xffffff00, "STMicroelectronics", NULL, NULL },
86{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL }, 87{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL },
87{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL }, 88{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL },
88{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL }, 89{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL },
@@ -161,6 +162,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
161{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix 162{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix
162{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, 163{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL },
163{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH }, 164{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH },
165{ 0x53544d02, 0xffffffff, "ST7597", NULL, NULL },
164{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL }, 166{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL },
165{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL }, 167{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL },
166{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL }, 168{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL },
@@ -213,6 +215,14 @@ static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg)
213{ 215{
214 /* filter some registers for buggy codecs */ 216 /* filter some registers for buggy codecs */
215 switch (ac97->id) { 217 switch (ac97->id) {
218 case AC97_ID_ST_AC97_ID4:
219 if (reg == 0x08)
220 return 0;
221 /* fall through */
222 case AC97_ID_ST7597:
223 if (reg == 0x22 || reg == 0x7a)
224 return 1;
225 /* fall through */
216 case AC97_ID_AK4540: 226 case AC97_ID_AK4540:
217 case AC97_ID_AK4542: 227 case AC97_ID_AK4542:
218 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) 228 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c)
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h
index c129492c82b3..d603147c4a96 100644
--- a/sound/pci/ac97/ac97_id.h
+++ b/sound/pci/ac97/ac97_id.h
@@ -62,3 +62,5 @@
62#define AC97_ID_CM9761_78 0x434d4978 62#define AC97_ID_CM9761_78 0x434d4978
63#define AC97_ID_CM9761_82 0x434d4982 63#define AC97_ID_CM9761_82 0x434d4982
64#define AC97_ID_CM9761_83 0x434d4983 64#define AC97_ID_CM9761_83 0x434d4983
65#define AC97_ID_ST7597 0x53544d02
66#define AC97_ID_ST_AC97_ID4 0x53544d04
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 139cf3b2b9d7..d9266bae2849 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1870,6 +1870,7 @@ static unsigned int ad1981_jacks_blacklist[] = {
1870 0x10140554, /* Thinkpad T42p/R50p */ 1870 0x10140554, /* Thinkpad T42p/R50p */
1871 0x10140567, /* Thinkpad T43p 2668-G7U */ 1871 0x10140567, /* Thinkpad T43p 2668-G7U */
1872 0x10140581, /* Thinkpad X41-2527 */ 1872 0x10140581, /* Thinkpad X41-2527 */
1873 0x10280160, /* Dell Dimension 2400 */
1873 0x104380b0, /* Asus A7V8X-MX */ 1874 0x104380b0, /* Asus A7V8X-MX */
1874 0x11790241, /* Toshiba Satellite A-15 S127 */ 1875 0x11790241, /* Toshiba Satellite A-15 S127 */
1875 0x144dc01a, /* Samsung NP-X20C004/SEG */ 1876 0x144dc01a, /* Samsung NP-X20C004/SEG */
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index d6752dff2a44..42b4fbbd8e2b 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -297,6 +297,7 @@ static struct pci_device_id snd_atiixp_ids[] = {
297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); 297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
298 298
299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = { 299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = {
300 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
300 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), 301 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0),
301 { } /* terminator */ 302 { } /* terminator */
302}; 303};
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index cb65bd0dd35b..459c1f62783b 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -166,18 +166,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
166 166
167static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index) 167static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
168{ 168{
169 struct ct_vm *vm; 169 return atc->vm->get_ptp_phys(atc->vm, index);
170 void *kvirt_addr;
171 unsigned long phys_addr;
172
173 vm = atc->vm;
174 kvirt_addr = vm->get_ptp_virt(vm, index);
175 if (kvirt_addr == NULL)
176 phys_addr = (~0UL);
177 else
178 phys_addr = virt_to_phys(kvirt_addr);
179
180 return phys_addr;
181} 170}
182 171
183static unsigned int convert_format(snd_pcm_format_t snd_format) 172static unsigned int convert_format(snd_pcm_format_t snd_format)
@@ -1669,7 +1658,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1669 } 1658 }
1670 1659
1671 /* Set up device virtual memory management object */ 1660 /* Set up device virtual memory management object */
1672 err = ct_vm_create(&atc->vm); 1661 err = ct_vm_create(&atc->vm, pci);
1673 if (err < 0) 1662 if (err < 0)
1674 goto error1; 1663 goto error1;
1675 1664
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c
index 6b78752e9503..65da6e466f80 100644
--- a/sound/pci/ctxfi/ctvmem.c
+++ b/sound/pci/ctxfi/ctvmem.c
@@ -138,7 +138,7 @@ ct_vm_map(struct ct_vm *vm, struct snd_pcm_substream *substream, int size)
138 return NULL; 138 return NULL;
139 } 139 }
140 140
141 ptp = vm->ptp[0]; 141 ptp = (unsigned long *)vm->ptp[0].area;
142 pte_start = (block->addr >> CT_PAGE_SHIFT); 142 pte_start = (block->addr >> CT_PAGE_SHIFT);
143 pages = block->size >> CT_PAGE_SHIFT; 143 pages = block->size >> CT_PAGE_SHIFT;
144 for (i = 0; i < pages; i++) { 144 for (i = 0; i < pages; i++) {
@@ -158,25 +158,25 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block)
158} 158}
159 159
160/* * 160/* *
161 * return the host (kmalloced) addr of the @index-th device 161 * return the host physical addr of the @index-th device
162 * page talbe page on success, or NULL on failure. 162 * page table page on success, or ~0UL on failure.
163 * The first returned NULL indicates the termination. 163 * The first returned ~0UL indicates the termination.
164 * */ 164 * */
165static void * 165static dma_addr_t
166ct_get_ptp_virt(struct ct_vm *vm, int index) 166ct_get_ptp_phys(struct ct_vm *vm, int index)
167{ 167{
168 void *addr; 168 dma_addr_t addr;
169 169
170 addr = (index >= CT_PTP_NUM) ? NULL : vm->ptp[index]; 170 addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
171 171
172 return addr; 172 return addr;
173} 173}
174 174
175int ct_vm_create(struct ct_vm **rvm) 175int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
176{ 176{
177 struct ct_vm *vm; 177 struct ct_vm *vm;
178 struct ct_vm_block *block; 178 struct ct_vm_block *block;
179 int i; 179 int i, err = 0;
180 180
181 *rvm = NULL; 181 *rvm = NULL;
182 182
@@ -188,23 +188,21 @@ int ct_vm_create(struct ct_vm **rvm)
188 188
189 /* Allocate page table pages */ 189 /* Allocate page table pages */
190 for (i = 0; i < CT_PTP_NUM; i++) { 190 for (i = 0; i < CT_PTP_NUM; i++) {
191 vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL); 191 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
192 if (!vm->ptp[i]) 192 snd_dma_pci_data(pci),
193 PAGE_SIZE, &vm->ptp[i]);
194 if (err < 0)
193 break; 195 break;
194 } 196 }
195 if (!i) { 197 if (err < 0) {
196 /* no page table pages are allocated */ 198 /* no page table pages are allocated */
197 kfree(vm); 199 ct_vm_destroy(vm);
198 return -ENOMEM; 200 return -ENOMEM;
199 } 201 }
200 vm->size = CT_ADDRS_PER_PAGE * i; 202 vm->size = CT_ADDRS_PER_PAGE * i;
201 /* Initialise remaining ptps */
202 for (; i < CT_PTP_NUM; i++)
203 vm->ptp[i] = NULL;
204
205 vm->map = ct_vm_map; 203 vm->map = ct_vm_map;
206 vm->unmap = ct_vm_unmap; 204 vm->unmap = ct_vm_unmap;
207 vm->get_ptp_virt = ct_get_ptp_virt; 205 vm->get_ptp_phys = ct_get_ptp_phys;
208 INIT_LIST_HEAD(&vm->unused); 206 INIT_LIST_HEAD(&vm->unused);
209 INIT_LIST_HEAD(&vm->used); 207 INIT_LIST_HEAD(&vm->used);
210 block = kzalloc(sizeof(*block), GFP_KERNEL); 208 block = kzalloc(sizeof(*block), GFP_KERNEL);
@@ -242,7 +240,7 @@ void ct_vm_destroy(struct ct_vm *vm)
242 240
243 /* free allocated page table pages */ 241 /* free allocated page table pages */
244 for (i = 0; i < CT_PTP_NUM; i++) 242 for (i = 0; i < CT_PTP_NUM; i++)
245 kfree(vm->ptp[i]); 243 snd_dma_free_pages(&vm->ptp[i]);
246 244
247 vm->size = 0; 245 vm->size = 0;
248 246
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
index 01e4fd0386a3..b23adfca4de6 100644
--- a/sound/pci/ctxfi/ctvmem.h
+++ b/sound/pci/ctxfi/ctvmem.h
@@ -22,6 +22,8 @@
22 22
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/pci.h>
26#include <sound/memalloc.h>
25 27
26/* The chip can handle the page table of 4k pages 28/* The chip can handle the page table of 4k pages
27 * (emu20k1 can handle even 8k pages, but we don't use it right now) 29 * (emu20k1 can handle even 8k pages, but we don't use it right now)
@@ -41,7 +43,7 @@ struct snd_pcm_substream;
41 43
42/* Virtual memory management object for card device */ 44/* Virtual memory management object for card device */
43struct ct_vm { 45struct ct_vm {
44 void *ptp[CT_PTP_NUM]; /* Device page table pages */ 46 struct snd_dma_buffer ptp[CT_PTP_NUM]; /* Device page table pages */
45 unsigned int size; /* Available addr space in bytes */ 47 unsigned int size; /* Available addr space in bytes */
46 struct list_head unused; /* List of unused blocks */ 48 struct list_head unused; /* List of unused blocks */
47 struct list_head used; /* List of used blocks */ 49 struct list_head used; /* List of used blocks */
@@ -52,10 +54,10 @@ struct ct_vm {
52 int size); 54 int size);
53 /* Unmap device logical addr area. */ 55 /* Unmap device logical addr area. */
54 void (*unmap)(struct ct_vm *, struct ct_vm_block *block); 56 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
55 void *(*get_ptp_virt)(struct ct_vm *vm, int index); 57 dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
56}; 58};
57 59
58int ct_vm_create(struct ct_vm **rvm); 60int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
59void ct_vm_destroy(struct ct_vm *vm); 61void ct_vm_destroy(struct ct_vm *vm);
60 62
61#endif /* CTVMEM_H */ 63#endif /* CTVMEM_H */
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 5fe34a8d8c81..e4581a42ace5 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work)
42 return; 42 return;
43 43
44 /* generate tone */ 44 /* generate tone */
45 snd_hda_codec_write_cache(codec, beep->nid, 0, 45 snd_hda_codec_write(codec, beep->nid, 0,
46 AC_VERB_SET_BEEP_CONTROL, beep->tone); 46 AC_VERB_SET_BEEP_CONTROL, beep->tone);
47} 47}
48 48
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep)
119 beep->dev = NULL; 119 beep->dev = NULL;
120 cancel_work_sync(&beep->beep_work); 120 cancel_work_sync(&beep->beep_work);
121 /* turn off beep for sure */ 121 /* turn off beep for sure */
122 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 122 snd_hda_codec_write(beep->codec, beep->nid, 0,
123 AC_VERB_SET_BEEP_CONTROL, 0); 123 AC_VERB_SET_BEEP_CONTROL, 0);
124} 124}
125 125
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
192 beep->enabled = enable; 192 beep->enabled = enable;
193 if (!enable) { 193 if (!enable) {
194 /* turn off beep */ 194 /* turn off beep */
195 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 195 snd_hda_codec_write(beep->codec, beep->nid, 0,
196 AC_VERB_SET_BEEP_CONTROL, 0); 196 AC_VERB_SET_BEEP_CONTROL, 0);
197 } 197 }
198 if (beep->mode == HDA_BEEP_MODE_SWREG) { 198 if (beep->mode == HDA_BEEP_MODE_SWREG) {
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
239 mutex_init(&beep->mutex); 239 mutex_init(&beep->mutex);
240 240
241 if (beep->mode == HDA_BEEP_MODE_ON) { 241 if (beep->mode == HDA_BEEP_MODE_ON) {
242 beep->enabled = 1; 242 int err = snd_hda_do_attach(beep);
243 snd_hda_do_register(&beep->register_work); 243 if (err < 0) {
244 kfree(beep);
245 codec->beep = NULL;
246 return err;
247 }
244 } 248 }
245 249
246 return 0; 250 return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
253 if (beep) { 257 if (beep) {
254 cancel_work_sync(&beep->register_work); 258 cancel_work_sync(&beep->register_work);
255 cancel_delayed_work(&beep->unregister_work); 259 cancel_delayed_work(&beep->unregister_work);
256 if (beep->enabled) 260 if (beep->dev)
257 snd_hda_do_detach(beep); 261 snd_hda_do_detach(beep);
258 codec->beep = NULL; 262 codec->beep = NULL;
259 kfree(beep); 263 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 950ee5cfcacf..f98b47cd6cfb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1327,11 +1327,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1327 */ 1327 */
1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) 1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1329{ 1329{
1330 u32 pincap = snd_hda_query_pin_caps(codec, nid); 1330 u32 pincap;
1331
1332 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1333 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1334 1331
1332 if (!codec->no_trigger_sense) {
1333 pincap = snd_hda_query_pin_caps(codec, nid);
1334 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1335 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1336 }
1335 return snd_hda_codec_read(codec, nid, 0, 1337 return snd_hda_codec_read(codec, nid, 0,
1336 AC_VERB_GET_PIN_SENSE, 0); 1338 AC_VERB_GET_PIN_SENSE, 0);
1337} 1339}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 1d541b7f5547..0a770a28e71f 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -817,6 +817,7 @@ struct hda_codec {
817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
818 * (e.g. Conexant codecs) 818 * (e.g. Conexant codecs)
819 */ 819 */
820 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
820#ifdef CONFIG_SND_HDA_POWER_SAVE 821#ifdef CONFIG_SND_HDA_POWER_SAVE
821 unsigned int power_on :1; /* current (global) power-state */ 822 unsigned int power_on :1; /* current (global) power-state */
822 unsigned int power_transition :1; /* power-state in transition */ 823 unsigned int power_transition :1; /* power-state in transition */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index ff8ad46cc50e..b8faa6dc5abe 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -356,6 +356,7 @@ struct azx_dev {
356 */ 356 */
357 unsigned char stream_tag; /* assigned stream */ 357 unsigned char stream_tag; /* assigned stream */
358 unsigned char index; /* stream index */ 358 unsigned char index; /* stream index */
359 int device; /* last device number assigned to */
359 360
360 unsigned int opened :1; 361 unsigned int opened :1;
361 unsigned int running :1; 362 unsigned int running :1;
@@ -425,6 +426,7 @@ struct azx {
425 426
426 /* flags */ 427 /* flags */
427 int position_fix; 428 int position_fix;
429 int poll_count;
428 unsigned int running :1; 430 unsigned int running :1;
429 unsigned int initialized :1; 431 unsigned int initialized :1;
430 unsigned int single_cmd :1; 432 unsigned int single_cmd :1;
@@ -505,7 +507,7 @@ static char *driver_short_names[] __devinitdata = {
505#define get_azx_dev(substream) (substream->runtime->private_data) 507#define get_azx_dev(substream) (substream->runtime->private_data)
506 508
507static int azx_acquire_irq(struct azx *chip, int do_disconnect); 509static int azx_acquire_irq(struct azx *chip, int do_disconnect);
508 510static int azx_send_cmd(struct hda_bus *bus, unsigned int val);
509/* 511/*
510 * Interface for HD codec 512 * Interface for HD codec
511 */ 513 */
@@ -663,11 +665,12 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
663{ 665{
664 struct azx *chip = bus->private_data; 666 struct azx *chip = bus->private_data;
665 unsigned long timeout; 667 unsigned long timeout;
668 int do_poll = 0;
666 669
667 again: 670 again:
668 timeout = jiffies + msecs_to_jiffies(1000); 671 timeout = jiffies + msecs_to_jiffies(1000);
669 for (;;) { 672 for (;;) {
670 if (chip->polling_mode) { 673 if (chip->polling_mode || do_poll) {
671 spin_lock_irq(&chip->reg_lock); 674 spin_lock_irq(&chip->reg_lock);
672 azx_update_rirb(chip); 675 azx_update_rirb(chip);
673 spin_unlock_irq(&chip->reg_lock); 676 spin_unlock_irq(&chip->reg_lock);
@@ -675,6 +678,9 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
675 if (!chip->rirb.cmds[addr]) { 678 if (!chip->rirb.cmds[addr]) {
676 smp_rmb(); 679 smp_rmb();
677 bus->rirb_error = 0; 680 bus->rirb_error = 0;
681
682 if (!do_poll)
683 chip->poll_count = 0;
678 return chip->rirb.res[addr]; /* the last value */ 684 return chip->rirb.res[addr]; /* the last value */
679 } 685 }
680 if (time_after(jiffies, timeout)) 686 if (time_after(jiffies, timeout))
@@ -687,6 +693,16 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
687 } 693 }
688 } 694 }
689 695
696 if (!chip->polling_mode && chip->poll_count < 2) {
697 snd_printdd(SFX "azx_get_response timeout, "
698 "polling the codec once: last cmd=0x%08x\n",
699 chip->last_cmd[addr]);
700 do_poll = 1;
701 chip->poll_count++;
702 goto again;
703 }
704
705
690 if (!chip->polling_mode) { 706 if (!chip->polling_mode) {
691 snd_printk(KERN_WARNING SFX "azx_get_response timeout, " 707 snd_printk(KERN_WARNING SFX "azx_get_response timeout, "
692 "switching to polling mode: last cmd=0x%08x\n", 708 "switching to polling mode: last cmd=0x%08x\n",
@@ -1441,10 +1457,13 @@ static int __devinit azx_codec_configure(struct azx *chip)
1441 */ 1457 */
1442 1458
1443/* assign a stream for the PCM */ 1459/* assign a stream for the PCM */
1444static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) 1460static inline struct azx_dev *
1461azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
1445{ 1462{
1446 int dev, i, nums; 1463 int dev, i, nums;
1447 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1464 struct azx_dev *res = NULL;
1465
1466 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1448 dev = chip->playback_index_offset; 1467 dev = chip->playback_index_offset;
1449 nums = chip->playback_streams; 1468 nums = chip->playback_streams;
1450 } else { 1469 } else {
@@ -1453,10 +1472,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream)
1453 } 1472 }
1454 for (i = 0; i < nums; i++, dev++) 1473 for (i = 0; i < nums; i++, dev++)
1455 if (!chip->azx_dev[dev].opened) { 1474 if (!chip->azx_dev[dev].opened) {
1456 chip->azx_dev[dev].opened = 1; 1475 res = &chip->azx_dev[dev];
1457 return &chip->azx_dev[dev]; 1476 if (res->device == substream->pcm->device)
1477 break;
1458 } 1478 }
1459 return NULL; 1479 if (res) {
1480 res->opened = 1;
1481 res->device = substream->pcm->device;
1482 }
1483 return res;
1460} 1484}
1461 1485
1462/* release the assigned stream */ 1486/* release the assigned stream */
@@ -1505,7 +1529,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1505 int err; 1529 int err;
1506 1530
1507 mutex_lock(&chip->open_mutex); 1531 mutex_lock(&chip->open_mutex);
1508 azx_dev = azx_assign_device(chip, substream->stream); 1532 azx_dev = azx_assign_device(chip, substream);
1509 if (azx_dev == NULL) { 1533 if (azx_dev == NULL) {
1510 mutex_unlock(&chip->open_mutex); 1534 mutex_unlock(&chip->open_mutex);
1511 return -EBUSY; 1535 return -EBUSY;
@@ -2034,7 +2058,7 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
2034{ 2058{
2035 if (request_irq(chip->pci->irq, azx_interrupt, 2059 if (request_irq(chip->pci->irq, azx_interrupt,
2036 chip->msi ? 0 : IRQF_SHARED, 2060 chip->msi ? 0 : IRQF_SHARED,
2037 "HDA Intel", chip)) { 2061 "hda_intel", chip)) {
2038 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " 2062 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
2039 "disabling device\n", chip->pci->irq); 2063 "disabling device\n", chip->pci->irq);
2040 if (do_disconnect) 2064 if (do_disconnect)
@@ -2323,6 +2347,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2323 */ 2347 */
2324static struct snd_pci_quirk msi_black_list[] __devinitdata = { 2348static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2325 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ 2349 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2350 SND_PCI_QUIRK(0x1043, 0x829c, "ASUS", 0), /* nvidia */
2326 {} 2351 {}
2327}; 2352};
2328 2353
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1a36137e13ec..69a941c7b158 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1186,6 +1186,8 @@ static int patch_ad1986a(struct hda_codec *codec)
1186 */ 1186 */
1187 spec->multiout.no_share_stream = 1; 1187 spec->multiout.no_share_stream = 1;
1188 1188
1189 codec->no_trigger_sense = 1;
1190
1189 return 0; 1191 return 0;
1190} 1192}
1191 1193
@@ -1371,6 +1373,8 @@ static int patch_ad1983(struct hda_codec *codec)
1371 1373
1372 codec->patch_ops = ad198x_patch_ops; 1374 codec->patch_ops = ad198x_patch_ops;
1373 1375
1376 codec->no_trigger_sense = 1;
1377
1374 return 0; 1378 return 0;
1375} 1379}
1376 1380
@@ -1813,6 +1817,9 @@ static int patch_ad1981(struct hda_codec *codec)
1813 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1817 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1814 break; 1818 break;
1815 } 1819 }
1820
1821 codec->no_trigger_sense = 1;
1822
1816 return 0; 1823 return 0;
1817} 1824}
1818 1825
@@ -3118,6 +3125,8 @@ static int patch_ad1988(struct hda_codec *codec)
3118#endif 3125#endif
3119 spec->vmaster_nid = 0x04; 3126 spec->vmaster_nid = 0x04;
3120 3127
3128 codec->no_trigger_sense = 1;
3129
3121 return 0; 3130 return 0;
3122} 3131}
3123 3132
@@ -3330,6 +3339,8 @@ static int patch_ad1884(struct hda_codec *codec)
3330 3339
3331 codec->patch_ops = ad198x_patch_ops; 3340 codec->patch_ops = ad198x_patch_ops;
3332 3341
3342 codec->no_trigger_sense = 1;
3343
3333 return 0; 3344 return 0;
3334} 3345}
3335 3346
@@ -4287,6 +4298,8 @@ static int patch_ad1884a(struct hda_codec *codec)
4287 break; 4298 break;
4288 } 4299 }
4289 4300
4301 codec->no_trigger_sense = 1;
4302
4290 return 0; 4303 return 0;
4291} 4304}
4292 4305
@@ -4623,6 +4636,9 @@ static int patch_ad1882(struct hda_codec *codec)
4623 spec->mixers[2] = ad1882_6stack_mixers; 4636 spec->mixers[2] = ad1882_6stack_mixers;
4624 break; 4637 break;
4625 } 4638 }
4639
4640 codec->no_trigger_sense = 1;
4641
4626 return 0; 4642 return 0;
4627} 4643}
4628 4644
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c7465053d6bb..da34095c707f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1093,6 +1093,16 @@ static void alc889_coef_init(struct hda_codec *codec)
1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); 1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1094} 1094}
1095 1095
1096/* turn on/off EAPD control (only if available) */
1097static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1098{
1099 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1100 return;
1101 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1102 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1103 on ? 2 : 0);
1104}
1105
1096static void alc_auto_init_amp(struct hda_codec *codec, int type) 1106static void alc_auto_init_amp(struct hda_codec *codec, int type)
1097{ 1107{
1098 unsigned int tmp; 1108 unsigned int tmp;
@@ -1110,25 +1120,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1110 case ALC_INIT_DEFAULT: 1120 case ALC_INIT_DEFAULT:
1111 switch (codec->vendor_id) { 1121 switch (codec->vendor_id) {
1112 case 0x10ec0260: 1122 case 0x10ec0260:
1113 snd_hda_codec_write(codec, 0x0f, 0, 1123 set_eapd(codec, 0x0f, 1);
1114 AC_VERB_SET_EAPD_BTLENABLE, 2); 1124 set_eapd(codec, 0x10, 1);
1115 snd_hda_codec_write(codec, 0x10, 0,
1116 AC_VERB_SET_EAPD_BTLENABLE, 2);
1117 break; 1125 break;
1118 case 0x10ec0262: 1126 case 0x10ec0262:
1119 case 0x10ec0267: 1127 case 0x10ec0267:
1120 case 0x10ec0268: 1128 case 0x10ec0268:
1121 case 0x10ec0269: 1129 case 0x10ec0269:
1130 case 0x10ec0270:
1122 case 0x10ec0272: 1131 case 0x10ec0272:
1123 case 0x10ec0660: 1132 case 0x10ec0660:
1124 case 0x10ec0662: 1133 case 0x10ec0662:
1125 case 0x10ec0663: 1134 case 0x10ec0663:
1126 case 0x10ec0862: 1135 case 0x10ec0862:
1127 case 0x10ec0889: 1136 case 0x10ec0889:
1128 snd_hda_codec_write(codec, 0x14, 0, 1137 set_eapd(codec, 0x14, 1);
1129 AC_VERB_SET_EAPD_BTLENABLE, 2); 1138 set_eapd(codec, 0x15, 1);
1130 snd_hda_codec_write(codec, 0x15, 0,
1131 AC_VERB_SET_EAPD_BTLENABLE, 2);
1132 break; 1139 break;
1133 } 1140 }
1134 switch (codec->vendor_id) { 1141 switch (codec->vendor_id) {
@@ -1230,6 +1237,8 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1230 return; /* invalid entry */ 1237 return; /* invalid entry */
1231 } 1238 }
1232 } 1239 }
1240 if (!ext || !fixed)
1241 return;
1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1242 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1234 return; /* no unsol support */ 1243 return; /* no unsol support */
1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", 1244 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
@@ -1834,10 +1843,8 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1834#ifdef CONFIG_SND_HDA_POWER_SAVE 1843#ifdef CONFIG_SND_HDA_POWER_SAVE
1835static void alc889_power_eapd(struct hda_codec *codec, int power) 1844static void alc889_power_eapd(struct hda_codec *codec, int power)
1836{ 1845{
1837 snd_hda_codec_write(codec, 0x14, 0, 1846 set_eapd(codec, 0x14, power);
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); 1847 set_eapd(codec, 0x15, power);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1841} 1848}
1842#endif 1849#endif
1843 1850
@@ -4812,6 +4819,49 @@ static void fixup_automic_adc(struct hda_codec *codec)
4812 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4819 spec->auto_mic = 0; /* disable auto-mic to be sure */
4813} 4820}
4814 4821
4822/* choose the ADC/MUX containing the input pin and initialize the setup */
4823static void fixup_single_adc(struct hda_codec *codec)
4824{
4825 struct alc_spec *spec = codec->spec;
4826 hda_nid_t pin;
4827 int i;
4828
4829 /* search for the input pin; there must be only one */
4830 for (i = 0; i < AUTO_PIN_LAST; i++) {
4831 if (spec->autocfg.input_pins[i]) {
4832 pin = spec->autocfg.input_pins[i];
4833 break;
4834 }
4835 }
4836 if (!pin)
4837 return;
4838
4839 /* set the default connection to that pin */
4840 for (i = 0; i < spec->num_adc_nids; i++) {
4841 hda_nid_t cap = spec->capsrc_nids ?
4842 spec->capsrc_nids[i] : spec->adc_nids[i];
4843 int idx;
4844
4845 idx = get_connection_index(codec, cap, pin);
4846 if (idx < 0)
4847 continue;
4848 /* use only this ADC */
4849 if (spec->capsrc_nids)
4850 spec->capsrc_nids += i;
4851 spec->adc_nids += i;
4852 spec->num_adc_nids = 1;
4853 /* select or unmute this route */
4854 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4855 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4856 HDA_AMP_MUTE, 0);
4857 } else {
4858 snd_hda_codec_write_cache(codec, cap, 0,
4859 AC_VERB_SET_CONNECT_SEL, idx);
4860 }
4861 return;
4862 }
4863}
4864
4815static void set_capture_mixer(struct hda_codec *codec) 4865static void set_capture_mixer(struct hda_codec *codec)
4816{ 4866{
4817 struct alc_spec *spec = codec->spec; 4867 struct alc_spec *spec = codec->spec;
@@ -4824,14 +4874,15 @@ static void set_capture_mixer(struct hda_codec *codec)
4824 alc_capture_mixer3 }, 4874 alc_capture_mixer3 },
4825 }; 4875 };
4826 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4876 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4827 int mux; 4877 int mux = 0;
4828 if (spec->auto_mic) { 4878 if (spec->auto_mic)
4829 mux = 0;
4830 fixup_automic_adc(codec); 4879 fixup_automic_adc(codec);
4831 } else if (spec->input_mux && spec->input_mux->num_items > 1) 4880 else if (spec->input_mux) {
4832 mux = 1; 4881 if (spec->input_mux->num_items > 1)
4833 else 4882 mux = 1;
4834 mux = 0; 4883 else if (spec->input_mux->num_items == 1)
4884 fixup_single_adc(codec);
4885 }
4835 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4886 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4836 } 4887 }
4837} 4888}
@@ -7094,8 +7145,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7145 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7146 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7147 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7098 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), 7149 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7151 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7496,6 +7547,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7549 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7550 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7499 /* Front Mic pin: input vref at 80% */ 7551 /* Front Mic pin: input vref at 80% */
7500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7501 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -7680,6 +7732,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
7680 spec->autocfg.speaker_pins[0] = 0x14; 7732 spec->autocfg.speaker_pins[0] = 0x14;
7681} 7733}
7682 7734
7735static void alc885_mb5_automute(struct hda_codec *codec)
7736{
7737 unsigned int present;
7738
7739 present = snd_hda_codec_read(codec, 0x14, 0,
7740 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7741 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7742 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7743 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7744 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7745
7746}
7747
7748static void alc885_mb5_unsol_event(struct hda_codec *codec,
7749 unsigned int res)
7750{
7751 /* Headphone insertion or removal. */
7752 if ((res >> 26) == ALC880_HP_EVENT)
7753 alc885_mb5_automute(codec);
7754}
7755
7683static void alc885_imac91_automute(struct hda_codec *codec) 7756static void alc885_imac91_automute(struct hda_codec *codec)
7684{ 7757{
7685 unsigned int present; 7758 unsigned int present;
@@ -9126,6 +9199,8 @@ static struct alc_config_preset alc882_presets[] = {
9126 .input_mux = &mb5_capture_source, 9199 .input_mux = &mb5_capture_source,
9127 .dig_out_nid = ALC882_DIGOUT_NID, 9200 .dig_out_nid = ALC882_DIGOUT_NID,
9128 .dig_in_nid = ALC882_DIGIN_NID, 9201 .dig_in_nid = ALC882_DIGIN_NID,
9202 .unsol_event = alc885_mb5_unsol_event,
9203 .init_hook = alc885_mb5_automute,
9129 }, 9204 },
9130 [ALC885_MACPRO] = { 9205 [ALC885_MACPRO] = {
9131 .mixers = { alc882_macpro_mixer }, 9206 .mixers = { alc882_macpro_mixer },
@@ -9403,6 +9478,7 @@ static struct alc_config_preset alc882_presets[] = {
9403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 9478 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9404 .channel_mode = alc883_3ST_6ch_modes, 9479 .channel_mode = alc883_3ST_6ch_modes,
9405 .need_dac_fix = 1, 9480 .need_dac_fix = 1,
9481 .const_channel_count = 6,
9406 .num_mux_defs = 9482 .num_mux_defs =
9407 ARRAY_SIZE(alc888_2_capture_sources), 9483 ARRAY_SIZE(alc888_2_capture_sources),
9408 .input_mux = alc888_2_capture_sources, 9484 .input_mux = alc888_2_capture_sources,
@@ -10307,7 +10383,7 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec)
10307 struct alc_spec *spec = codec->spec; 10383 struct alc_spec *spec = codec->spec;
10308 10384
10309 spec->autocfg.hp_pins[0] = 0x15; 10385 spec->autocfg.hp_pins[0] = 0x15;
10310 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ 10386 spec->autocfg.speaker_pins[0] = 0x14;
10311} 10387}
10312 10388
10313static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { 10389static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
@@ -11179,7 +11255,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11179} 11255}
11180 11256
11181#define alc262_auto_create_input_ctls \ 11257#define alc262_auto_create_input_ctls \
11182 alc880_auto_create_input_ctls 11258 alc882_auto_create_input_ctls
11183 11259
11184/* 11260/*
11185 * generic initialization of ADC, input mixers and output mixers 11261 * generic initialization of ADC, input mixers and output mixers
@@ -11718,9 +11794,9 @@ static struct alc_config_preset alc262_presets[] = {
11718 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11719 .channel_mode = alc262_modes, 11795 .channel_mode = alc262_modes,
11720 .input_mux = &alc262_capture_source, 11796 .input_mux = &alc262_capture_source,
11721 .unsol_event = alc_automute_amp_unsol_event, 11797 .unsol_event = alc_sku_unsol_event,
11722 .setup = alc262_hp_t5735_setup, 11798 .setup = alc262_hp_t5735_setup,
11723 .init_hook = alc_automute_amp, 11799 .init_hook = alc_inithook,
11724 }, 11800 },
11725 [ALC262_HP_RP5700] = { 11801 [ALC262_HP_RP5700] = {
11726 .mixers = { alc262_hp_rp5700_mixer }, 11802 .mixers = { alc262_hp_rp5700_mixer },
@@ -12471,6 +12547,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12471 dac = 0x02; 12547 dac = 0x02;
12472 break; 12548 break;
12473 case 0x15: 12549 case 0x15:
12550 case 0x21:
12474 dac = 0x03; 12551 dac = 0x03;
12475 break; 12552 break;
12476 default: 12553 default:
@@ -14855,6 +14932,8 @@ static int patch_alc861(struct hda_codec *codec)
14855 spec->stream_digital_playback = &alc861_pcm_digital_playback; 14932 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14856 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14933 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14857 14934
14935 if (!spec->cap_mixer)
14936 set_capture_mixer(codec);
14858 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 14937 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14859 14938
14860 spec->vmaster_nid = 0x03; 14939 spec->vmaster_nid = 0x03;
@@ -15493,7 +15572,7 @@ static struct alc_config_preset alc861vd_presets[] = {
15493static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, 15572static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15494 const struct auto_pin_cfg *cfg) 15573 const struct auto_pin_cfg *cfg)
15495{ 15574{
15496 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); 15575 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15497} 15576}
15498 15577
15499 15578
@@ -17251,7 +17330,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17251 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 17330 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17252 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 17331 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17253 ALC662_3ST_6ch_DIG), 17332 ALC662_3ST_6ch_DIG),
17254 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), 17333 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17255 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17334 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17256 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17335 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17257 ALC662_3ST_6ch_DIG), 17336 ALC662_3ST_6ch_DIG),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index eeda7beeb57a..799ba2570902 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4453,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4453{ 4453{
4454 if (!nid) 4454 if (!nid)
4455 return 0; 4455 return 0;
4456 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4456 return snd_hda_jack_detect(codec, nid);
4457 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4458 * the pincap gives TRIG_REQ bit.
4459 */
4460 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4461 AC_PINSENSE_PRESENCE)
4462 return 1;
4463 return 0;
4464} 4457}
4465 4458
4466static void stac92xx_line_out_detect(struct hda_codec *codec, 4459static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4737,6 +4730,26 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4737 } 4730 }
4738} 4731}
4739 4732
4733static int hp_blike_system(u32 subsystem_id);
4734
4735static void set_hp_led_gpio(struct hda_codec *codec)
4736{
4737 struct sigmatel_spec *spec = codec->spec;
4738 switch (codec->vendor_id) {
4739 case 0x111d7608:
4740 /* GPIO 0 */
4741 spec->gpio_led = 0x01;
4742 break;
4743 case 0x111d7600:
4744 case 0x111d7601:
4745 case 0x111d7602:
4746 case 0x111d7603:
4747 /* GPIO 3 */
4748 spec->gpio_led = 0x08;
4749 break;
4750 }
4751}
4752
4740/* 4753/*
4741 * This method searches for the mute LED GPIO configuration 4754 * This method searches for the mute LED GPIO configuration
4742 * provided as OEM string in SMBIOS. The format of that string 4755 * provided as OEM string in SMBIOS. The format of that string
@@ -4748,6 +4761,14 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4748 * 4761 *
4749 * So, HP B-series like systems may have HP_Mute_LED_0 (current models) 4762 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4750 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings 4763 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
4764 *
4765 *
4766 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
4767 * SMBIOS - at least the ones I have seen do not have them - which include
4768 * my own system (HP Pavilion dv6-1110ax) and my cousin's
4769 * HP Pavilion dv9500t CTO.
4770 * Need more information on whether it is true across the entire series.
4771 * -- kunal
4751 */ 4772 */
4752static int find_mute_led_gpio(struct hda_codec *codec) 4773static int find_mute_led_gpio(struct hda_codec *codec)
4753{ 4774{
@@ -4758,28 +4779,27 @@ static int find_mute_led_gpio(struct hda_codec *codec)
4758 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, 4779 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4759 NULL, dev))) { 4780 NULL, dev))) {
4760 if (sscanf(dev->name, "HP_Mute_LED_%d_%d", 4781 if (sscanf(dev->name, "HP_Mute_LED_%d_%d",
4761 &spec->gpio_led_polarity, 4782 &spec->gpio_led_polarity,
4762 &spec->gpio_led) == 2) { 4783 &spec->gpio_led) == 2) {
4763 spec->gpio_led = 1 << spec->gpio_led; 4784 spec->gpio_led = 1 << spec->gpio_led;
4764 return 1; 4785 return 1;
4765 } 4786 }
4766 if (sscanf(dev->name, "HP_Mute_LED_%d", 4787 if (sscanf(dev->name, "HP_Mute_LED_%d",
4767 &spec->gpio_led_polarity) == 1) { 4788 &spec->gpio_led_polarity) == 1) {
4768 switch (codec->vendor_id) { 4789 set_hp_led_gpio(codec);
4769 case 0x111d7608: 4790 return 1;
4770 /* GPIO 0 */
4771 spec->gpio_led = 0x01;
4772 return 1;
4773 case 0x111d7600:
4774 case 0x111d7601:
4775 case 0x111d7602:
4776 case 0x111d7603:
4777 /* GPIO 3 */
4778 spec->gpio_led = 0x08;
4779 return 1;
4780 }
4781 } 4791 }
4782 } 4792 }
4793
4794 /*
4795 * Fallback case - if we don't find the DMI strings,
4796 * we statically set the GPIO - if not a B-series system.
4797 */
4798 if (!hp_blike_system(codec->subsystem_id)) {
4799 set_hp_led_gpio(codec);
4800 spec->gpio_led_polarity = 1;
4801 return 1;
4802 }
4783 } 4803 }
4784 return 0; 4804 return 0;
4785} 4805}
@@ -4962,6 +4982,7 @@ static int patch_stac9200(struct hda_codec *codec)
4962 if (spec == NULL) 4982 if (spec == NULL)
4963 return -ENOMEM; 4983 return -ENOMEM;
4964 4984
4985 codec->no_trigger_sense = 1;
4965 codec->spec = spec; 4986 codec->spec = spec;
4966 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4987 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4967 spec->pin_nids = stac9200_pin_nids; 4988 spec->pin_nids = stac9200_pin_nids;
@@ -5024,6 +5045,7 @@ static int patch_stac925x(struct hda_codec *codec)
5024 if (spec == NULL) 5045 if (spec == NULL)
5025 return -ENOMEM; 5046 return -ENOMEM;
5026 5047
5048 codec->no_trigger_sense = 1;
5027 codec->spec = spec; 5049 codec->spec = spec;
5028 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5050 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5029 spec->pin_nids = stac925x_pin_nids; 5051 spec->pin_nids = stac925x_pin_nids;
@@ -5108,6 +5130,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5108 if (spec == NULL) 5130 if (spec == NULL)
5109 return -ENOMEM; 5131 return -ENOMEM;
5110 5132
5133 codec->no_trigger_sense = 1;
5111 codec->spec = spec; 5134 codec->spec = spec;
5112 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5135 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5113 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5136 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5255,6 +5278,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5255 if (spec == NULL) 5278 if (spec == NULL)
5256 return -ENOMEM; 5279 return -ENOMEM;
5257 5280
5281 codec->no_trigger_sense = 1;
5258 codec->spec = spec; 5282 codec->spec = spec;
5259 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5283 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5260 spec->digbeep_nid = 0x21; 5284 spec->digbeep_nid = 0x21;
@@ -5418,6 +5442,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5418 if (spec == NULL) 5442 if (spec == NULL)
5419 return -ENOMEM; 5443 return -ENOMEM;
5420 5444
5445 codec->no_trigger_sense = 1;
5421 codec->spec = spec; 5446 codec->spec = spec;
5422 codec->patch_ops = stac92xx_patch_ops; 5447 codec->patch_ops = stac92xx_patch_ops;
5423 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5448 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5550,6 +5575,8 @@ again:
5550 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5575 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5551 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 5576 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
5552 5577
5578 snd_printdd("Found board config: %d\n", spec->board_config);
5579
5553 switch (spec->board_config) { 5580 switch (spec->board_config) {
5554 case STAC_HP_M4: 5581 case STAC_HP_M4:
5555 /* enable internal microphone */ 5582 /* enable internal microphone */
@@ -5661,6 +5688,7 @@ static int patch_stac922x(struct hda_codec *codec)
5661 if (spec == NULL) 5688 if (spec == NULL)
5662 return -ENOMEM; 5689 return -ENOMEM;
5663 5690
5691 codec->no_trigger_sense = 1;
5664 codec->spec = spec; 5692 codec->spec = spec;
5665 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5693 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5666 spec->pin_nids = stac922x_pin_nids; 5694 spec->pin_nids = stac922x_pin_nids;
@@ -5764,6 +5792,7 @@ static int patch_stac927x(struct hda_codec *codec)
5764 if (spec == NULL) 5792 if (spec == NULL)
5765 return -ENOMEM; 5793 return -ENOMEM;
5766 5794
5795 codec->no_trigger_sense = 1;
5767 codec->spec = spec; 5796 codec->spec = spec;
5768 codec->slave_dig_outs = stac927x_slave_dig_outs; 5797 codec->slave_dig_outs = stac927x_slave_dig_outs;
5769 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5798 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5898,6 +5927,7 @@ static int patch_stac9205(struct hda_codec *codec)
5898 if (spec == NULL) 5927 if (spec == NULL)
5899 return -ENOMEM; 5928 return -ENOMEM;
5900 5929
5930 codec->no_trigger_sense = 1;
5901 codec->spec = spec; 5931 codec->spec = spec;
5902 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5932 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5903 spec->pin_nids = stac9205_pin_nids; 5933 spec->pin_nids = stac9205_pin_nids;
@@ -6053,6 +6083,7 @@ static int patch_stac9872(struct hda_codec *codec)
6053 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6083 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6054 if (spec == NULL) 6084 if (spec == NULL)
6055 return -ENOMEM; 6085 return -ENOMEM;
6086 codec->no_trigger_sense = 1;
6056 codec->spec = spec; 6087 codec->spec = spec;
6057 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6088 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6058 spec->pin_nids = stac9872_pin_nids; 6089 spec->pin_nids = stac9872_pin_nids;
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 765d7bd4c3d4..9e66f6d306f8 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -703,11 +703,13 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho
703{ 703{
704 unsigned char nvol; 704 unsigned char nvol;
705 705
706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) 706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) {
707 nvol = 0; 707 nvol = 0;
708 else 708 } else {
709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) / 709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) /
710 WM_VOL_MAX; 710 WM_VOL_MAX;
711 nvol += 0x1b;
712 }
711 713
712 wm_put(ice, index, nvol); 714 wm_put(ice, index, nvol);
713 wm_put_nocache(ice, index, 0x180 | nvol); 715 wm_put_nocache(ice, index, 0x180 | nvol);
@@ -778,7 +780,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
778 for (ch = 0; ch < 2; ch++) { 780 for (ch = 0; ch < 2; ch++) {
779 unsigned int vol = ucontrol->value.integer.value[ch]; 781 unsigned int vol = ucontrol->value.integer.value[ch];
780 if (vol > WM_VOL_MAX) 782 if (vol > WM_VOL_MAX)
781 continue; 783 vol = WM_VOL_MAX;
782 vol |= spec->master[ch] & WM_VOL_MUTE; 784 vol |= spec->master[ch] & WM_VOL_MUTE;
783 if (vol != spec->master[ch]) { 785 if (vol != spec->master[ch]) {
784 int dac; 786 int dac;
@@ -834,8 +836,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
834 for (i = 0; i < voices; i++) { 836 for (i = 0; i < voices; i++) {
835 unsigned int vol = ucontrol->value.integer.value[i]; 837 unsigned int vol = ucontrol->value.integer.value[i];
836 if (vol > WM_VOL_MAX) 838 if (vol > WM_VOL_MAX)
837 continue; 839 vol = WM_VOL_MAX;
838 vol |= spec->vol[ofs+i]; 840 vol |= spec->vol[ofs+i] & WM_VOL_MUTE;
839 if (vol != spec->vol[ofs+i]) { 841 if (vol != spec->vol[ofs+i]) {
840 spec->vol[ofs+i] = vol; 842 spec->vol[ofs+i] = vol;
841 idx = WM_DAC_ATTEN + ofs + i; 843 idx = WM_DAC_ATTEN + ofs + i;
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index b5ca02e2038c..e66ef2b69b5d 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1058,7 +1058,7 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
1058 rptr.retwords[2] != M && 1058 rptr.retwords[2] != M &&
1059 rptr.retwords[3] != N && 1059 rptr.retwords[3] != N &&
1060 i++ < MAX_WRITE_RETRY); 1060 i++ < MAX_WRITE_RETRY);
1061 if (i == MAX_WRITE_RETRY) { 1061 if (i > MAX_WRITE_RETRY) {
1062 snd_printdd("sent samplerate %d: %d failed\n", 1062 snd_printdd("sent samplerate %d: %d failed\n",
1063 *intdec, rate); 1063 *intdec, rate);
1064 return -EIO; 1064 return -EIO;
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 69bd0acc81c8..a1bbe16b7f96 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -102,6 +102,12 @@ static int ac97_soc_probe(struct platform_device *pdev)
102 INIT_LIST_HEAD(&codec->dapm_widgets); 102 INIT_LIST_HEAD(&codec->dapm_widgets);
103 INIT_LIST_HEAD(&codec->dapm_paths); 103 INIT_LIST_HEAD(&codec->dapm_paths);
104 104
105 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
106 if (ret < 0) {
107 printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n");
108 goto err;
109 }
110
105 /* register pcms */ 111 /* register pcms */
106 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 112 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
107 if (ret < 0) 113 if (ret < 0)
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index a9dc5fb54774..da589d8664d0 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -627,7 +627,7 @@ static int tlv320aic23_resume(struct platform_device *pdev)
627 u16 reg; 627 u16 reg;
628 628
629 /* Sync reg_cache with the hardware */ 629 /* Sync reg_cache with the hardware */
630 for (reg = 0; reg < TLV320AIC23_RESET; reg++) { 630 for (reg = 0; reg <= TLV320AIC23_ACTIVE; reg++) {
631 u16 val = tlv320aic23_read_reg_cache(codec, reg); 631 u16 val = tlv320aic23_read_reg_cache(codec, reg);
632 tlv320aic23_write(codec, reg, val); 632 tlv320aic23_write(codec, reg, val);
633 } 633 }
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index ebbf11b653a4..718ef912e758 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -925,7 +925,7 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
925 iface |= 0x3 << 8; 925 iface |= 0x3 << 8;
926 break; 926 break;
927 case SND_SOC_DAIFMT_DSP_B: 927 case SND_SOC_DAIFMT_DSP_B:
928 iface |= 0x3 << 8; /* lg not sure which mode */ 928 iface |= 0x3 << 8 | WM8350_AIF_LRCLK_INV;
929 break; 929 break;
930 default: 930 default:
931 return -EINVAL; 931 return -EINVAL;
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 265e68c75df8..af8cb6995a1f 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -424,23 +424,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
424 424
425 /* filter coefficient */ 425 /* filter coefficient */
426 switch (params_rate(params)) { 426 switch (params_rate(params)) {
427 case SNDRV_PCM_RATE_8000: 427 case 8000:
428 adn |= 0x5 << 1; 428 adn |= 0x5 << 1;
429 break; 429 break;
430 case SNDRV_PCM_RATE_11025: 430 case 11025:
431 adn |= 0x4 << 1; 431 adn |= 0x4 << 1;
432 break; 432 break;
433 case SNDRV_PCM_RATE_16000: 433 case 16000:
434 adn |= 0x3 << 1; 434 adn |= 0x3 << 1;
435 break; 435 break;
436 case SNDRV_PCM_RATE_22050: 436 case 22050:
437 adn |= 0x2 << 1; 437 adn |= 0x2 << 1;
438 break; 438 break;
439 case SNDRV_PCM_RATE_32000: 439 case 32000:
440 adn |= 0x1 << 1; 440 adn |= 0x1 << 1;
441 break; 441 break;
442 case SNDRV_PCM_RATE_44100: 442 case 44100:
443 case SNDRV_PCM_RATE_48000: 443 case 48000:
444 break; 444 break;
445 } 445 }
446 446
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index ce5515e3f2b0..3595bd57c4eb 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev)
1504 struct i2c_client *i2c = codec->control_data; 1504 struct i2c_client *i2c = codec->control_data;
1505 int i; 1505 int i;
1506 u16 *reg_cache = codec->reg_cache; 1506 u16 *reg_cache = codec->reg_cache;
1507 u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults), 1507 u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults),
1508 GFP_KERNEL); 1508 GFP_KERNEL);
1509 1509
1510 /* Bring the codec back up to standby first to minimise pop/clicks */ 1510 /* Bring the codec back up to standby first to minimise pop/clicks */
@@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev)
1516 for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) 1516 for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
1517 if (tmp_cache[i] != reg_cache[i]) 1517 if (tmp_cache[i] != reg_cache[i])
1518 snd_soc_write(codec, i, tmp_cache[i]); 1518 snd_soc_write(codec, i, tmp_cache[i]);
1519 kfree(tmp_cache);
1519 } else { 1520 } else {
1520 dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); 1521 dev_err(&i2c->dev, "Failed to allocate temporary cache\n");
1521 } 1522 }
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 3d850b97037a..31e39ffd1d8e 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -378,23 +378,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
378 iface |= (1 << 9); 378 iface |= (1 << 9);
379 379
380 switch (params_rate(params)) { 380 switch (params_rate(params)) {
381 case SNDRV_PCM_RATE_8000: 381 case 8000:
382 addcntrl |= (0x5 << 1); 382 addcntrl |= (0x5 << 1);
383 break; 383 break;
384 case SNDRV_PCM_RATE_11025: 384 case 11025:
385 addcntrl |= (0x4 << 1); 385 addcntrl |= (0x4 << 1);
386 break; 386 break;
387 case SNDRV_PCM_RATE_16000: 387 case 16000:
388 addcntrl |= (0x3 << 1); 388 addcntrl |= (0x3 << 1);
389 break; 389 break;
390 case SNDRV_PCM_RATE_22050: 390 case 22050:
391 addcntrl |= (0x2 << 1); 391 addcntrl |= (0x2 << 1);
392 break; 392 break;
393 case SNDRV_PCM_RATE_32000: 393 case 32000:
394 addcntrl |= (0x1 << 1); 394 addcntrl |= (0x1 << 1);
395 break; 395 break;
396 case SNDRV_PCM_RATE_44100: 396 case 44100:
397 case SNDRV_PCM_RATE_48000: 397 case 48000:
398 break; 398 break;
399 } 399 }
400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); 400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl);
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index a808675388fc..8812751da8c9 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -482,23 +482,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
482 482
483 /* filter coefficient */ 483 /* filter coefficient */
484 switch (params_rate(params)) { 484 switch (params_rate(params)) {
485 case SNDRV_PCM_RATE_8000: 485 case 8000:
486 adn |= 0x5 << 1; 486 adn |= 0x5 << 1;
487 break; 487 break;
488 case SNDRV_PCM_RATE_11025: 488 case 11025:
489 adn |= 0x4 << 1; 489 adn |= 0x4 << 1;
490 break; 490 break;
491 case SNDRV_PCM_RATE_16000: 491 case 16000:
492 adn |= 0x3 << 1; 492 adn |= 0x3 << 1;
493 break; 493 break;
494 case SNDRV_PCM_RATE_22050: 494 case 22050:
495 adn |= 0x2 << 1; 495 adn |= 0x2 << 1;
496 break; 496 break;
497 case SNDRV_PCM_RATE_32000: 497 case 32000:
498 adn |= 0x1 << 1; 498 adn |= 0x1 << 1;
499 break; 499 break;
500 case SNDRV_PCM_RATE_44100: 500 case 44100:
501 case SNDRV_PCM_RATE_48000: 501 case 48000:
502 break; 502 break;
503 } 503 }
504 504
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 3db8a6c523f4..19283e5edfbf 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
25obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o 25obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
26obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o 26obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o
27obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o 27obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o
28obj-$(CONFIG_SND_OMAP_SOC_OMAP3517EVM) += snd-soc-am3517evm.o 28obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
29obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o 29obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
30obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o 30obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
31obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o 31obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 71b2c161158d..68980c19a3bc 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -145,6 +145,7 @@ static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = {
145}; 145};
146 146
147static const struct snd_soc_dapm_route omap3pandora_out_map[] = { 147static const struct snd_soc_dapm_route omap3pandora_out_map[] = {
148 {"PCM DAC", NULL, "APLL Enable"},
148 {"Headphone Amplifier", NULL, "PCM DAC"}, 149 {"Headphone Amplifier", NULL, "PCM DAC"},
149 {"Line Out", NULL, "PCM DAC"}, 150 {"Line Out", NULL, "PCM DAC"},
150 {"Headphone Jack", NULL, "Headphone Amplifier"}, 151 {"Headphone Jack", NULL, "Headphone Amplifier"},
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index c7af09729c6e..5263ab18f827 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -42,42 +42,12 @@ static struct snd_soc_device fsi_snd_devdata = {
42 .codec_dev = &soc_codec_dev_ak4642, 42 .codec_dev = &soc_codec_dev_ak4642,
43}; 43};
44 44
45#define AK4642_BUS 0
46#define AK4642_ADR 0x12
47static int ak4642_add_i2c_device(void)
48{
49 struct i2c_board_info info;
50 struct i2c_adapter *adapter;
51 struct i2c_client *client;
52
53 memset(&info, 0, sizeof(struct i2c_board_info));
54 info.addr = AK4642_ADR;
55 strlcpy(info.type, "ak4642", I2C_NAME_SIZE);
56
57 adapter = i2c_get_adapter(AK4642_BUS);
58 if (!adapter) {
59 printk(KERN_DEBUG "can't get i2c adapter\n");
60 return -ENODEV;
61 }
62
63 client = i2c_new_device(adapter, &info);
64 i2c_put_adapter(adapter);
65 if (!client) {
66 printk(KERN_DEBUG "can't add i2c device\n");
67 return -ENODEV;
68 }
69
70 return 0;
71}
72
73static struct platform_device *fsi_snd_device; 45static struct platform_device *fsi_snd_device;
74 46
75static int __init fsi_ak4642_init(void) 47static int __init fsi_ak4642_init(void)
76{ 48{
77 int ret = -ENOMEM; 49 int ret = -ENOMEM;
78 50
79 ak4642_add_i2c_device();
80
81 fsi_snd_device = platform_device_alloc("soc-audio", -1); 51 fsi_snd_device = platform_device_alloc("soc-audio", -1);
82 if (!fsi_snd_device) 52 if (!fsi_snd_device)
83 goto out; 53 goto out;
diff --git a/sound/sound_core.c b/sound/sound_core.c
index dbca7c909a31..7c2d677a2df5 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -61,7 +61,7 @@ static void __exit cleanup_soundcore(void)
61 class_destroy(sound_class); 61 class_destroy(sound_class);
62} 62}
63 63
64module_init(init_soundcore); 64subsys_initcall(init_soundcore);
65module_exit(cleanup_soundcore); 65module_exit(cleanup_soundcore);
66 66
67 67
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 4963defee18a..9edef4684978 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1936,7 +1936,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
1936 struct snd_usb_stream *as = snd_pcm_substream_chip(substream); 1936 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1937 struct snd_usb_substream *subs = &as->substream[direction]; 1937 struct snd_usb_substream *subs = &as->substream[direction];
1938 1938
1939 if (subs->interface >= 0) { 1939 if (!as->chip->shutdown && subs->interface >= 0) {
1940 usb_set_interface(subs->dev, subs->interface, 0); 1940 usb_set_interface(subs->dev, subs->interface, 0);
1941 subs->interface = -1; 1941 subs->interface = -1;
1942 } 1942 }