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 | 371 | return (protocol == UAC_VERSION_1) ? |
| 372 | 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 | 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 | 379 | return (protocol == UAC_VERSION_1) ? |
| 380 | 380 | &desc->baSourceID[desc->bNrInPins + 5] : |
| 381 | − &desc->baSourceID[desc->bNrInPins + 7]; | |
| 381 | + &desc->baSourceID[desc->bNrInPins + 6]; | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 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 | 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 | 200 | #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK) |
| 196 | 201 | #define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE) |
| 197 | 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 | 331 | struct loopback_cable *cable = dpcm->cable; |
| 327 | 332 | int bps, salign; |
| 328 | 333 | |
| 334 | + loopback_timer_stop_sync(dpcm); | |
| 335 | + | |
| 329 | 336 | salign = (snd_pcm_format_width(runtime->format) * |
| 330 | 337 | runtime->channels) / 8; |
| 331 | 338 | bps = salign * runtime->rate; |
| @@ -659,7 +666,9 @@ static void free_cable(struct snd_pcm_substream *substream) · 327 unmodified lines | ||
| 659 | 666 | return; |
| 660 | 667 | if (cable->streams[!substream->stream]) { |
| 661 | 668 | /* other stream is still alive */ |
| 669 | + spin_lock_irq(&cable->lock); | |
| 662 | 670 | cable->streams[substream->stream] = NULL; |
| 671 | + spin_unlock_irq(&cable->lock); | |
| 663 | 672 | } else { |
| 664 | 673 | /* free the cable */ |
| 665 | 674 | loopback->cables[substream->number][dev] = NULL; |
| @@ -698,7 +707,6 @@ static int loopback_open(struct snd_pcm_substream *substream) · 32 unmodified lines | ||
| 698 | 707 | loopback->cables[substream->number][dev] = cable; |
| 699 | 708 | } |
| 700 | 709 | dpcm->cable = cable; |
| 701 | − cable->streams[substream->stream] = dpcm; | |
| 702 | 710 | |
| 703 | 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 | 738 | runtime->hw = loopback_pcm_hardware; |
| 731 | 739 | else |
| 732 | 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 | 746 | unlock: |
| 734 | 747 | if (err < 0) { |
| 735 | 748 | free_cable(substream); |
| @@ -744,7 +757,7 @@ static int loopback_close(struct snd_pcm_substream *substream) · 8 unmodified lines | ||
| 744 | 757 | struct loopback *loopback = substream->private_data; |
| 745 | 758 | struct loopback_pcm *dpcm = substream->runtime->private_data; |
| 746 | 759 | |
| 747 | − loopback_timer_stop(dpcm); | |
| 760 | + loopback_timer_stop_sync(dpcm); | |
| 748 | 761 | mutex_lock(&loopback->cable_lock); |
| 749 | 762 | free_cable(substream); |
| 750 | 763 | mutex_unlock(&loopback->cable_lock); |
| @@ -375,6 +375,7 @@ enum { · 374 unmodified lines | ||
| 375 | 375 | ((pci)->device == 0x160c)) |
| 376 | 376 | |
| 377 | 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 | 380 | static char *driver_short_names[] = { |
| 380 | 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 | 1745 | else |
| 1745 | 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 | 1752 | err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); |
| 1748 | 1753 | if (err < 0) { |
| 1749 | 1754 | kfree(hda); |
| @@ -3130,6 +3130,8 @@ static void alc256_init(struct hda_codec *codec) · 3129 unmodified lines | ||
| 3130 | 3130 | |
| 3131 | 3131 | alc_update_coef_idx(codec, 0x46, 3 << 12, 0); |
| 3132 | 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 | 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 | 3598 | pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); |
| 3597 | 3599 | pinval &= ~AC_PINCTL_VREFEN; |
| 3598 | 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 | 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 | 3609 | /* Make sure the led works even in runtime suspend */ |
| @@ -5497,6 +5503,7 @@ enum { · 1893 unmodified lines | ||
| 5497 | 5503 | ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, |
| 5498 | 5504 | ALC298_FIXUP_TPT470_DOCK, |
| 5499 | 5505 | ALC255_FIXUP_DUMMY_LINEOUT_VERB, |
| 5506 | + ALC255_FIXUP_DELL_HEADSET_MIC, | |
| 5500 | 5507 | }; |
| 5501 | 5508 | |
| 5502 | 5509 | static const struct hda_fixup alc269_fixups[] = { |
| @@ -6357,6 +6364,13 @@ static const struct hda_fixup alc269_fixups[] = { · 854 unmodified lines | ||
| 6357 | 6364 | .chained = true, |
| 6358 | 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 | 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 | 6425 | SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
| 6412 | 6426 | SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
| 6413 | 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 | 6430 | SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), |
| 6415 | 6431 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 6416 | 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 | 7170 | break; |
| 7155 | 7171 | case 0x10ec0257: |
| 7156 | 7172 | spec->codec_variant = ALC269_TYPE_ALC257; |
| 7173 | + spec->shutup = alc256_shutup; | |
| 7174 | + spec->init_hook = alc256_init; | |
| 7157 | 7175 | spec->gen.mixer_nid = 0; |
| 7158 | 7176 | break; |
| 7159 | 7177 | case 0x10ec0215: |