Pull sound fixes from Takashi Iwai: "Things look calming down, but people were still busy to plaster over small holes: - Two fixes to harden against races in aloop driver - A correction of a long-standing bug in USB-audio UAC2 processing unit parser - As usual suspects, HD-audio: a workaround for Coffee Lake controller and a few other device-specific fixes All small and for stable" * tag 'sound-4.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: aloop: Fix access to not-yet-ready substream via cable ALSA: aloop: Sync stale timer before release ALSA: hda/realtek - Fix speaker no sound after system resume ALSA: hda/realtek - Fix Dell headset Mic can't record ALSA: hda - Force polling mode on CFL for fixing codec communication ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit ALSA: hda/realtek - Always immediately update mute LED with pin VREF
Unified · Split
| @@ -370,7 +370,7 @@ static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_d · 369 unmodified lines | |||
| 370 | { | 370 | { |
| 371 | return (protocol == UAC_VERSION_1) ? | 371 | return (protocol == UAC_VERSION_1) ? |
| 372 | desc->baSourceID[desc->bNrInPins + 4] : | 372 | desc->baSourceID[desc->bNrInPins + 4] : |
| 373 | desc->baSourceID[desc->bNrInPins + 6]; | 373 | 2; /* in UAC2, this value is constant */ |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, | 376 | static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, |
| @@ -378,7 +378,7 @@ static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_de · 1 unmodified line | |||
| 378 | { | 378 | { |
| 379 | return (protocol == UAC_VERSION_1) ? | 379 | return (protocol == UAC_VERSION_1) ? |
| 380 | &desc->baSourceID[desc->bNrInPins + 5] : | 380 | &desc->baSourceID[desc->bNrInPins + 5] : |
| 381 | &desc->baSourceID[desc->bNrInPins + 7]; | 381 | &desc->baSourceID[desc->bNrInPins + 6]; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, | 384 | static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, |
| @@ -192,6 +192,11 @@ static inline void loopback_timer_stop(struct loopback_pcm *dpcm) · 191 unmodified lines | |||
| 192 | dpcm->timer.expires = 0; | 192 | dpcm->timer.expires = 0; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static inline void loopback_timer_stop_sync(struct loopback_pcm *dpcm) | ||
| 196 | { | ||
| 197 | del_timer_sync(&dpcm->timer); | ||
| 198 | } | ||
| 199 | |||
| 195 | #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK) | 200 | #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK) |
| 196 | #define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE) | 201 | #define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE) |
| 197 | #define CABLE_VALID_BOTH (CABLE_VALID_PLAYBACK|CABLE_VALID_CAPTURE) | 202 | #define CABLE_VALID_BOTH (CABLE_VALID_PLAYBACK|CABLE_VALID_CAPTURE) |
| @@ -326,6 +331,8 @@ static int loopback_prepare(struct snd_pcm_substream *substream) · 128 unmodified lines | |||
| 326 | struct loopback_cable *cable = dpcm->cable; | 331 | struct loopback_cable *cable = dpcm->cable; |
| 327 | int bps, salign; | 332 | int bps, salign; |
| 328 | 333 | ||
| 334 | loopback_timer_stop_sync(dpcm); | ||
| 335 | |||
| 329 | salign = (snd_pcm_format_width(runtime->format) * | 336 | salign = (snd_pcm_format_width(runtime->format) * |
| 330 | runtime->channels) / 8; | 337 | runtime->channels) / 8; |
| 331 | bps = salign * runtime->rate; | 338 | bps = salign * runtime->rate; |
| @@ -659,7 +666,9 @@ static void free_cable(struct snd_pcm_substream *substream) · 327 unmodified lines | |||
| 659 | return; | 666 | return; |
| 660 | if (cable->streams[!substream->stream]) { | 667 | if (cable->streams[!substream->stream]) { |
| 661 | /* other stream is still alive */ | 668 | /* other stream is still alive */ |
| 669 | spin_lock_irq(&cable->lock); | ||
| 662 | cable->streams[substream->stream] = NULL; | 670 | cable->streams[substream->stream] = NULL; |
| 671 | spin_unlock_irq(&cable->lock); | ||
| 663 | } else { | 672 | } else { |
| 664 | /* free the cable */ | 673 | /* free the cable */ |
| 665 | loopback->cables[substream->number][dev] = NULL; | 674 | loopback->cables[substream->number][dev] = NULL; |
| @@ -698,7 +707,6 @@ static int loopback_open(struct snd_pcm_substream *substream) · 32 unmodified lines | |||
| 698 | loopback->cables[substream->number][dev] = cable; | 707 | loopback->cables[substream->number][dev] = cable; |
| 699 | } | 708 | } |
| 700 | dpcm->cable = cable; | 709 | dpcm->cable = cable; |
| 701 | cable->streams[substream->stream] = dpcm; | ||
| 702 | 710 | ||
| 703 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 711 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
| 704 | 712 | ||
| @@ -730,6 +738,11 @@ static int loopback_open(struct snd_pcm_substream *substream) · 25 unmodified lines | |||
| 730 | runtime->hw = loopback_pcm_hardware; | 738 | runtime->hw = loopback_pcm_hardware; |
| 731 | else | 739 | else |
| 732 | runtime->hw = cable->hw; | 740 | runtime->hw = cable->hw; |
| 741 | |||
| 742 | spin_lock_irq(&cable->lock); | ||
| 743 | cable->streams[substream->stream] = dpcm; | ||
| 744 | spin_unlock_irq(&cable->lock); | ||
| 745 | |||
| 733 | unlock: | 746 | unlock: |
| 734 | if (err < 0) { | 747 | if (err < 0) { |
| 735 | free_cable(substream); | 748 | free_cable(substream); |
| @@ -744,7 +757,7 @@ static int loopback_close(struct snd_pcm_substream *substream) · 8 unmodified lines | |||
| 744 | struct loopback *loopback = substream->private_data; | 757 | struct loopback *loopback = substream->private_data; |
| 745 | struct loopback_pcm *dpcm = substream->runtime->private_data; | 758 | struct loopback_pcm *dpcm = substream->runtime->private_data; |
| 746 | 759 | ||
| 747 | loopback_timer_stop(dpcm); | 760 | loopback_timer_stop_sync(dpcm); |
| 748 | mutex_lock(&loopback->cable_lock); | 761 | mutex_lock(&loopback->cable_lock); |
| 749 | free_cable(substream); | 762 | free_cable(substream); |
| 750 | mutex_unlock(&loopback->cable_lock); | 763 | mutex_unlock(&loopback->cable_lock); |
| @@ -375,6 +375,7 @@ enum { · 374 unmodified lines | |||
| 375 | ((pci)->device == 0x160c)) | 375 | ((pci)->device == 0x160c)) |
| 376 | 376 | ||
| 377 | #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) | 377 | #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) |
| 378 | #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) | ||
| 378 | 379 | ||
| 379 | static char *driver_short_names[] = { | 380 | static char *driver_short_names[] = { |
| 380 | [AZX_DRIVER_ICH] = "HDA Intel", | 381 | [AZX_DRIVER_ICH] = "HDA Intel", |
| @@ -1744,6 +1745,10 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 1363 unmodified lines | |||
| 1744 | else | 1745 | else |
| 1745 | chip->bdl_pos_adj = bdl_pos_adj[dev]; | 1746 | chip->bdl_pos_adj = bdl_pos_adj[dev]; |
| 1746 | 1747 | ||
| 1748 | /* Workaround for a communication error on CFL (bko#199007) */ | ||
| 1749 | if (IS_CFL(pci)) | ||
| 1750 | chip->polling_mode = 1; | ||
| 1751 | |||
| 1747 | err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); | 1752 | err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); |
| 1748 | if (err < 0) { | 1753 | if (err < 0) { |
| 1749 | kfree(hda); | 1754 | kfree(hda); |
| @@ -3130,6 +3130,8 @@ static void alc256_init(struct hda_codec *codec) · 3129 unmodified lines | |||
| 3130 | 3130 | ||
| 3131 | alc_update_coef_idx(codec, 0x46, 3 << 12, 0); | 3131 | alc_update_coef_idx(codec, 0x46, 3 << 12, 0); |
| 3132 | alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ | 3132 | alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ |
| 3133 | alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ | ||
| 3134 | alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); | ||
| 3133 | } | 3135 | } |
| 3134 | 3136 | ||
| 3135 | static void alc256_shutup(struct hda_codec *codec) | 3137 | static void alc256_shutup(struct hda_codec *codec) |
| @@ -3596,8 +3598,12 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) · 460 unmodified lines | |||
| 3596 | pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); | 3598 | pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); |
| 3597 | pinval &= ~AC_PINCTL_VREFEN; | 3599 | pinval &= ~AC_PINCTL_VREFEN; |
| 3598 | pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80; | 3600 | pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80; |
| 3599 | if (spec->mute_led_nid) | 3601 | if (spec->mute_led_nid) { |
| 3602 | /* temporarily power up/down for setting VREF */ | ||
| 3603 | snd_hda_power_up_pm(codec); | ||
| 3600 | snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); | 3604 | snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); |
| 3605 | snd_hda_power_down_pm(codec); | ||
| 3606 | } | ||
| 3601 | } | 3607 | } |
| 3602 | 3608 | ||
| 3603 | /* Make sure the led works even in runtime suspend */ | 3609 | /* Make sure the led works even in runtime suspend */ |
| @@ -5497,6 +5503,7 @@ enum { · 1893 unmodified lines | |||
| 5497 | ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, | 5503 | ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, |
| 5498 | ALC298_FIXUP_TPT470_DOCK, | 5504 | ALC298_FIXUP_TPT470_DOCK, |
| 5499 | ALC255_FIXUP_DUMMY_LINEOUT_VERB, | 5505 | ALC255_FIXUP_DUMMY_LINEOUT_VERB, |
| 5506 | ALC255_FIXUP_DELL_HEADSET_MIC, | ||
| 5500 | }; | 5507 | }; |
| 5501 | 5508 | ||
| 5502 | static const struct hda_fixup alc269_fixups[] = { | 5509 | static const struct hda_fixup alc269_fixups[] = { |
| @@ -6357,6 +6364,13 @@ static const struct hda_fixup alc269_fixups[] = { · 854 unmodified lines | |||
| 6357 | .chained = true, | 6364 | .chained = true, |
| 6358 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | 6365 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
| 6359 | }, | 6366 | }, |
| 6367 | [ALC255_FIXUP_DELL_HEADSET_MIC] = { | ||
| 6368 | .type = HDA_FIXUP_PINS, | ||
| 6369 | .v.pins = (const struct hda_pintbl[]) { | ||
| 6370 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | ||
| 6371 | { } | ||
| 6372 | }, | ||
| 6373 | }, | ||
| 6360 | }; | 6374 | }; |
| 6361 | 6375 | ||
| 6362 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 6376 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
| @@ -6411,6 +6425,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 48 unmodified lines | |||
| 6411 | SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 6425 | SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
| 6412 | SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), | 6426 | SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
| 6413 | SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), | 6427 | SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
| 6428 | SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), | ||
| 6429 | SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), | ||
| 6414 | SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), | 6430 | SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), |
| 6415 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 6431 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 6416 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 6432 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| @@ -7154,6 +7170,8 @@ static int patch_alc269(struct hda_codec *codec) · 737 unmodified lines | |||
| 7154 | break; | 7170 | break; |
| 7155 | case 0x10ec0257: | 7171 | case 0x10ec0257: |
| 7156 | spec->codec_variant = ALC269_TYPE_ALC257; | 7172 | spec->codec_variant = ALC269_TYPE_ALC257; |
| 7173 | spec->shutup = alc256_shutup; | ||
| 7174 | spec->init_hook = alc256_init; | ||
| 7157 | spec->gen.mixer_nid = 0; | 7175 | spec->gen.mixer_nid = 0; |
| 7158 | break; | 7176 | break; |
| 7159 | case 0x10ec0215: | 7177 | case 0x10ec0215: |