aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c25
-rw-r--r--sound/core/oss/pcm_oss.c2
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/i2c/other/tea575x-tuner.c6
-rw-r--r--sound/oss/aedsp16.c2
-rw-r--r--sound/oss/dmasound/dmasound_atari.c5
-rw-r--r--sound/oss/dmasound/dmasound_q40.c16
-rw-r--r--sound/pci/Kconfig4
-rw-r--r--sound/pci/hda/hda_beep.c1
-rw-r--r--sound/pci/hda/hda_codec.c111
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_intel.c6
-rw-r--r--sound/pci/hda/hda_local.h3
-rw-r--r--sound/pci/hda/hda_proc.c3
-rw-r--r--sound/pci/hda/patch_analog.c5
-rw-r--r--sound/pci/hda/patch_conexant.c124
-rw-r--r--sound/pci/hda/patch_nvhdmi.c4
-rw-r--r--sound/pci/hda/patch_realtek.c26
-rw-r--r--sound/pci/hda/patch_sigmatel.c213
-rw-r--r--sound/pci/ice1712/ice1724.c2
-rw-r--r--sound/pci/intel8x0.c2
-rw-r--r--sound/pci/oxygen/virtuoso.c20
-rw-r--r--sound/ppc/snd_ps3.c4
-rw-r--r--sound/soc/atmel/atmel-pcm.c2
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.c2
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.h2
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c4
-rw-r--r--sound/soc/au1x/dbdma2.c2
-rw-r--r--sound/soc/codecs/Kconfig20
-rw-r--r--sound/soc/codecs/twl4030.c417
-rw-r--r--sound/soc/codecs/twl4030.h7
-rw-r--r--sound/soc/codecs/wm8350.c2
-rw-r--r--sound/soc/codecs/wm8753.c9
-rw-r--r--sound/soc/codecs/wm8990.c3
-rw-r--r--sound/soc/davinci/davinci-evm.c19
-rw-r--r--sound/soc/davinci/davinci-pcm.c2
-rw-r--r--sound/soc/davinci/davinci-sffsdr.c4
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c18
-rw-r--r--sound/soc/omap/Kconfig1
-rw-r--r--sound/soc/omap/omap-mcbsp.c4
-rw-r--r--sound/soc/omap/omap-pcm.c5
-rw-r--r--sound/soc/omap/omap3pandora.c13
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c4
-rw-r--r--sound/soc/soc-core.c120
-rw-r--r--sound/soc/soc-dapm.c140
-rw-r--r--sound/sparc/cs4231.c2
-rw-r--r--sound/usb/caiaq/caiaq-device.c6
-rw-r--r--sound/usb/caiaq/caiaq-device.h1
-rw-r--r--sound/usb/caiaq/caiaq-midi.c32
-rw-r--r--sound/usb/usbaudio.c8
-rw-r--r--sound/usb/usbmidi.c39
-rw-r--r--sound/usb/usbmixer.c5
-rw-r--r--sound/usb/usbquirks.h8
-rw-r--r--sound/usb/usx2y/us122l.c4
-rw-r--r--sound/usb/usx2y/usbusx2y.c6
55 files changed, 1054 insertions, 447 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index ef6539eea579..35afd0c33be5 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -321,10 +321,6 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
321{ 321{
322 int ret; 322 int ret;
323 323
324 ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL);
325 if (ret < 0)
326 goto err;
327
328 if (cpu_is_pxa25x() || cpu_is_pxa27x()) { 324 if (cpu_is_pxa25x() || cpu_is_pxa27x()) {
329 pxa_gpio_mode(GPIO31_SYNC_AC97_MD); 325 pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
330 pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); 326 pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
@@ -339,7 +335,7 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
339 if (IS_ERR(ac97conf_clk)) { 335 if (IS_ERR(ac97conf_clk)) {
340 ret = PTR_ERR(ac97conf_clk); 336 ret = PTR_ERR(ac97conf_clk);
341 ac97conf_clk = NULL; 337 ac97conf_clk = NULL;
342 goto err_irq; 338 goto err_conf;
343 } 339 }
344 } 340 }
345 341
@@ -347,19 +343,30 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
347 if (IS_ERR(ac97_clk)) { 343 if (IS_ERR(ac97_clk)) {
348 ret = PTR_ERR(ac97_clk); 344 ret = PTR_ERR(ac97_clk);
349 ac97_clk = NULL; 345 ac97_clk = NULL;
350 goto err_irq; 346 goto err_clk;
351 } 347 }
352 348
353 return clk_enable(ac97_clk); 349 ret = clk_enable(ac97_clk);
350 if (ret)
351 goto err_clk2;
352
353 ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, IRQF_DISABLED, "AC97", NULL);
354 if (ret < 0)
355 goto err_irq;
356
357 return 0;
354 358
355err_irq: 359err_irq:
356 GCR |= GCR_ACLINK_OFF; 360 GCR |= GCR_ACLINK_OFF;
361err_clk2:
362 clk_put(ac97_clk);
363 ac97_clk = NULL;
364err_clk:
357 if (ac97conf_clk) { 365 if (ac97conf_clk) {
358 clk_put(ac97conf_clk); 366 clk_put(ac97conf_clk);
359 ac97conf_clk = NULL; 367 ac97conf_clk = NULL;
360 } 368 }
361 free_irq(IRQ_AC97, NULL); 369err_conf:
362err:
363 return ret; 370 return ret;
364} 371}
365EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); 372EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index e17836680f49..0a1798eafb0b 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1767,7 +1767,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
1767 AFMT_S8 | AFMT_U16_LE | 1767 AFMT_S8 | AFMT_U16_LE |
1768 AFMT_U16_BE | 1768 AFMT_U16_BE |
1769 AFMT_S32_LE | AFMT_S32_BE | 1769 AFMT_S32_LE | AFMT_S32_BE |
1770 AFMT_S24_LE | AFMT_S24_LE | 1770 AFMT_S24_LE | AFMT_S24_BE |
1771 AFMT_S24_PACKED; 1771 AFMT_S24_PACKED;
1772 params = kmalloc(sizeof(*params), GFP_KERNEL); 1772 params = kmalloc(sizeof(*params), GFP_KERNEL);
1773 if (!params) 1773 if (!params)
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 44a69bb8d4f0..7872a02f6ca9 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -152,6 +152,10 @@ static int __snd_open(struct inode *inode, struct file *file)
152 } 152 }
153 old_fops = file->f_op; 153 old_fops = file->f_op;
154 file->f_op = fops_get(mptr->f_ops); 154 file->f_op = fops_get(mptr->f_ops);
155 if (file->f_op == NULL) {
156 file->f_op = old_fops;
157 return -ENODEV;
158 }
155 if (file->f_op->open) 159 if (file->f_op->open)
156 err = file->f_op->open(inode, file); 160 err = file->f_op->open(inode, file);
157 if (err) { 161 if (err) {
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 549b4eba1496..9d98a6658ac9 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -84,7 +84,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
84 * Linux Video interface 84 * Linux Video interface
85 */ 85 */
86 86
87static int snd_tea575x_ioctl(struct inode *inode, struct file *file, 87static long snd_tea575x_ioctl(struct file *file,
88 unsigned int cmd, unsigned long data) 88 unsigned int cmd, unsigned long data)
89{ 89{
90 struct snd_tea575x *tea = video_drvdata(file); 90 struct snd_tea575x *tea = video_drvdata(file);
@@ -174,14 +174,14 @@ static void snd_tea575x_release(struct video_device *vfd)
174{ 174{
175} 175}
176 176
177static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) 177static int snd_tea575x_exclusive_open(struct file *file)
178{ 178{
179 struct snd_tea575x *tea = video_drvdata(file); 179 struct snd_tea575x *tea = video_drvdata(file);
180 180
181 return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; 181 return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0;
182} 182}
183 183
184static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) 184static int snd_tea575x_exclusive_release(struct file *file)
185{ 185{
186 struct snd_tea575x *tea = video_drvdata(file); 186 struct snd_tea575x *tea = video_drvdata(file);
187 187
diff --git a/sound/oss/aedsp16.c b/sound/oss/aedsp16.c
index a0274f3dac08..3ee9900ffd7b 100644
--- a/sound/oss/aedsp16.c
+++ b/sound/oss/aedsp16.c
@@ -157,7 +157,7 @@
157 157
158 Started Fri Mar 17 16:13:18 MET 1995 158 Started Fri Mar 17 16:13:18 MET 1995
159 159
160 v0.1 (ALPHA, was an user-level program called AudioExcelDSP16.c) 160 v0.1 (ALPHA, was a user-level program called AudioExcelDSP16.c)
161 - Initial code. 161 - Initial code.
162 v0.2 (ALPHA) 162 v0.2 (ALPHA)
163 - Cleanups. 163 - Cleanups.
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c
index 4d45bd63718b..57d9f154c88b 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -851,8 +851,9 @@ static int __init AtaIrqInit(void)
851 mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ 851 mfp.tim_dt_a = 1; /* Cause interrupt after first event. */
852 mfp.tim_ct_a = 8; /* Turn on event counting. */ 852 mfp.tim_ct_a = 8; /* Turn on event counting. */
853 /* Register interrupt handler. */ 853 /* Register interrupt handler. */
854 request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", 854 if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound",
855 AtaInterrupt); 855 AtaInterrupt))
856 return 0;
856 mfp.int_en_a |= 0x20; /* Turn interrupt on. */ 857 mfp.int_en_a |= 0x20; /* Turn interrupt on. */
857 mfp.int_mk_a |= 0x20; 858 mfp.int_mk_a |= 0x20;
858 return 1; 859 return 1;
diff --git a/sound/oss/dmasound/dmasound_q40.c b/sound/oss/dmasound/dmasound_q40.c
index 1855b14d90c3..99bcb21c2281 100644
--- a/sound/oss/dmasound/dmasound_q40.c
+++ b/sound/oss/dmasound/dmasound_q40.c
@@ -371,8 +371,9 @@ static void Q40Free(void *ptr, unsigned int size)
371static int __init Q40IrqInit(void) 371static int __init Q40IrqInit(void)
372{ 372{
373 /* Register interrupt handler. */ 373 /* Register interrupt handler. */
374 request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, 374 if (request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0,
375 "DMA sound", Q40Interrupt); 375 "DMA sound", Q40Interrupt))
376 return 0;
376 377
377 return(1); 378 return(1);
378} 379}
@@ -401,6 +402,7 @@ static void Q40PlayNextFrame(int index)
401 u_char *start; 402 u_char *start;
402 u_long size; 403 u_long size;
403 u_char speed; 404 u_char speed;
405 int error;
404 406
405 /* used by Q40Play() if all doubts whether there really is something 407 /* used by Q40Play() if all doubts whether there really is something
406 * to be played are already wiped out. 408 * to be played are already wiped out.
@@ -419,11 +421,13 @@ static void Q40PlayNextFrame(int index)
419 master_outb( 0,SAMPLE_ENABLE_REG); 421 master_outb( 0,SAMPLE_ENABLE_REG);
420 free_irq(Q40_IRQ_SAMPLE, Q40Interrupt); 422 free_irq(Q40_IRQ_SAMPLE, Q40Interrupt);
421 if (dmasound.soft.stereo) 423 if (dmasound.soft.stereo)
422 request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, 424 error = request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0,
423 "Q40 sound", Q40Interrupt); 425 "Q40 sound", Q40Interrupt);
424 else 426 else
425 request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0, 427 error = request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0,
426 "Q40 sound", Q40Interrupt); 428 "Q40 sound", Q40Interrupt);
429 if (error && printk_ratelimit())
430 pr_err("Couldn't register sound interrupt\n");
427 431
428 master_outb( speed, SAMPLE_RATE_REG); 432 master_outb( speed, SAMPLE_RATE_REG);
429 master_outb( 1,SAMPLE_CLEAR_REG); 433 master_outb( 1,SAMPLE_CLEAR_REG);
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 6e3a1848447c..82b9bddcdcd6 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -744,8 +744,8 @@ config SND_VIRTUOSO
744 select SND_OXYGEN_LIB 744 select SND_OXYGEN_LIB
745 help 745 help
746 Say Y here to include support for sound cards based on the 746 Say Y here to include support for sound cards based on the
747 Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X and 747 Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2 and D2X.
748 HDAV1.3 (Deluxe). 748 Support for the HDAV1.3 (Deluxe) is very experimental.
749 749
750 To compile this driver as a module, choose M here: the module 750 To compile this driver as a module, choose M here: the module
751 will be called snd-virtuoso. 751 will be called snd-virtuoso.
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index e00421c0d8ba..960fd7970384 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -135,7 +135,6 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
135 struct hda_beep *beep = codec->beep; 135 struct hda_beep *beep = codec->beep;
136 if (beep) { 136 if (beep) {
137 cancel_work_sync(&beep->beep_work); 137 cancel_work_sync(&beep->beep_work);
138 flush_scheduled_work();
139 138
140 input_unregister_device(beep->dev); 139 input_unregister_device(beep->dev);
141 kfree(beep); 140 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e16cf63821ae..b7bba7dc7cf1 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -373,7 +373,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
373 unsol->queue[wp] = res; 373 unsol->queue[wp] = res;
374 unsol->queue[wp + 1] = res_ex; 374 unsol->queue[wp + 1] = res_ex;
375 375
376 schedule_work(&unsol->work); 376 queue_work(bus->workq, &unsol->work);
377 377
378 return 0; 378 return 0;
379} 379}
@@ -437,15 +437,17 @@ static int snd_hda_bus_free(struct hda_bus *bus)
437 437
438 if (!bus) 438 if (!bus)
439 return 0; 439 return 0;
440 if (bus->unsol) { 440 if (bus->workq)
441 flush_scheduled_work(); 441 flush_workqueue(bus->workq);
442 if (bus->unsol)
442 kfree(bus->unsol); 443 kfree(bus->unsol);
443 }
444 list_for_each_entry_safe(codec, n, &bus->codec_list, list) { 444 list_for_each_entry_safe(codec, n, &bus->codec_list, list) {
445 snd_hda_codec_free(codec); 445 snd_hda_codec_free(codec);
446 } 446 }
447 if (bus->ops.private_free) 447 if (bus->ops.private_free)
448 bus->ops.private_free(bus); 448 bus->ops.private_free(bus);
449 if (bus->workq)
450 destroy_workqueue(bus->workq);
449 kfree(bus); 451 kfree(bus);
450 return 0; 452 return 0;
451} 453}
@@ -485,6 +487,7 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
485{ 487{
486 struct hda_bus *bus; 488 struct hda_bus *bus;
487 int err; 489 int err;
490 char qname[8];
488 static struct snd_device_ops dev_ops = { 491 static struct snd_device_ops dev_ops = {
489 .dev_register = snd_hda_bus_dev_register, 492 .dev_register = snd_hda_bus_dev_register,
490 .dev_free = snd_hda_bus_dev_free, 493 .dev_free = snd_hda_bus_dev_free,
@@ -514,6 +517,14 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
514 mutex_init(&bus->cmd_mutex); 517 mutex_init(&bus->cmd_mutex);
515 INIT_LIST_HEAD(&bus->codec_list); 518 INIT_LIST_HEAD(&bus->codec_list);
516 519
520 snprintf(qname, sizeof(qname), "hda%d", card->number);
521 bus->workq = create_workqueue(qname);
522 if (!bus->workq) {
523 snd_printk(KERN_ERR "cannot create workqueue %s\n", qname);
524 kfree(bus);
525 return -ENOMEM;
526 }
527
517 err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops); 528 err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops);
518 if (err < 0) { 529 if (err < 0) {
519 snd_hda_bus_free(bus); 530 snd_hda_bus_free(bus);
@@ -684,7 +695,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
684 return; 695 return;
685#ifdef CONFIG_SND_HDA_POWER_SAVE 696#ifdef CONFIG_SND_HDA_POWER_SAVE
686 cancel_delayed_work(&codec->power_work); 697 cancel_delayed_work(&codec->power_work);
687 flush_scheduled_work(); 698 flush_workqueue(codec->bus->workq);
688#endif 699#endif
689 list_del(&codec->list); 700 list_del(&codec->list);
690 snd_array_free(&codec->mixers); 701 snd_array_free(&codec->mixers);
@@ -735,6 +746,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr
735 codec->bus = bus; 746 codec->bus = bus;
736 codec->addr = codec_addr; 747 codec->addr = codec_addr;
737 mutex_init(&codec->spdif_mutex); 748 mutex_init(&codec->spdif_mutex);
749 mutex_init(&codec->control_mutex);
738 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); 750 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info));
739 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); 751 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));
740 snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); 752 snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32);
@@ -1272,7 +1284,7 @@ void snd_hda_codec_reset(struct hda_codec *codec)
1272 1284
1273#ifdef CONFIG_SND_HDA_POWER_SAVE 1285#ifdef CONFIG_SND_HDA_POWER_SAVE
1274 cancel_delayed_work(&codec->power_work); 1286 cancel_delayed_work(&codec->power_work);
1275 flush_scheduled_work(); 1287 flush_workqueue(codec->bus->workq);
1276#endif 1288#endif
1277 snd_hda_ctls_clear(codec); 1289 snd_hda_ctls_clear(codec);
1278 /* relase PCMs */ 1290 /* relase PCMs */
@@ -1418,12 +1430,12 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol,
1418 unsigned long pval; 1430 unsigned long pval;
1419 int err; 1431 int err;
1420 1432
1421 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1433 mutex_lock(&codec->control_mutex);
1422 pval = kcontrol->private_value; 1434 pval = kcontrol->private_value;
1423 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ 1435 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */
1424 err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 1436 err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol);
1425 kcontrol->private_value = pval; 1437 kcontrol->private_value = pval;
1426 mutex_unlock(&codec->spdif_mutex); 1438 mutex_unlock(&codec->control_mutex);
1427 return err; 1439 return err;
1428} 1440}
1429EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get); 1441EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get);
@@ -1435,7 +1447,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
1435 unsigned long pval; 1447 unsigned long pval;
1436 int i, indices, err = 0, change = 0; 1448 int i, indices, err = 0, change = 0;
1437 1449
1438 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1450 mutex_lock(&codec->control_mutex);
1439 pval = kcontrol->private_value; 1451 pval = kcontrol->private_value;
1440 indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; 1452 indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT;
1441 for (i = 0; i < indices; i++) { 1453 for (i = 0; i < indices; i++) {
@@ -1447,7 +1459,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
1447 change |= err; 1459 change |= err;
1448 } 1460 }
1449 kcontrol->private_value = pval; 1461 kcontrol->private_value = pval;
1450 mutex_unlock(&codec->spdif_mutex); 1462 mutex_unlock(&codec->control_mutex);
1451 return err < 0 ? err : change; 1463 return err < 0 ? err : change;
1452} 1464}
1453EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put); 1465EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put);
@@ -1462,12 +1474,12 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol,
1462 struct hda_bind_ctls *c; 1474 struct hda_bind_ctls *c;
1463 int err; 1475 int err;
1464 1476
1465 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1477 mutex_lock(&codec->control_mutex);
1466 c = (struct hda_bind_ctls *)kcontrol->private_value; 1478 c = (struct hda_bind_ctls *)kcontrol->private_value;
1467 kcontrol->private_value = *c->values; 1479 kcontrol->private_value = *c->values;
1468 err = c->ops->info(kcontrol, uinfo); 1480 err = c->ops->info(kcontrol, uinfo);
1469 kcontrol->private_value = (long)c; 1481 kcontrol->private_value = (long)c;
1470 mutex_unlock(&codec->spdif_mutex); 1482 mutex_unlock(&codec->control_mutex);
1471 return err; 1483 return err;
1472} 1484}
1473EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info); 1485EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info);
@@ -1479,12 +1491,12 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
1479 struct hda_bind_ctls *c; 1491 struct hda_bind_ctls *c;
1480 int err; 1492 int err;
1481 1493
1482 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1494 mutex_lock(&codec->control_mutex);
1483 c = (struct hda_bind_ctls *)kcontrol->private_value; 1495 c = (struct hda_bind_ctls *)kcontrol->private_value;
1484 kcontrol->private_value = *c->values; 1496 kcontrol->private_value = *c->values;
1485 err = c->ops->get(kcontrol, ucontrol); 1497 err = c->ops->get(kcontrol, ucontrol);
1486 kcontrol->private_value = (long)c; 1498 kcontrol->private_value = (long)c;
1487 mutex_unlock(&codec->spdif_mutex); 1499 mutex_unlock(&codec->control_mutex);
1488 return err; 1500 return err;
1489} 1501}
1490EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get); 1502EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get);
@@ -1497,7 +1509,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1497 unsigned long *vals; 1509 unsigned long *vals;
1498 int err = 0, change = 0; 1510 int err = 0, change = 0;
1499 1511
1500 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1512 mutex_lock(&codec->control_mutex);
1501 c = (struct hda_bind_ctls *)kcontrol->private_value; 1513 c = (struct hda_bind_ctls *)kcontrol->private_value;
1502 for (vals = c->values; *vals; vals++) { 1514 for (vals = c->values; *vals; vals++) {
1503 kcontrol->private_value = *vals; 1515 kcontrol->private_value = *vals;
@@ -1507,7 +1519,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1507 change |= err; 1519 change |= err;
1508 } 1520 }
1509 kcontrol->private_value = (long)c; 1521 kcontrol->private_value = (long)c;
1510 mutex_unlock(&codec->spdif_mutex); 1522 mutex_unlock(&codec->control_mutex);
1511 return err < 0 ? err : change; 1523 return err < 0 ? err : change;
1512} 1524}
1513EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put); 1525EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put);
@@ -1519,12 +1531,12 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1519 struct hda_bind_ctls *c; 1531 struct hda_bind_ctls *c;
1520 int err; 1532 int err;
1521 1533
1522 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1534 mutex_lock(&codec->control_mutex);
1523 c = (struct hda_bind_ctls *)kcontrol->private_value; 1535 c = (struct hda_bind_ctls *)kcontrol->private_value;
1524 kcontrol->private_value = *c->values; 1536 kcontrol->private_value = *c->values;
1525 err = c->ops->tlv(kcontrol, op_flag, size, tlv); 1537 err = c->ops->tlv(kcontrol, op_flag, size, tlv);
1526 kcontrol->private_value = (long)c; 1538 kcontrol->private_value = (long)c;
1527 mutex_unlock(&codec->spdif_mutex); 1539 mutex_unlock(&codec->control_mutex);
1528 return err; 1540 return err;
1529} 1541}
1530EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv); 1542EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv);
@@ -2712,6 +2724,67 @@ int snd_hda_check_board_config(struct hda_codec *codec,
2712EXPORT_SYMBOL_HDA(snd_hda_check_board_config); 2724EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
2713 2725
2714/** 2726/**
2727 * snd_hda_check_board_codec_sid_config - compare the current codec
2728 subsystem ID with the
2729 config table
2730
2731 This is important for Gateway notebooks with SB450 HDA Audio
2732 where the vendor ID of the PCI device is:
2733 ATI Technologies Inc SB450 HDA Audio [1002:437b]
2734 and the vendor/subvendor are found only at the codec.
2735
2736 * @codec: the HDA codec
2737 * @num_configs: number of config enums
2738 * @models: array of model name strings
2739 * @tbl: configuration table, terminated by null entries
2740 *
2741 * Compares the modelname or PCI subsystem id of the current codec with the
2742 * given configuration table. If a matching entry is found, returns its
2743 * config value (supposed to be 0 or positive).
2744 *
2745 * If no entries are matching, the function returns a negative value.
2746 */
2747int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
2748 int num_configs, const char **models,
2749 const struct snd_pci_quirk *tbl)
2750{
2751 const struct snd_pci_quirk *q;
2752
2753 /* Search for codec ID */
2754 for (q = tbl; q->subvendor; q++) {
2755 unsigned long vendorid = (q->subdevice) | (q->subvendor << 16);
2756
2757 if (vendorid == codec->subsystem_id)
2758 break;
2759 }
2760
2761 if (!q->subvendor)
2762 return -1;
2763
2764 tbl = q;
2765
2766 if (tbl->value >= 0 && tbl->value < num_configs) {
2767#ifdef CONFIG_SND_DEBUG_DETECT
2768 char tmp[10];
2769 const char *model = NULL;
2770 if (models)
2771 model = models[tbl->value];
2772 if (!model) {
2773 sprintf(tmp, "#%d", tbl->value);
2774 model = tmp;
2775 }
2776 snd_printdd(KERN_INFO "hda_codec: model '%s' is selected "
2777 "for config %x:%x (%s)\n",
2778 model, tbl->subvendor, tbl->subdevice,
2779 (tbl->name ? tbl->name : "Unknown device"));
2780#endif
2781 return tbl->value;
2782 }
2783 return -1;
2784}
2785EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config);
2786
2787/**
2715 * snd_hda_add_new_ctls - create controls from the array 2788 * snd_hda_add_new_ctls - create controls from the array
2716 * @codec: the HDA codec 2789 * @codec: the HDA codec
2717 * @knew: the array of struct snd_kcontrol_new 2790 * @knew: the array of struct snd_kcontrol_new
@@ -2803,7 +2876,7 @@ void snd_hda_power_down(struct hda_codec *codec)
2803 return; 2876 return;
2804 if (power_save(codec)) { 2877 if (power_save(codec)) {
2805 codec->power_transition = 1; /* avoid reentrance */ 2878 codec->power_transition = 1; /* avoid reentrance */
2806 schedule_delayed_work(&codec->power_work, 2879 queue_delayed_work(codec->bus->workq, &codec->power_work,
2807 msecs_to_jiffies(power_save(codec) * 1000)); 2880 msecs_to_jiffies(power_save(codec) * 1000));
2808 } 2881 }
2809} 2882}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 729fc7642d7f..5810ef588402 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -614,6 +614,7 @@ struct hda_bus {
614 614
615 /* unsolicited event queue */ 615 /* unsolicited event queue */
616 struct hda_bus_unsolicited *unsol; 616 struct hda_bus_unsolicited *unsol;
617 struct workqueue_struct *workq; /* common workqueue for codecs */
617 618
618 /* assigned PCMs */ 619 /* assigned PCMs */
619 DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES); 620 DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES);
@@ -771,6 +772,7 @@ struct hda_codec {
771 struct hda_cache_rec cmd_cache; /* cache for other commands */ 772 struct hda_cache_rec cmd_cache; /* cache for other commands */
772 773
773 struct mutex spdif_mutex; 774 struct mutex spdif_mutex;
775 struct mutex control_mutex;
774 unsigned int spdif_status; /* IEC958 status bits */ 776 unsigned int spdif_status; /* IEC958 status bits */
775 unsigned short spdif_ctls; /* SPDIF control bits */ 777 unsigned short spdif_ctls; /* SPDIF control bits */
776 unsigned int spdif_in_enable; /* SPDIF input enable? */ 778 unsigned int spdif_in_enable; /* SPDIF input enable? */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f04de115ee11..11e791b965f6 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -996,10 +996,11 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id)
996 spin_unlock(&chip->reg_lock); 996 spin_unlock(&chip->reg_lock);
997 snd_pcm_period_elapsed(azx_dev->substream); 997 snd_pcm_period_elapsed(azx_dev->substream);
998 spin_lock(&chip->reg_lock); 998 spin_lock(&chip->reg_lock);
999 } else { 999 } else if (chip->bus && chip->bus->workq) {
1000 /* bogus IRQ, process it later */ 1000 /* bogus IRQ, process it later */
1001 azx_dev->irq_pending = 1; 1001 azx_dev->irq_pending = 1;
1002 schedule_work(&chip->irq_pending_work); 1002 queue_work(chip->bus->workq,
1003 &chip->irq_pending_work);
1003 } 1004 }
1004 } 1005 }
1005 } 1006 }
@@ -1741,7 +1742,6 @@ static void azx_clear_irq_pending(struct azx *chip)
1741 for (i = 0; i < chip->num_streams; i++) 1742 for (i = 0; i < chip->num_streams; i++)
1742 chip->azx_dev[i].irq_pending = 0; 1743 chip->azx_dev[i].irq_pending = 0;
1743 spin_unlock_irq(&chip->reg_lock); 1744 spin_unlock_irq(&chip->reg_lock);
1744 flush_scheduled_work();
1745} 1745}
1746 1746
1747static struct snd_pcm_ops azx_pcm_ops = { 1747static struct snd_pcm_ops azx_pcm_ops = {
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 6f2fe0f9fdd8..1dd8716c387f 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -296,6 +296,9 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen);
296int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, 296int snd_hda_check_board_config(struct hda_codec *codec, int num_configs,
297 const char **modelnames, 297 const char **modelnames,
298 const struct snd_pci_quirk *pci_list); 298 const struct snd_pci_quirk *pci_list);
299int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
300 int num_configs, const char **models,
301 const struct snd_pci_quirk *tbl);
299int snd_hda_add_new_ctls(struct hda_codec *codec, 302int snd_hda_add_new_ctls(struct hda_codec *codec,
300 struct snd_kcontrol_new *knew); 303 struct snd_kcontrol_new *knew);
301 304
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 7ca66d654148..144b85276d5a 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -399,7 +399,8 @@ static void print_conn_list(struct snd_info_buffer *buffer,
399{ 399{
400 int c, curr = -1; 400 int c, curr = -1;
401 401
402 if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) 402 if (conn_len > 1 && wid_type != AC_WID_AUD_MIX &&
403 wid_type != AC_WID_VOL_KNB)
403 curr = snd_hda_codec_read(codec, nid, 0, 404 curr = snd_hda_codec_read(codec, nid, 0,
404 AC_VERB_GET_CONNECT_SEL, 0); 405 AC_VERB_GET_CONNECT_SEL, 0);
405 snd_iprintf(buffer, " Connection: %d\n", conn_len); 406 snd_iprintf(buffer, " Connection: %d\n", conn_len);
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 26247cfe749d..2e7371ec2e23 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -3900,6 +3900,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = {
3900 3900
3901static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 3901static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
3902 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), 3902 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
3903 SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP),
3903 SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), 3904 SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE),
3904 SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), 3905 SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP),
3905 SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), 3906 SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP),
@@ -4262,13 +4263,13 @@ static int patch_ad1882(struct hda_codec *codec)
4262 spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids); 4263 spec->num_adc_nids = ARRAY_SIZE(ad1882_adc_nids);
4263 spec->adc_nids = ad1882_adc_nids; 4264 spec->adc_nids = ad1882_adc_nids;
4264 spec->capsrc_nids = ad1882_capsrc_nids; 4265 spec->capsrc_nids = ad1882_capsrc_nids;
4265 if (codec->vendor_id == 0x11d1882) 4266 if (codec->vendor_id == 0x11d41882)
4266 spec->input_mux = &ad1882_capture_source; 4267 spec->input_mux = &ad1882_capture_source;
4267 else 4268 else
4268 spec->input_mux = &ad1882a_capture_source; 4269 spec->input_mux = &ad1882a_capture_source;
4269 spec->num_mixers = 2; 4270 spec->num_mixers = 2;
4270 spec->mixers[0] = ad1882_base_mixers; 4271 spec->mixers[0] = ad1882_base_mixers;
4271 if (codec->vendor_id == 0x11d1882) 4272 if (codec->vendor_id == 0x11d41882)
4272 spec->mixers[1] = ad1882_loopback_mixers; 4273 spec->mixers[1] = ad1882_loopback_mixers;
4273 else 4274 else
4274 spec->mixers[1] = ad1882a_loopback_mixers; 4275 spec->mixers[1] = ad1882a_loopback_mixers;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b20e1cede00b..0177ef8f4c9e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -25,6 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <sound/core.h> 27#include <sound/core.h>
28#include <sound/jack.h>
29
28#include "hda_codec.h" 30#include "hda_codec.h"
29#include "hda_local.h" 31#include "hda_local.h"
30 32
@@ -37,7 +39,20 @@
37#define CONEXANT_HP_EVENT 0x37 39#define CONEXANT_HP_EVENT 0x37
38#define CONEXANT_MIC_EVENT 0x38 40#define CONEXANT_MIC_EVENT 0x38
39 41
42/* Conexant 5051 specific */
43
44#define CXT5051_SPDIF_OUT 0x1C
45#define CXT5051_PORTB_EVENT 0x38
46#define CXT5051_PORTC_EVENT 0x39
47
40 48
49struct conexant_jack {
50
51 hda_nid_t nid;
52 int type;
53 struct snd_jack *jack;
54
55};
41 56
42struct conexant_spec { 57struct conexant_spec {
43 58
@@ -83,6 +98,9 @@ struct conexant_spec {
83 98
84 unsigned int spdif_route; 99 unsigned int spdif_route;
85 100
101 /* jack detection */
102 struct snd_array jacks;
103
86 /* dynamic controls, init_verbs and input_mux */ 104 /* dynamic controls, init_verbs and input_mux */
87 struct auto_pin_cfg autocfg; 105 struct auto_pin_cfg autocfg;
88 struct hda_input_mux private_imux; 106 struct hda_input_mux private_imux;
@@ -329,6 +347,95 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
329 &spec->cur_mux[adc_idx]); 347 &spec->cur_mux[adc_idx]);
330} 348}
331 349
350#ifdef CONFIG_SND_JACK
351static int conexant_add_jack(struct hda_codec *codec,
352 hda_nid_t nid, int type)
353{
354 struct conexant_spec *spec;
355 struct conexant_jack *jack;
356 const char *name;
357
358 spec = codec->spec;
359 snd_array_init(&spec->jacks, sizeof(*jack), 32);
360 jack = snd_array_new(&spec->jacks);
361 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
362
363 if (!jack)
364 return -ENOMEM;
365
366 jack->nid = nid;
367 jack->type = type;
368
369 return snd_jack_new(codec->bus->card, name, type, &jack->jack);
370}
371
372static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
373{
374 struct conexant_spec *spec = codec->spec;
375 struct conexant_jack *jacks = spec->jacks.list;
376
377 if (jacks) {
378 int i;
379 for (i = 0; i < spec->jacks.used; i++) {
380 if (jacks->nid == nid) {
381 unsigned int present;
382 present = snd_hda_codec_read(codec, nid, 0,
383 AC_VERB_GET_PIN_SENSE, 0) &
384 AC_PINSENSE_PRESENCE;
385
386 present = (present) ? jacks->type : 0 ;
387
388 snd_jack_report(jacks->jack,
389 present);
390 }
391 jacks++;
392 }
393 }
394}
395
396static int conexant_init_jacks(struct hda_codec *codec)
397{
398 struct conexant_spec *spec = codec->spec;
399 int i;
400
401 for (i = 0; i < spec->num_init_verbs; i++) {
402 const struct hda_verb *hv;
403
404 hv = spec->init_verbs[i];
405 while (hv->nid) {
406 int err = 0;
407 switch (hv->param ^ AC_USRSP_EN) {
408 case CONEXANT_HP_EVENT:
409 err = conexant_add_jack(codec, hv->nid,
410 SND_JACK_HEADPHONE);
411 conexant_report_jack(codec, hv->nid);
412 break;
413 case CXT5051_PORTC_EVENT:
414 case CONEXANT_MIC_EVENT:
415 err = conexant_add_jack(codec, hv->nid,
416 SND_JACK_MICROPHONE);
417 conexant_report_jack(codec, hv->nid);
418 break;
419 }
420 if (err < 0)
421 return err;
422 ++hv;
423 }
424 }
425 return 0;
426
427}
428#else
429static inline void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
430{
431}
432
433static inline int conexant_init_jacks(struct hda_codec *codec)
434{
435 return 0;
436}
437#endif
438
332static int conexant_init(struct hda_codec *codec) 439static int conexant_init(struct hda_codec *codec)
333{ 440{
334 struct conexant_spec *spec = codec->spec; 441 struct conexant_spec *spec = codec->spec;
@@ -341,6 +448,16 @@ static int conexant_init(struct hda_codec *codec)
341 448
342static void conexant_free(struct hda_codec *codec) 449static void conexant_free(struct hda_codec *codec)
343{ 450{
451#ifdef CONFIG_SND_JACK
452 struct conexant_spec *spec = codec->spec;
453 if (spec->jacks.list) {
454 struct conexant_jack *jacks = spec->jacks.list;
455 int i;
456 for (i = 0; i < spec->jacks.used; i++)
457 snd_device_free(codec->bus->card, &jacks[i].jack);
458 snd_array_free(&spec->jacks);
459 }
460#endif
344 kfree(codec->spec); 461 kfree(codec->spec);
345} 462}
346 463
@@ -1458,6 +1575,7 @@ static struct snd_pci_quirk cxt5047_cfg_tbl[] = {
1458 SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), 1575 SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP),
1459 SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), 1576 SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP),
1460 SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), 1577 SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP),
1578 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP),
1461 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), 1579 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD),
1462 {} 1580 {}
1463}; 1581};
@@ -1526,9 +1644,6 @@ static int patch_cxt5047(struct hda_codec *codec)
1526/* Conexant 5051 specific */ 1644/* Conexant 5051 specific */
1527static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; 1645static hda_nid_t cxt5051_dac_nids[1] = { 0x10 };
1528static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; 1646static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 };
1529#define CXT5051_SPDIF_OUT 0x1C
1530#define CXT5051_PORTB_EVENT 0x38
1531#define CXT5051_PORTC_EVENT 0x39
1532 1647
1533static struct hda_channel_mode cxt5051_modes[1] = { 1648static struct hda_channel_mode cxt5051_modes[1] = {
1534 { 2, NULL }, 1649 { 2, NULL },
@@ -1608,6 +1723,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec)
1608static void cxt5051_hp_unsol_event(struct hda_codec *codec, 1723static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1609 unsigned int res) 1724 unsigned int res)
1610{ 1725{
1726 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20;
1611 switch (res >> 26) { 1727 switch (res >> 26) {
1612 case CONEXANT_HP_EVENT: 1728 case CONEXANT_HP_EVENT:
1613 cxt5051_hp_automute(codec); 1729 cxt5051_hp_automute(codec);
@@ -1619,6 +1735,7 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1619 cxt5051_portc_automic(codec); 1735 cxt5051_portc_automic(codec);
1620 break; 1736 break;
1621 } 1737 }
1738 conexant_report_jack(codec, nid);
1622} 1739}
1623 1740
1624static struct snd_kcontrol_new cxt5051_mixers[] = { 1741static struct snd_kcontrol_new cxt5051_mixers[] = {
@@ -1693,6 +1810,7 @@ static struct hda_verb cxt5051_init_verbs[] = {
1693static int cxt5051_init(struct hda_codec *codec) 1810static int cxt5051_init(struct hda_codec *codec)
1694{ 1811{
1695 conexant_init(codec); 1812 conexant_init(codec);
1813 conexant_init_jacks(codec);
1696 if (codec->patch_ops.unsol_event) { 1814 if (codec->patch_ops.unsol_event) {
1697 cxt5051_hp_automute(codec); 1815 cxt5051_hp_automute(codec);
1698 cxt5051_portb_automic(codec); 1816 cxt5051_portb_automic(codec);
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index 0270fda0bda5..d57d8132a06e 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -160,14 +160,18 @@ static int patch_nvhdmi(struct hda_codec *codec)
160 */ 160 */
161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { 161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = {
162 { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, 162 { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi },
163 { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi },
163 { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi }, 164 { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi },
164 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi }, 165 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi },
166 { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi },
165 {} /* terminator */ 167 {} /* terminator */
166}; 168};
167 169
168MODULE_ALIAS("snd-hda-codec-id:10de0002"); 170MODULE_ALIAS("snd-hda-codec-id:10de0002");
171MODULE_ALIAS("snd-hda-codec-id:10de0006");
169MODULE_ALIAS("snd-hda-codec-id:10de0007"); 172MODULE_ALIAS("snd-hda-codec-id:10de0007");
170MODULE_ALIAS("snd-hda-codec-id:10de0067"); 173MODULE_ALIAS("snd-hda-codec-id:10de0067");
174MODULE_ALIAS("snd-hda-codec-id:10de8001");
171 175
172MODULE_LICENSE("GPL"); 176MODULE_LICENSE("GPL");
173MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec"); 177MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 0bd4e6bf354d..0040101f6150 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1502,11 +1502,11 @@ static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1502 struct alc_spec *spec = codec->spec; 1502 struct alc_spec *spec = codec->spec;
1503 int err; 1503 int err;
1504 1504
1505 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1505 mutex_lock(&codec->control_mutex);
1506 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, 1506 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1507 HDA_INPUT); 1507 HDA_INPUT);
1508 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); 1508 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1509 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1509 mutex_unlock(&codec->control_mutex);
1510 return err; 1510 return err;
1511} 1511}
1512 1512
@@ -1517,11 +1517,11 @@ static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1517 struct alc_spec *spec = codec->spec; 1517 struct alc_spec *spec = codec->spec;
1518 int err; 1518 int err;
1519 1519
1520 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1520 mutex_lock(&codec->control_mutex);
1521 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, 1521 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1522 HDA_INPUT); 1522 HDA_INPUT);
1523 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); 1523 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1524 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1524 mutex_unlock(&codec->control_mutex);
1525 return err; 1525 return err;
1526} 1526}
1527 1527
@@ -1537,11 +1537,11 @@ static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1537 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1537 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1538 int err; 1538 int err;
1539 1539
1540 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1540 mutex_lock(&codec->control_mutex);
1541 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], 1541 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1542 3, 0, HDA_INPUT); 1542 3, 0, HDA_INPUT);
1543 err = func(kcontrol, ucontrol); 1543 err = func(kcontrol, ucontrol);
1544 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1544 mutex_unlock(&codec->control_mutex);
1545 return err; 1545 return err;
1546} 1546}
1547 1547
@@ -7012,12 +7012,14 @@ static int patch_alc882(struct hda_codec *codec)
7012 break; 7012 break;
7013 case 0x106b1000: /* iMac 24 */ 7013 case 0x106b1000: /* iMac 24 */
7014 case 0x106b2800: /* AppleTV */ 7014 case 0x106b2800: /* AppleTV */
7015 case 0x106b3e00: /* iMac 24 Aluminium */
7015 board_config = ALC885_IMAC24; 7016 board_config = ALC885_IMAC24;
7016 break; 7017 break;
7017 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 7018 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7018 case 0x106b00a4: /* MacbookPro4,1 */ 7019 case 0x106b00a4: /* MacbookPro4,1 */
7019 case 0x106b2c00: /* Macbook Pro rev3 */ 7020 case 0x106b2c00: /* Macbook Pro rev3 */
7020 case 0x106b3600: /* Macbook 3.1 */ 7021 case 0x106b3600: /* Macbook 3.1 */
7022 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7021 board_config = ALC885_MBP3; 7023 board_config = ALC885_MBP3;
7022 break; 7024 break;
7023 default: 7025 default:
@@ -8461,18 +8463,24 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8461 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), 8463 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8462 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", 8464 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8463 ALC888_ACER_ASPIRE_4930G), 8465 ALC888_ACER_ASPIRE_4930G),
8466 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8467 ALC888_ACER_ASPIRE_4930G),
8468 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8469 ALC888_ACER_ASPIRE_4930G),
8464 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8470 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8465 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 8471 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8466 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 8472 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8467 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 8473 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8468 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8474 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8469 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8475 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8476 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8470 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), 8477 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8471 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8478 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8472 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), 8479 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8473 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), 8480 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8474 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 8481 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8475 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 8482 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8483 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8476 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 8484 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8477 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 8485 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8478 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), 8486 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
@@ -8521,6 +8529,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8521 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), 8529 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8522 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), 8530 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8523 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), 8531 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8532 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8533 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8524 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 8534 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8525 {} 8535 {}
8526}; 8536};
@@ -10567,6 +10577,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
10567 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10577 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10568 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10578 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10569 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 10579 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10580 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10570 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 10581 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10571 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 10582 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10572 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), 10583 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
@@ -11688,6 +11699,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
11688 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", 11699 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11689 ALC268_ACER_ASPIRE_ONE), 11700 ALC268_ACER_ASPIRE_ONE),
11690 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 11701 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11702 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
11691 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 11703 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11692 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 11704 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11693 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 11705 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
@@ -16638,9 +16650,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
16638 .patch = patch_alc882 }, /* should be patch_alc883() in future */ 16650 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16639 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 16651 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16640 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, 16652 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16641 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16642 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", 16653 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16643 .patch = patch_alc883 }, 16654 .patch = patch_alc883 },
16655 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16644 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16656 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16645 {} /* terminator */ 16657 {} /* terminator */
16646}; 16658};
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 35b83dc6e19e..38428e22428f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -55,7 +55,8 @@ enum {
55 STAC_9200_DELL_M25, 55 STAC_9200_DELL_M25,
56 STAC_9200_DELL_M26, 56 STAC_9200_DELL_M26,
57 STAC_9200_DELL_M27, 57 STAC_9200_DELL_M27,
58 STAC_9200_GATEWAY, 58 STAC_9200_M4,
59 STAC_9200_M4_2,
59 STAC_9200_PANASONIC, 60 STAC_9200_PANASONIC,
60 STAC_9200_MODELS 61 STAC_9200_MODELS
61}; 62};
@@ -80,6 +81,7 @@ enum {
80 81
81enum { 82enum {
82 STAC_92HD83XXX_REF, 83 STAC_92HD83XXX_REF,
84 STAC_92HD83XXX_PWR_REF,
83 STAC_92HD83XXX_MODELS 85 STAC_92HD83XXX_MODELS
84}; 86};
85 87
@@ -89,14 +91,19 @@ enum {
89 STAC_DELL_M4_2, 91 STAC_DELL_M4_2,
90 STAC_DELL_M4_3, 92 STAC_DELL_M4_3,
91 STAC_HP_M4, 93 STAC_HP_M4,
94 STAC_HP_DV5,
92 STAC_92HD71BXX_MODELS 95 STAC_92HD71BXX_MODELS
93}; 96};
94 97
95enum { 98enum {
96 STAC_925x_REF, 99 STAC_925x_REF,
100 STAC_M1,
101 STAC_M1_2,
102 STAC_M2,
97 STAC_M2_2, 103 STAC_M2_2,
98 STAC_MA6, 104 STAC_M3,
99 STAC_PA6, 105 STAC_M5,
106 STAC_M6,
100 STAC_925x_MODELS 107 STAC_925x_MODELS
101}; 108};
102 109
@@ -328,7 +335,11 @@ static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
328}; 335};
329 336
330static unsigned int stac92hd83xxx_pwr_mapping[4] = { 337static unsigned int stac92hd83xxx_pwr_mapping[4] = {
331 0x03, 0x0c, 0x10, 0x40, 338 0x03, 0x0c, 0x20, 0x40,
339};
340
341static hda_nid_t stac92hd83xxx_amp_nids[1] = {
342 0xc,
332}; 343};
333 344
334static hda_nid_t stac92hd71bxx_pwr_nids[3] = { 345static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
@@ -831,10 +842,6 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = {
831}; 842};
832 843
833static struct hda_verb stac92hd83xxx_core_init[] = { 844static struct hda_verb stac92hd83xxx_core_init[] = {
834 /* start of config #1 */
835 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3},
836
837 /* start of config #2 */
838 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, 845 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0},
839 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, 846 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0},
840 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, 847 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1},
@@ -875,6 +882,8 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = {
875static struct hda_verb stac925x_core_init[] = { 882static struct hda_verb stac925x_core_init[] = {
876 /* set dac0mux for dac converter */ 883 /* set dac0mux for dac converter */
877 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, 884 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
885 /* mute the master volume */
886 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
878 {} 887 {}
879}; 888};
880 889
@@ -1126,6 +1135,8 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
1126}; 1135};
1127 1136
1128static struct snd_kcontrol_new stac925x_mixer[] = { 1137static struct snd_kcontrol_new stac925x_mixer[] = {
1138 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),
1139 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
1129 STAC_INPUT_SOURCE(1), 1140 STAC_INPUT_SOURCE(1),
1130 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), 1141 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
1131 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), 1142 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT),
@@ -1334,7 +1345,16 @@ static unsigned int ref9200_pin_configs[8] = {
1334 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, 1345 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1335}; 1346};
1336 1347
1337/* 1348static unsigned int gateway9200_m4_pin_configs[8] = {
1349 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1350 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1351};
1352static unsigned int gateway9200_m4_2_pin_configs[8] = {
1353 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1354 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1355};
1356
1357/*
1338 STAC 9200 pin configs for 1358 STAC 9200 pin configs for
1339 102801A8 1359 102801A8
1340 102801DE 1360 102801DE
@@ -1464,6 +1484,8 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1464 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, 1484 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1465 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, 1485 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1466 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, 1486 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1487 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1488 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1467 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1489 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1468}; 1490};
1469 1491
@@ -1480,7 +1502,8 @@ static const char *stac9200_models[STAC_9200_MODELS] = {
1480 [STAC_9200_DELL_M25] = "dell-m25", 1502 [STAC_9200_DELL_M25] = "dell-m25",
1481 [STAC_9200_DELL_M26] = "dell-m26", 1503 [STAC_9200_DELL_M26] = "dell-m26",
1482 [STAC_9200_DELL_M27] = "dell-m27", 1504 [STAC_9200_DELL_M27] = "dell-m27",
1483 [STAC_9200_GATEWAY] = "gateway", 1505 [STAC_9200_M4] = "gateway-m4",
1506 [STAC_9200_M4_2] = "gateway-m4-2",
1484 [STAC_9200_PANASONIC] = "panasonic", 1507 [STAC_9200_PANASONIC] = "panasonic",
1485}; 1508};
1486 1509
@@ -1550,11 +1573,9 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1550 /* Panasonic */ 1573 /* Panasonic */
1551 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1574 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1552 /* Gateway machines needs EAPD to be set on resume */ 1575 /* Gateway machines needs EAPD to be set on resume */
1553 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), 1576 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1554 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", 1577 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1555 STAC_9200_GATEWAY), 1578 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1556 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1557 STAC_9200_GATEWAY),
1558 /* OQO Mobile */ 1579 /* OQO Mobile */
1559 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), 1580 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1560 {} /* terminator */ 1581 {} /* terminator */
@@ -1565,44 +1586,85 @@ static unsigned int ref925x_pin_configs[8] = {
1565 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, 1586 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1566}; 1587};
1567 1588
1568static unsigned int stac925x_MA6_pin_configs[8] = { 1589static unsigned int stac925xM1_pin_configs[8] = {
1569 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1590 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1570 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, 1591 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1571}; 1592};
1572 1593
1573static unsigned int stac925x_PA6_pin_configs[8] = { 1594static unsigned int stac925xM1_2_pin_configs[8] = {
1574 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1595 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1575 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, 1596 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1597};
1598
1599static unsigned int stac925xM2_pin_configs[8] = {
1600 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1601 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1576}; 1602};
1577 1603
1578static unsigned int stac925xM2_2_pin_configs[8] = { 1604static unsigned int stac925xM2_2_pin_configs[8] = {
1579 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, 1605 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1580 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, 1606 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1607};
1608
1609static unsigned int stac925xM3_pin_configs[8] = {
1610 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1611 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1612};
1613
1614static unsigned int stac925xM5_pin_configs[8] = {
1615 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1616 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1617};
1618
1619static unsigned int stac925xM6_pin_configs[8] = {
1620 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1621 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1581}; 1622};
1582 1623
1583static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 1624static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1584 [STAC_REF] = ref925x_pin_configs, 1625 [STAC_REF] = ref925x_pin_configs,
1626 [STAC_M1] = stac925xM1_pin_configs,
1627 [STAC_M1_2] = stac925xM1_2_pin_configs,
1628 [STAC_M2] = stac925xM2_pin_configs,
1585 [STAC_M2_2] = stac925xM2_2_pin_configs, 1629 [STAC_M2_2] = stac925xM2_2_pin_configs,
1586 [STAC_MA6] = stac925x_MA6_pin_configs, 1630 [STAC_M3] = stac925xM3_pin_configs,
1587 [STAC_PA6] = stac925x_PA6_pin_configs, 1631 [STAC_M5] = stac925xM5_pin_configs,
1632 [STAC_M6] = stac925xM6_pin_configs,
1588}; 1633};
1589 1634
1590static const char *stac925x_models[STAC_925x_MODELS] = { 1635static const char *stac925x_models[STAC_925x_MODELS] = {
1591 [STAC_REF] = "ref", 1636 [STAC_REF] = "ref",
1637 [STAC_M1] = "m1",
1638 [STAC_M1_2] = "m1-2",
1639 [STAC_M2] = "m2",
1592 [STAC_M2_2] = "m2-2", 1640 [STAC_M2_2] = "m2-2",
1593 [STAC_MA6] = "m6", 1641 [STAC_M3] = "m3",
1594 [STAC_PA6] = "pa6", 1642 [STAC_M5] = "m5",
1643 [STAC_M6] = "m6",
1644};
1645
1646static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1647 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1648 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1649 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1650 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1651 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1652 /* Not sure about the brand name for those */
1653 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1654 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1655 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1656 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1657 {} /* terminator */
1595}; 1658};
1596 1659
1597static struct snd_pci_quirk stac925x_cfg_tbl[] = { 1660static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1598 /* SigmaTel reference board */ 1661 /* SigmaTel reference board */
1599 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), 1662 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1600 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), 1663 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1601 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), 1664
1602 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), 1665 /* Default table for unknown ID */
1603 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), 1666 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1604 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), 1667
1605 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1606 {} /* terminator */ 1668 {} /* terminator */
1607}; 1669};
1608 1670
@@ -1673,16 +1735,18 @@ static unsigned int ref92hd83xxx_pin_configs[14] = {
1673 1735
1674static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { 1736static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1675 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, 1737 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1738 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1676}; 1739};
1677 1740
1678static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { 1741static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1679 [STAC_92HD83XXX_REF] = "ref", 1742 [STAC_92HD83XXX_REF] = "ref",
1743 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
1680}; 1744};
1681 1745
1682static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { 1746static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1683 /* SigmaTel reference board */ 1747 /* SigmaTel reference board */
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1748 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1685 "DFI LanParty", STAC_92HD71BXX_REF), 1749 "DFI LanParty", STAC_92HD83XXX_REF),
1686 {} /* terminator */ 1750 {} /* terminator */
1687}; 1751};
1688 1752
@@ -1716,6 +1780,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1716 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1780 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1717 [STAC_DELL_M4_3] = dell_m4_3_pin_configs, 1781 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1718 [STAC_HP_M4] = NULL, 1782 [STAC_HP_M4] = NULL,
1783 [STAC_HP_DV5] = NULL,
1719}; 1784};
1720 1785
1721static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1786static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
@@ -1724,6 +1789,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1724 [STAC_DELL_M4_2] = "dell-m4-2", 1789 [STAC_DELL_M4_2] = "dell-m4-2",
1725 [STAC_DELL_M4_3] = "dell-m4-3", 1790 [STAC_DELL_M4_3] = "dell-m4-3",
1726 [STAC_HP_M4] = "hp-m4", 1791 [STAC_HP_M4] = "hp-m4",
1792 [STAC_HP_DV5] = "hp-dv5",
1727}; 1793};
1728 1794
1729static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { 1795static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
@@ -1734,8 +1800,14 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1734 "HP dv5", STAC_HP_M4), 1800 "HP dv5", STAC_HP_M4),
1735 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, 1801 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
1736 "HP dv7", STAC_HP_M4), 1802 "HP dv7", STAC_HP_M4),
1803 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7,
1804 "HP dv4", STAC_HP_DV5),
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, 1805 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
1738 "HP dv7", STAC_HP_M4), 1806 "HP dv7", STAC_HP_M4),
1807 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600,
1808 "HP dv5", STAC_HP_DV5),
1809 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,
1810 "HP dv5", STAC_HP_DV5),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, 1811 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1740 "unknown HP", STAC_HP_M4), 1812 "unknown HP", STAC_HP_M4),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 1813 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
@@ -2469,6 +2541,8 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2469 2541
2470 info->name = "STAC92xx Analog"; 2542 info->name = "STAC92xx Analog";
2471 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 2543 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2544 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2545 spec->multiout.dac_nids[0];
2472 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 2546 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2473 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2547 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2474 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; 2548 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
@@ -3506,13 +3580,12 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3506 err = stac92xx_auto_fill_dac_nids(codec); 3580 err = stac92xx_auto_fill_dac_nids(codec);
3507 if (err < 0) 3581 if (err < 0)
3508 return err; 3582 return err;
3583 err = stac92xx_auto_create_multi_out_ctls(codec,
3584 &spec->autocfg);
3585 if (err < 0)
3586 return err;
3509 } 3587 }
3510 3588
3511 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg);
3512
3513 if (err < 0)
3514 return err;
3515
3516 /* setup analog beep controls */ 3589 /* setup analog beep controls */
3517 if (spec->anabeep_nid > 0) { 3590 if (spec->anabeep_nid > 0) {
3518 err = stac92xx_auto_create_beep_ctls(codec, 3591 err = stac92xx_auto_create_beep_ctls(codec,
@@ -4163,8 +4236,19 @@ static void stac92xx_hp_detect(struct hda_codec *codec)
4163 continue; 4236 continue;
4164 if (presence) 4237 if (presence)
4165 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4238 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4239#if 0 /* FIXME */
4240/* Resetting the pinctl like below may lead to (a sort of) regressions
4241 * on some devices since they use the HP pin actually for line/speaker
4242 * outs although the default pin config shows a different pin (that is
4243 * wrong and useless).
4244 *
4245 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4246 * But, disabling the code below just works around it, and I'm too tired of
4247 * bug reports with such devices...
4248 */
4166 else 4249 else
4167 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); 4250 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4251#endif /* FIXME */
4168 } 4252 }
4169} 4253}
4170 4254
@@ -4390,7 +4474,8 @@ static int patch_stac9200(struct hda_codec *codec)
4390 spec->num_adcs = 1; 4474 spec->num_adcs = 1;
4391 spec->num_pwrs = 0; 4475 spec->num_pwrs = 0;
4392 4476
4393 if (spec->board_config == STAC_9200_GATEWAY || 4477 if (spec->board_config == STAC_9200_M4 ||
4478 spec->board_config == STAC_9200_M4_2 ||
4394 spec->board_config == STAC_9200_OQO) 4479 spec->board_config == STAC_9200_OQO)
4395 spec->init = stac9200_eapd_init; 4480 spec->init = stac9200_eapd_init;
4396 else 4481 else
@@ -4408,6 +4493,12 @@ static int patch_stac9200(struct hda_codec *codec)
4408 return err; 4493 return err;
4409 } 4494 }
4410 4495
4496 /* CF-74 has no headphone detection, and the driver should *NOT*
4497 * do detection and HP/speaker toggle because the hardware does it.
4498 */
4499 if (spec->board_config == STAC_9200_PANASONIC)
4500 spec->hp_detect = 0;
4501
4411 codec->patch_ops = stac92xx_patch_ops; 4502 codec->patch_ops = stac92xx_patch_ops;
4412 4503
4413 return 0; 4504 return 0;
@@ -4425,12 +4516,22 @@ static int patch_stac925x(struct hda_codec *codec)
4425 codec->spec = spec; 4516 codec->spec = spec;
4426 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 4517 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4427 spec->pin_nids = stac925x_pin_nids; 4518 spec->pin_nids = stac925x_pin_nids;
4428 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 4519
4520 /* Check first for codec ID */
4521 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
4522 STAC_925x_MODELS,
4523 stac925x_models,
4524 stac925x_codec_id_cfg_tbl);
4525
4526 /* Now checks for PCI ID, if codec ID is not found */
4527 if (spec->board_config < 0)
4528 spec->board_config = snd_hda_check_board_config(codec,
4529 STAC_925x_MODELS,
4429 stac925x_models, 4530 stac925x_models,
4430 stac925x_cfg_tbl); 4531 stac925x_cfg_tbl);
4431 again: 4532 again:
4432 if (spec->board_config < 0) { 4533 if (spec->board_config < 0) {
4433 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4534 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4434 "using BIOS defaults\n"); 4535 "using BIOS defaults\n");
4435 err = stac92xx_save_bios_config_regs(codec); 4536 err = stac92xx_save_bios_config_regs(codec);
4436 } else 4537 } else
@@ -4658,7 +4759,9 @@ static struct hda_input_mux stac92hd83xxx_dmux = {
4658static int patch_stac92hd83xxx(struct hda_codec *codec) 4759static int patch_stac92hd83xxx(struct hda_codec *codec)
4659{ 4760{
4660 struct sigmatel_spec *spec; 4761 struct sigmatel_spec *spec;
4762 hda_nid_t conn[STAC92HD83_DAC_COUNT + 1];
4661 int err; 4763 int err;
4764 int num_dacs;
4662 4765
4663 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4766 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4664 if (spec == NULL) 4767 if (spec == NULL)
@@ -4672,23 +4775,26 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
4672 spec->dmux_nids = stac92hd83xxx_dmux_nids; 4775 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4673 spec->adc_nids = stac92hd83xxx_adc_nids; 4776 spec->adc_nids = stac92hd83xxx_adc_nids;
4674 spec->pwr_nids = stac92hd83xxx_pwr_nids; 4777 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4778 spec->amp_nids = stac92hd83xxx_amp_nids;
4675 spec->pwr_mapping = stac92hd83xxx_pwr_mapping; 4779 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4676 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); 4780 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4677 spec->multiout.dac_nids = spec->dac_nids; 4781 spec->multiout.dac_nids = spec->dac_nids;
4678 4782
4679 spec->init = stac92hd83xxx_core_init;
4680 switch (codec->vendor_id) {
4681 case 0x111d7605:
4682 break;
4683 default:
4684 spec->num_pwrs--;
4685 spec->init++; /* switch to config #2 */
4686 }
4687 4783
4784 /* set port 0xe to select the last DAC
4785 */
4786 num_dacs = snd_hda_get_connections(codec, 0x0e,
4787 conn, STAC92HD83_DAC_COUNT + 1) - 1;
4788
4789 snd_hda_codec_write_cache(codec, 0xe, 0,
4790 AC_VERB_SET_CONNECT_SEL, num_dacs);
4791
4792 spec->init = stac92hd83xxx_core_init;
4688 spec->mixer = stac92hd83xxx_mixer; 4793 spec->mixer = stac92hd83xxx_mixer;
4689 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); 4794 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4690 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); 4795 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4691 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); 4796 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4797 spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids);
4692 spec->num_dmics = STAC92HD83XXX_NUM_DMICS; 4798 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4693 spec->dinput_mux = &stac92hd83xxx_dmux; 4799 spec->dinput_mux = &stac92hd83xxx_dmux;
4694 spec->pin_nids = stac92hd83xxx_pin_nids; 4800 spec->pin_nids = stac92hd83xxx_pin_nids;
@@ -4709,6 +4815,15 @@ again:
4709 return err; 4815 return err;
4710 } 4816 }
4711 4817
4818 switch (codec->vendor_id) {
4819 case 0x111d7604:
4820 case 0x111d7605:
4821 if (spec->board_config == STAC_92HD83XXX_PWR_REF)
4822 break;
4823 spec->num_pwrs = 0;
4824 break;
4825 }
4826
4712 err = stac92xx_parse_auto_config(codec, 0x1d, 0); 4827 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
4713 if (!err) { 4828 if (!err) {
4714 if (spec->board_config < 0) { 4829 if (spec->board_config < 0) {
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 0dfa0540ce2c..bb8d8c766b9d 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -1239,7 +1239,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
1239 if (ice->force_pdma4 || ice->force_rdma1) 1239 if (ice->force_pdma4 || ice->force_rdma1)
1240 name = "ICE1724 Secondary"; 1240 name = "ICE1724 Secondary";
1241 else 1241 else
1242 name = "IEC1724 IEC958"; 1242 name = "ICE1724 IEC958";
1243 err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); 1243 err = snd_pcm_new(ice->card, name, device, play, capt, &pcm);
1244 if (err < 0) 1244 if (err < 0)
1245 return err; 1245 return err;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 19d3391e229f..e900cdc84849 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -617,7 +617,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip)
617 int time = 100; 617 int time = 100;
618 if (chip->buggy_semaphore) 618 if (chip->buggy_semaphore)
619 return 0; /* just ignore ... */ 619 return 0; /* just ignore ... */
620 while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) 620 while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
621 udelay(1); 621 udelay(1);
622 if (! time && ! chip->in_ac97_init) 622 if (! time && ! chip->in_ac97_init)
623 snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); 623 snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n");
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 98c6a8c65d81..18c7c91786bc 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -26,7 +26,7 @@
26 * SPI 0 -> 1st PCM1796 (front) 26 * SPI 0 -> 1st PCM1796 (front)
27 * SPI 1 -> 2nd PCM1796 (surround) 27 * SPI 1 -> 2nd PCM1796 (surround)
28 * SPI 2 -> 3rd PCM1796 (center/LFE) 28 * SPI 2 -> 3rd PCM1796 (center/LFE)
29 * SPI 4 -> 4th PCM1796 (back) 29 * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
30 * 30 *
31 * GPIO 2 -> M0 of CS5381 31 * GPIO 2 -> M0 of CS5381
32 * GPIO 3 -> M1 of CS5381 32 * GPIO 3 -> M1 of CS5381
@@ -207,6 +207,12 @@ static void xonar_gpio_changed(struct oxygen *chip);
207static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, 207static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
208 u8 reg, u8 value) 208 u8 reg, u8 value)
209{ 209{
210 /*
211 * We don't want to do writes on SPI 4 because the EEPROM, which shares
212 * the same pin, might get confused and broken. We'd better take care
213 * that the driver works with the default register values ...
214 */
215#if 0
210 /* maps ALSA channel pair number to SPI output */ 216 /* maps ALSA channel pair number to SPI output */
211 static const u8 codec_map[4] = { 217 static const u8 codec_map[4] = {
212 0, 1, 2, 4 218 0, 1, 2, 4
@@ -217,6 +223,7 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
217 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | 223 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
218 OXYGEN_SPI_CEN_LATCH_CLOCK_HI, 224 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
219 (reg << 8) | value); 225 (reg << 8) | value);
226#endif
220} 227}
221 228
222static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, 229static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
@@ -676,7 +683,7 @@ static void xonar_hdav_uart_input(struct oxygen *chip)
676 if (chip->uart_input_count >= 2 && 683 if (chip->uart_input_count >= 2 &&
677 chip->uart_input[chip->uart_input_count - 2] == 'O' && 684 chip->uart_input[chip->uart_input_count - 2] == 'O' &&
678 chip->uart_input[chip->uart_input_count - 1] == 'K') { 685 chip->uart_input[chip->uart_input_count - 1] == 'K') {
679 printk(KERN_DEBUG "message from Xonar HDAV HDMI chip received:"); 686 printk(KERN_DEBUG "message from Xonar HDAV HDMI chip received:\n");
680 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 687 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
681 chip->uart_input, chip->uart_input_count); 688 chip->uart_input, chip->uart_input_count);
682 chip->uart_input_count = 0; 689 chip->uart_input_count = 0;
@@ -750,6 +757,9 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
750 757
751static int xonar_d2_control_filter(struct snd_kcontrol_new *template) 758static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
752{ 759{
760 if (!strncmp(template->name, "Master Playback ", 16))
761 /* disable volume/mute because they would require SPI writes */
762 return 1;
753 if (!strncmp(template->name, "CD Capture ", 11)) 763 if (!strncmp(template->name, "CD Capture ", 11))
754 /* CD in is actually connected to the video in pin */ 764 /* CD in is actually connected to the video in pin */
755 template->private_value ^= AC97_CD ^ AC97_VIDEO; 765 template->private_value ^= AC97_CD ^ AC97_VIDEO;
@@ -840,9 +850,8 @@ static const struct oxygen_model model_xonar_d2 = {
840 .dac_volume_min = 0x0f, 850 .dac_volume_min = 0x0f,
841 .dac_volume_max = 0xff, 851 .dac_volume_max = 0xff,
842 .misc_flags = OXYGEN_MISC_MIDI, 852 .misc_flags = OXYGEN_MISC_MIDI,
843 .function_flags = OXYGEN_FUNCTION_SPI | 853 .function_flags = OXYGEN_FUNCTION_SPI,
844 OXYGEN_FUNCTION_ENABLE_SPI_4_5, 854 .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
845 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
846 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 855 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
847}; 856};
848 857
@@ -899,6 +908,7 @@ static const struct oxygen_model model_xonar_hdav = {
899 .dac_channels = 8, 908 .dac_channels = 8,
900 .dac_volume_min = 0x0f, 909 .dac_volume_min = 0x0f,
901 .dac_volume_max = 0xff, 910 .dac_volume_max = 0xff,
911 .misc_flags = OXYGEN_MISC_MIDI,
902 .function_flags = OXYGEN_FUNCTION_2WIRE, 912 .function_flags = OXYGEN_FUNCTION_2WIRE,
903 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 913 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
904 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 914 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index 8f9e3859c37c..ff321110ec02 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -477,7 +477,7 @@ static int snd_ps3_pcm_prepare(struct snd_pcm_substream *substream)
477 card->dma_start_bus_addr[SND_PS3_CH_R] = 477 card->dma_start_bus_addr[SND_PS3_CH_R] =
478 runtime->dma_addr + (runtime->dma_bytes / 2); 478 runtime->dma_addr + (runtime->dma_bytes / 2);
479 479
480 pr_debug("%s: vaddr=%p bus=%#lx\n", __func__, 480 pr_debug("%s: vaddr=%p bus=%#llx\n", __func__,
481 card->dma_start_vaddr[SND_PS3_CH_L], 481 card->dma_start_vaddr[SND_PS3_CH_L],
482 card->dma_start_bus_addr[SND_PS3_CH_L]); 482 card->dma_start_bus_addr[SND_PS3_CH_L]);
483 483
@@ -1030,7 +1030,7 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
1030 pr_info("%s: nullbuffer alloc failed\n", __func__); 1030 pr_info("%s: nullbuffer alloc failed\n", __func__);
1031 goto clean_preallocate; 1031 goto clean_preallocate;
1032 } 1032 }
1033 pr_debug("%s: null vaddr=%p dma=%#lx\n", __func__, 1033 pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__,
1034 the_card.null_buffer_start_vaddr, 1034 the_card.null_buffer_start_vaddr,
1035 the_card.null_buffer_start_dma_addr); 1035 the_card.null_buffer_start_dma_addr);
1036 /* set default sample rate/word width */ 1036 /* set default sample rate/word width */
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index 1fac5efd285b..3dcdc4e3cfa0 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -44,8 +44,6 @@
44#include <sound/pcm_params.h> 44#include <sound/pcm_params.h>
45#include <sound/soc.h> 45#include <sound/soc.h>
46 46
47#include <mach/hardware.h>
48
49#include "atmel-pcm.h" 47#include "atmel-pcm.h"
50 48
51 49
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index c5d67900d666..ff0054b76502 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -10,7 +10,7 @@
10 * Based on at91-ssc.c by 10 * Based on at91-ssc.c by
11 * Frank Mandarino <fmandarino@endrelia.com> 11 * Frank Mandarino <fmandarino@endrelia.com>
12 * Based on pxa2xx Platform drivers by 12 * Based on pxa2xx Platform drivers by
13 * Liam Girdwood <liam.girdwood@wolfsonmicro.com> 13 * Liam Girdwood <lrg@slimlogic.co.uk>
14 * 14 *
15 * This program is free software; you can redistribute it and/or modify 15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by 16 * it under the terms of the GNU General Public License as published by
diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h
index a828746e8a2f..391135f9c6c1 100644
--- a/sound/soc/atmel/atmel_ssc_dai.h
+++ b/sound/soc/atmel/atmel_ssc_dai.h
@@ -10,7 +10,7 @@
10 * Based on at91-ssc.c by 10 * Based on at91-ssc.c by
11 * Frank Mandarino <fmandarino@endrelia.com> 11 * Frank Mandarino <fmandarino@endrelia.com>
12 * Based on pxa2xx Platform drivers by 12 * Based on pxa2xx Platform drivers by
13 * Liam Girdwood <liam.girdwood@wolfsonmicro.com> 13 * Liam Girdwood <lrg@slimlogic.co.uk>
14 * 14 *
15 * This program is free software; you can redistribute it and/or modify 15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by 16 * it under the terms of the GNU General Public License as published by
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 1fb59a9d3719..6ea04be911d0 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -221,8 +221,8 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec)
221 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 221 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
222 222
223 /* not connected */ 223 /* not connected */
224 snd_soc_dapm_disable_pin(codec, "RLINEIN"); 224 snd_soc_dapm_nc_pin(codec, "RLINEIN");
225 snd_soc_dapm_disable_pin(codec, "LLINEIN"); 225 snd_soc_dapm_nc_pin(codec, "LLINEIN");
226 226
227 /* always connected */ 227 /* always connected */
228 snd_soc_dapm_enable_pin(codec, "Int Mic"); 228 snd_soc_dapm_enable_pin(codec, "Int Mic");
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c
index 74c823d60f91..bc8d654576c0 100644
--- a/sound/soc/au1x/dbdma2.c
+++ b/sound/soc/au1x/dbdma2.c
@@ -187,7 +187,7 @@ static int au1x_pcm_dbdma_realloc(struct au1xpsc_audio_dmadata *pcd,
187 au1x_pcm_dmatx_cb, (void *)pcd); 187 au1x_pcm_dmatx_cb, (void *)pcd);
188 188
189 if (!pcd->ddma_chan) 189 if (!pcd->ddma_chan)
190 return -ENOMEM;; 190 return -ENOMEM;
191 191
192 au1xxx_dbdma_set_devwidth(pcd->ddma_chan, msbits); 192 au1xxx_dbdma_set_devwidth(pcd->ddma_chan, msbits);
193 au1xxx_dbdma_ring_alloc(pcd->ddma_chan, 2); 193 au1xxx_dbdma_ring_alloc(pcd->ddma_chan, 2);
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index c41289b5f586..d0e0d691ae51 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -1,3 +1,13 @@
1# Helper to resolve issues with configs that have SPI enabled but I2C
2# modular, meaning we can't build the codec driver in with I2C support.
3# We use an ordered list of conditional defaults to pick the appropriate
4# setting - SPI can't be modular so that case doesn't need to be covered.
5config SND_SOC_I2C_AND_SPI
6 tristate
7 default m if I2C=m
8 default y if I2C=y
9 default y if SPI_MASTER=y
10
1config SND_SOC_ALL_CODECS 11config SND_SOC_ALL_CODECS
2 tristate "Build all ASoC CODEC drivers" 12 tristate "Build all ASoC CODEC drivers"
3 select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS 13 select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS
@@ -14,12 +24,12 @@ config SND_SOC_ALL_CODECS
14 select SND_SOC_UDA134X 24 select SND_SOC_UDA134X
15 select SND_SOC_UDA1380 if I2C 25 select SND_SOC_UDA1380 if I2C
16 select SND_SOC_WM8350 if MFD_WM8350 26 select SND_SOC_WM8350 if MFD_WM8350
17 select SND_SOC_WM8510 if (I2C || SPI_MASTER) 27 select SND_SOC_WM8510 if SND_SOC_I2C_AND_SPI
18 select SND_SOC_WM8580 if I2C 28 select SND_SOC_WM8580 if I2C
19 select SND_SOC_WM8728 if (I2C || SPI_MASTER) 29 select SND_SOC_WM8728 if SND_SOC_I2C_AND_SPI
20 select SND_SOC_WM8731 if (I2C || SPI_MASTER) 30 select SND_SOC_WM8731 if SND_SOC_I2C_AND_SPI
21 select SND_SOC_WM8750 if (I2C || SPI_MASTER) 31 select SND_SOC_WM8750 if SND_SOC_I2C_AND_SPI
22 select SND_SOC_WM8753 if (I2C || SPI_MASTER) 32 select SND_SOC_WM8753 if SND_SOC_I2C_AND_SPI
23 select SND_SOC_WM8900 if I2C 33 select SND_SOC_WM8900 if I2C
24 select SND_SOC_WM8903 if I2C 34 select SND_SOC_WM8903 if I2C
25 select SND_SOC_WM8971 if I2C 35 select SND_SOC_WM8971 if I2C
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 51848880504a..ea370a4f86d5 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -192,39 +192,51 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
192 192
193/* Earpiece */ 193/* Earpiece */
194static const char *twl4030_earpiece_texts[] = 194static const char *twl4030_earpiece_texts[] =
195 {"Off", "DACL1", "DACL2", "Invalid", "DACR1"}; 195 {"Off", "DACL1", "DACL2", "DACR1"};
196
197static const unsigned int twl4030_earpiece_values[] =
198 {0x0, 0x1, 0x2, 0x4};
196 199
197static const struct soc_enum twl4030_earpiece_enum = 200static const struct soc_enum twl4030_earpiece_enum =
198 SOC_ENUM_SINGLE(TWL4030_REG_EAR_CTL, 1, 201 SOC_VALUE_ENUM_SINGLE(TWL4030_REG_EAR_CTL, 1, 0x7,
199 ARRAY_SIZE(twl4030_earpiece_texts), 202 ARRAY_SIZE(twl4030_earpiece_texts),
200 twl4030_earpiece_texts); 203 twl4030_earpiece_texts,
204 twl4030_earpiece_values);
201 205
202static const struct snd_kcontrol_new twl4030_dapm_earpiece_control = 206static const struct snd_kcontrol_new twl4030_dapm_earpiece_control =
203SOC_DAPM_ENUM("Route", twl4030_earpiece_enum); 207SOC_DAPM_VALUE_ENUM("Route", twl4030_earpiece_enum);
204 208
205/* PreDrive Left */ 209/* PreDrive Left */
206static const char *twl4030_predrivel_texts[] = 210static const char *twl4030_predrivel_texts[] =
207 {"Off", "DACL1", "DACL2", "Invalid", "DACR2"}; 211 {"Off", "DACL1", "DACL2", "DACR2"};
212
213static const unsigned int twl4030_predrivel_values[] =
214 {0x0, 0x1, 0x2, 0x4};
208 215
209static const struct soc_enum twl4030_predrivel_enum = 216static const struct soc_enum twl4030_predrivel_enum =
210 SOC_ENUM_SINGLE(TWL4030_REG_PREDL_CTL, 1, 217 SOC_VALUE_ENUM_SINGLE(TWL4030_REG_PREDL_CTL, 1, 0x7,
211 ARRAY_SIZE(twl4030_predrivel_texts), 218 ARRAY_SIZE(twl4030_predrivel_texts),
212 twl4030_predrivel_texts); 219 twl4030_predrivel_texts,
220 twl4030_predrivel_values);
213 221
214static const struct snd_kcontrol_new twl4030_dapm_predrivel_control = 222static const struct snd_kcontrol_new twl4030_dapm_predrivel_control =
215SOC_DAPM_ENUM("Route", twl4030_predrivel_enum); 223SOC_DAPM_VALUE_ENUM("Route", twl4030_predrivel_enum);
216 224
217/* PreDrive Right */ 225/* PreDrive Right */
218static const char *twl4030_predriver_texts[] = 226static const char *twl4030_predriver_texts[] =
219 {"Off", "DACR1", "DACR2", "Invalid", "DACL2"}; 227 {"Off", "DACR1", "DACR2", "DACL2"};
228
229static const unsigned int twl4030_predriver_values[] =
230 {0x0, 0x1, 0x2, 0x4};
220 231
221static const struct soc_enum twl4030_predriver_enum = 232static const struct soc_enum twl4030_predriver_enum =
222 SOC_ENUM_SINGLE(TWL4030_REG_PREDR_CTL, 1, 233 SOC_VALUE_ENUM_SINGLE(TWL4030_REG_PREDR_CTL, 1, 0x7,
223 ARRAY_SIZE(twl4030_predriver_texts), 234 ARRAY_SIZE(twl4030_predriver_texts),
224 twl4030_predriver_texts); 235 twl4030_predriver_texts,
236 twl4030_predriver_values);
225 237
226static const struct snd_kcontrol_new twl4030_dapm_predriver_control = 238static const struct snd_kcontrol_new twl4030_dapm_predriver_control =
227SOC_DAPM_ENUM("Route", twl4030_predriver_enum); 239SOC_DAPM_VALUE_ENUM("Route", twl4030_predriver_enum);
228 240
229/* Headset Left */ 241/* Headset Left */
230static const char *twl4030_hsol_texts[] = 242static const char *twl4030_hsol_texts[] =
@@ -298,28 +310,90 @@ static const struct soc_enum twl4030_handsfreer_enum =
298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = 310static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control =
299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); 311SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
300 312
301static int outmixer_event(struct snd_soc_dapm_widget *w, 313/* Left analog microphone selection */
314static const char *twl4030_analoglmic_texts[] =
315 {"Off", "Main mic", "Headset mic", "AUXL", "Carkit mic"};
316
317static const unsigned int twl4030_analoglmic_values[] =
318 {0x0, 0x1, 0x2, 0x4, 0x8};
319
320static const struct soc_enum twl4030_analoglmic_enum =
321 SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICL, 0, 0xf,
322 ARRAY_SIZE(twl4030_analoglmic_texts),
323 twl4030_analoglmic_texts,
324 twl4030_analoglmic_values);
325
326static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control =
327SOC_DAPM_VALUE_ENUM("Route", twl4030_analoglmic_enum);
328
329/* Right analog microphone selection */
330static const char *twl4030_analogrmic_texts[] =
331 {"Off", "Sub mic", "AUXR"};
332
333static const unsigned int twl4030_analogrmic_values[] =
334 {0x0, 0x1, 0x4};
335
336static const struct soc_enum twl4030_analogrmic_enum =
337 SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICR, 0, 0x5,
338 ARRAY_SIZE(twl4030_analogrmic_texts),
339 twl4030_analogrmic_texts,
340 twl4030_analogrmic_values);
341
342static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control =
343SOC_DAPM_VALUE_ENUM("Route", twl4030_analogrmic_enum);
344
345/* TX1 L/R Analog/Digital microphone selection */
346static const char *twl4030_micpathtx1_texts[] =
347 {"Analog", "Digimic0"};
348
349static const struct soc_enum twl4030_micpathtx1_enum =
350 SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0,
351 ARRAY_SIZE(twl4030_micpathtx1_texts),
352 twl4030_micpathtx1_texts);
353
354static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control =
355SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum);
356
357/* TX2 L/R Analog/Digital microphone selection */
358static const char *twl4030_micpathtx2_texts[] =
359 {"Analog", "Digimic1"};
360
361static const struct soc_enum twl4030_micpathtx2_enum =
362 SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2,
363 ARRAY_SIZE(twl4030_micpathtx2_texts),
364 twl4030_micpathtx2_texts);
365
366static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control =
367SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum);
368
369static int micpath_event(struct snd_soc_dapm_widget *w,
302 struct snd_kcontrol *kcontrol, int event) 370 struct snd_kcontrol *kcontrol, int event)
303{ 371{
304 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 372 struct soc_enum *e = (struct soc_enum *)w->kcontrols->private_value;
305 int ret = 0; 373 unsigned char adcmicsel, micbias_ctl;
306 int val; 374
307 375 adcmicsel = twl4030_read_reg_cache(w->codec, TWL4030_REG_ADCMICSEL);
308 switch (e->reg) { 376 micbias_ctl = twl4030_read_reg_cache(w->codec, TWL4030_REG_MICBIAS_CTL);
309 case TWL4030_REG_PREDL_CTL: 377 /* Prepare the bits for the given TX path:
310 case TWL4030_REG_PREDR_CTL: 378 * shift_l == 0: TX1 microphone path
311 case TWL4030_REG_EAR_CTL: 379 * shift_l == 2: TX2 microphone path */
312 val = w->value >> e->shift_l; 380 if (e->shift_l) {
313 if (val == 3) { 381 /* TX2 microphone path */
314 printk(KERN_WARNING 382 if (adcmicsel & TWL4030_TX2IN_SEL)
315 "Invalid MUX setting for register 0x%02x (%d)\n", 383 micbias_ctl |= TWL4030_MICBIAS2_CTL; /* digimic */
316 e->reg, val); 384 else
317 ret = -1; 385 micbias_ctl &= ~TWL4030_MICBIAS2_CTL;
318 } 386 } else {
319 break; 387 /* TX1 microphone path */
388 if (adcmicsel & TWL4030_TX1IN_SEL)
389 micbias_ctl |= TWL4030_MICBIAS1_CTL; /* digimic */
390 else
391 micbias_ctl &= ~TWL4030_MICBIAS1_CTL;
320 } 392 }
321 393
322 return ret; 394 twl4030_write(w->codec, TWL4030_REG_MICBIAS_CTL, micbias_ctl);
395
396 return 0;
323} 397}
324 398
325static int handsfree_event(struct snd_soc_dapm_widget *w, 399static int handsfree_event(struct snd_soc_dapm_widget *w,
@@ -503,162 +577,6 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol,
503 return err; 577 return err;
504} 578}
505 579
506static int twl4030_get_left_input(struct snd_kcontrol *kcontrol,
507 struct snd_ctl_elem_value *ucontrol)
508{
509 struct snd_soc_codec *codec = kcontrol->private_data;
510 u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
511 int result = 0;
512
513 /* one bit must be set a time */
514 reg &= TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN
515 | TWL4030_MAINMIC_EN;
516 if (reg != 0) {
517 result++;
518 while ((reg & 1) == 0) {
519 result++;
520 reg >>= 1;
521 }
522 }
523
524 ucontrol->value.integer.value[0] = result;
525 return 0;
526}
527
528static int twl4030_put_left_input(struct snd_kcontrol *kcontrol,
529 struct snd_ctl_elem_value *ucontrol)
530{
531 struct snd_soc_codec *codec = kcontrol->private_data;
532 int value = ucontrol->value.integer.value[0];
533 u8 anamicl, micbias, avadc_ctl;
534
535 anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
536 anamicl &= ~(TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN
537 | TWL4030_MAINMIC_EN);
538 micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL);
539 micbias &= ~(TWL4030_HSMICBIAS_EN | TWL4030_MICBIAS1_EN);
540 avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL);
541
542 switch (value) {
543 case 1:
544 anamicl |= TWL4030_MAINMIC_EN;
545 micbias |= TWL4030_MICBIAS1_EN;
546 break;
547 case 2:
548 anamicl |= TWL4030_HSMIC_EN;
549 micbias |= TWL4030_HSMICBIAS_EN;
550 break;
551 case 3:
552 anamicl |= TWL4030_AUXL_EN;
553 break;
554 case 4:
555 anamicl |= TWL4030_CKMIC_EN;
556 break;
557 default:
558 break;
559 }
560
561 /* If some input is selected, enable amp and ADC */
562 if (value != 0) {
563 anamicl |= TWL4030_MICAMPL_EN;
564 avadc_ctl |= TWL4030_ADCL_EN;
565 } else {
566 anamicl &= ~TWL4030_MICAMPL_EN;
567 avadc_ctl &= ~TWL4030_ADCL_EN;
568 }
569
570 twl4030_write(codec, TWL4030_REG_ANAMICL, anamicl);
571 twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias);
572 twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl);
573
574 return 1;
575}
576
577static int twl4030_get_right_input(struct snd_kcontrol *kcontrol,
578 struct snd_ctl_elem_value *ucontrol)
579{
580 struct snd_soc_codec *codec = kcontrol->private_data;
581 u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR);
582 int value = 0;
583
584 reg &= TWL4030_SUBMIC_EN|TWL4030_AUXR_EN;
585 switch (reg) {
586 case TWL4030_SUBMIC_EN:
587 value = 1;
588 break;
589 case TWL4030_AUXR_EN:
590 value = 2;
591 break;
592 default:
593 break;
594 }
595
596 ucontrol->value.integer.value[0] = value;
597 return 0;
598}
599
600static int twl4030_put_right_input(struct snd_kcontrol *kcontrol,
601 struct snd_ctl_elem_value *ucontrol)
602{
603 struct snd_soc_codec *codec = kcontrol->private_data;
604 int value = ucontrol->value.integer.value[0];
605 u8 anamicr, micbias, avadc_ctl;
606
607 anamicr = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR);
608 anamicr &= ~(TWL4030_SUBMIC_EN|TWL4030_AUXR_EN);
609 micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL);
610 micbias &= ~TWL4030_MICBIAS2_EN;
611 avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL);
612
613 switch (value) {
614 case 1:
615 anamicr |= TWL4030_SUBMIC_EN;
616 micbias |= TWL4030_MICBIAS2_EN;
617 break;
618 case 2:
619 anamicr |= TWL4030_AUXR_EN;
620 break;
621 default:
622 break;
623 }
624
625 if (value != 0) {
626 anamicr |= TWL4030_MICAMPR_EN;
627 avadc_ctl |= TWL4030_ADCR_EN;
628 } else {
629 anamicr &= ~TWL4030_MICAMPR_EN;
630 avadc_ctl &= ~TWL4030_ADCR_EN;
631 }
632
633 twl4030_write(codec, TWL4030_REG_ANAMICR, anamicr);
634 twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias);
635 twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl);
636
637 return 1;
638}
639
640static const char *twl4030_left_in_sel[] = {
641 "None",
642 "Main Mic",
643 "Headset Mic",
644 "Line In",
645 "Carkit Mic",
646};
647
648static const char *twl4030_right_in_sel[] = {
649 "None",
650 "Sub Mic",
651 "Line In",
652};
653
654static const struct soc_enum twl4030_left_input_mux =
655 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_left_in_sel),
656 twl4030_left_in_sel);
657
658static const struct soc_enum twl4030_right_input_mux =
659 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_right_in_sel),
660 twl4030_right_in_sel);
661
662/* 580/*
663 * FGAIN volume control: 581 * FGAIN volume control:
664 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) 582 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
@@ -741,18 +659,15 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = {
741 TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), 659 TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl),
742 660
743 /* Common capture gain controls */ 661 /* Common capture gain controls */
744 SOC_DOUBLE_R_TLV("Capture Volume", 662 SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume",
745 TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, 663 TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA,
746 0, 0x1f, 0, digital_capture_tlv), 664 0, 0x1f, 0, digital_capture_tlv),
665 SOC_DOUBLE_R_TLV("TX2 Digital Capture Volume",
666 TWL4030_REG_AVTXL2PGA, TWL4030_REG_AVTXR2PGA,
667 0, 0x1f, 0, digital_capture_tlv),
747 668
748 SOC_DOUBLE_TLV("Input Boost Volume", TWL4030_REG_ANAMIC_GAIN, 669 SOC_DOUBLE_TLV("Analog Capture Volume", TWL4030_REG_ANAMIC_GAIN,
749 0, 3, 5, 0, input_gain_tlv), 670 0, 3, 5, 0, input_gain_tlv),
750
751 /* Input source controls */
752 SOC_ENUM_EXT("Left Input Source", twl4030_left_input_mux,
753 twl4030_get_left_input, twl4030_put_left_input),
754 SOC_ENUM_EXT("Right Input Source", twl4030_right_input_mux,
755 twl4030_get_right_input, twl4030_put_right_input),
756}; 671};
757 672
758/* add non dapm controls */ 673/* add non dapm controls */
@@ -772,9 +687,19 @@ static int twl4030_add_controls(struct snd_soc_codec *codec)
772} 687}
773 688
774static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { 689static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
775 SND_SOC_DAPM_INPUT("INL"), 690 /* Left channel inputs */
776 SND_SOC_DAPM_INPUT("INR"), 691 SND_SOC_DAPM_INPUT("MAINMIC"),
777 692 SND_SOC_DAPM_INPUT("HSMIC"),
693 SND_SOC_DAPM_INPUT("AUXL"),
694 SND_SOC_DAPM_INPUT("CARKITMIC"),
695 /* Right channel inputs */
696 SND_SOC_DAPM_INPUT("SUBMIC"),
697 SND_SOC_DAPM_INPUT("AUXR"),
698 /* Digital microphones (Stereo) */
699 SND_SOC_DAPM_INPUT("DIGIMIC0"),
700 SND_SOC_DAPM_INPUT("DIGIMIC1"),
701
702 /* Outputs */
778 SND_SOC_DAPM_OUTPUT("OUTL"), 703 SND_SOC_DAPM_OUTPUT("OUTL"),
779 SND_SOC_DAPM_OUTPUT("OUTR"), 704 SND_SOC_DAPM_OUTPUT("OUTR"),
780 SND_SOC_DAPM_OUTPUT("EARPIECE"), 705 SND_SOC_DAPM_OUTPUT("EARPIECE"),
@@ -809,16 +734,13 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
809 734
810 /* Output MUX controls */ 735 /* Output MUX controls */
811 /* Earpiece */ 736 /* Earpiece */
812 SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, 737 SND_SOC_DAPM_VALUE_MUX("Earpiece Mux", SND_SOC_NOPM, 0, 0,
813 &twl4030_dapm_earpiece_control, outmixer_event, 738 &twl4030_dapm_earpiece_control),
814 SND_SOC_DAPM_PRE_REG),
815 /* PreDrivL/R */ 739 /* PreDrivL/R */
816 SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, 740 SND_SOC_DAPM_VALUE_MUX("PredriveL Mux", SND_SOC_NOPM, 0, 0,
817 &twl4030_dapm_predrivel_control, outmixer_event, 741 &twl4030_dapm_predrivel_control),
818 SND_SOC_DAPM_PRE_REG), 742 SND_SOC_DAPM_VALUE_MUX("PredriveR Mux", SND_SOC_NOPM, 0, 0,
819 SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, 743 &twl4030_dapm_predriver_control),
820 &twl4030_dapm_predriver_control, outmixer_event,
821 SND_SOC_DAPM_PRE_REG),
822 /* HeadsetL/R */ 744 /* HeadsetL/R */
823 SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, 745 SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0,
824 &twl4030_dapm_hsol_control), 746 &twl4030_dapm_hsol_control),
@@ -837,8 +759,48 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
837 &twl4030_dapm_handsfreer_control, handsfree_event, 759 &twl4030_dapm_handsfreer_control, handsfree_event,
838 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), 760 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
839 761
840 SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), 762 /* Introducing four virtual ADC, since TWL4030 have four channel for
841 SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), 763 capture */
764 SND_SOC_DAPM_ADC("ADC Virtual Left1", "Left Front Capture",
765 SND_SOC_NOPM, 0, 0),
766 SND_SOC_DAPM_ADC("ADC Virtual Right1", "Right Front Capture",
767 SND_SOC_NOPM, 0, 0),
768 SND_SOC_DAPM_ADC("ADC Virtual Left2", "Left Rear Capture",
769 SND_SOC_NOPM, 0, 0),
770 SND_SOC_DAPM_ADC("ADC Virtual Right2", "Right Rear Capture",
771 SND_SOC_NOPM, 0, 0),
772
773 /* Analog/Digital mic path selection.
774 TX1 Left/Right: either analog Left/Right or Digimic0
775 TX2 Left/Right: either analog Left/Right or Digimic1 */
776 SND_SOC_DAPM_MUX_E("TX1 Capture Route", SND_SOC_NOPM, 0, 0,
777 &twl4030_dapm_micpathtx1_control, micpath_event,
778 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD|
779 SND_SOC_DAPM_POST_REG),
780 SND_SOC_DAPM_MUX_E("TX2 Capture Route", SND_SOC_NOPM, 0, 0,
781 &twl4030_dapm_micpathtx2_control, micpath_event,
782 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD|
783 SND_SOC_DAPM_POST_REG),
784
785 /* Analog input muxes with power switch for the physical ADCL/R */
786 SND_SOC_DAPM_VALUE_MUX("Analog Left Capture Route",
787 TWL4030_REG_AVADC_CTL, 3, 0, &twl4030_dapm_analoglmic_control),
788 SND_SOC_DAPM_VALUE_MUX("Analog Right Capture Route",
789 TWL4030_REG_AVADC_CTL, 1, 0, &twl4030_dapm_analogrmic_control),
790
791 SND_SOC_DAPM_PGA("Analog Left Amplifier",
792 TWL4030_REG_ANAMICL, 4, 0, NULL, 0),
793 SND_SOC_DAPM_PGA("Analog Right Amplifier",
794 TWL4030_REG_ANAMICR, 4, 0, NULL, 0),
795
796 SND_SOC_DAPM_PGA("Digimic0 Enable",
797 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0),
798 SND_SOC_DAPM_PGA("Digimic1 Enable",
799 TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0),
800
801 SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0),
802 SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0),
803 SND_SOC_DAPM_MICBIAS("Headset Mic Bias", TWL4030_REG_MICBIAS_CTL, 2, 0),
842}; 804};
843 805
844static const struct snd_soc_dapm_route intercon[] = { 806static const struct snd_soc_dapm_route intercon[] = {
@@ -894,9 +856,39 @@ static const struct snd_soc_dapm_route intercon[] = {
894 {"HFL", NULL, "HandsfreeL Mux"}, 856 {"HFL", NULL, "HandsfreeL Mux"},
895 {"HFR", NULL, "HandsfreeR Mux"}, 857 {"HFR", NULL, "HandsfreeR Mux"},
896 858
897 /* inputs */ 859 /* Capture path */
898 {"ADCL", NULL, "INL"}, 860 {"Analog Left Capture Route", "Main mic", "MAINMIC"},
899 {"ADCR", NULL, "INR"}, 861 {"Analog Left Capture Route", "Headset mic", "HSMIC"},
862 {"Analog Left Capture Route", "AUXL", "AUXL"},
863 {"Analog Left Capture Route", "Carkit mic", "CARKITMIC"},
864
865 {"Analog Right Capture Route", "Sub mic", "SUBMIC"},
866 {"Analog Right Capture Route", "AUXR", "AUXR"},
867
868 {"Analog Left Amplifier", NULL, "Analog Left Capture Route"},
869 {"Analog Right Amplifier", NULL, "Analog Right Capture Route"},
870
871 {"Digimic0 Enable", NULL, "DIGIMIC0"},
872 {"Digimic1 Enable", NULL, "DIGIMIC1"},
873
874 /* TX1 Left capture path */
875 {"TX1 Capture Route", "Analog", "Analog Left Amplifier"},
876 {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"},
877 /* TX1 Right capture path */
878 {"TX1 Capture Route", "Analog", "Analog Right Amplifier"},
879 {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"},
880 /* TX2 Left capture path */
881 {"TX2 Capture Route", "Analog", "Analog Left Amplifier"},
882 {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"},
883 /* TX2 Right capture path */
884 {"TX2 Capture Route", "Analog", "Analog Right Amplifier"},
885 {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"},
886
887 {"ADC Virtual Left1", NULL, "TX1 Capture Route"},
888 {"ADC Virtual Right1", NULL, "TX1 Capture Route"},
889 {"ADC Virtual Left2", NULL, "TX2 Capture Route"},
890 {"ADC Virtual Right2", NULL, "TX2 Capture Route"},
891
900}; 892};
901 893
902static int twl4030_add_widgets(struct snd_soc_codec *codec) 894static int twl4030_add_widgets(struct snd_soc_codec *codec)
@@ -923,6 +915,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec)
923 twl4030_write(codec, TWL4030_REG_ANAMICL, 915 twl4030_write(codec, TWL4030_REG_ANAMICL,
924 anamicl | TWL4030_CNCL_OFFSET_START); 916 anamicl | TWL4030_CNCL_OFFSET_START);
925 917
918
926 /* wait for offset cancellation to complete */ 919 /* wait for offset cancellation to complete */
927 do { 920 do {
928 /* this takes a little while, so don't slam i2c */ 921 /* this takes a little while, so don't slam i2c */
@@ -1287,6 +1280,8 @@ static int twl4030_remove(struct platform_device *pdev)
1287 struct snd_soc_codec *codec = socdev->codec; 1280 struct snd_soc_codec *codec = socdev->codec;
1288 1281
1289 printk(KERN_INFO "TWL4030 Audio Codec remove\n"); 1282 printk(KERN_INFO "TWL4030 Audio Codec remove\n");
1283 snd_soc_free_pcms(socdev);
1284 snd_soc_dapm_free(socdev);
1290 kfree(codec); 1285 kfree(codec);
1291 1286
1292 return 0; 1287 return 0;
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index 54615c76802b..442e5a828617 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -147,6 +147,13 @@
147#define TWL4030_AVADC_CLK_PRIORITY 0x04 147#define TWL4030_AVADC_CLK_PRIORITY 0x04
148#define TWL4030_ADCR_EN 0x02 148#define TWL4030_ADCR_EN 0x02
149 149
150/* TWL4030_REG_ADCMICSEL (0x08) Fields */
151
152#define TWL4030_DIGMIC1_EN 0x08
153#define TWL4030_TX2IN_SEL 0x04
154#define TWL4030_DIGMIC0_EN 0x02
155#define TWL4030_TX1IN_SEL 0x01
156
150/* AUDIO_IF (0x0E) Fields */ 157/* AUDIO_IF (0x0E) Fields */
151 158
152#define TWL4030_AIF_SLAVE_EN 0x80 159#define TWL4030_AIF_SLAVE_EN 0x80
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index e3989d406f54..35d99750c383 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 6c21b50c9375..77620ab98756 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1451,7 +1451,14 @@ static const struct snd_soc_dai wm8753_all_dai[] = {
1451}, 1451},
1452}; 1452};
1453 1453
1454struct snd_soc_dai wm8753_dai[2]; 1454struct snd_soc_dai wm8753_dai[] = {
1455 {
1456 .name = "WM8753 DAI 0",
1457 },
1458 {
1459 .name = "WM8753 DAI 1",
1460 },
1461};
1455EXPORT_SYMBOL_GPL(wm8753_dai); 1462EXPORT_SYMBOL_GPL(wm8753_dai);
1456 1463
1457static void wm8753_set_dai_mode(struct snd_soc_codec *codec, unsigned int mode) 1464static void wm8753_set_dai_mode(struct snd_soc_codec *codec, unsigned int mode)
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 5b5afc144478..1cbb7b9b51ce 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -2,8 +2,7 @@
2 * wm8990.c -- WM8990 ALSA Soc Audio driver 2 * wm8990.c -- WM8990 ALSA Soc Audio driver
3 * 3 *
4 * Copyright 2008 Wolfson Microelectronics PLC. 4 * Copyright 2008 Wolfson Microelectronics PLC.
5 * Author: Liam Girdwood 5 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
6 * lg@opensource.wolfsonmicro.com or linux@wolfsonmicro.com
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 01b948bb55a1..54851f318568 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -26,7 +26,6 @@
26#include "davinci-pcm.h" 26#include "davinci-pcm.h"
27#include "davinci-i2s.h" 27#include "davinci-i2s.h"
28 28
29#define EVM_CODEC_CLOCK 22579200
30 29
31#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ 30#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
32 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) 31 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)
@@ -37,6 +36,21 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
37 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 36 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
38 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 37 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
39 int ret = 0; 38 int ret = 0;
39 unsigned sysclk;
40
41 /* ASP1 on DM355 EVM is clocked by an external oscillator */
42 if (machine_is_davinci_dm355_evm())
43 sysclk = 27000000;
44
45 /* ASP0 in DM6446 EVM is clocked by U55, as configured by
46 * board-dm644x-evm.c using GPIOs from U18. There are six
47 * options; here we "know" we use a 48 KHz sample rate.
48 */
49 else if (machine_is_davinci_evm())
50 sysclk = 12288000;
51
52 else
53 return -EINVAL;
40 54
41 /* set codec DAI configuration */ 55 /* set codec DAI configuration */
42 ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); 56 ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
@@ -49,8 +63,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
49 return ret; 63 return ret;
50 64
51 /* set the codec system clock */ 65 /* set the codec system clock */
52 ret = snd_soc_dai_set_sysclk(codec_dai, 0, EVM_CODEC_CLOCK, 66 ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
53 SND_SOC_CLOCK_OUT);
54 if (ret < 0) 67 if (ret < 0)
55 return ret; 68 return ret;
56 69
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 74abc9b4f1cc..366049d8578c 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -212,7 +212,7 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream)
212 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 212 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
213 count = src - runtime->dma_addr; 213 count = src - runtime->dma_addr;
214 else 214 else
215 count = dst - runtime->dma_addr;; 215 count = dst - runtime->dma_addr;
216 216
217 spin_unlock(&prtd->lock); 217 spin_unlock(&prtd->lock);
218 218
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c
index f67579d52765..4935d1bcbd8d 100644
--- a/sound/soc/davinci/davinci-sffsdr.c
+++ b/sound/soc/davinci/davinci-sffsdr.c
@@ -24,6 +24,7 @@
24#include <sound/soc-dapm.h> 24#include <sound/soc-dapm.h>
25 25
26#include <asm/dma.h> 26#include <asm/dma.h>
27#include <asm/mach-types.h>
27#include <asm/plat-sffsdr/sffsdr-fpga.h> 28#include <asm/plat-sffsdr/sffsdr-fpga.h>
28 29
29#include <mach/mcbsp.h> 30#include <mach/mcbsp.h>
@@ -115,6 +116,9 @@ static int __init sffsdr_init(void)
115{ 116{
116 int ret; 117 int ret;
117 118
119 if (!machine_is_sffsdr())
120 return -EINVAL;
121
118 sffsdr_snd_device = platform_device_alloc("soc-audio", 0); 122 sffsdr_snd_device = platform_device_alloc("soc-audio", 0);
119 if (!sffsdr_snd_device) { 123 if (!sffsdr_snd_device) {
120 printk(KERN_ERR "platform device allocation failed\n"); 124 printk(KERN_ERR "platform device allocation failed\n");
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index bcec3f60bad9..acf39a646b2f 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -183,16 +183,6 @@ static struct snd_soc_ops mpc8610_hpcd_ops = {
183}; 183};
184 184
185/** 185/**
186 * mpc8610_hpcd_machine: ASoC machine data
187 */
188static struct snd_soc_card mpc8610_hpcd_machine = {
189 .probe = mpc8610_hpcd_machine_probe,
190 .remove = mpc8610_hpcd_machine_remove,
191 .name = "MPC8610 HPCD",
192 .num_links = 1,
193};
194
195/**
196 * mpc8610_hpcd_probe: OF probe function for the fabric driver 186 * mpc8610_hpcd_probe: OF probe function for the fabric driver
197 * 187 *
198 * This function gets called when an SSI node is found in the device tree. 188 * This function gets called when an SSI node is found in the device tree.
@@ -455,7 +445,11 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
455 machine_data->dai.codec_dai = &cs4270_dai; /* The codec_dai we want */ 445 machine_data->dai.codec_dai = &cs4270_dai; /* The codec_dai we want */
456 machine_data->dai.ops = &mpc8610_hpcd_ops; 446 machine_data->dai.ops = &mpc8610_hpcd_ops;
457 447
458 mpc8610_hpcd_machine.dai_link = &machine_data->dai; 448 machine_data->machine.probe = mpc8610_hpcd_machine_probe;
449 machine_data->machine.remove = mpc8610_hpcd_machine_remove;
450 machine_data->machine.name = "MPC8610 HPCD";
451 machine_data->machine.num_links = 1;
452 machine_data->machine.dai_link = &machine_data->dai;
459 453
460 /* Allocate a new audio platform device structure */ 454 /* Allocate a new audio platform device structure */
461 sound_device = platform_device_alloc("soc-audio", -1); 455 sound_device = platform_device_alloc("soc-audio", -1);
@@ -465,7 +459,7 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
465 goto error; 459 goto error;
466 } 460 }
467 461
468 machine_data->sound_devdata.card = &mpc8610_hpcd_machine; 462 machine_data->sound_devdata.card = &machine_data->machine;
469 machine_data->sound_devdata.codec_dev = &soc_codec_device_cs4270; 463 machine_data->sound_devdata.codec_dev = &soc_codec_device_cs4270;
470 machine_data->machine.platform = &fsl_soc_platform; 464 machine_data->machine.platform = &fsl_soc_platform;
471 465
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index a7b1d77b2105..4f7f04014585 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -10,6 +10,7 @@ config SND_OMAP_SOC_N810
10 tristate "SoC Audio support for Nokia N810" 10 tristate "SoC Audio support for Nokia N810"
11 depends on SND_OMAP_SOC && MACH_NOKIA_N810 11 depends on SND_OMAP_SOC && MACH_NOKIA_N810
12 select SND_OMAP_SOC_MCBSP 12 select SND_OMAP_SOC_MCBSP
13 select OMAP_MUX
13 select SND_SOC_TLV320AIC3X 14 select SND_SOC_TLV320AIC3X
14 help 15 help
15 Say Y if you want to add support for SoC audio on Nokia N810. 16 Say Y if you want to add support for SoC audio on Nokia N810.
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index ec5e18a78758..05dd5abcddf4 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -302,6 +302,10 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
302 regs->spcr1 |= RINTM(3); 302 regs->spcr1 |= RINTM(3);
303 regs->rcr2 |= RFIG; 303 regs->rcr2 |= RFIG;
304 regs->xcr2 |= XFIG; 304 regs->xcr2 |= XFIG;
305 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
306 regs->xccr = DXENDLY(1) | XDMAEN;
307 regs->rccr = RFULL_CYCLE | RDMAEN;
308 }
305 309
306 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 310 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
307 case SND_SOC_DAIFMT_I2S: 311 case SND_SOC_DAIFMT_I2S:
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index b0362dfd5b71..dd3bb2933762 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -175,9 +175,10 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
175{ 175{
176 struct snd_pcm_runtime *runtime = substream->runtime; 176 struct snd_pcm_runtime *runtime = substream->runtime;
177 struct omap_runtime_data *prtd = runtime->private_data; 177 struct omap_runtime_data *prtd = runtime->private_data;
178 unsigned long flags;
178 int ret = 0; 179 int ret = 0;
179 180
180 spin_lock_irq(&prtd->lock); 181 spin_lock_irqsave(&prtd->lock, flags);
181 switch (cmd) { 182 switch (cmd) {
182 case SNDRV_PCM_TRIGGER_START: 183 case SNDRV_PCM_TRIGGER_START:
183 case SNDRV_PCM_TRIGGER_RESUME: 184 case SNDRV_PCM_TRIGGER_RESUME:
@@ -195,7 +196,7 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
195 default: 196 default:
196 ret = -EINVAL; 197 ret = -EINVAL;
197 } 198 }
198 spin_unlock_irq(&prtd->lock); 199 spin_unlock_irqrestore(&prtd->lock, flags);
199 200
200 return ret; 201 return ret;
201} 202}
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index bd91594496b1..fcc2f5d9a878 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -180,6 +180,19 @@ static int omap3pandora_in_init(struct snd_soc_codec *codec)
180{ 180{
181 int ret; 181 int ret;
182 182
183 /* All TWL4030 output pins are floating */
184 snd_soc_dapm_nc_pin(codec, "OUTL"),
185 snd_soc_dapm_nc_pin(codec, "OUTR"),
186 snd_soc_dapm_nc_pin(codec, "EARPIECE"),
187 snd_soc_dapm_nc_pin(codec, "PREDRIVEL"),
188 snd_soc_dapm_nc_pin(codec, "PREDRIVER"),
189 snd_soc_dapm_nc_pin(codec, "HSOL"),
190 snd_soc_dapm_nc_pin(codec, "HSOR"),
191 snd_soc_dapm_nc_pin(codec, "CARKITL"),
192 snd_soc_dapm_nc_pin(codec, "CARKITR"),
193 snd_soc_dapm_nc_pin(codec, "HFL"),
194 snd_soc_dapm_nc_pin(codec, "HFR"),
195
183 ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, 196 ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets,
184 ARRAY_SIZE(omap3pandora_in_dapm_widgets)); 197 ARRAY_SIZE(omap3pandora_in_dapm_widgets));
185 if (ret < 0) 198 if (ret < 0)
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index c670d08e7c9e..53b9fb127a6d 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -61,9 +61,9 @@ static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream)
61 61
62 __pxa2xx_pcm_hw_free(substream); 62 __pxa2xx_pcm_hw_free(substream);
63 63
64 if (prtd->dma_ch) { 64 if (prtd->dma_ch >= 0) {
65 pxa_free_dma(prtd->dma_ch); 65 pxa_free_dma(prtd->dma_ch);
66 prtd->dma_ch = 0; 66 prtd->dma_ch = -1;
67 } 67 }
68 68
69 return 0; 69 return 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b098c0b4c584..55fdb4abb179 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1300,6 +1300,8 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits);
1300/** 1300/**
1301 * snd_soc_new_pcms - create new sound card and pcms 1301 * snd_soc_new_pcms - create new sound card and pcms
1302 * @socdev: the SoC audio device 1302 * @socdev: the SoC audio device
1303 * @idx: ALSA card index
1304 * @xid: card identification
1303 * 1305 *
1304 * Create a new sound card based upon the codec and interface pcms. 1306 * Create a new sound card based upon the codec and interface pcms.
1305 * 1307 *
@@ -1472,7 +1474,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams);
1472 * snd_soc_cnew - create new control 1474 * snd_soc_cnew - create new control
1473 * @_template: control template 1475 * @_template: control template
1474 * @data: control private data 1476 * @data: control private data
1475 * @lnng_name: control long name 1477 * @long_name: control long name
1476 * 1478 *
1477 * Create a new mixer control from a template control. 1479 * Create a new mixer control from a template control.
1478 * 1480 *
@@ -1522,7 +1524,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
1522/** 1524/**
1523 * snd_soc_get_enum_double - enumerated double mixer get callback 1525 * snd_soc_get_enum_double - enumerated double mixer get callback
1524 * @kcontrol: mixer control 1526 * @kcontrol: mixer control
1525 * @uinfo: control element information 1527 * @ucontrol: control element information
1526 * 1528 *
1527 * Callback to get the value of a double enumerated mixer. 1529 * Callback to get the value of a double enumerated mixer.
1528 * 1530 *
@@ -1551,7 +1553,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double);
1551/** 1553/**
1552 * snd_soc_put_enum_double - enumerated double mixer put callback 1554 * snd_soc_put_enum_double - enumerated double mixer put callback
1553 * @kcontrol: mixer control 1555 * @kcontrol: mixer control
1554 * @uinfo: control element information 1556 * @ucontrol: control element information
1555 * 1557 *
1556 * Callback to set the value of a double enumerated mixer. 1558 * Callback to set the value of a double enumerated mixer.
1557 * 1559 *
@@ -1583,6 +1585,80 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
1583EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); 1585EXPORT_SYMBOL_GPL(snd_soc_put_enum_double);
1584 1586
1585/** 1587/**
1588 * snd_soc_get_value_enum_double - semi enumerated double mixer get callback
1589 * @kcontrol: mixer control
1590 * @ucontrol: control element information
1591 *
1592 * Callback to get the value of a double semi enumerated mixer.
1593 *
1594 * Semi enumerated mixer: the enumerated items are referred as values. Can be
1595 * used for handling bitfield coded enumeration for example.
1596 *
1597 * Returns 0 for success.
1598 */
1599int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
1600 struct snd_ctl_elem_value *ucontrol)
1601{
1602 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1603 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1604 unsigned short reg_val, val, mux;
1605
1606 reg_val = snd_soc_read(codec, e->reg);
1607 val = (reg_val >> e->shift_l) & e->mask;
1608 for (mux = 0; mux < e->max; mux++) {
1609 if (val == e->values[mux])
1610 break;
1611 }
1612 ucontrol->value.enumerated.item[0] = mux;
1613 if (e->shift_l != e->shift_r) {
1614 val = (reg_val >> e->shift_r) & e->mask;
1615 for (mux = 0; mux < e->max; mux++) {
1616 if (val == e->values[mux])
1617 break;
1618 }
1619 ucontrol->value.enumerated.item[1] = mux;
1620 }
1621
1622 return 0;
1623}
1624EXPORT_SYMBOL_GPL(snd_soc_get_value_enum_double);
1625
1626/**
1627 * snd_soc_put_value_enum_double - semi enumerated double mixer put callback
1628 * @kcontrol: mixer control
1629 * @ucontrol: control element information
1630 *
1631 * Callback to set the value of a double semi enumerated mixer.
1632 *
1633 * Semi enumerated mixer: the enumerated items are referred as values. Can be
1634 * used for handling bitfield coded enumeration for example.
1635 *
1636 * Returns 0 for success.
1637 */
1638int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
1639 struct snd_ctl_elem_value *ucontrol)
1640{
1641 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1642 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1643 unsigned short val;
1644 unsigned short mask;
1645
1646 if (ucontrol->value.enumerated.item[0] > e->max - 1)
1647 return -EINVAL;
1648 val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l;
1649 mask = e->mask << e->shift_l;
1650 if (e->shift_l != e->shift_r) {
1651 if (ucontrol->value.enumerated.item[1] > e->max - 1)
1652 return -EINVAL;
1653 val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r;
1654 mask |= e->mask << e->shift_r;
1655 }
1656
1657 return snd_soc_update_bits(codec, e->reg, mask, val);
1658}
1659EXPORT_SYMBOL_GPL(snd_soc_put_value_enum_double);
1660
1661/**
1586 * snd_soc_info_enum_ext - external enumerated single mixer info callback 1662 * snd_soc_info_enum_ext - external enumerated single mixer info callback
1587 * @kcontrol: mixer control 1663 * @kcontrol: mixer control
1588 * @uinfo: control element information 1664 * @uinfo: control element information
@@ -1668,7 +1744,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
1668/** 1744/**
1669 * snd_soc_get_volsw - single mixer get callback 1745 * snd_soc_get_volsw - single mixer get callback
1670 * @kcontrol: mixer control 1746 * @kcontrol: mixer control
1671 * @uinfo: control element information 1747 * @ucontrol: control element information
1672 * 1748 *
1673 * Callback to get the value of a single mixer control. 1749 * Callback to get the value of a single mixer control.
1674 * 1750 *
@@ -1707,7 +1783,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
1707/** 1783/**
1708 * snd_soc_put_volsw - single mixer put callback 1784 * snd_soc_put_volsw - single mixer put callback
1709 * @kcontrol: mixer control 1785 * @kcontrol: mixer control
1710 * @uinfo: control element information 1786 * @ucontrol: control element information
1711 * 1787 *
1712 * Callback to set the value of a single mixer control. 1788 * Callback to set the value of a single mixer control.
1713 * 1789 *
@@ -1775,7 +1851,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r);
1775/** 1851/**
1776 * snd_soc_get_volsw_2r - double mixer get callback 1852 * snd_soc_get_volsw_2r - double mixer get callback
1777 * @kcontrol: mixer control 1853 * @kcontrol: mixer control
1778 * @uinfo: control element information 1854 * @ucontrol: control element information
1779 * 1855 *
1780 * Callback to get the value of a double mixer control that spans 2 registers. 1856 * Callback to get the value of a double mixer control that spans 2 registers.
1781 * 1857 *
@@ -1812,7 +1888,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r);
1812/** 1888/**
1813 * snd_soc_put_volsw_2r - double mixer set callback 1889 * snd_soc_put_volsw_2r - double mixer set callback
1814 * @kcontrol: mixer control 1890 * @kcontrol: mixer control
1815 * @uinfo: control element information 1891 * @ucontrol: control element information
1816 * 1892 *
1817 * Callback to set the value of a double mixer control that spans 2 registers. 1893 * Callback to set the value of a double mixer control that spans 2 registers.
1818 * 1894 *
@@ -1882,7 +1958,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8);
1882/** 1958/**
1883 * snd_soc_get_volsw_s8 - signed mixer get callback 1959 * snd_soc_get_volsw_s8 - signed mixer get callback
1884 * @kcontrol: mixer control 1960 * @kcontrol: mixer control
1885 * @uinfo: control element information 1961 * @ucontrol: control element information
1886 * 1962 *
1887 * Callback to get the value of a signed mixer control. 1963 * Callback to get the value of a signed mixer control.
1888 * 1964 *
@@ -1909,7 +1985,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8);
1909/** 1985/**
1910 * snd_soc_put_volsw_sgn - signed mixer put callback 1986 * snd_soc_put_volsw_sgn - signed mixer put callback
1911 * @kcontrol: mixer control 1987 * @kcontrol: mixer control
1912 * @uinfo: control element information 1988 * @ucontrol: control element information
1913 * 1989 *
1914 * Callback to set the value of a signed mixer control. 1990 * Callback to set the value of a signed mixer control.
1915 * 1991 *
@@ -1954,7 +2030,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
1954/** 2030/**
1955 * snd_soc_dai_set_clkdiv - configure DAI clock dividers. 2031 * snd_soc_dai_set_clkdiv - configure DAI clock dividers.
1956 * @dai: DAI 2032 * @dai: DAI
1957 * @clk_id: DAI specific clock divider ID 2033 * @div_id: DAI specific clock divider ID
1958 * @div: new clock divisor. 2034 * @div: new clock divisor.
1959 * 2035 *
1960 * Configures the clock dividers. This is used to derive the best DAI bit and 2036 * Configures the clock dividers. This is used to derive the best DAI bit and
@@ -2060,7 +2136,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute);
2060/** 2136/**
2061 * snd_soc_register_card - Register a card with the ASoC core 2137 * snd_soc_register_card - Register a card with the ASoC core
2062 * 2138 *
2063 * @param card Card to register 2139 * @card: Card to register
2064 * 2140 *
2065 * Note that currently this is an internal only function: it will be 2141 * Note that currently this is an internal only function: it will be
2066 * exposed to machine drivers after further backporting of ASoC v2 2142 * exposed to machine drivers after further backporting of ASoC v2
@@ -2087,7 +2163,7 @@ static int snd_soc_register_card(struct snd_soc_card *card)
2087/** 2163/**
2088 * snd_soc_unregister_card - Unregister a card with the ASoC core 2164 * snd_soc_unregister_card - Unregister a card with the ASoC core
2089 * 2165 *
2090 * @param card Card to unregister 2166 * @card: Card to unregister
2091 * 2167 *
2092 * Note that currently this is an internal only function: it will be 2168 * Note that currently this is an internal only function: it will be
2093 * exposed to machine drivers after further backporting of ASoC v2 2169 * exposed to machine drivers after further backporting of ASoC v2
@@ -2107,7 +2183,7 @@ static int snd_soc_unregister_card(struct snd_soc_card *card)
2107/** 2183/**
2108 * snd_soc_register_dai - Register a DAI with the ASoC core 2184 * snd_soc_register_dai - Register a DAI with the ASoC core
2109 * 2185 *
2110 * @param dai DAI to register 2186 * @dai: DAI to register
2111 */ 2187 */
2112int snd_soc_register_dai(struct snd_soc_dai *dai) 2188int snd_soc_register_dai(struct snd_soc_dai *dai)
2113{ 2189{
@@ -2134,7 +2210,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dai);
2134/** 2210/**
2135 * snd_soc_unregister_dai - Unregister a DAI from the ASoC core 2211 * snd_soc_unregister_dai - Unregister a DAI from the ASoC core
2136 * 2212 *
2137 * @param dai DAI to unregister 2213 * @dai: DAI to unregister
2138 */ 2214 */
2139void snd_soc_unregister_dai(struct snd_soc_dai *dai) 2215void snd_soc_unregister_dai(struct snd_soc_dai *dai)
2140{ 2216{
@@ -2149,8 +2225,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai);
2149/** 2225/**
2150 * snd_soc_register_dais - Register multiple DAIs with the ASoC core 2226 * snd_soc_register_dais - Register multiple DAIs with the ASoC core
2151 * 2227 *
2152 * @param dai Array of DAIs to register 2228 * @dai: Array of DAIs to register
2153 * @param count Number of DAIs 2229 * @count: Number of DAIs
2154 */ 2230 */
2155int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) 2231int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count)
2156{ 2232{
@@ -2175,8 +2251,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dais);
2175/** 2251/**
2176 * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core 2252 * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core
2177 * 2253 *
2178 * @param dai Array of DAIs to unregister 2254 * @dai: Array of DAIs to unregister
2179 * @param count Number of DAIs 2255 * @count: Number of DAIs
2180 */ 2256 */
2181void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) 2257void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count)
2182{ 2258{
@@ -2190,7 +2266,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais);
2190/** 2266/**
2191 * snd_soc_register_platform - Register a platform with the ASoC core 2267 * snd_soc_register_platform - Register a platform with the ASoC core
2192 * 2268 *
2193 * @param platform platform to register 2269 * @platform: platform to register
2194 */ 2270 */
2195int snd_soc_register_platform(struct snd_soc_platform *platform) 2271int snd_soc_register_platform(struct snd_soc_platform *platform)
2196{ 2272{
@@ -2213,7 +2289,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform);
2213/** 2289/**
2214 * snd_soc_unregister_platform - Unregister a platform from the ASoC core 2290 * snd_soc_unregister_platform - Unregister a platform from the ASoC core
2215 * 2291 *
2216 * @param platform platform to unregister 2292 * @platform: platform to unregister
2217 */ 2293 */
2218void snd_soc_unregister_platform(struct snd_soc_platform *platform) 2294void snd_soc_unregister_platform(struct snd_soc_platform *platform)
2219{ 2295{
@@ -2228,7 +2304,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform);
2228/** 2304/**
2229 * snd_soc_register_codec - Register a codec with the ASoC core 2305 * snd_soc_register_codec - Register a codec with the ASoC core
2230 * 2306 *
2231 * @param codec codec to register 2307 * @codec: codec to register
2232 */ 2308 */
2233int snd_soc_register_codec(struct snd_soc_codec *codec) 2309int snd_soc_register_codec(struct snd_soc_codec *codec)
2234{ 2310{
@@ -2255,7 +2331,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec);
2255/** 2331/**
2256 * snd_soc_unregister_codec - Unregister a codec from the ASoC core 2332 * snd_soc_unregister_codec - Unregister a codec from the ASoC core
2257 * 2333 *
2258 * @param codec codec to unregister 2334 * @codec: codec to unregister
2259 */ 2335 */
2260void snd_soc_unregister_codec(struct snd_soc_codec *codec) 2336void snd_soc_unregister_codec(struct snd_soc_codec *codec)
2261{ 2337{
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8863eddbac02..a2f1da8b4646 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -53,13 +53,15 @@
53/* dapm power sequences - make this per codec in the future */ 53/* dapm power sequences - make this per codec in the future */
54static int dapm_up_seq[] = { 54static int dapm_up_seq[] = {
55 snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, 55 snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic,
56 snd_soc_dapm_mux, snd_soc_dapm_dac, snd_soc_dapm_mixer, snd_soc_dapm_pga, 56 snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_dac,
57 snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, snd_soc_dapm_post 57 snd_soc_dapm_mixer, snd_soc_dapm_pga, snd_soc_dapm_adc, snd_soc_dapm_hp,
58 snd_soc_dapm_spk, snd_soc_dapm_post
58}; 59};
59static int dapm_down_seq[] = { 60static int dapm_down_seq[] = {
60 snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, 61 snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk,
61 snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic, 62 snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic,
62 snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_post 63 snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_value_mux,
64 snd_soc_dapm_post
63}; 65};
64 66
65static int dapm_status = 1; 67static int dapm_status = 1;
@@ -134,6 +136,25 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
134 } 136 }
135 } 137 }
136 break; 138 break;
139 case snd_soc_dapm_value_mux: {
140 struct soc_enum *e = (struct soc_enum *)
141 w->kcontrols[i].private_value;
142 int val, item;
143
144 val = snd_soc_read(w->codec, e->reg);
145 val = (val >> e->shift_l) & e->mask;
146 for (item = 0; item < e->max; item++) {
147 if (val == e->values[item])
148 break;
149 }
150
151 p->connect = 0;
152 for (i = 0; i < e->max; i++) {
153 if (!(strcmp(p->name, e->texts[i])) && item == i)
154 p->connect = 1;
155 }
156 }
157 break;
137 /* does not effect routing - always connected */ 158 /* does not effect routing - always connected */
138 case snd_soc_dapm_pga: 159 case snd_soc_dapm_pga:
139 case snd_soc_dapm_output: 160 case snd_soc_dapm_output:
@@ -653,6 +674,7 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action)
653 case snd_soc_dapm_vmid: 674 case snd_soc_dapm_vmid:
654 continue; 675 continue;
655 case snd_soc_dapm_mux: 676 case snd_soc_dapm_mux:
677 case snd_soc_dapm_value_mux:
656 case snd_soc_dapm_output: 678 case snd_soc_dapm_output:
657 case snd_soc_dapm_input: 679 case snd_soc_dapm_input:
658 case snd_soc_dapm_switch: 680 case snd_soc_dapm_switch:
@@ -698,7 +720,8 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
698 struct snd_soc_dapm_path *path; 720 struct snd_soc_dapm_path *path;
699 int found = 0; 721 int found = 0;
700 722
701 if (widget->id != snd_soc_dapm_mux) 723 if (widget->id != snd_soc_dapm_mux &&
724 widget->id != snd_soc_dapm_value_mux)
702 return -ENODEV; 725 return -ENODEV;
703 726
704 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val)) 727 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val))
@@ -960,6 +983,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
960 path->connect = 1; 983 path->connect = 1;
961 return 0; 984 return 0;
962 case snd_soc_dapm_mux: 985 case snd_soc_dapm_mux:
986 case snd_soc_dapm_value_mux:
963 ret = dapm_connect_mux(codec, wsource, wsink, path, control, 987 ret = dapm_connect_mux(codec, wsource, wsink, path, control,
964 &wsink->kcontrols[0]); 988 &wsink->kcontrols[0]);
965 if (ret != 0) 989 if (ret != 0)
@@ -1047,6 +1071,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec)
1047 dapm_new_mixer(codec, w); 1071 dapm_new_mixer(codec, w);
1048 break; 1072 break;
1049 case snd_soc_dapm_mux: 1073 case snd_soc_dapm_mux:
1074 case snd_soc_dapm_value_mux:
1050 dapm_new_mux(codec, w); 1075 dapm_new_mux(codec, w);
1051 break; 1076 break;
1052 case snd_soc_dapm_adc: 1077 case snd_soc_dapm_adc:
@@ -1077,7 +1102,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
1077/** 1102/**
1078 * snd_soc_dapm_get_volsw - dapm mixer get callback 1103 * snd_soc_dapm_get_volsw - dapm mixer get callback
1079 * @kcontrol: mixer control 1104 * @kcontrol: mixer control
1080 * @uinfo: control element information 1105 * @ucontrol: control element information
1081 * 1106 *
1082 * Callback to get the value of a dapm mixer control. 1107 * Callback to get the value of a dapm mixer control.
1083 * 1108 *
@@ -1122,7 +1147,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
1122/** 1147/**
1123 * snd_soc_dapm_put_volsw - dapm mixer set callback 1148 * snd_soc_dapm_put_volsw - dapm mixer set callback
1124 * @kcontrol: mixer control 1149 * @kcontrol: mixer control
1125 * @uinfo: control element information 1150 * @ucontrol: control element information
1126 * 1151 *
1127 * Callback to set the value of a dapm mixer control. 1152 * Callback to set the value of a dapm mixer control.
1128 * 1153 *
@@ -1193,7 +1218,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
1193/** 1218/**
1194 * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback 1219 * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback
1195 * @kcontrol: mixer control 1220 * @kcontrol: mixer control
1196 * @uinfo: control element information 1221 * @ucontrol: control element information
1197 * 1222 *
1198 * Callback to get the value of a dapm enumerated double mixer control. 1223 * Callback to get the value of a dapm enumerated double mixer control.
1199 * 1224 *
@@ -1221,7 +1246,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
1221/** 1246/**
1222 * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback 1247 * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback
1223 * @kcontrol: mixer control 1248 * @kcontrol: mixer control
1224 * @uinfo: control element information 1249 * @ucontrol: control element information
1225 * 1250 *
1226 * Callback to set the value of a dapm enumerated double mixer control. 1251 * Callback to set the value of a dapm enumerated double mixer control.
1227 * 1252 *
@@ -1274,6 +1299,103 @@ out:
1274EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double); 1299EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double);
1275 1300
1276/** 1301/**
1302 * snd_soc_dapm_get_value_enum_double - dapm semi enumerated double mixer get
1303 * callback
1304 * @kcontrol: mixer control
1305 * @ucontrol: control element information
1306 *
1307 * Callback to get the value of a dapm semi enumerated double mixer control.
1308 *
1309 * Semi enumerated mixer: the enumerated items are referred as values. Can be
1310 * used for handling bitfield coded enumeration for example.
1311 *
1312 * Returns 0 for success.
1313 */
1314int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
1315 struct snd_ctl_elem_value *ucontrol)
1316{
1317 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
1318 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1319 unsigned short reg_val, val, mux;
1320
1321 reg_val = snd_soc_read(widget->codec, e->reg);
1322 val = (reg_val >> e->shift_l) & e->mask;
1323 for (mux = 0; mux < e->max; mux++) {
1324 if (val == e->values[mux])
1325 break;
1326 }
1327 ucontrol->value.enumerated.item[0] = mux;
1328 if (e->shift_l != e->shift_r) {
1329 val = (reg_val >> e->shift_r) & e->mask;
1330 for (mux = 0; mux < e->max; mux++) {
1331 if (val == e->values[mux])
1332 break;
1333 }
1334 ucontrol->value.enumerated.item[1] = mux;
1335 }
1336
1337 return 0;
1338}
1339EXPORT_SYMBOL_GPL(snd_soc_dapm_get_value_enum_double);
1340
1341/**
1342 * snd_soc_dapm_put_value_enum_double - dapm semi enumerated double mixer set
1343 * callback
1344 * @kcontrol: mixer control
1345 * @ucontrol: control element information
1346 *
1347 * Callback to set the value of a dapm semi enumerated double mixer control.
1348 *
1349 * Semi enumerated mixer: the enumerated items are referred as values. Can be
1350 * used for handling bitfield coded enumeration for example.
1351 *
1352 * Returns 0 for success.
1353 */
1354int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
1355 struct snd_ctl_elem_value *ucontrol)
1356{
1357 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
1358 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1359 unsigned short val, mux;
1360 unsigned short mask;
1361 int ret = 0;
1362
1363 if (ucontrol->value.enumerated.item[0] > e->max - 1)
1364 return -EINVAL;
1365 mux = ucontrol->value.enumerated.item[0];
1366 val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l;
1367 mask = e->mask << e->shift_l;
1368 if (e->shift_l != e->shift_r) {
1369 if (ucontrol->value.enumerated.item[1] > e->max - 1)
1370 return -EINVAL;
1371 val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r;
1372 mask |= e->mask << e->shift_r;
1373 }
1374
1375 mutex_lock(&widget->codec->mutex);
1376 widget->value = val;
1377 dapm_mux_update_power(widget, kcontrol, mask, mux, val, e);
1378 if (widget->event) {
1379 if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
1380 ret = widget->event(widget,
1381 kcontrol, SND_SOC_DAPM_PRE_REG);
1382 if (ret < 0)
1383 goto out;
1384 }
1385 ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
1386 if (widget->event_flags & SND_SOC_DAPM_POST_REG)
1387 ret = widget->event(widget,
1388 kcontrol, SND_SOC_DAPM_POST_REG);
1389 } else
1390 ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
1391
1392out:
1393 mutex_unlock(&widget->codec->mutex);
1394 return ret;
1395}
1396EXPORT_SYMBOL_GPL(snd_soc_dapm_put_value_enum_double);
1397
1398/**
1277 * snd_soc_dapm_new_control - create new dapm control 1399 * snd_soc_dapm_new_control - create new dapm control
1278 * @codec: audio codec 1400 * @codec: audio codec
1279 * @widget: widget template 1401 * @widget: widget template
@@ -1419,7 +1541,7 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
1419 1541
1420/** 1542/**
1421 * snd_soc_dapm_enable_pin - enable pin. 1543 * snd_soc_dapm_enable_pin - enable pin.
1422 * @snd_soc_codec: SoC codec 1544 * @codec: SoC codec
1423 * @pin: pin name 1545 * @pin: pin name
1424 * 1546 *
1425 * Enables input/output pin and it's parents or children widgets iff there is 1547 * Enables input/output pin and it's parents or children widgets iff there is
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index d44bf98e965e..41c387587474 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -2057,7 +2057,7 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_dev
2057 if (err) 2057 if (err)
2058 return err; 2058 return err;
2059 2059
2060 sprintf(card->longname, "%s at 0x%lx, irq %d", 2060 sprintf(card->longname, "%s at 0x%llx, irq %d",
2061 card->shortname, 2061 card->shortname,
2062 op->resource[0].start, 2062 op->resource[0].start,
2063 op->irqs[0]); 2063 op->irqs[0]);
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c
index b143ef7152f7..41c36b055f6b 100644
--- a/sound/usb/caiaq/caiaq-device.c
+++ b/sound/usb/caiaq/caiaq-device.c
@@ -42,7 +42,7 @@
42#endif 42#endif
43 43
44MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); 44MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
45MODULE_DESCRIPTION("caiaq USB audio, version 1.3.9"); 45MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10");
46MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
47MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," 47MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
48 "{Native Instruments, RigKontrol3}," 48 "{Native Instruments, RigKontrol3},"
@@ -446,7 +446,7 @@ static int __devinit snd_probe(struct usb_interface *intf,
446 if (!card) 446 if (!card)
447 return -ENOMEM; 447 return -ENOMEM;
448 448
449 dev_set_drvdata(&intf->dev, card); 449 usb_set_intfdata(intf, card);
450 ret = init_card(caiaqdev(card)); 450 ret = init_card(caiaqdev(card));
451 if (ret < 0) { 451 if (ret < 0) {
452 log("unable to init card! (ret=%d)\n", ret); 452 log("unable to init card! (ret=%d)\n", ret);
@@ -460,7 +460,7 @@ static int __devinit snd_probe(struct usb_interface *intf,
460static void snd_disconnect(struct usb_interface *intf) 460static void snd_disconnect(struct usb_interface *intf)
461{ 461{
462 struct snd_usb_caiaqdev *dev; 462 struct snd_usb_caiaqdev *dev;
463 struct snd_card *card = dev_get_drvdata(&intf->dev); 463 struct snd_card *card = usb_get_intfdata(intf);
464 464
465 debug("%s(%p)\n", __func__, intf); 465 debug("%s(%p)\n", __func__, intf);
466 466
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h
index f9fbdbae269d..ab56e738c5fc 100644
--- a/sound/usb/caiaq/caiaq-device.h
+++ b/sound/usb/caiaq/caiaq-device.h
@@ -75,6 +75,7 @@ struct snd_usb_caiaqdev {
75 wait_queue_head_t ep1_wait_queue; 75 wait_queue_head_t ep1_wait_queue;
76 wait_queue_head_t prepare_wait_queue; 76 wait_queue_head_t prepare_wait_queue;
77 int spec_received, audio_parm_answer; 77 int spec_received, audio_parm_answer;
78 int midi_out_active;
78 79
79 char vendor_name[CAIAQ_USB_STR_LEN]; 80 char vendor_name[CAIAQ_USB_STR_LEN];
80 char product_name[CAIAQ_USB_STR_LEN]; 81 char product_name[CAIAQ_USB_STR_LEN];
diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/caiaq-midi.c
index 30b57f97c6e4..f19fd360c936 100644
--- a/sound/usb/caiaq/caiaq-midi.c
+++ b/sound/usb/caiaq/caiaq-midi.c
@@ -59,6 +59,11 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea
59 59
60static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) 60static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream)
61{ 61{
62 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data;
63 if (dev->midi_out_active) {
64 usb_kill_urb(&dev->midi_out_urb);
65 dev->midi_out_active = 0;
66 }
62 return 0; 67 return 0;
63} 68}
64 69
@@ -69,7 +74,8 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev,
69 74
70 dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; 75 dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE;
71 dev->midi_out_buf[1] = 0; /* port */ 76 dev->midi_out_buf[1] = 0; /* port */
72 len = snd_rawmidi_transmit_peek(substream, dev->midi_out_buf+3, EP1_BUFSIZE-3); 77 len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3,
78 EP1_BUFSIZE - 3);
73 79
74 if (len <= 0) 80 if (len <= 0)
75 return; 81 return;
@@ -79,24 +85,24 @@ static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev,
79 85
80 ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); 86 ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC);
81 if (ret < 0) 87 if (ret < 0)
82 log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed, %d\n", 88 log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed,"
83 substream, ret); 89 "ret=%d, len=%d\n",
90 substream, ret, len);
91 else
92 dev->midi_out_active = 1;
84} 93}
85 94
86static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) 95static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
87{ 96{
88 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; 97 struct snd_usb_caiaqdev *dev = substream->rmidi->private_data;
89 98
90 if (dev->midi_out_substream != NULL) 99 if (up) {
91 return; 100 dev->midi_out_substream = substream;
92 101 if (!dev->midi_out_active)
93 if (!up) { 102 snd_usb_caiaq_midi_send(dev, substream);
103 } else {
94 dev->midi_out_substream = NULL; 104 dev->midi_out_substream = NULL;
95 return;
96 } 105 }
97
98 dev->midi_out_substream = substream;
99 snd_usb_caiaq_midi_send(dev, substream);
100} 106}
101 107
102 108
@@ -161,16 +167,14 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
161void snd_usb_caiaq_midi_output_done(struct urb* urb) 167void snd_usb_caiaq_midi_output_done(struct urb* urb)
162{ 168{
163 struct snd_usb_caiaqdev *dev = urb->context; 169 struct snd_usb_caiaqdev *dev = urb->context;
164 char *buf = urb->transfer_buffer;
165 170
171 dev->midi_out_active = 0;
166 if (urb->status != 0) 172 if (urb->status != 0)
167 return; 173 return;
168 174
169 if (!dev->midi_out_substream) 175 if (!dev->midi_out_substream)
170 return; 176 return;
171 177
172 snd_rawmidi_transmit_ack(dev->midi_out_substream, buf[2]);
173 dev->midi_out_substream = NULL;
174 snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); 178 snd_usb_caiaq_midi_send(dev, dev->midi_out_substream);
175} 179}
176 180
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index bbd70d5814a0..c709b9563226 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -3709,7 +3709,7 @@ static int usb_audio_probe(struct usb_interface *intf,
3709 void *chip; 3709 void *chip;
3710 chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); 3710 chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id);
3711 if (chip) { 3711 if (chip) {
3712 dev_set_drvdata(&intf->dev, chip); 3712 usb_set_intfdata(intf, chip);
3713 return 0; 3713 return 0;
3714 } else 3714 } else
3715 return -EIO; 3715 return -EIO;
@@ -3718,13 +3718,13 @@ static int usb_audio_probe(struct usb_interface *intf,
3718static void usb_audio_disconnect(struct usb_interface *intf) 3718static void usb_audio_disconnect(struct usb_interface *intf)
3719{ 3719{
3720 snd_usb_audio_disconnect(interface_to_usbdev(intf), 3720 snd_usb_audio_disconnect(interface_to_usbdev(intf),
3721 dev_get_drvdata(&intf->dev)); 3721 usb_get_intfdata(intf));
3722} 3722}
3723 3723
3724#ifdef CONFIG_PM 3724#ifdef CONFIG_PM
3725static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) 3725static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
3726{ 3726{
3727 struct snd_usb_audio *chip = dev_get_drvdata(&intf->dev); 3727 struct snd_usb_audio *chip = usb_get_intfdata(intf);
3728 struct list_head *p; 3728 struct list_head *p;
3729 struct snd_usb_stream *as; 3729 struct snd_usb_stream *as;
3730 3730
@@ -3744,7 +3744,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
3744 3744
3745static int usb_audio_resume(struct usb_interface *intf) 3745static int usb_audio_resume(struct usb_interface *intf)
3746{ 3746{
3747 struct snd_usb_audio *chip = dev_get_drvdata(&intf->dev); 3747 struct snd_usb_audio *chip = usb_get_intfdata(intf);
3748 3748
3749 if (chip == (void *)-1L) 3749 if (chip == (void *)-1L)
3750 return 0; 3750 return 0;
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 6d9f9b135c62..320641ab5be7 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -1392,8 +1392,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1392 for (i = 0; i < intfd->bNumEndpoints; ++i) { 1392 for (i = 0; i < intfd->bNumEndpoints; ++i) {
1393 hostep = &hostif->endpoint[i]; 1393 hostep = &hostif->endpoint[i];
1394 ep = get_ep_desc(hostep); 1394 ep = get_ep_desc(hostep);
1395 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && 1395 if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep))
1396 (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
1397 continue; 1396 continue;
1398 ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; 1397 ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra;
1399 if (hostep->extralen < 4 || 1398 if (hostep->extralen < 4 ||
@@ -1401,15 +1400,15 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1401 ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || 1400 ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT ||
1402 ms_ep->bDescriptorSubtype != MS_GENERAL) 1401 ms_ep->bDescriptorSubtype != MS_GENERAL)
1403 continue; 1402 continue;
1404 if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { 1403 if (usb_endpoint_dir_out(ep)) {
1405 if (endpoints[epidx].out_ep) { 1404 if (endpoints[epidx].out_ep) {
1406 if (++epidx >= MIDI_MAX_ENDPOINTS) { 1405 if (++epidx >= MIDI_MAX_ENDPOINTS) {
1407 snd_printk(KERN_WARNING "too many endpoints\n"); 1406 snd_printk(KERN_WARNING "too many endpoints\n");
1408 break; 1407 break;
1409 } 1408 }
1410 } 1409 }
1411 endpoints[epidx].out_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1410 endpoints[epidx].out_ep = usb_endpoint_num(ep);
1412 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1411 if (usb_endpoint_xfer_int(ep))
1413 endpoints[epidx].out_interval = ep->bInterval; 1412 endpoints[epidx].out_interval = ep->bInterval;
1414 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) 1413 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW)
1415 /* 1414 /*
@@ -1428,8 +1427,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1428 break; 1427 break;
1429 } 1428 }
1430 } 1429 }
1431 endpoints[epidx].in_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1430 endpoints[epidx].in_ep = usb_endpoint_num(ep);
1432 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1431 if (usb_endpoint_xfer_int(ep))
1433 endpoints[epidx].in_interval = ep->bInterval; 1432 endpoints[epidx].in_interval = ep->bInterval;
1434 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) 1433 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW)
1435 endpoints[epidx].in_interval = 1; 1434 endpoints[epidx].in_interval = 1;
@@ -1495,20 +1494,20 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi,
1495 1494
1496 for (i = 0; i < intfd->bNumEndpoints; ++i) { 1495 for (i = 0; i < intfd->bNumEndpoints; ++i) {
1497 epd = get_endpoint(hostif, i); 1496 epd = get_endpoint(hostif, i);
1498 if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && 1497 if (!usb_endpoint_xfer_bulk(epd) &&
1499 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) 1498 !usb_endpoint_xfer_int(epd))
1500 continue; 1499 continue;
1501 if (out_eps < max_endpoints && 1500 if (out_eps < max_endpoints &&
1502 (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { 1501 usb_endpoint_dir_out(epd)) {
1503 endpoint[out_eps].out_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1502 endpoint[out_eps].out_ep = usb_endpoint_num(epd);
1504 if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1503 if (usb_endpoint_xfer_int(epd))
1505 endpoint[out_eps].out_interval = epd->bInterval; 1504 endpoint[out_eps].out_interval = epd->bInterval;
1506 ++out_eps; 1505 ++out_eps;
1507 } 1506 }
1508 if (in_eps < max_endpoints && 1507 if (in_eps < max_endpoints &&
1509 (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) { 1508 usb_endpoint_dir_in(epd)) {
1510 endpoint[in_eps].in_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1509 endpoint[in_eps].in_ep = usb_endpoint_num(epd);
1511 if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1510 if (usb_endpoint_xfer_int(epd))
1512 endpoint[in_eps].in_interval = epd->bInterval; 1511 endpoint[in_eps].in_interval = epd->bInterval;
1513 ++in_eps; 1512 ++in_eps;
1514 } 1513 }
@@ -1607,21 +1606,19 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
1607 } 1606 }
1608 1607
1609 epd = get_endpoint(hostif, 0); 1608 epd = get_endpoint(hostif, 0);
1610 if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || 1609 if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) {
1611 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) {
1612 snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); 1610 snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n");
1613 return -ENXIO; 1611 return -ENXIO;
1614 } 1612 }
1615 epd = get_endpoint(hostif, 2); 1613 epd = get_endpoint(hostif, 2);
1616 if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || 1614 if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) {
1617 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) {
1618 snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); 1615 snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n");
1619 return -ENXIO; 1616 return -ENXIO;
1620 } 1617 }
1621 if (endpoint->out_cables > 0x0001) { 1618 if (endpoint->out_cables > 0x0001) {
1622 epd = get_endpoint(hostif, 4); 1619 epd = get_endpoint(hostif, 4);
1623 if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || 1620 if (!usb_endpoint_dir_out(epd) ||
1624 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { 1621 !usb_endpoint_xfer_bulk(epd)) {
1625 snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); 1622 snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n");
1626 return -ENXIO; 1623 return -ENXIO;
1627 } 1624 }
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index a49246113e75..00397c8a765b 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1755,11 +1755,10 @@ static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
1755 if (get_iface_desc(hostif)->bNumEndpoints < 1) 1755 if (get_iface_desc(hostif)->bNumEndpoints < 1)
1756 return 0; 1756 return 0;
1757 ep = get_endpoint(hostif, 0); 1757 ep = get_endpoint(hostif, 0);
1758 if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || 1758 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
1759 (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
1760 return 0; 1759 return 0;
1761 1760
1762 epnum = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1761 epnum = usb_endpoint_num(ep);
1763 buffer_length = le16_to_cpu(ep->wMaxPacketSize); 1762 buffer_length = le16_to_cpu(ep->wMaxPacketSize);
1764 transfer_buffer = kmalloc(buffer_length, GFP_KERNEL); 1763 transfer_buffer = kmalloc(buffer_length, GFP_KERNEL);
1765 if (!transfer_buffer) 1764 if (!transfer_buffer)
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 92115755d98e..5d8ef09b9dcc 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -128,6 +128,14 @@
128 .bInterfaceClass = USB_CLASS_AUDIO, 128 .bInterfaceClass = USB_CLASS_AUDIO,
129 .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL 129 .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
130}, 130},
131{
132 USB_DEVICE(0x046d, 0x0990),
133 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
134 .vendor_name = "Logitech, Inc.",
135 .product_name = "QuickCam Pro 9000",
136 .ifnum = QUIRK_NO_INTERFACE
137 }
138},
131 139
132/* 140/*
133 * Yamaha devices 141 * Yamaha devices
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index c2515b680f9f..73e59f4403a4 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -589,7 +589,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
589 struct us122l *us122l; 589 struct us122l *us122l;
590 struct list_head *p; 590 struct list_head *p;
591 591
592 card = dev_get_drvdata(&intf->dev); 592 card = usb_get_intfdata(intf);
593 if (!card) 593 if (!card)
594 return 0; 594 return 0;
595 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 595 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -615,7 +615,7 @@ static int snd_us122l_resume(struct usb_interface *intf)
615 struct list_head *p; 615 struct list_head *p;
616 int err; 616 int err;
617 617
618 card = dev_get_drvdata(&intf->dev); 618 card = usb_get_intfdata(intf);
619 if (!card) 619 if (!card)
620 return 0; 620 return 0;
621 621
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index e5981a630314..11639bd72a51 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -238,7 +238,7 @@ static void i_usX2Y_In04Int(struct urb *urb)
238 send = 0; 238 send = 0;
239 for (j = 0; j < URBS_AsyncSeq && !err; ++j) 239 for (j = 0; j < URBS_AsyncSeq && !err; ++j)
240 if (0 == usX2Y->AS04.urb[j]->status) { 240 if (0 == usX2Y->AS04.urb[j]->status) {
241 struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. 241 struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost.
242 usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, 242 usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev,
243 usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, 243 usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol,
244 p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, 244 p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5,
@@ -392,7 +392,7 @@ static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_i
392 void *chip; 392 void *chip;
393 chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); 393 chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id);
394 if (chip) { 394 if (chip) {
395 dev_set_drvdata(&intf->dev, chip); 395 usb_set_intfdata(intf, chip);
396 return 0; 396 return 0;
397 } else 397 } else
398 return -EIO; 398 return -EIO;
@@ -401,7 +401,7 @@ static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_i
401static void snd_usX2Y_disconnect(struct usb_interface *intf) 401static void snd_usX2Y_disconnect(struct usb_interface *intf)
402{ 402{
403 usX2Y_usb_disconnect(interface_to_usbdev(intf), 403 usX2Y_usb_disconnect(interface_to_usbdev(intf),
404 dev_get_drvdata(&intf->dev)); 404 usb_get_intfdata(intf));
405} 405}
406 406
407MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table); 407MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table);