aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/fabrics/layout.c2
-rw-r--r--sound/core/pcm_lib.c33
-rw-r--r--sound/core/timer.c5
-rw-r--r--sound/oss/pas2_pcm.c8
-rw-r--r--sound/oss/pss.c6
-rw-r--r--sound/pci/Kconfig10
-rw-r--r--sound/pci/ac97/ac97_patch.c1
-rw-r--r--sound/pci/asihpi/hpicmn.c5
-rw-r--r--sound/pci/azt3328.c11
-rw-r--r--sound/pci/fm801.c15
-rw-r--r--sound/pci/hda/alc268_quirks.c36
-rw-r--r--sound/pci/hda/alc269_quirks.c7
-rw-r--r--sound/pci/hda/hda_codec.c6
-rw-r--r--sound/pci/hda/hda_eld.c31
-rw-r--r--sound/pci/hda/patch_cirrus.c10
-rw-r--r--sound/pci/hda/patch_conexant.c57
-rw-r--r--sound/pci/hda/patch_realtek.c65
-rw-r--r--sound/pci/hda/patch_sigmatel.c3
-rw-r--r--sound/pci/hda/patch_via.c2
-rw-r--r--sound/pci/rme9652/hdspm.c19
-rw-r--r--sound/usb/caiaq/audio.c37
-rw-r--r--sound/usb/caiaq/device.h1
-rw-r--r--sound/usb/caiaq/input.c2
-rw-r--r--sound/usb/card.c1
-rw-r--r--sound/usb/endpoint.c2
-rw-r--r--sound/usb/mixer.c28
-rw-r--r--sound/usb/mixer.h1
-rw-r--r--sound/usb/quirks-table.h40
-rw-r--r--sound/usb/quirks.c2
29 files changed, 306 insertions, 140 deletions
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index 3fd1a7e24928..552b97afbca5 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -1073,10 +1073,10 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
1073 sdev->pcmid = -1; 1073 sdev->pcmid = -1;
1074 list_del(&ldev->list); 1074 list_del(&ldev->list);
1075 layouts_list_items--; 1075 layouts_list_items--;
1076 kfree(ldev);
1076 outnodev: 1077 outnodev:
1077 of_node_put(sound); 1078 of_node_put(sound);
1078 layout_device = NULL; 1079 layout_device = NULL;
1079 kfree(ldev);
1080 return -ENODEV; 1080 return -ENODEV;
1081} 1081}
1082 1082
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 86d0caf91b35..62e90b862a0d 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1761,6 +1761,10 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
1761 snd_pcm_uframes_t avail = 0; 1761 snd_pcm_uframes_t avail = 0;
1762 long wait_time, tout; 1762 long wait_time, tout;
1763 1763
1764 init_waitqueue_entry(&wait, current);
1765 set_current_state(TASK_INTERRUPTIBLE);
1766 add_wait_queue(&runtime->tsleep, &wait);
1767
1764 if (runtime->no_period_wakeup) 1768 if (runtime->no_period_wakeup)
1765 wait_time = MAX_SCHEDULE_TIMEOUT; 1769 wait_time = MAX_SCHEDULE_TIMEOUT;
1766 else { 1770 else {
@@ -1771,16 +1775,32 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
1771 } 1775 }
1772 wait_time = msecs_to_jiffies(wait_time * 1000); 1776 wait_time = msecs_to_jiffies(wait_time * 1000);
1773 } 1777 }
1774 init_waitqueue_entry(&wait, current); 1778
1775 add_wait_queue(&runtime->tsleep, &wait);
1776 for (;;) { 1779 for (;;) {
1777 if (signal_pending(current)) { 1780 if (signal_pending(current)) {
1778 err = -ERESTARTSYS; 1781 err = -ERESTARTSYS;
1779 break; 1782 break;
1780 } 1783 }
1784
1785 /*
1786 * We need to check if space became available already
1787 * (and thus the wakeup happened already) first to close
1788 * the race of space already having become available.
1789 * This check must happen after been added to the waitqueue
1790 * and having current state be INTERRUPTIBLE.
1791 */
1792 if (is_playback)
1793 avail = snd_pcm_playback_avail(runtime);
1794 else
1795 avail = snd_pcm_capture_avail(runtime);
1796 if (avail >= runtime->twake)
1797 break;
1781 snd_pcm_stream_unlock_irq(substream); 1798 snd_pcm_stream_unlock_irq(substream);
1782 tout = schedule_timeout_interruptible(wait_time); 1799
1800 tout = schedule_timeout(wait_time);
1801
1783 snd_pcm_stream_lock_irq(substream); 1802 snd_pcm_stream_lock_irq(substream);
1803 set_current_state(TASK_INTERRUPTIBLE);
1784 switch (runtime->status->state) { 1804 switch (runtime->status->state) {
1785 case SNDRV_PCM_STATE_SUSPENDED: 1805 case SNDRV_PCM_STATE_SUSPENDED:
1786 err = -ESTRPIPE; 1806 err = -ESTRPIPE;
@@ -1806,14 +1826,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
1806 err = -EIO; 1826 err = -EIO;
1807 break; 1827 break;
1808 } 1828 }
1809 if (is_playback)
1810 avail = snd_pcm_playback_avail(runtime);
1811 else
1812 avail = snd_pcm_capture_avail(runtime);
1813 if (avail >= runtime->twake)
1814 break;
1815 } 1829 }
1816 _endloop: 1830 _endloop:
1831 set_current_state(TASK_RUNNING);
1817 remove_wait_queue(&runtime->tsleep, &wait); 1832 remove_wait_queue(&runtime->tsleep, &wait);
1818 *availp = avail; 1833 *availp = avail;
1819 return err; 1834 return err;
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 7c1cbf0a0dc4..67ebf1c21c04 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -328,6 +328,8 @@ int snd_timer_close(struct snd_timer_instance *timeri)
328 mutex_unlock(&register_mutex); 328 mutex_unlock(&register_mutex);
329 } else { 329 } else {
330 timer = timeri->timer; 330 timer = timeri->timer;
331 if (snd_BUG_ON(!timer))
332 goto out;
331 /* wait, until the active callback is finished */ 333 /* wait, until the active callback is finished */
332 spin_lock_irq(&timer->lock); 334 spin_lock_irq(&timer->lock);
333 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) { 335 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
@@ -353,6 +355,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)
353 } 355 }
354 mutex_unlock(&register_mutex); 356 mutex_unlock(&register_mutex);
355 } 357 }
358 out:
356 if (timeri->private_free) 359 if (timeri->private_free)
357 timeri->private_free(timeri); 360 timeri->private_free(timeri);
358 kfree(timeri->owner); 361 kfree(timeri->owner);
@@ -531,6 +534,8 @@ int snd_timer_stop(struct snd_timer_instance *timeri)
531 if (err < 0) 534 if (err < 0)
532 return err; 535 return err;
533 timer = timeri->timer; 536 timer = timeri->timer;
537 if (!timer)
538 return -EINVAL;
534 spin_lock_irqsave(&timer->lock, flags); 539 spin_lock_irqsave(&timer->lock, flags);
535 timeri->cticks = timeri->ticks; 540 timeri->cticks = timeri->ticks;
536 timeri->pticks = 0; 541 timeri->pticks = 0;
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
index 8f7d175767a2..6f13ab4afc6b 100644
--- a/sound/oss/pas2_pcm.c
+++ b/sound/oss/pas2_pcm.c
@@ -63,13 +63,13 @@ static int pcm_set_speed(int arg)
63 63
64 if (pcm_channels & 2) 64 if (pcm_channels & 2)
65 { 65 {
66 foo = ((CLOCK_TICK_RATE / 2) + (arg / 2)) / arg; 66 foo = ((PIT_TICK_RATE / 2) + (arg / 2)) / arg;
67 arg = ((CLOCK_TICK_RATE / 2) + (foo / 2)) / foo; 67 arg = ((PIT_TICK_RATE / 2) + (foo / 2)) / foo;
68 } 68 }
69 else 69 else
70 { 70 {
71 foo = (CLOCK_TICK_RATE + (arg / 2)) / arg; 71 foo = (PIT_TICK_RATE + (arg / 2)) / arg;
72 arg = (CLOCK_TICK_RATE + (foo / 2)) / foo; 72 arg = (PIT_TICK_RATE + (foo / 2)) / foo;
73 } 73 }
74 74
75 pcm_speed = arg; 75 pcm_speed = arg;
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index 9b800ce5100e..2fc0624024b5 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -673,7 +673,8 @@ static void configure_nonsound_components(void)
673 673
674 if (pss_cdrom_port == -1) { /* If cdrom port enablation wasn't requested */ 674 if (pss_cdrom_port == -1) { /* If cdrom port enablation wasn't requested */
675 printk(KERN_INFO "PSS: CDROM port not enabled.\n"); 675 printk(KERN_INFO "PSS: CDROM port not enabled.\n");
676 } else if (check_region(pss_cdrom_port, 2)) { 676 } else if (!request_region(pss_cdrom_port, 2, "PSS CDROM")) {
677 pss_cdrom_port = -1;
677 printk(KERN_ERR "PSS: CDROM I/O port conflict.\n"); 678 printk(KERN_ERR "PSS: CDROM I/O port conflict.\n");
678 } else { 679 } else {
679 set_io_base(devc, CONF_CDROM, pss_cdrom_port); 680 set_io_base(devc, CONF_CDROM, pss_cdrom_port);
@@ -1232,7 +1233,8 @@ static void __exit cleanup_pss(void)
1232 if(pssmpu) 1233 if(pssmpu)
1233 unload_pss_mpu(&cfg_mpu); 1234 unload_pss_mpu(&cfg_mpu);
1234 unload_pss(&cfg); 1235 unload_pss(&cfg);
1235 } 1236 } else if (pss_cdrom_port != -1)
1237 release_region(pss_cdrom_port, 2);
1236 1238
1237 if(!pss_keep_settings) /* Keep hardware settings if asked */ 1239 if(!pss_keep_settings) /* Keep hardware settings if asked */
1238 { 1240 {
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 50abf5bf8e09..88168044375f 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -1,5 +1,10 @@
1# ALSA PCI drivers 1# ALSA PCI drivers
2 2
3config SND_TEA575X
4 tristate
5 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2
6 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2
7
3menuconfig SND_PCI 8menuconfig SND_PCI
4 bool "PCI sound devices" 9 bool "PCI sound devices"
5 depends on PCI 10 depends on PCI
@@ -563,11 +568,6 @@ config SND_FM801_TEA575X_BOOL
563 FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and 568 FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and
564 SF64-PCR) into the snd-fm801 driver. 569 SF64-PCR) into the snd-fm801 driver.
565 570
566config SND_TEA575X
567 tristate
568 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2
569 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2
570
571source "sound/pci/hda/Kconfig" 571source "sound/pci/hda/Kconfig"
572 572
573config SND_HDSP 573config SND_HDSP
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 200c9a1d48b7..a872d0a82976 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1909,6 +1909,7 @@ static unsigned int ad1981_jacks_whitelist[] = {
1909 0x103c0944, /* HP nc6220 */ 1909 0x103c0944, /* HP nc6220 */
1910 0x103c0934, /* HP nc8220 */ 1910 0x103c0934, /* HP nc8220 */
1911 0x103c006d, /* HP nx9105 */ 1911 0x103c006d, /* HP nx9105 */
1912 0x103c300d, /* HP Compaq dc5100 SFF(PT003AW) */
1912 0x17340088, /* FSC Scenic-W */ 1913 0x17340088, /* FSC Scenic-W */
1913 0 /* end */ 1914 0 /* end */
1914}; 1915};
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index 65b7ca13115b..bd47521b24ec 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -631,13 +631,12 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count,
631 if (!p_cache) 631 if (!p_cache)
632 return NULL; 632 return NULL;
633 633
634 p_cache->p_info = 634 p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count,
635 kmalloc(sizeof(*p_cache->p_info) * control_count, GFP_KERNEL); 635 GFP_KERNEL);
636 if (!p_cache->p_info) { 636 if (!p_cache->p_info) {
637 kfree(p_cache); 637 kfree(p_cache);
638 return NULL; 638 return NULL;
639 } 639 }
640 memset(p_cache->p_info, 0, sizeof(*p_cache->p_info) * control_count);
641 p_cache->cache_size_in_bytes = size_in_bytes; 640 p_cache->cache_size_in_bytes = size_in_bytes;
642 p_cache->control_count = control_count; 641 p_cache->control_count = control_count;
643 p_cache->p_cache = p_dsp_control_buffer; 642 p_cache->p_cache = p_dsp_control_buffer;
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index e4d76a270c9f..579fc0dce128 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2625,16 +2625,19 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2625 int err; 2625 int err;
2626 2626
2627 snd_azf3328_dbgcallenter(); 2627 snd_azf3328_dbgcallenter();
2628 if (dev >= SNDRV_CARDS) 2628 if (dev >= SNDRV_CARDS) {
2629 return -ENODEV; 2629 err = -ENODEV;
2630 goto out;
2631 }
2630 if (!enable[dev]) { 2632 if (!enable[dev]) {
2631 dev++; 2633 dev++;
2632 return -ENOENT; 2634 err = -ENOENT;
2635 goto out;
2633 } 2636 }
2634 2637
2635 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 2638 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
2636 if (err < 0) 2639 if (err < 0)
2637 return err; 2640 goto out;
2638 2641
2639 strcpy(card->driver, "AZF3328"); 2642 strcpy(card->driver, "AZF3328");
2640 strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); 2643 strcpy(card->shortname, "Aztech AZF3328 (PCI168)");
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index f9123f09e83e..32b02d906703 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -68,6 +68,7 @@ MODULE_PARM_DESC(enable, "Enable FM801 soundcard.");
68module_param_array(tea575x_tuner, int, NULL, 0444); 68module_param_array(tea575x_tuner, int, NULL, 0444);
69MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (0 = auto, 1 = SF256-PCS, 2=SF256-PCP, 3=SF64-PCR, 8=disable, +16=tuner-only)."); 69MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (0 = auto, 1 = SF256-PCS, 2=SF256-PCP, 3=SF64-PCR, 8=disable, +16=tuner-only).");
70 70
71#define TUNER_DISABLED (1<<3)
71#define TUNER_ONLY (1<<4) 72#define TUNER_ONLY (1<<4)
72#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF) 73#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF)
73 74
@@ -1150,7 +1151,8 @@ static int snd_fm801_free(struct fm801 *chip)
1150 1151
1151 __end_hw: 1152 __end_hw:
1152#ifdef CONFIG_SND_FM801_TEA575X_BOOL 1153#ifdef CONFIG_SND_FM801_TEA575X_BOOL
1153 snd_tea575x_exit(&chip->tea); 1154 if (!(chip->tea575x_tuner & TUNER_DISABLED))
1155 snd_tea575x_exit(&chip->tea);
1154#endif 1156#endif
1155 if (chip->irq >= 0) 1157 if (chip->irq >= 0)
1156 free_irq(chip->irq, chip); 1158 free_irq(chip->irq, chip);
@@ -1236,7 +1238,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1236 (tea575x_tuner & TUNER_TYPE_MASK) < 4) { 1238 (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
1237 if (snd_tea575x_init(&chip->tea)) { 1239 if (snd_tea575x_init(&chip->tea)) {
1238 snd_printk(KERN_ERR "TEA575x radio not found\n"); 1240 snd_printk(KERN_ERR "TEA575x radio not found\n");
1239 snd_fm801_free(chip);
1240 return -ENODEV; 1241 return -ENODEV;
1241 } 1242 }
1242 } else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) { 1243 } else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) {
@@ -1251,11 +1252,15 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1251 } 1252 }
1252 if (tea575x_tuner == 4) { 1253 if (tea575x_tuner == 4) {
1253 snd_printk(KERN_ERR "TEA575x radio not found\n"); 1254 snd_printk(KERN_ERR "TEA575x radio not found\n");
1254 snd_fm801_free(chip); 1255 chip->tea575x_tuner = TUNER_DISABLED;
1255 return -ENODEV;
1256 } 1256 }
1257 } 1257 }
1258 strlcpy(chip->tea.card, snd_fm801_tea575x_gpios[(tea575x_tuner & TUNER_TYPE_MASK) - 1].name, sizeof(chip->tea.card)); 1258 if (!(chip->tea575x_tuner & TUNER_DISABLED)) {
1259 strlcpy(chip->tea.card,
1260 snd_fm801_tea575x_gpios[(tea575x_tuner &
1261 TUNER_TYPE_MASK) - 1].name,
1262 sizeof(chip->tea.card));
1263 }
1259#endif 1264#endif
1260 1265
1261 *rchip = chip; 1266 *rchip = chip;
diff --git a/sound/pci/hda/alc268_quirks.c b/sound/pci/hda/alc268_quirks.c
index be58bf2f3aec..2e5876ce71fe 100644
--- a/sound/pci/hda/alc268_quirks.c
+++ b/sound/pci/hda/alc268_quirks.c
@@ -476,8 +476,8 @@ static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
476 476
477static const struct alc_config_preset alc268_presets[] = { 477static const struct alc_config_preset alc268_presets[] = {
478 [ALC267_QUANTA_IL1] = { 478 [ALC267_QUANTA_IL1] = {
479 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, 479 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
480 alc268_capture_nosrc_mixer }, 480 .cap_mixer = alc268_capture_nosrc_mixer,
481 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 481 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
482 alc267_quanta_il1_verbs }, 482 alc267_quanta_il1_verbs },
483 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 483 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -492,8 +492,8 @@ static const struct alc_config_preset alc268_presets[] = {
492 .init_hook = alc_inithook, 492 .init_hook = alc_inithook,
493 }, 493 },
494 [ALC268_3ST] = { 494 [ALC268_3ST] = {
495 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 495 .mixers = { alc268_base_mixer, alc268_beep_mixer },
496 alc268_beep_mixer }, 496 .cap_mixer = alc268_capture_alt_mixer,
497 .init_verbs = { alc268_base_init_verbs }, 497 .init_verbs = { alc268_base_init_verbs },
498 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 498 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
499 .dac_nids = alc268_dac_nids, 499 .dac_nids = alc268_dac_nids,
@@ -507,8 +507,8 @@ static const struct alc_config_preset alc268_presets[] = {
507 .input_mux = &alc268_capture_source, 507 .input_mux = &alc268_capture_source,
508 }, 508 },
509 [ALC268_TOSHIBA] = { 509 [ALC268_TOSHIBA] = {
510 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, 510 .mixers = { alc268_toshiba_mixer, alc268_beep_mixer },
511 alc268_beep_mixer }, 511 .cap_mixer = alc268_capture_alt_mixer,
512 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 512 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
513 alc268_toshiba_verbs }, 513 alc268_toshiba_verbs },
514 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 514 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -525,8 +525,8 @@ static const struct alc_config_preset alc268_presets[] = {
525 .init_hook = alc_inithook, 525 .init_hook = alc_inithook,
526 }, 526 },
527 [ALC268_ACER] = { 527 [ALC268_ACER] = {
528 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, 528 .mixers = { alc268_acer_mixer, alc268_beep_mixer },
529 alc268_beep_mixer }, 529 .cap_mixer = alc268_capture_alt_mixer,
530 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 530 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
531 alc268_acer_verbs }, 531 alc268_acer_verbs },
532 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 532 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -543,8 +543,8 @@ static const struct alc_config_preset alc268_presets[] = {
543 .init_hook = alc_inithook, 543 .init_hook = alc_inithook,
544 }, 544 },
545 [ALC268_ACER_DMIC] = { 545 [ALC268_ACER_DMIC] = {
546 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, 546 .mixers = { alc268_acer_dmic_mixer, alc268_beep_mixer },
547 alc268_beep_mixer }, 547 .cap_mixer = alc268_capture_alt_mixer,
548 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 548 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
549 alc268_acer_verbs }, 549 alc268_acer_verbs },
550 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 550 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -561,9 +561,8 @@ static const struct alc_config_preset alc268_presets[] = {
561 .init_hook = alc_inithook, 561 .init_hook = alc_inithook,
562 }, 562 },
563 [ALC268_ACER_ASPIRE_ONE] = { 563 [ALC268_ACER_ASPIRE_ONE] = {
564 .mixers = { alc268_acer_aspire_one_mixer, 564 .mixers = { alc268_acer_aspire_one_mixer, alc268_beep_mixer},
565 alc268_beep_mixer, 565 .cap_mixer = alc268_capture_nosrc_mixer,
566 alc268_capture_nosrc_mixer },
567 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 566 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
568 alc268_acer_aspire_one_verbs }, 567 alc268_acer_aspire_one_verbs },
569 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 568 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -579,8 +578,8 @@ static const struct alc_config_preset alc268_presets[] = {
579 .init_hook = alc_inithook, 578 .init_hook = alc_inithook,
580 }, 579 },
581 [ALC268_DELL] = { 580 [ALC268_DELL] = {
582 .mixers = { alc268_dell_mixer, alc268_beep_mixer, 581 .mixers = { alc268_dell_mixer, alc268_beep_mixer},
583 alc268_capture_nosrc_mixer }, 582 .cap_mixer = alc268_capture_nosrc_mixer,
584 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 583 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
585 alc268_dell_verbs }, 584 alc268_dell_verbs },
586 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 585 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -596,8 +595,8 @@ static const struct alc_config_preset alc268_presets[] = {
596 .init_hook = alc_inithook, 595 .init_hook = alc_inithook,
597 }, 596 },
598 [ALC268_ZEPTO] = { 597 [ALC268_ZEPTO] = {
599 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 598 .mixers = { alc268_base_mixer, alc268_beep_mixer },
600 alc268_beep_mixer }, 599 .cap_mixer = alc268_capture_alt_mixer,
601 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 600 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
602 alc268_toshiba_verbs }, 601 alc268_toshiba_verbs },
603 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 602 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -616,7 +615,8 @@ static const struct alc_config_preset alc268_presets[] = {
616 }, 615 },
617#ifdef CONFIG_SND_DEBUG 616#ifdef CONFIG_SND_DEBUG
618 [ALC268_TEST] = { 617 [ALC268_TEST] = {
619 .mixers = { alc268_test_mixer, alc268_capture_mixer }, 618 .mixers = { alc268_test_mixer },
619 .cap_mixer = alc268_capture_mixer,
620 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 620 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
621 alc268_volume_init_verbs, 621 alc268_volume_init_verbs,
622 alc268_beep_init_verbs }, 622 alc268_beep_init_verbs },
diff --git a/sound/pci/hda/alc269_quirks.c b/sound/pci/hda/alc269_quirks.c
index 14fdcf29b154..5ac0e2162a46 100644
--- a/sound/pci/hda/alc269_quirks.c
+++ b/sound/pci/hda/alc269_quirks.c
@@ -531,17 +531,10 @@ static const struct snd_pci_quirk alc269_cfg_tbl[] = {
531 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), 531 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
532 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), 532 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
533 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), 533 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
534 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
535 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), 534 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
536 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), 535 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
537 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), 536 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
538 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), 537 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
539 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
540 ALC269_DMIC),
541 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
542 ALC269_DMIC),
543 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
544 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
545 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), 538 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
546 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), 539 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
547 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), 540 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 3e7850c238c3..f3aefef37216 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -579,9 +579,13 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux,
579 return -1; 579 return -1;
580 } 580 }
581 recursive++; 581 recursive++;
582 for (i = 0; i < nums; i++) 582 for (i = 0; i < nums; i++) {
583 unsigned int type = get_wcaps_type(get_wcaps(codec, conn[i]));
584 if (type == AC_WID_PIN || type == AC_WID_AUD_OUT)
585 continue;
583 if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0) 586 if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0)
584 return i; 587 return i;
588 }
585 return -1; 589 return -1;
586} 590}
587EXPORT_SYMBOL_HDA(snd_hda_get_conn_index); 591EXPORT_SYMBOL_HDA(snd_hda_get_conn_index);
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 28ce17d09c33..c34f730f4815 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -144,25 +144,17 @@ static int cea_sampling_frequencies[8] = {
144 SNDRV_PCM_RATE_192000, /* 7: 192000Hz */ 144 SNDRV_PCM_RATE_192000, /* 7: 192000Hz */
145}; 145};
146 146
147static unsigned char hdmi_get_eld_byte(struct hda_codec *codec, hda_nid_t nid, 147static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid,
148 int byte_index) 148 int byte_index)
149{ 149{
150 unsigned int val; 150 unsigned int val;
151 151
152 val = snd_hda_codec_read(codec, nid, 0, 152 val = snd_hda_codec_read(codec, nid, 0,
153 AC_VERB_GET_HDMI_ELDD, byte_index); 153 AC_VERB_GET_HDMI_ELDD, byte_index);
154
155#ifdef BE_PARANOID 154#ifdef BE_PARANOID
156 printk(KERN_INFO "HDMI: ELD data byte %d: 0x%x\n", byte_index, val); 155 printk(KERN_INFO "HDMI: ELD data byte %d: 0x%x\n", byte_index, val);
157#endif 156#endif
158 157 return val;
159 if ((val & AC_ELDD_ELD_VALID) == 0) {
160 snd_printd(KERN_INFO "HDMI: invalid ELD data byte %d\n",
161 byte_index);
162 val = 0;
163 }
164
165 return val & AC_ELDD_ELD_DATA;
166} 158}
167 159
168#define GRAB_BITS(buf, byte, lowbit, bits) \ 160#define GRAB_BITS(buf, byte, lowbit, bits) \
@@ -344,11 +336,26 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
344 if (!buf) 336 if (!buf)
345 return -ENOMEM; 337 return -ENOMEM;
346 338
347 for (i = 0; i < size; i++) 339 for (i = 0; i < size; i++) {
348 buf[i] = hdmi_get_eld_byte(codec, nid, i); 340 unsigned int val = hdmi_get_eld_data(codec, nid, i);
341 if (!(val & AC_ELDD_ELD_VALID)) {
342 if (!i) {
343 snd_printd(KERN_INFO
344 "HDMI: invalid ELD data\n");
345 ret = -EINVAL;
346 goto error;
347 }
348 snd_printd(KERN_INFO
349 "HDMI: invalid ELD data byte %d\n", i);
350 val = 0;
351 } else
352 val &= AC_ELDD_ELD_DATA;
353 buf[i] = val;
354 }
349 355
350 ret = hdmi_update_eld(eld, buf, size); 356 ret = hdmi_update_eld(eld, buf, size);
351 357
358error:
352 kfree(buf); 359 kfree(buf);
353 return ret; 360 return ret;
354} 361}
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 47d6ffc9b5b5..c45f3e69bcf0 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -375,7 +375,7 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
375static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin, 375static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
376 unsigned int *idxp) 376 unsigned int *idxp)
377{ 377{
378 int i; 378 int i, idx;
379 hda_nid_t nid; 379 hda_nid_t nid;
380 380
381 nid = codec->start_nid; 381 nid = codec->start_nid;
@@ -384,9 +384,11 @@ static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
384 type = get_wcaps_type(get_wcaps(codec, nid)); 384 type = get_wcaps_type(get_wcaps(codec, nid));
385 if (type != AC_WID_AUD_IN) 385 if (type != AC_WID_AUD_IN)
386 continue; 386 continue;
387 *idxp = snd_hda_get_conn_index(codec, nid, pin, false); 387 idx = snd_hda_get_conn_index(codec, nid, pin, false);
388 if (*idxp >= 0) 388 if (idx >= 0) {
389 *idxp = idx;
389 return nid; 390 return nid;
391 }
390 } 392 }
391 return 0; 393 return 0;
392} 394}
@@ -533,7 +535,7 @@ static int add_volume(struct hda_codec *codec, const char *name,
533 int index, unsigned int pval, int dir, 535 int index, unsigned int pval, int dir,
534 struct snd_kcontrol **kctlp) 536 struct snd_kcontrol **kctlp)
535{ 537{
536 char tmp[32]; 538 char tmp[44];
537 struct snd_kcontrol_new knew = 539 struct snd_kcontrol_new knew =
538 HDA_CODEC_VOLUME_IDX(tmp, index, 0, 0, HDA_OUTPUT); 540 HDA_CODEC_VOLUME_IDX(tmp, index, 0, 0, HDA_OUTPUT);
539 knew.private_value = pval; 541 knew.private_value = pval;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 502fc9499453..7696d05b9356 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3348,6 +3348,8 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t pin,
3348 3348
3349#define MAX_AUTO_DACS 5 3349#define MAX_AUTO_DACS 5
3350 3350
3351#define DAC_SLAVE_FLAG 0x8000 /* filled dac is a slave */
3352
3351/* fill analog DAC list from the widget tree */ 3353/* fill analog DAC list from the widget tree */
3352static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs) 3354static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
3353{ 3355{
@@ -3370,16 +3372,26 @@ static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
3370/* fill pin_dac_pair list from the pin and dac list */ 3372/* fill pin_dac_pair list from the pin and dac list */
3371static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins, 3373static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
3372 int num_pins, hda_nid_t *dacs, int *rest, 3374 int num_pins, hda_nid_t *dacs, int *rest,
3373 struct pin_dac_pair *filled, int type) 3375 struct pin_dac_pair *filled, int nums,
3376 int type)
3374{ 3377{
3375 int i, nums; 3378 int i, start = nums;
3376 3379
3377 nums = 0; 3380 for (i = 0; i < num_pins; i++, nums++) {
3378 for (i = 0; i < num_pins; i++) {
3379 filled[nums].pin = pins[i]; 3381 filled[nums].pin = pins[i];
3380 filled[nums].type = type; 3382 filled[nums].type = type;
3381 filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest); 3383 filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
3382 nums++; 3384 if (filled[nums].dac)
3385 continue;
3386 if (filled[start].dac && get_connection_index(codec, pins[i], filled[start].dac) >= 0) {
3387 filled[nums].dac = filled[start].dac | DAC_SLAVE_FLAG;
3388 continue;
3389 }
3390 if (filled[0].dac && get_connection_index(codec, pins[i], filled[0].dac) >= 0) {
3391 filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
3392 continue;
3393 }
3394 snd_printdd("Failed to find a DAC for pin 0x%x", pins[i]);
3383 } 3395 }
3384 return nums; 3396 return nums;
3385} 3397}
@@ -3395,19 +3407,19 @@ static void cx_auto_parse_output(struct hda_codec *codec)
3395 rest = fill_cx_auto_dacs(codec, dacs); 3407 rest = fill_cx_auto_dacs(codec, dacs);
3396 /* parse all analog output pins */ 3408 /* parse all analog output pins */
3397 nums = fill_dacs_for_pins(codec, cfg->line_out_pins, cfg->line_outs, 3409 nums = fill_dacs_for_pins(codec, cfg->line_out_pins, cfg->line_outs,
3398 dacs, &rest, spec->dac_info, 3410 dacs, &rest, spec->dac_info, 0,
3399 AUTO_PIN_LINE_OUT); 3411 AUTO_PIN_LINE_OUT);
3400 nums += fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs, 3412 nums = fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
3401 dacs, &rest, spec->dac_info + nums, 3413 dacs, &rest, spec->dac_info, nums,
3402 AUTO_PIN_HP_OUT); 3414 AUTO_PIN_HP_OUT);
3403 nums += fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs, 3415 nums = fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
3404 dacs, &rest, spec->dac_info + nums, 3416 dacs, &rest, spec->dac_info, nums,
3405 AUTO_PIN_SPEAKER_OUT); 3417 AUTO_PIN_SPEAKER_OUT);
3406 spec->dac_info_filled = nums; 3418 spec->dac_info_filled = nums;
3407 /* fill multiout struct */ 3419 /* fill multiout struct */
3408 for (i = 0; i < nums; i++) { 3420 for (i = 0; i < nums; i++) {
3409 hda_nid_t dac = spec->dac_info[i].dac; 3421 hda_nid_t dac = spec->dac_info[i].dac;
3410 if (!dac) 3422 if (!dac || (dac & DAC_SLAVE_FLAG))
3411 continue; 3423 continue;
3412 switch (spec->dac_info[i].type) { 3424 switch (spec->dac_info[i].type) {
3413 case AUTO_PIN_LINE_OUT: 3425 case AUTO_PIN_LINE_OUT:
@@ -3862,7 +3874,7 @@ static void cx_auto_parse_input(struct hda_codec *codec)
3862 } 3874 }
3863 if (imux->num_items >= 2 && cfg->num_inputs == imux->num_items) 3875 if (imux->num_items >= 2 && cfg->num_inputs == imux->num_items)
3864 cx_auto_check_auto_mic(codec); 3876 cx_auto_check_auto_mic(codec);
3865 if (imux->num_items > 1 && !spec->auto_mic) { 3877 if (imux->num_items > 1) {
3866 for (i = 1; i < imux->num_items; i++) { 3878 for (i = 1; i < imux->num_items; i++) {
3867 if (spec->imux_info[i].adc != spec->imux_info[0].adc) { 3879 if (spec->imux_info[i].adc != spec->imux_info[0].adc) {
3868 spec->adc_switching = 1; 3880 spec->adc_switching = 1;
@@ -4035,6 +4047,8 @@ static void cx_auto_init_output(struct hda_codec *codec)
4035 nid = spec->dac_info[i].dac; 4047 nid = spec->dac_info[i].dac;
4036 if (!nid) 4048 if (!nid)
4037 nid = spec->multiout.dac_nids[0]; 4049 nid = spec->multiout.dac_nids[0];
4050 else if (nid & DAC_SLAVE_FLAG)
4051 nid &= ~DAC_SLAVE_FLAG;
4038 select_connection(codec, spec->dac_info[i].pin, nid); 4052 select_connection(codec, spec->dac_info[i].pin, nid);
4039 } 4053 }
4040 if (spec->auto_mute) { 4054 if (spec->auto_mute) {
@@ -4167,9 +4181,11 @@ static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
4167 hda_nid_t pin, const char *name, int idx) 4181 hda_nid_t pin, const char *name, int idx)
4168{ 4182{
4169 unsigned int caps; 4183 unsigned int caps;
4170 caps = query_amp_caps(codec, dac, HDA_OUTPUT); 4184 if (dac && !(dac & DAC_SLAVE_FLAG)) {
4171 if (caps & AC_AMPCAP_NUM_STEPS) 4185 caps = query_amp_caps(codec, dac, HDA_OUTPUT);
4172 return cx_auto_add_pb_volume(codec, dac, name, idx); 4186 if (caps & AC_AMPCAP_NUM_STEPS)
4187 return cx_auto_add_pb_volume(codec, dac, name, idx);
4188 }
4173 caps = query_amp_caps(codec, pin, HDA_OUTPUT); 4189 caps = query_amp_caps(codec, pin, HDA_OUTPUT);
4174 if (caps & AC_AMPCAP_NUM_STEPS) 4190 if (caps & AC_AMPCAP_NUM_STEPS)
4175 return cx_auto_add_pb_volume(codec, pin, name, idx); 4191 return cx_auto_add_pb_volume(codec, pin, name, idx);
@@ -4191,8 +4207,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4191 for (i = 0; i < spec->dac_info_filled; i++) { 4207 for (i = 0; i < spec->dac_info_filled; i++) {
4192 const char *label; 4208 const char *label;
4193 int idx, type; 4209 int idx, type;
4194 if (!spec->dac_info[i].dac) 4210 hda_nid_t dac = spec->dac_info[i].dac;
4195 continue;
4196 type = spec->dac_info[i].type; 4211 type = spec->dac_info[i].type;
4197 if (type == AUTO_PIN_LINE_OUT) 4212 if (type == AUTO_PIN_LINE_OUT)
4198 type = spec->autocfg.line_out_type; 4213 type = spec->autocfg.line_out_type;
@@ -4211,7 +4226,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4211 idx = num_spk++; 4226 idx = num_spk++;
4212 break; 4227 break;
4213 } 4228 }
4214 err = try_add_pb_volume(codec, spec->dac_info[i].dac, 4229 err = try_add_pb_volume(codec, dac,
4215 spec->dac_info[i].pin, 4230 spec->dac_info[i].pin,
4216 label, idx); 4231 label, idx);
4217 if (err < 0) 4232 if (err < 0)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e125c60fe352..0503c999e7d3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -168,7 +168,7 @@ struct alc_spec {
168 unsigned int auto_mic_valid_imux:1; /* valid imux for auto-mic */ 168 unsigned int auto_mic_valid_imux:1; /* valid imux for auto-mic */
169 unsigned int automute:1; /* HP automute enabled */ 169 unsigned int automute:1; /* HP automute enabled */
170 unsigned int detect_line:1; /* Line-out detection enabled */ 170 unsigned int detect_line:1; /* Line-out detection enabled */
171 unsigned int automute_lines:1; /* automute line-out as well */ 171 unsigned int automute_lines:1; /* automute line-out as well; NOP when automute_hp_lo isn't set */
172 unsigned int automute_hp_lo:1; /* both HP and LO available */ 172 unsigned int automute_hp_lo:1; /* both HP and LO available */
173 173
174 /* other flags */ 174 /* other flags */
@@ -551,7 +551,7 @@ static void update_speakers(struct hda_codec *codec)
551 if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] || 551 if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
552 spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0]) 552 spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
553 return; 553 return;
554 if (!spec->automute_lines || !spec->automute) 554 if (!spec->automute || (spec->automute_hp_lo && !spec->automute_lines))
555 on = 0; 555 on = 0;
556 else 556 else
557 on = spec->jack_present; 557 on = spec->jack_present;
@@ -565,11 +565,11 @@ static void alc_hp_automute(struct hda_codec *codec)
565{ 565{
566 struct alc_spec *spec = codec->spec; 566 struct alc_spec *spec = codec->spec;
567 567
568 if (!spec->automute)
569 return;
570 spec->jack_present = 568 spec->jack_present =
571 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), 569 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
572 spec->autocfg.hp_pins); 570 spec->autocfg.hp_pins);
571 if (!spec->automute)
572 return;
573 update_speakers(codec); 573 update_speakers(codec);
574} 574}
575 575
@@ -578,11 +578,11 @@ static void alc_line_automute(struct hda_codec *codec)
578{ 578{
579 struct alc_spec *spec = codec->spec; 579 struct alc_spec *spec = codec->spec;
580 580
581 if (!spec->automute || !spec->detect_line)
582 return;
583 spec->line_jack_present = 581 spec->line_jack_present =
584 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), 582 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
585 spec->autocfg.line_out_pins); 583 spec->autocfg.line_out_pins);
584 if (!spec->automute || !spec->detect_line)
585 return;
586 update_speakers(codec); 586 update_speakers(codec);
587} 587}
588 588
@@ -803,7 +803,7 @@ static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
803 unsigned int val; 803 unsigned int val;
804 if (!spec->automute) 804 if (!spec->automute)
805 val = 0; 805 val = 0;
806 else if (!spec->automute_lines) 806 else if (!spec->automute_hp_lo || !spec->automute_lines)
807 val = 1; 807 val = 1;
808 else 808 else
809 val = 2; 809 val = 2;
@@ -824,7 +824,8 @@ static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
824 spec->automute = 0; 824 spec->automute = 0;
825 break; 825 break;
826 case 1: 826 case 1:
827 if (spec->automute && !spec->automute_lines) 827 if (spec->automute &&
828 (!spec->automute_hp_lo || !spec->automute_lines))
828 return 0; 829 return 0;
829 spec->automute = 1; 830 spec->automute = 1;
830 spec->automute_lines = 0; 831 spec->automute_lines = 0;
@@ -1784,6 +1785,7 @@ static const char * const alc_slave_vols[] = {
1784 "Speaker Playback Volume", 1785 "Speaker Playback Volume",
1785 "Mono Playback Volume", 1786 "Mono Playback Volume",
1786 "Line-Out Playback Volume", 1787 "Line-Out Playback Volume",
1788 "PCM Playback Volume",
1787 NULL, 1789 NULL,
1788}; 1790};
1789 1791
@@ -1798,6 +1800,7 @@ static const char * const alc_slave_sws[] = {
1798 "Mono Playback Switch", 1800 "Mono Playback Switch",
1799 "IEC958 Playback Switch", 1801 "IEC958 Playback Switch",
1800 "Line-Out Playback Switch", 1802 "Line-Out Playback Switch",
1803 "PCM Playback Switch",
1801 NULL, 1804 NULL,
1802}; 1805};
1803 1806
@@ -3081,16 +3084,22 @@ static void alc_auto_init_multi_out(struct hda_codec *codec)
3081static void alc_auto_init_extra_out(struct hda_codec *codec) 3084static void alc_auto_init_extra_out(struct hda_codec *codec)
3082{ 3085{
3083 struct alc_spec *spec = codec->spec; 3086 struct alc_spec *spec = codec->spec;
3084 hda_nid_t pin; 3087 hda_nid_t pin, dac;
3085 3088
3086 pin = spec->autocfg.hp_pins[0]; 3089 pin = spec->autocfg.hp_pins[0];
3087 if (pin) 3090 if (pin) {
3088 alc_auto_set_output_and_unmute(codec, pin, PIN_HP, 3091 dac = spec->multiout.hp_nid;
3089 spec->multiout.hp_nid); 3092 if (!dac)
3093 dac = spec->multiout.dac_nids[0];
3094 alc_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
3095 }
3090 pin = spec->autocfg.speaker_pins[0]; 3096 pin = spec->autocfg.speaker_pins[0];
3091 if (pin) 3097 if (pin) {
3092 alc_auto_set_output_and_unmute(codec, pin, PIN_OUT, 3098 dac = spec->multiout.extra_out_nid[0];
3093 spec->multiout.extra_out_nid[0]); 3099 if (!dac)
3100 dac = spec->multiout.dac_nids[0];
3101 alc_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
3102 }
3094} 3103}
3095 3104
3096/* 3105/*
@@ -4484,6 +4493,22 @@ static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4484 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; 4493 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
4485} 4494}
4486 4495
4496static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4497 const struct alc_fixup *fix, int action)
4498{
4499 int coef;
4500
4501 if (action != ALC_FIXUP_ACT_INIT)
4502 return;
4503 /* The digital-mic unit sends PDM (differential signal) instead of
4504 * the standard PCM, thus you can't record a valid mono stream as is.
4505 * Below is a workaround specific to ALC269 to control the dmic
4506 * signal source as mono.
4507 */
4508 coef = alc_read_coef_idx(codec, 0x07);
4509 alc_write_coef_idx(codec, 0x07, coef | 0x80);
4510}
4511
4487enum { 4512enum {
4488 ALC269_FIXUP_SONY_VAIO, 4513 ALC269_FIXUP_SONY_VAIO,
4489 ALC275_FIXUP_SONY_VAIO_GPIO2, 4514 ALC275_FIXUP_SONY_VAIO_GPIO2,
@@ -4494,6 +4519,7 @@ enum {
4494 ALC275_FIXUP_SONY_HWEQ, 4519 ALC275_FIXUP_SONY_HWEQ,
4495 ALC271_FIXUP_DMIC, 4520 ALC271_FIXUP_DMIC,
4496 ALC269_FIXUP_PCM_44K, 4521 ALC269_FIXUP_PCM_44K,
4522 ALC269_FIXUP_STEREO_DMIC,
4497}; 4523};
4498 4524
4499static const struct alc_fixup alc269_fixups[] = { 4525static const struct alc_fixup alc269_fixups[] = {
@@ -4556,10 +4582,19 @@ static const struct alc_fixup alc269_fixups[] = {
4556 .type = ALC_FIXUP_FUNC, 4582 .type = ALC_FIXUP_FUNC,
4557 .v.func = alc269_fixup_pcm_44k, 4583 .v.func = alc269_fixup_pcm_44k,
4558 }, 4584 },
4585 [ALC269_FIXUP_STEREO_DMIC] = {
4586 .type = ALC_FIXUP_FUNC,
4587 .v.func = alc269_fixup_stereo_dmic,
4588 },
4559}; 4589};
4560 4590
4561static const struct snd_pci_quirk alc269_fixup_tbl[] = { 4591static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4562 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 4592 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
4593 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
4594 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
4595 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
4596 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4597 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4563 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), 4598 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
4564 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 4599 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4565 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 4600 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index aa376b59c006..1b7c11432aa7 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -673,6 +673,7 @@ static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
673 return 0; 673 return 0;
674} 674}
675 675
676#ifdef CONFIG_SND_HDA_POWER_SAVE
676static int stac_vrefout_set(struct hda_codec *codec, 677static int stac_vrefout_set(struct hda_codec *codec,
677 hda_nid_t nid, unsigned int new_vref) 678 hda_nid_t nid, unsigned int new_vref)
678{ 679{
@@ -696,6 +697,7 @@ static int stac_vrefout_set(struct hda_codec *codec,
696 697
697 return 1; 698 return 1;
698} 699}
700#endif
699 701
700static unsigned int stac92xx_vref_set(struct hda_codec *codec, 702static unsigned int stac92xx_vref_set(struct hda_codec *codec,
701 hda_nid_t nid, unsigned int new_vref) 703 hda_nid_t nid, unsigned int new_vref)
@@ -6571,6 +6573,7 @@ static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6571 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx }, 6573 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
6572 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, 6574 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
6573 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, 6575 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
6576 { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
6574 { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, 6577 { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
6575 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, 6578 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
6576 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, 6579 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 84d8798bf33a..4ebfbd874c9a 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -2084,7 +2084,7 @@ static int via_auto_create_speaker_ctls(struct hda_codec *codec)
2084 struct via_spec *spec = codec->spec; 2084 struct via_spec *spec = codec->spec;
2085 struct nid_path *path; 2085 struct nid_path *path;
2086 bool check_dac; 2086 bool check_dac;
2087 hda_nid_t pin, dac; 2087 hda_nid_t pin, dac = 0;
2088 int err; 2088 int err;
2089 2089
2090 pin = spec->autocfg.speaker_pins[0]; 2090 pin = spec->autocfg.speaker_pins[0];
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 6edc67ced905..493e3946756f 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -1339,6 +1339,10 @@ static u64 hdspm_calc_dds_value(struct hdspm *hdspm, u64 period)
1339 break; 1339 break;
1340 case MADIface: 1340 case MADIface:
1341 freq_const = 131072000000000ULL; 1341 freq_const = 131072000000000ULL;
1342 break;
1343 default:
1344 snd_BUG();
1345 return 0;
1342 } 1346 }
1343 1347
1344 return div_u64(freq_const, period); 1348 return div_u64(freq_const, period);
@@ -1356,16 +1360,19 @@ static void hdspm_set_dds_value(struct hdspm *hdspm, int rate)
1356 1360
1357 switch (hdspm->io_type) { 1361 switch (hdspm->io_type) {
1358 case MADIface: 1362 case MADIface:
1359 n = 131072000000000ULL; /* 125 MHz */ 1363 n = 131072000000000ULL; /* 125 MHz */
1360 break; 1364 break;
1361 case MADI: 1365 case MADI:
1362 case AES32: 1366 case AES32:
1363 n = 110069313433624ULL; /* 105 MHz */ 1367 n = 110069313433624ULL; /* 105 MHz */
1364 break; 1368 break;
1365 case RayDAT: 1369 case RayDAT:
1366 case AIO: 1370 case AIO:
1367 n = 104857600000000ULL; /* 100 MHz */ 1371 n = 104857600000000ULL; /* 100 MHz */
1368 break; 1372 break;
1373 default:
1374 snd_BUG();
1375 return;
1369 } 1376 }
1370 1377
1371 n = div_u64(n, rate); 1378 n = div_u64(n, rate);
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index d0d493ca28ae..2cf87f5afed4 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -139,8 +139,12 @@ static void stream_stop(struct snd_usb_caiaqdev *dev)
139 139
140 for (i = 0; i < N_URBS; i++) { 140 for (i = 0; i < N_URBS; i++) {
141 usb_kill_urb(dev->data_urbs_in[i]); 141 usb_kill_urb(dev->data_urbs_in[i]);
142 usb_kill_urb(dev->data_urbs_out[i]); 142
143 if (test_bit(i, &dev->outurb_active_mask))
144 usb_kill_urb(dev->data_urbs_out[i]);
143 } 145 }
146
147 dev->outurb_active_mask = 0;
144} 148}
145 149
146static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream) 150static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream)
@@ -612,8 +616,9 @@ static void read_completed(struct urb *urb)
612{ 616{
613 struct snd_usb_caiaq_cb_info *info = urb->context; 617 struct snd_usb_caiaq_cb_info *info = urb->context;
614 struct snd_usb_caiaqdev *dev; 618 struct snd_usb_caiaqdev *dev;
615 struct urb *out; 619 struct urb *out = NULL;
616 int frame, len, send_it = 0, outframe = 0; 620 int i, frame, len, send_it = 0, outframe = 0;
621 size_t offset = 0;
617 622
618 if (urb->status || !info) 623 if (urb->status || !info)
619 return; 624 return;
@@ -623,7 +628,17 @@ static void read_completed(struct urb *urb)
623 if (!dev->streaming) 628 if (!dev->streaming)
624 return; 629 return;
625 630
626 out = dev->data_urbs_out[info->index]; 631 /* find an unused output urb that is unused */
632 for (i = 0; i < N_URBS; i++)
633 if (test_and_set_bit(i, &dev->outurb_active_mask) == 0) {
634 out = dev->data_urbs_out[i];
635 break;
636 }
637
638 if (!out) {
639 log("Unable to find an output urb to use\n");
640 goto requeue;
641 }
627 642
628 /* read the recently received packet and send back one which has 643 /* read the recently received packet and send back one which has
629 * the same layout */ 644 * the same layout */
@@ -634,7 +649,8 @@ static void read_completed(struct urb *urb)
634 len = urb->iso_frame_desc[outframe].actual_length; 649 len = urb->iso_frame_desc[outframe].actual_length;
635 out->iso_frame_desc[outframe].length = len; 650 out->iso_frame_desc[outframe].length = len;
636 out->iso_frame_desc[outframe].actual_length = 0; 651 out->iso_frame_desc[outframe].actual_length = 0;
637 out->iso_frame_desc[outframe].offset = BYTES_PER_FRAME * frame; 652 out->iso_frame_desc[outframe].offset = offset;
653 offset += len;
638 654
639 if (len > 0) { 655 if (len > 0) {
640 spin_lock(&dev->spinlock); 656 spin_lock(&dev->spinlock);
@@ -650,11 +666,15 @@ static void read_completed(struct urb *urb)
650 } 666 }
651 667
652 if (send_it) { 668 if (send_it) {
653 out->number_of_packets = FRAMES_PER_URB; 669 out->number_of_packets = outframe;
654 out->transfer_flags = URB_ISO_ASAP; 670 out->transfer_flags = URB_ISO_ASAP;
655 usb_submit_urb(out, GFP_ATOMIC); 671 usb_submit_urb(out, GFP_ATOMIC);
672 } else {
673 struct snd_usb_caiaq_cb_info *oinfo = out->context;
674 clear_bit(oinfo->index, &dev->outurb_active_mask);
656 } 675 }
657 676
677requeue:
658 /* re-submit inbound urb */ 678 /* re-submit inbound urb */
659 for (frame = 0; frame < FRAMES_PER_URB; frame++) { 679 for (frame = 0; frame < FRAMES_PER_URB; frame++) {
660 urb->iso_frame_desc[frame].offset = BYTES_PER_FRAME * frame; 680 urb->iso_frame_desc[frame].offset = BYTES_PER_FRAME * frame;
@@ -676,6 +696,8 @@ static void write_completed(struct urb *urb)
676 dev->output_running = 1; 696 dev->output_running = 1;
677 wake_up(&dev->prepare_wait_queue); 697 wake_up(&dev->prepare_wait_queue);
678 } 698 }
699
700 clear_bit(info->index, &dev->outurb_active_mask);
679} 701}
680 702
681static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret) 703static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret)
@@ -827,6 +849,9 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev)
827 if (!dev->data_cb_info) 849 if (!dev->data_cb_info)
828 return -ENOMEM; 850 return -ENOMEM;
829 851
852 dev->outurb_active_mask = 0;
853 BUILD_BUG_ON(N_URBS > (sizeof(dev->outurb_active_mask) * 8));
854
830 for (i = 0; i < N_URBS; i++) { 855 for (i = 0; i < N_URBS; i++) {
831 dev->data_cb_info[i].dev = dev; 856 dev->data_cb_info[i].dev = dev;
832 dev->data_cb_info[i].index = i; 857 dev->data_cb_info[i].index = i;
diff --git a/sound/usb/caiaq/device.h b/sound/usb/caiaq/device.h
index b2b310194ffa..3f9c6339ae90 100644
--- a/sound/usb/caiaq/device.h
+++ b/sound/usb/caiaq/device.h
@@ -96,6 +96,7 @@ struct snd_usb_caiaqdev {
96 int input_panic, output_panic, warned; 96 int input_panic, output_panic, warned;
97 char *audio_in_buf, *audio_out_buf; 97 char *audio_in_buf, *audio_out_buf;
98 unsigned int samplerates, bpp; 98 unsigned int samplerates, bpp;
99 unsigned long outurb_active_mask;
99 100
100 struct snd_pcm_substream *sub_playback[MAX_STREAMS]; 101 struct snd_pcm_substream *sub_playback[MAX_STREAMS];
101 struct snd_pcm_substream *sub_capture[MAX_STREAMS]; 102 struct snd_pcm_substream *sub_capture[MAX_STREAMS];
diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
index 4432ef7a70a9..a213813487bd 100644
--- a/sound/usb/caiaq/input.c
+++ b/sound/usb/caiaq/input.c
@@ -30,7 +30,7 @@ static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A };
30static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, 30static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4,
31 KEY_5, KEY_6, KEY_7 }; 31 KEY_5, KEY_6, KEY_7 };
32static unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, 32static unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4,
33 KEY_5, KEY_6, KEY_7, KEY_5, KEY_6 }; 33 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9 };
34 34
35static unsigned short keycode_kore[] = { 35static unsigned short keycode_kore[] = {
36 KEY_FN_F1, /* "menu" */ 36 KEY_FN_F1, /* "menu" */
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 781d9e61adfb..ed120ca2353d 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -532,6 +532,7 @@ snd_usb_audio_probe(struct usb_device *dev,
532 __error: 532 __error:
533 if (chip && !chip->num_interfaces) 533 if (chip && !chip->num_interfaces)
534 snd_card_free(chip->card); 534 snd_card_free(chip->card);
535 chip->probing = 0;
535 mutex_unlock(&register_mutex); 536 mutex_unlock(&register_mutex);
536 __err_val: 537 __err_val:
537 return NULL; 538 return NULL;
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 7c0d21ecd821..7d46e482375d 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -352,7 +352,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
352 continue; 352 continue;
353 } 353 }
354 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || 354 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) ||
355 ((protocol == UAC_VERSION_2) && (fmt->bLength != 6))) { 355 ((protocol == UAC_VERSION_2) && (fmt->bLength < 6))) {
356 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 356 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n",
357 dev->devnum, iface_no, altno); 357 dev->devnum, iface_no, altno);
358 continue; 358 continue;
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c22fa76e363a..cdd19d7fe500 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
152 if (p && p->dB) { 152 if (p && p->dB) {
153 cval->dBmin = p->dB->min; 153 cval->dBmin = p->dB->min;
154 cval->dBmax = p->dB->max; 154 cval->dBmax = p->dB->max;
155 cval->initialized = 1;
155 } 156 }
156} 157}
157 158
@@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1092 " Switch" : " Volume"); 1093 " Switch" : " Volume");
1093 if (control == UAC_FU_VOLUME) { 1094 if (control == UAC_FU_VOLUME) {
1094 check_mapped_dB(map, cval); 1095 check_mapped_dB(map, cval);
1095 if (cval->dBmin < cval->dBmax) { 1096 if (cval->dBmin < cval->dBmax || !cval->initialized) {
1096 kctl->tlv.c = mixer_vol_tlv; 1097 kctl->tlv.c = mixer_vol_tlv;
1097 kctl->vd[0].access |= 1098 kctl->vd[0].access |=
1098 SNDRV_CTL_ELEM_ACCESS_TLV_READ | 1099 SNDRV_CTL_ELEM_ACCESS_TLV_READ |
@@ -1191,6 +1192,11 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1191 1192
1192 if (state->mixer->protocol == UAC_VERSION_1) { 1193 if (state->mixer->protocol == UAC_VERSION_1) {
1193 csize = hdr->bControlSize; 1194 csize = hdr->bControlSize;
1195 if (!csize) {
1196 snd_printdd(KERN_ERR "usbaudio: unit %u: "
1197 "invalid bControlSize == 0\n", unitid);
1198 return -EINVAL;
1199 }
1194 channels = (hdr->bLength - 7) / csize - 1; 1200 channels = (hdr->bLength - 7) / csize - 1;
1195 bmaControls = hdr->bmaControls; 1201 bmaControls = hdr->bmaControls;
1196 } else { 1202 } else {
@@ -1934,15 +1940,13 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
1934 struct mixer_build state; 1940 struct mixer_build state;
1935 int err; 1941 int err;
1936 const struct usbmix_ctl_map *map; 1942 const struct usbmix_ctl_map *map;
1937 struct usb_host_interface *hostif;
1938 void *p; 1943 void *p;
1939 1944
1940 hostif = mixer->chip->ctrl_intf;
1941 memset(&state, 0, sizeof(state)); 1945 memset(&state, 0, sizeof(state));
1942 state.chip = mixer->chip; 1946 state.chip = mixer->chip;
1943 state.mixer = mixer; 1947 state.mixer = mixer;
1944 state.buffer = hostif->extra; 1948 state.buffer = mixer->hostif->extra;
1945 state.buflen = hostif->extralen; 1949 state.buflen = mixer->hostif->extralen;
1946 1950
1947 /* check the mapping table */ 1951 /* check the mapping table */
1948 for (map = usbmix_ctl_maps; map->id; map++) { 1952 for (map = usbmix_ctl_maps; map->id; map++) {
@@ -1955,7 +1959,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
1955 } 1959 }
1956 1960
1957 p = NULL; 1961 p = NULL;
1958 while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) { 1962 while ((p = snd_usb_find_csint_desc(mixer->hostif->extra, mixer->hostif->extralen,
1963 p, UAC_OUTPUT_TERMINAL)) != NULL) {
1959 if (mixer->protocol == UAC_VERSION_1) { 1964 if (mixer->protocol == UAC_VERSION_1) {
1960 struct uac1_output_terminal_descriptor *desc = p; 1965 struct uac1_output_terminal_descriptor *desc = p;
1961 1966
@@ -2162,17 +2167,15 @@ int snd_usb_mixer_activate(struct usb_mixer_interface *mixer)
2162/* create the handler for the optional status interrupt endpoint */ 2167/* create the handler for the optional status interrupt endpoint */
2163static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer) 2168static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
2164{ 2169{
2165 struct usb_host_interface *hostif;
2166 struct usb_endpoint_descriptor *ep; 2170 struct usb_endpoint_descriptor *ep;
2167 void *transfer_buffer; 2171 void *transfer_buffer;
2168 int buffer_length; 2172 int buffer_length;
2169 unsigned int epnum; 2173 unsigned int epnum;
2170 2174
2171 hostif = mixer->chip->ctrl_intf;
2172 /* we need one interrupt input endpoint */ 2175 /* we need one interrupt input endpoint */
2173 if (get_iface_desc(hostif)->bNumEndpoints < 1) 2176 if (get_iface_desc(mixer->hostif)->bNumEndpoints < 1)
2174 return 0; 2177 return 0;
2175 ep = get_endpoint(hostif, 0); 2178 ep = get_endpoint(mixer->hostif, 0);
2176 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep)) 2179 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
2177 return 0; 2180 return 0;
2178 2181
@@ -2202,7 +2205,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2202 }; 2205 };
2203 struct usb_mixer_interface *mixer; 2206 struct usb_mixer_interface *mixer;
2204 struct snd_info_entry *entry; 2207 struct snd_info_entry *entry;
2205 struct usb_host_interface *host_iface;
2206 int err; 2208 int err;
2207 2209
2208 strcpy(chip->card->mixername, "USB Mixer"); 2210 strcpy(chip->card->mixername, "USB Mixer");
@@ -2219,8 +2221,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2219 return -ENOMEM; 2221 return -ENOMEM;
2220 } 2222 }
2221 2223
2222 host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; 2224 mixer->hostif = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
2223 switch (get_iface_desc(host_iface)->bInterfaceProtocol) { 2225 switch (get_iface_desc(mixer->hostif)->bInterfaceProtocol) {
2224 case UAC_VERSION_1: 2226 case UAC_VERSION_1:
2225 default: 2227 default:
2226 mixer->protocol = UAC_VERSION_1; 2228 mixer->protocol = UAC_VERSION_1;
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index ae1a14dcfe82..81b2d8a32fb0 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -3,6 +3,7 @@
3 3
4struct usb_mixer_interface { 4struct usb_mixer_interface {
5 struct snd_usb_audio *chip; 5 struct snd_usb_audio *chip;
6 struct usb_host_interface *hostif;
6 struct list_head list; 7 struct list_head list;
7 unsigned int ignore_ctl_error; 8 unsigned int ignore_ctl_error;
8 struct urb *urb; 9 struct urb *urb;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index dba0b7f11c54..a42e3ef3832d 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -1707,6 +1707,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1707 } 1707 }
1708 } 1708 }
1709}, 1709},
1710{
1711 USB_DEVICE(0x0582, 0x0130),
1712 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1713 /* .vendor_name = "BOSS", */
1714 /* .product_name = "MICRO BR-80", */
1715 .ifnum = QUIRK_ANY_INTERFACE,
1716 .type = QUIRK_COMPOSITE,
1717 .data = (const struct snd_usb_audio_quirk[]) {
1718 {
1719 .ifnum = 0,
1720 .type = QUIRK_IGNORE_INTERFACE
1721 },
1722 {
1723 .ifnum = 1,
1724 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1725 },
1726 {
1727 .ifnum = 2,
1728 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1729 },
1730 {
1731 .ifnum = 3,
1732 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1733 .data = & (const struct snd_usb_midi_endpoint_info) {
1734 .out_cables = 0x0001,
1735 .in_cables = 0x0001
1736 }
1737 },
1738 {
1739 .ifnum = -1
1740 }
1741 }
1742 }
1743},
1710 1744
1711/* Guillemot devices */ 1745/* Guillemot devices */
1712{ 1746{
@@ -2417,6 +2451,12 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2417 .idProduct = 0x1020, 2451 .idProduct = 0x1020,
2418}, 2452},
2419 2453
2454/* KeithMcMillen Stringport */
2455{
2456 USB_DEVICE(0x1f38, 0x0001),
2457 .bInterfaceClass = USB_CLASS_AUDIO,
2458},
2459
2420/* Miditech devices */ 2460/* Miditech devices */
2421{ 2461{
2422 USB_DEVICE(0x4752, 0x0011), 2462 USB_DEVICE(0x4752, 0x0011),
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 77762c99afbe..81e07d842581 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -426,7 +426,7 @@ static int snd_usb_cm106_boot_quirk(struct usb_device *dev)
426 */ 426 */
427static int snd_usb_cm6206_boot_quirk(struct usb_device *dev) 427static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
428{ 428{
429 int err, reg; 429 int err = 0, reg;
430 int val[] = {0x2004, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000}; 430 int val[] = {0x2004, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000};
431 431
432 for (reg = 0; reg < ARRAY_SIZE(val); reg++) { 432 for (reg = 0; reg < ARRAY_SIZE(val); reg++) {