Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'sound-fix-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"Here is a collection of small fixes on top of the previous update.

All small and obvious fixes. Mostly for usual suspects, USB-audio and
HD-audio, but a few trivial error handling fixes for misc drivers as
well"

* tag 'sound-fix-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: usb-audio: Always create the interrupt pipe for the mixer
ALSA: usb-audio: Add insertion control for UAC3 BADD
ALSA: usb-audio: Change in connectors control creation interface
ALSA: usb-audio: Add bi-directional terminal types
ALSA: lx6464es: add error handling for pci_ioremap_bar
ALSA: sonicvibes: add error handling for snd_ctl_add
ALSA: usb-audio: Remove explicitly listed Mytek devices
ALSA: usb-audio: Generic DSD detection for XMOS-based implementations
ALSA: usb-audio: Add native DSD support for Mytek DACs
ALSA: hda/realtek - Add shutup hint
ALSA: usb-audio: Disable the quirk for Nura headset
ALSA: hda: add dock and led support for HP ProBook 640 G4
ALSA: hda: add dock and led support for HP EliteBook 830 G5
ALSA: emu10k1: add error handling for snd_ctl_add
ALSA: fm801: add error handling for snd_ctl_add

+101 -26
+8
include/uapi/linux/usb/audio.h
··· 230 230 #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 231 231 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 232 232 233 + /* Terminals - 2.4 Bi-directional Terminal Types */ 234 + #define UAC_BIDIR_TERMINAL_UNDEFINED 0x400 235 + #define UAC_BIDIR_TERMINAL_HANDSET 0x401 236 + #define UAC_BIDIR_TERMINAL_HEADSET 0x402 237 + #define UAC_BIDIR_TERMINAL_SPEAKER_PHONE 0x403 238 + #define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING 0x404 239 + #define UAC_BIDIR_TERMINAL_ECHO_CANCELING 0x405 240 + 233 241 /* Set bControlSize = 2 as default setting */ 234 242 #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 235 243
+3 -1
sound/pci/emu10k1/emupcm.c
··· 1858 1858 if (!kctl) 1859 1859 return -ENOMEM; 1860 1860 kctl->id.device = device; 1861 - snd_ctl_add(emu->card, kctl); 1861 + err = snd_ctl_add(emu->card, kctl); 1862 + if (err < 0) 1863 + return err; 1862 1864 1863 1865 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1864 1866
+12 -4
sound/pci/fm801.c
··· 1068 1068 if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0) 1069 1069 return err; 1070 1070 } 1071 - for (i = 0; i < FM801_CONTROLS; i++) 1072 - snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls[i], chip)); 1071 + for (i = 0; i < FM801_CONTROLS; i++) { 1072 + err = snd_ctl_add(chip->card, 1073 + snd_ctl_new1(&snd_fm801_controls[i], chip)); 1074 + if (err < 0) 1075 + return err; 1076 + } 1073 1077 if (chip->multichannel) { 1074 - for (i = 0; i < FM801_CONTROLS_MULTI; i++) 1075 - snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); 1078 + for (i = 0; i < FM801_CONTROLS_MULTI; i++) { 1079 + err = snd_ctl_add(chip->card, 1080 + snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); 1081 + if (err < 0) 1082 + return err; 1083 + } 1076 1084 } 1077 1085 return 0; 1078 1086 }
+2
sound/pci/hda/patch_conexant.c
··· 958 958 SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), 959 959 SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), 960 960 SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), 961 + SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), 962 + SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), 961 963 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), 962 964 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), 963 965 SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
+3
sound/pci/hda/patch_realtek.c
··· 793 793 { 794 794 struct alc_spec *spec = codec->spec; 795 795 796 + if (!snd_hda_get_bool_hint(codec, "shutup")) 797 + return; /* disabled explicitly by hints */ 798 + 796 799 if (spec && spec->shutup) 797 800 spec->shutup(codec); 798 801 else
+7
sound/pci/lx6464es/lx6464es.c
··· 1016 1016 1017 1017 /* dsp port */ 1018 1018 chip->port_dsp_bar = pci_ioremap_bar(pci, 2); 1019 + if (!chip->port_dsp_bar) { 1020 + dev_err(card->dev, "cannot remap PCI memory region\n"); 1021 + goto remap_pci_failed; 1022 + } 1019 1023 1020 1024 err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq, 1021 1025 IRQF_SHARED, KBUILD_MODNAME, chip); ··· 1059 1055 free_irq(pci->irq, chip); 1060 1056 1061 1057 request_irq_failed: 1058 + iounmap(chip->port_dsp_bar); 1059 + 1060 + remap_pci_failed: 1062 1061 pci_release_regions(pci); 1063 1062 1064 1063 request_regions_failed:
+10 -2
sound/pci/sonicvibes.c
··· 1188 1188 static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) 1189 1189 { 1190 1190 struct gameport *gp; 1191 + int err; 1191 1192 1192 1193 sonic->gameport = gp = gameport_allocate_port(); 1193 1194 if (!gp) { ··· 1204 1203 1205 1204 gameport_register_port(gp); 1206 1205 1207 - snd_ctl_add(sonic->card, snd_ctl_new1(&snd_sonicvibes_game_control, sonic)); 1206 + err = snd_ctl_add(sonic->card, 1207 + snd_ctl_new1(&snd_sonicvibes_game_control, sonic)); 1208 + if (err < 0) 1209 + return err; 1208 1210 1209 1211 return 0; 1210 1212 } ··· 1519 1515 return err; 1520 1516 } 1521 1517 1522 - snd_sonicvibes_create_gameport(sonic); 1518 + err = snd_sonicvibes_create_gameport(sonic); 1519 + if (err < 0) { 1520 + snd_card_free(card); 1521 + return err; 1522 + } 1523 1523 1524 1524 if ((err = snd_card_register(card)) < 0) { 1525 1525 snd_card_free(card);
+1
sound/usb/card.h
··· 32 32 struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */ 33 33 bool dsd_dop; /* add DOP headers in case of DSD samples */ 34 34 bool dsd_bitrev; /* reverse the bits of each DSD sample */ 35 + bool dsd_raw; /* altsetting is raw DSD */ 35 36 }; 36 37 37 38 struct snd_usb_substream;
+4 -1
sound/usb/format.c
··· 64 64 sample_width = fmt->bBitResolution; 65 65 sample_bytes = fmt->bSubslotSize; 66 66 67 - if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) 67 + if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) { 68 68 pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL; 69 + /* flag potentially raw DSD capable altsettings */ 70 + fp->dsd_raw = true; 71 + } 69 72 70 73 format <<= 1; 71 74 break;
+32 -13
sound/usb/mixer.c
··· 1653 1653 NULL, NULL, unitid, 0, 0); 1654 1654 } 1655 1655 1656 - static void get_connector_control_name(struct mixer_build *state, 1656 + static void get_connector_control_name(struct usb_mixer_interface *mixer, 1657 1657 struct usb_audio_term *term, 1658 1658 bool is_input, char *name, int name_size) 1659 1659 { 1660 - int name_len = get_term_name(state->chip, term, name, name_size, 0); 1660 + int name_len = get_term_name(mixer->chip, term, name, name_size, 0); 1661 1661 1662 1662 if (name_len == 0) 1663 1663 strlcpy(name, "Unknown", name_size); ··· 1674 1674 } 1675 1675 1676 1676 /* Build a mixer control for a UAC connector control (jack-detect) */ 1677 - static void build_connector_control(struct mixer_build *state, 1677 + static void build_connector_control(struct usb_mixer_interface *mixer, 1678 1678 struct usb_audio_term *term, bool is_input) 1679 1679 { 1680 1680 struct snd_kcontrol *kctl; ··· 1683 1683 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1684 1684 if (!cval) 1685 1685 return; 1686 - snd_usb_mixer_elem_init_std(&cval->head, state->mixer, term->id); 1686 + snd_usb_mixer_elem_init_std(&cval->head, mixer, term->id); 1687 1687 /* 1688 1688 * UAC2: The first byte from reading the UAC2_TE_CONNECTOR control returns the 1689 1689 * number of channels connected. ··· 1694 1694 * This boolean ctl will simply report if any channels are connected 1695 1695 * or not. 1696 1696 */ 1697 - if (state->mixer->protocol == UAC_VERSION_2) 1697 + if (mixer->protocol == UAC_VERSION_2) 1698 1698 cval->control = UAC2_TE_CONNECTOR; 1699 1699 else /* UAC_VERSION_3 */ 1700 1700 cval->control = UAC3_TE_INSERTION; ··· 1705 1705 cval->max = 1; 1706 1706 kctl = snd_ctl_new1(&usb_connector_ctl_ro, cval); 1707 1707 if (!kctl) { 1708 - usb_audio_err(state->chip, "cannot malloc kcontrol\n"); 1708 + usb_audio_err(mixer->chip, "cannot malloc kcontrol\n"); 1709 1709 kfree(cval); 1710 1710 return; 1711 1711 } 1712 - get_connector_control_name(state, term, is_input, kctl->id.name, 1712 + get_connector_control_name(mixer, term, is_input, kctl->id.name, 1713 1713 sizeof(kctl->id.name)); 1714 1714 kctl->private_free = snd_usb_mixer_elem_free; 1715 1715 snd_usb_mixer_add_control(&cval->head, kctl); ··· 2042 2042 2043 2043 /* Check for jack detection. */ 2044 2044 if (uac_v2v3_control_is_readable(bmctls, control)) 2045 - build_connector_control(state, &iterm, true); 2045 + build_connector_control(state->mixer, &iterm, true); 2046 2046 2047 2047 return 0; 2048 2048 } ··· 2918 2918 UAC3_BADD_FU_ID7, map->map); 2919 2919 } 2920 2920 2921 + /* Insertion Control */ 2922 + if (f->subclass == UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER) { 2923 + struct usb_audio_term iterm, oterm; 2924 + 2925 + /* Input Term - Insertion control */ 2926 + memset(&iterm, 0, sizeof(iterm)); 2927 + iterm.id = UAC3_BADD_IT_ID4; 2928 + iterm.type = UAC_BIDIR_TERMINAL_HEADSET; 2929 + build_connector_control(mixer, &iterm, true); 2930 + 2931 + /* Output Term - Insertion control */ 2932 + memset(&oterm, 0, sizeof(oterm)); 2933 + oterm.id = UAC3_BADD_OT_ID3; 2934 + oterm.type = UAC_BIDIR_TERMINAL_HEADSET; 2935 + build_connector_control(mixer, &oterm, false); 2936 + } 2937 + 2921 2938 return 0; 2922 2939 } 2923 2940 ··· 3007 2990 3008 2991 if (uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls), 3009 2992 UAC2_TE_CONNECTOR)) { 3010 - build_connector_control(&state, &state.oterm, 2993 + build_connector_control(state.mixer, &state.oterm, 3011 2994 false); 3012 2995 } 3013 2996 } else { /* UAC_VERSION_3 */ ··· 3034 3017 3035 3018 if (uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls), 3036 3019 UAC3_TE_INSERTION)) { 3037 - build_connector_control(&state, &state.oterm, 3020 + build_connector_control(state.mixer, &state.oterm, 3038 3021 false); 3039 3022 } 3040 3023 } ··· 3338 3321 err = snd_usb_mixer_controls(mixer); 3339 3322 if (err < 0) 3340 3323 goto _error; 3341 - err = snd_usb_mixer_status_create(mixer); 3342 - if (err < 0) 3343 - goto _error; 3344 3324 } 3325 + 3326 + err = snd_usb_mixer_status_create(mixer); 3327 + if (err < 0) 3328 + goto _error; 3329 + 3345 3330 err = create_keep_iface_ctl(mixer); 3346 3331 if (err < 0) 3347 3332 goto _error;
+5
sound/usb/quirks-table.h
··· 3277 3277 } 3278 3278 }, 3279 3279 3280 + /* disabled due to regression for other devices; 3281 + * see https://bugzilla.kernel.org/show_bug.cgi?id=199905 3282 + */ 3283 + #if 0 3280 3284 { 3281 3285 /* 3282 3286 * Nura's first gen headphones use Cambridge Silicon Radio's vendor ··· 3328 3324 } 3329 3325 } 3330 3326 }, 3327 + #endif /* disabled */ 3331 3328 3332 3329 { 3333 3330 /*
+14 -5
sound/usb/quirks.c
··· 1362 1362 case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */ 1363 1363 case USB_ID(0x20b1, 0x0002): /* Wyred 4 Sound DAC-2 DSD */ 1364 1364 case USB_ID(0x20b1, 0x2004): /* Matrix Audio X-SPDIF 2 */ 1365 - case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */ 1366 1365 case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */ 1367 1366 case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */ 1368 1367 case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ 1369 1368 case USB_ID(0x22d9, 0x0436): /* OPPO Sonica */ 1370 1369 case USB_ID(0x22d9, 0x0461): /* OPPO UDP-205 */ 1371 1370 case USB_ID(0x2522, 0x0012): /* LH Labs VI DAC Infinity */ 1372 - case USB_ID(0x25ce, 0x001f): /* Mytek Brooklyn DAC */ 1373 - case USB_ID(0x25ce, 0x0021): /* Mytek Manhattan DAC */ 1374 - case USB_ID(0x25ce, 0x8025): /* Mytek Brooklyn DAC+ */ 1375 1371 case USB_ID(0x2772, 0x0230): /* Pro-Ject Pre Box S2 Digital */ 1376 1372 if (fp->altsetting == 2) 1377 1373 return SNDRV_PCM_FMTBIT_DSD_U32_BE; ··· 1385 1389 case USB_ID(0x20b1, 0x3021): /* Eastern El. MiniMax Tube DAC Supreme */ 1386 1390 case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ 1387 1391 case USB_ID(0x20b1, 0x302d): /* Unison Research Unico CD Due */ 1388 - case USB_ID(0x20b1, 0x3036): /* Holo Springs Level 3 R2R DAC */ 1389 1392 case USB_ID(0x20b1, 0x307b): /* CH Precision C1 DAC */ 1390 1393 case USB_ID(0x20b1, 0x3086): /* Singxer F-1 converter board */ 1391 1394 case USB_ID(0x22d9, 0x0426): /* OPPO HA-2 */ ··· 1436 1441 */ 1437 1442 if (fp->altsetting == iface->num_altsetting - 1) 1438 1443 return SNDRV_PCM_FMTBIT_DSD_U32_BE; 1444 + } 1445 + 1446 + /* Mostly generic method to detect many DSD-capable implementations - 1447 + * from XMOS/Thesycon 1448 + */ 1449 + switch (USB_ID_VENDOR(chip->usb_id)) { 1450 + case 0x20b1: /* XMOS based devices */ 1451 + case 0x25ce: /* Mytek devices */ 1452 + if (fp->dsd_raw) 1453 + return SNDRV_PCM_FMTBIT_DSD_U32_BE; 1454 + break; 1455 + default: 1456 + break; 1457 + 1439 1458 } 1440 1459 1441 1460 return 0;