diff options
-rw-r--r-- | include/uapi/linux/usb/audio.h | 8 | ||||
-rw-r--r-- | sound/pci/emu10k1/emupcm.c | 4 | ||||
-rw-r--r-- | sound/pci/fm801.c | 16 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 3 | ||||
-rw-r--r-- | sound/pci/lx6464es/lx6464es.c | 7 | ||||
-rw-r--r-- | sound/pci/sonicvibes.c | 12 | ||||
-rw-r--r-- | sound/usb/card.h | 1 | ||||
-rw-r--r-- | sound/usb/format.c | 5 | ||||
-rw-r--r-- | sound/usb/mixer.c | 45 | ||||
-rw-r--r-- | sound/usb/quirks-table.h | 5 | ||||
-rw-r--r-- | sound/usb/quirks.c | 19 |
12 files changed, 101 insertions, 26 deletions
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h index 13d98e6e0db1..74e520fb944f 100644 --- a/include/uapi/linux/usb/audio.h +++ b/include/uapi/linux/usb/audio.h @@ -230,6 +230,14 @@ struct uac1_output_terminal_descriptor { #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 +/* Terminals - 2.4 Bi-directional Terminal Types */ +#define UAC_BIDIR_TERMINAL_UNDEFINED 0x400 +#define UAC_BIDIR_TERMINAL_HANDSET 0x401 +#define UAC_BIDIR_TERMINAL_HEADSET 0x402 +#define UAC_BIDIR_TERMINAL_SPEAKER_PHONE 0x403 +#define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING 0x404 +#define UAC_BIDIR_TERMINAL_ECHO_CANCELING 0x405 + /* Set bControlSize = 2 as default setting */ #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index d39458ab251f..69f9b100bd24 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -1858,7 +1858,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device) if (!kctl) return -ENOMEM; kctl->id.device = device; - snd_ctl_add(emu->card, kctl); + err = snd_ctl_add(emu->card, kctl); + if (err < 0) + return err; snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 73a67bc3586b..e3fb9c61017c 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -1068,11 +1068,19 @@ static int snd_fm801_mixer(struct fm801 *chip) if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0) return err; } - for (i = 0; i < FM801_CONTROLS; i++) - snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls[i], chip)); + for (i = 0; i < FM801_CONTROLS; i++) { + err = snd_ctl_add(chip->card, + snd_ctl_new1(&snd_fm801_controls[i], chip)); + if (err < 0) + return err; + } if (chip->multichannel) { - for (i = 0; i < FM801_CONTROLS_MULTI; i++) - snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); + for (i = 0; i < FM801_CONTROLS_MULTI; i++) { + err = snd_ctl_add(chip->card, + snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); + if (err < 0) + return err; + } } return 0; } diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index dbf9910c5269..e7fcfc3b8885 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -958,6 +958,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), + SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), + SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d64dcb9a4c99..e9bd33ea538f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -793,6 +793,9 @@ static inline void alc_shutup(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; + if (!snd_hda_get_bool_hint(codec, "shutup")) + return; /* disabled explicitly by hints */ + if (spec && spec->shutup) spec->shutup(codec); else diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 9655b08a1c52..6c85f13ab23f 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -1016,6 +1016,10 @@ static int snd_lx6464es_create(struct snd_card *card, /* dsp port */ chip->port_dsp_bar = pci_ioremap_bar(pci, 2); + if (!chip->port_dsp_bar) { + dev_err(card->dev, "cannot remap PCI memory region\n"); + goto remap_pci_failed; + } err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq, IRQF_SHARED, KBUILD_MODNAME, chip); @@ -1055,6 +1059,9 @@ device_new_failed: free_irq(pci->irq, chip); request_irq_failed: + iounmap(chip->port_dsp_bar); + +remap_pci_failed: pci_release_regions(pci); request_regions_failed: diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index a8abb15e3c3a..7fbdb703bfcd 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -1188,6 +1188,7 @@ SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0); static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) { struct gameport *gp; + int err; sonic->gameport = gp = gameport_allocate_port(); if (!gp) { @@ -1203,7 +1204,10 @@ static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) gameport_register_port(gp); - snd_ctl_add(sonic->card, snd_ctl_new1(&snd_sonicvibes_game_control, sonic)); + err = snd_ctl_add(sonic->card, + snd_ctl_new1(&snd_sonicvibes_game_control, sonic)); + if (err < 0) + return err; return 0; } @@ -1515,7 +1519,11 @@ static int snd_sonic_probe(struct pci_dev *pci, return err; } - snd_sonicvibes_create_gameport(sonic); + err = snd_sonicvibes_create_gameport(sonic); + if (err < 0) { + snd_card_free(card); + return err; + } if ((err = snd_card_register(card)) < 0) { snd_card_free(card); diff --git a/sound/usb/card.h b/sound/usb/card.h index 1406292d50ec..9b41b7dda84f 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -32,6 +32,7 @@ struct audioformat { struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */ bool dsd_dop; /* add DOP headers in case of DSD samples */ bool dsd_bitrev; /* reverse the bits of each DSD sample */ + bool dsd_raw; /* altsetting is raw DSD */ }; struct snd_usb_substream; diff --git a/sound/usb/format.c b/sound/usb/format.c index 1f7a74a77ea3..fd13ac11b136 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -64,8 +64,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubslotSize; - if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) + if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) { pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL; + /* flag potentially raw DSD capable altsettings */ + fp->dsd_raw = true; + } format <<= 1; break; diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 8c3568d8d03b..ca963e94ec03 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1653,11 +1653,11 @@ static void build_feature_ctl_badd(struct usb_mixer_interface *mixer, NULL, NULL, unitid, 0, 0); } -static void get_connector_control_name(struct mixer_build *state, +static void get_connector_control_name(struct usb_mixer_interface *mixer, struct usb_audio_term *term, bool is_input, char *name, int name_size) { - int name_len = get_term_name(state->chip, term, name, name_size, 0); + int name_len = get_term_name(mixer->chip, term, name, name_size, 0); if (name_len == 0) strlcpy(name, "Unknown", name_size); @@ -1674,7 +1674,7 @@ static void get_connector_control_name(struct mixer_build *state, } /* Build a mixer control for a UAC connector control (jack-detect) */ -static void build_connector_control(struct mixer_build *state, +static void build_connector_control(struct usb_mixer_interface *mixer, struct usb_audio_term *term, bool is_input) { struct snd_kcontrol *kctl; @@ -1683,7 +1683,7 @@ static void build_connector_control(struct mixer_build *state, cval = kzalloc(sizeof(*cval), GFP_KERNEL); if (!cval) return; - snd_usb_mixer_elem_init_std(&cval->head, state->mixer, term->id); + snd_usb_mixer_elem_init_std(&cval->head, mixer, term->id); /* * UAC2: The first byte from reading the UAC2_TE_CONNECTOR control returns the * number of channels connected. @@ -1694,7 +1694,7 @@ static void build_connector_control(struct mixer_build *state, * This boolean ctl will simply report if any channels are connected * or not. */ - if (state->mixer->protocol == UAC_VERSION_2) + if (mixer->protocol == UAC_VERSION_2) cval->control = UAC2_TE_CONNECTOR; else /* UAC_VERSION_3 */ cval->control = UAC3_TE_INSERTION; @@ -1705,11 +1705,11 @@ static void build_connector_control(struct mixer_build *state, cval->max = 1; kctl = snd_ctl_new1(&usb_connector_ctl_ro, cval); if (!kctl) { - usb_audio_err(state->chip, "cannot malloc kcontrol\n"); + usb_audio_err(mixer->chip, "cannot malloc kcontrol\n"); kfree(cval); return; } - get_connector_control_name(state, term, is_input, kctl->id.name, + get_connector_control_name(mixer, term, is_input, kctl->id.name, sizeof(kctl->id.name)); kctl->private_free = snd_usb_mixer_elem_free; snd_usb_mixer_add_control(&cval->head, kctl); @@ -2042,7 +2042,7 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid, /* Check for jack detection. */ if (uac_v2v3_control_is_readable(bmctls, control)) - build_connector_control(state, &iterm, true); + build_connector_control(state->mixer, &iterm, true); return 0; } @@ -2918,6 +2918,23 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer, UAC3_BADD_FU_ID7, map->map); } + /* Insertion Control */ + if (f->subclass == UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER) { + struct usb_audio_term iterm, oterm; + + /* Input Term - Insertion control */ + memset(&iterm, 0, sizeof(iterm)); + iterm.id = UAC3_BADD_IT_ID4; + iterm.type = UAC_BIDIR_TERMINAL_HEADSET; + build_connector_control(mixer, &iterm, true); + + /* Output Term - Insertion control */ + memset(&oterm, 0, sizeof(oterm)); + oterm.id = UAC3_BADD_OT_ID3; + oterm.type = UAC_BIDIR_TERMINAL_HEADSET; + build_connector_control(mixer, &oterm, false); + } + return 0; } @@ -2990,7 +3007,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) if (uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls), UAC2_TE_CONNECTOR)) { - build_connector_control(&state, &state.oterm, + build_connector_control(state.mixer, &state.oterm, false); } } else { /* UAC_VERSION_3 */ @@ -3017,7 +3034,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) if (uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls), UAC3_TE_INSERTION)) { - build_connector_control(&state, &state.oterm, + build_connector_control(state.mixer, &state.oterm, false); } } @@ -3321,10 +3338,12 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, err = snd_usb_mixer_controls(mixer); if (err < 0) goto _error; - err = snd_usb_mixer_status_create(mixer); - if (err < 0) - goto _error; } + + err = snd_usb_mixer_status_create(mixer); + if (err < 0) + goto _error; + err = create_keep_iface_ctl(mixer); if (err < 0) goto _error; diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 0e37e358ca97..8aac48f9c322 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -3277,6 +3277,10 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), } }, +/* disabled due to regression for other devices; + * see https://bugzilla.kernel.org/show_bug.cgi?id=199905 + */ +#if 0 { /* * Nura's first gen headphones use Cambridge Silicon Radio's vendor @@ -3324,6 +3328,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), } } }, +#endif /* disabled */ { /* diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index f4b69173682c..02b6cc02767f 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1362,16 +1362,12 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */ case USB_ID(0x20b1, 0x0002): /* Wyred 4 Sound DAC-2 DSD */ case USB_ID(0x20b1, 0x2004): /* Matrix Audio X-SPDIF 2 */ - case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */ case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */ case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */ case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ case USB_ID(0x22d9, 0x0436): /* OPPO Sonica */ case USB_ID(0x22d9, 0x0461): /* OPPO UDP-205 */ case USB_ID(0x2522, 0x0012): /* LH Labs VI DAC Infinity */ - case USB_ID(0x25ce, 0x001f): /* Mytek Brooklyn DAC */ - case USB_ID(0x25ce, 0x0021): /* Mytek Manhattan DAC */ - case USB_ID(0x25ce, 0x8025): /* Mytek Brooklyn DAC+ */ case USB_ID(0x2772, 0x0230): /* Pro-Ject Pre Box S2 Digital */ if (fp->altsetting == 2) return SNDRV_PCM_FMTBIT_DSD_U32_BE; @@ -1389,7 +1385,6 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, case USB_ID(0x20b1, 0x3021): /* Eastern El. MiniMax Tube DAC Supreme */ case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ case USB_ID(0x20b1, 0x302d): /* Unison Research Unico CD Due */ - case USB_ID(0x20b1, 0x3036): /* Holo Springs Level 3 R2R DAC */ case USB_ID(0x20b1, 0x307b): /* CH Precision C1 DAC */ case USB_ID(0x20b1, 0x3086): /* Singxer F-1 converter board */ case USB_ID(0x22d9, 0x0426): /* OPPO HA-2 */ @@ -1443,6 +1438,20 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, return SNDRV_PCM_FMTBIT_DSD_U32_BE; } + /* Mostly generic method to detect many DSD-capable implementations - + * from XMOS/Thesycon + */ + switch (USB_ID_VENDOR(chip->usb_id)) { + case 0x20b1: /* XMOS based devices */ + case 0x25ce: /* Mytek devices */ + if (fp->dsd_raw) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + default: + break; + + } + return 0; } |