aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-11-05 09:37:22 -0500
committerTakashi Iwai <tiwai@suse.de>2014-11-05 09:37:22 -0500
commit19566b0bd93c34e4941822ed3c0d76a5abddcf82 (patch)
tree7e1894610584133feb4ee6e08bb3e05eb3d6acc1 /sound
parent9161bd0d1cf375492f0a6aa86b3e4c28b070fb7c (diff)
parent0725dda207e95ff25f1aa01432250323e0ec49d6 (diff)
Merge branch 'for-linus' into for-next
This merges the USB-audio disconnect fix and resolves the conflicts so that we can continue working on development of usb-audio stuff. Conflicts: sound/usb/card.c
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_compat.c2
-rw-r--r--sound/pci/hda/hda_intel.c4
-rw-r--r--sound/pci/hda/patch_realtek.c82
-rw-r--r--sound/usb/card.c9
4 files changed, 62 insertions, 35 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 102e8fd1d450..2d957ba63557 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -210,6 +210,8 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
210 if (err < 0) 210 if (err < 0)
211 return err; 211 return err;
212 212
213 if (clear_user(src, sizeof(*src)))
214 return -EFAULT;
213 if (put_user(status.state, &src->state) || 215 if (put_user(status.state, &src->state) ||
214 compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || 216 compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) ||
215 compat_put_timespec(&status.tstamp, &src->tstamp) || 217 compat_put_timespec(&status.tstamp, &src->tstamp) ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index cfcca4c30d4d..9ab1e631cb32 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -374,6 +374,8 @@ static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool
374#ifdef CONFIG_SND_DMA_SGBUF 374#ifdef CONFIG_SND_DMA_SGBUF
375 if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { 375 if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) {
376 struct snd_sg_buf *sgbuf = dmab->private_data; 376 struct snd_sg_buf *sgbuf = dmab->private_data;
377 if (chip->driver_type == AZX_DRIVER_CMEDIA)
378 return; /* deal with only CORB/RIRB buffers */
377 if (on) 379 if (on)
378 set_pages_array_wc(sgbuf->page_table, sgbuf->pages); 380 set_pages_array_wc(sgbuf->page_table, sgbuf->pages);
379 else 381 else
@@ -1769,7 +1771,7 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
1769#ifdef CONFIG_X86 1771#ifdef CONFIG_X86
1770 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1772 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1771 struct azx *chip = apcm->chip; 1773 struct azx *chip = apcm->chip;
1772 if (!azx_snoop(chip)) 1774 if (!azx_snoop(chip) && chip->driver_type != AZX_DRIVER_CMEDIA)
1773 area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); 1775 area->vm_page_prot = pgprot_writecombine(area->vm_page_prot);
1774#endif 1776#endif
1775} 1777}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c9cf248ce8ec..1af917f58a70 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -291,18 +291,14 @@ static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
291/* additional initialization for ALC888 variants */ 291/* additional initialization for ALC888 variants */
292static void alc888_coef_init(struct hda_codec *codec) 292static void alc888_coef_init(struct hda_codec *codec)
293{ 293{
294 if (alc_get_coef0(codec) == 0x20) 294 switch (alc_get_coef0(codec) & 0x00f0) {
295 /* alc888S-VC */ 295 /* alc888-VA */
296 alc_write_coef_idx(codec, 7, 0x830); 296 case 0x00:
297 else 297 /* alc888-VB */
298 /* alc888-VB */ 298 case 0x10:
299 alc_write_coef_idx(codec, 7, 0x3030); 299 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
300} 300 break;
301 301 }
302/* additional initialization for ALC889 variants */
303static void alc889_coef_init(struct hda_codec *codec)
304{
305 alc_update_coef_idx(codec, 7, 0, 0x2010);
306} 302}
307 303
308/* turn on/off EAPD control (only if available) */ 304/* turn on/off EAPD control (only if available) */
@@ -359,25 +355,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
359 case 0x10ec0260: 355 case 0x10ec0260:
360 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); 356 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
361 break; 357 break;
362 case 0x10ec0262:
363 case 0x10ec0880: 358 case 0x10ec0880:
364 case 0x10ec0882: 359 case 0x10ec0882:
365 case 0x10ec0883: 360 case 0x10ec0883:
366 case 0x10ec0885: 361 case 0x10ec0885:
367 case 0x10ec0887: 362 alc_update_coef_idx(codec, 7, 0, 0x2030);
368 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
369 case 0x10ec0900:
370 alc889_coef_init(codec);
371 break; 363 break;
372 case 0x10ec0888: 364 case 0x10ec0888:
373 alc888_coef_init(codec); 365 alc888_coef_init(codec);
374 break; 366 break;
375#if 0 /* XXX: This may cause the silent output on speaker on some machines */
376 case 0x10ec0267:
377 case 0x10ec0268:
378 alc_update_coef_idx(codec, 7, 0, 0x3000);
379 break;
380#endif /* XXX */
381 } 367 }
382 break; 368 break;
383 } 369 }
@@ -1710,7 +1696,7 @@ static void alc889_fixup_coef(struct hda_codec *codec,
1710{ 1696{
1711 if (action != HDA_FIXUP_ACT_INIT) 1697 if (action != HDA_FIXUP_ACT_INIT)
1712 return; 1698 return;
1713 alc889_coef_init(codec); 1699 alc_update_coef_idx(codec, 7, 0, 0x2030);
1714} 1700}
1715 1701
1716/* toggle speaker-output according to the hp-jack state */ 1702/* toggle speaker-output according to the hp-jack state */
@@ -3350,6 +3336,27 @@ static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3350 } 3336 }
3351} 3337}
3352 3338
3339static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3340 const struct hda_fixup *fix, int action)
3341{
3342 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3343 struct alc_spec *spec = codec->spec;
3344 static const struct hda_verb gpio_init[] = {
3345 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3346 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3347 {}
3348 };
3349
3350 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3351 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3352 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3353 spec->gpio_led = 0;
3354 spec->cap_mute_led_nid = 0x18;
3355 snd_hda_add_verbs(codec, gpio_init);
3356 codec->power_filter = led_power_filter;
3357 }
3358}
3359
3353static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, 3360static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3354 const struct hda_fixup *fix, int action) 3361 const struct hda_fixup *fix, int action)
3355{ 3362{
@@ -4217,6 +4224,7 @@ enum {
4217 ALC283_FIXUP_BXBT2807_MIC, 4224 ALC283_FIXUP_BXBT2807_MIC,
4218 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, 4225 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4219 ALC282_FIXUP_ASPIRE_V5_PINS, 4226 ALC282_FIXUP_ASPIRE_V5_PINS,
4227 ALC280_FIXUP_HP_GPIO4,
4220}; 4228};
4221 4229
4222static const struct hda_fixup alc269_fixups[] = { 4230static const struct hda_fixup alc269_fixups[] = {
@@ -4680,7 +4688,10 @@ static const struct hda_fixup alc269_fixups[] = {
4680 { }, 4688 { },
4681 }, 4689 },
4682 }, 4690 },
4683 4691 [ALC280_FIXUP_HP_GPIO4] = {
4692 .type = HDA_FIXUP_FUNC,
4693 .v.func = alc280_fixup_hp_gpio4,
4694 },
4684}; 4695};
4685 4696
4686static const struct snd_pci_quirk alc269_fixup_tbl[] = { 4697static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4728,21 +4739,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4728 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4739 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4729 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4740 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4730 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4741 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4731 SND_PCI_QUIRK(0x103c, 0x8004, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4732 /* ALC290 */ 4742 /* ALC290 */
4733 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4743 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4734 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4744 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4735 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4745 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4736 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4746 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4737 SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4738 SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4739 SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4740 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4747 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4741 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4748 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4742 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4749 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4743 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4750 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4744 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4751 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4745 SND_PCI_QUIRK(0x103c, 0x2258, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4746 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4752 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4747 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4753 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4748 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4754 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
@@ -4751,7 +4757,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4751 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4757 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4752 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4758 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4753 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4759 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4754 SND_PCI_QUIRK(0x103c, 0x2277, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4755 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4760 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4756 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4761 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4757 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4762 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
@@ -4804,7 +4809,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4804 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), 4809 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4805 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), 4810 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
4806 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), 4811 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
4807 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4812 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
4808 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4813 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4809 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 4814 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
4810 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4815 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -4984,6 +4989,19 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4984 {0x17, 0x40000000}, 4989 {0x17, 0x40000000},
4985 {0x1d, 0x40700001}, 4990 {0x1d, 0x40700001},
4986 {0x21, 0x02211040}), 4991 {0x21, 0x02211040}),
4992 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
4993 {0x12, 0x90a60130},
4994 {0x13, 0x40000000},
4995 {0x14, 0x90170110},
4996 {0x15, 0x0421101f},
4997 {0x16, 0x411111f0},
4998 {0x17, 0x411111f0},
4999 {0x18, 0x411111f0},
5000 {0x19, 0x411111f0},
5001 {0x1a, 0x04a11020},
5002 {0x1b, 0x411111f0},
5003 {0x1d, 0x40748605},
5004 {0x1e, 0x411111f0}),
4987 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED, 5005 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
4988 {0x12, 0x90a60140}, 5006 {0x12, 0x90a60140},
4989 {0x13, 0x40000000}, 5007 {0x13, 0x40000000},
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 69725d5fa2d6..1fab9778807a 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -585,18 +585,19 @@ static void usb_audio_disconnect(struct usb_interface *intf)
585 struct snd_usb_audio *chip = usb_get_intfdata(intf); 585 struct snd_usb_audio *chip = usb_get_intfdata(intf);
586 struct snd_card *card; 586 struct snd_card *card;
587 struct list_head *p; 587 struct list_head *p;
588 bool was_shutdown;
588 589
589 if (chip == (void *)-1L) 590 if (chip == (void *)-1L)
590 return; 591 return;
591 592
592 card = chip->card; 593 card = chip->card;
593 down_write(&chip->shutdown_rwsem); 594 down_write(&chip->shutdown_rwsem);
595 was_shutdown = chip->shutdown;
594 chip->shutdown = 1; 596 chip->shutdown = 1;
595 up_write(&chip->shutdown_rwsem); 597 up_write(&chip->shutdown_rwsem);
596 598
597 mutex_lock(&register_mutex); 599 mutex_lock(&register_mutex);
598 chip->num_interfaces--; 600 if (!was_shutdown) {
599 if (chip->num_interfaces <= 0) {
600 struct snd_usb_stream *as; 601 struct snd_usb_stream *as;
601 struct snd_usb_endpoint *ep; 602 struct snd_usb_endpoint *ep;
602 struct usb_mixer_interface *mixer; 603 struct usb_mixer_interface *mixer;
@@ -618,6 +619,10 @@ static void usb_audio_disconnect(struct usb_interface *intf)
618 list_for_each_entry(mixer, &chip->mixer_list, list) { 619 list_for_each_entry(mixer, &chip->mixer_list, list) {
619 snd_usb_mixer_disconnect(mixer); 620 snd_usb_mixer_disconnect(mixer);
620 } 621 }
622 }
623
624 chip->num_interfaces--;
625 if (chip->num_interfaces <= 0) {
621 usb_chip[chip->index] = NULL; 626 usb_chip[chip->index] = NULL;
622 mutex_unlock(&register_mutex); 627 mutex_unlock(&register_mutex);
623 snd_card_free_when_closed(card); 628 snd_card_free_when_closed(card);