Skip to content

Commit 2f6e24d

Browse files
committed
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
2 parents becfc5e + ad6baae commit 2f6e24d

File tree

12 files changed

+101
-26
lines changed

12 files changed

+101
-26
lines changed

include/uapi/linux/usb/audio.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ struct uac1_output_terminal_descriptor {
230230
#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
231231
#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
232232

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+
233241
/* Set bControlSize = 2 as default setting */
234242
#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
235243

sound/pci/emu10k1/emupcm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
18581858
if (!kctl)
18591859
return -ENOMEM;
18601860
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;
18621864

18631865
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);
18641866

sound/pci/fm801.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,11 +1068,19 @@ static int snd_fm801_mixer(struct fm801 *chip)
10681068
if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0)
10691069
return err;
10701070
}
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+
}
10731077
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+
}
10761084
}
10771085
return 0;
10781086
}

sound/pci/hda/patch_conexant.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
958958
SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
959959
SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK),
960960
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),
961963
SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
962964
SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
963965
SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),

sound/pci/hda/patch_realtek.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ static inline void alc_shutup(struct hda_codec *codec)
793793
{
794794
struct alc_spec *spec = codec->spec;
795795

796+
if (!snd_hda_get_bool_hint(codec, "shutup"))
797+
return; /* disabled explicitly by hints */
798+
796799
if (spec && spec->shutup)
797800
spec->shutup(codec);
798801
else

sound/pci/lx6464es/lx6464es.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,10 @@ static int snd_lx6464es_create(struct snd_card *card,
10161016

10171017
/* dsp port */
10181018
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+
}
10191023

10201024
err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq,
10211025
IRQF_SHARED, KBUILD_MODNAME, chip);
@@ -1055,6 +1059,9 @@ static int snd_lx6464es_create(struct snd_card *card,
10551059
free_irq(pci->irq, chip);
10561060

10571061
request_irq_failed:
1062+
iounmap(chip->port_dsp_bar);
1063+
1064+
remap_pci_failed:
10581065
pci_release_regions(pci);
10591066

10601067
request_regions_failed:

sound/pci/sonicvibes.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@ SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
11881188
static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
11891189
{
11901190
struct gameport *gp;
1191+
int err;
11911192

11921193
sonic->gameport = gp = gameport_allocate_port();
11931194
if (!gp) {
@@ -1203,7 +1204,10 @@ static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
12031204

12041205
gameport_register_port(gp);
12051206

1206-
snd_ctl_add(sonic->card, snd_ctl_new1(&snd_sonicvibes_game_control, sonic));
1207+
err = snd_ctl_add(sonic->card,
1208+
snd_ctl_new1(&snd_sonicvibes_game_control, sonic));
1209+
if (err < 0)
1210+
return err;
12071211

12081212
return 0;
12091213
}
@@ -1515,7 +1519,11 @@ static int snd_sonic_probe(struct pci_dev *pci,
15151519
return err;
15161520
}
15171521

1518-
snd_sonicvibes_create_gameport(sonic);
1522+
err = snd_sonicvibes_create_gameport(sonic);
1523+
if (err < 0) {
1524+
snd_card_free(card);
1525+
return err;
1526+
}
15191527

15201528
if ((err = snd_card_register(card)) < 0) {
15211529
snd_card_free(card);

sound/usb/card.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct audioformat {
3232
struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */
3333
bool dsd_dop; /* add DOP headers in case of DSD samples */
3434
bool dsd_bitrev; /* reverse the bits of each DSD sample */
35+
bool dsd_raw; /* altsetting is raw DSD */
3536
};
3637

3738
struct snd_usb_substream;

sound/usb/format.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
6464
sample_width = fmt->bBitResolution;
6565
sample_bytes = fmt->bSubslotSize;
6666

67-
if (format & UAC2_FORMAT_TYPE_I_RAW_DATA)
67+
if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) {
6868
pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL;
69+
/* flag potentially raw DSD capable altsettings */
70+
fp->dsd_raw = true;
71+
}
6972

7073
format <<= 1;
7174
break;

sound/usb/mixer.c

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,11 +1653,11 @@ static void build_feature_ctl_badd(struct usb_mixer_interface *mixer,
16531653
NULL, NULL, unitid, 0, 0);
16541654
}
16551655

1656-
static void get_connector_control_name(struct mixer_build *state,
1656+
static void get_connector_control_name(struct usb_mixer_interface *mixer,
16571657
struct usb_audio_term *term,
16581658
bool is_input, char *name, int name_size)
16591659
{
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);
16611661

16621662
if (name_len == 0)
16631663
strlcpy(name, "Unknown", name_size);
@@ -1674,7 +1674,7 @@ static void get_connector_control_name(struct mixer_build *state,
16741674
}
16751675

16761676
/* 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,
16781678
struct usb_audio_term *term, bool is_input)
16791679
{
16801680
struct snd_kcontrol *kctl;
@@ -1683,7 +1683,7 @@ static void build_connector_control(struct mixer_build *state,
16831683
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
16841684
if (!cval)
16851685
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);
16871687
/*
16881688
* UAC2: The first byte from reading the UAC2_TE_CONNECTOR control returns the
16891689
* number of channels connected.
@@ -1694,7 +1694,7 @@ static void build_connector_control(struct mixer_build *state,
16941694
* This boolean ctl will simply report if any channels are connected
16951695
* or not.
16961696
*/
1697-
if (state->mixer->protocol == UAC_VERSION_2)
1697+
if (mixer->protocol == UAC_VERSION_2)
16981698
cval->control = UAC2_TE_CONNECTOR;
16991699
else /* UAC_VERSION_3 */
17001700
cval->control = UAC3_TE_INSERTION;
@@ -1705,11 +1705,11 @@ static void build_connector_control(struct mixer_build *state,
17051705
cval->max = 1;
17061706
kctl = snd_ctl_new1(&usb_connector_ctl_ro, cval);
17071707
if (!kctl) {
1708-
usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1708+
usb_audio_err(mixer->chip, "cannot malloc kcontrol\n");
17091709
kfree(cval);
17101710
return;
17111711
}
1712-
get_connector_control_name(state, term, is_input, kctl->id.name,
1712+
get_connector_control_name(mixer, term, is_input, kctl->id.name,
17131713
sizeof(kctl->id.name));
17141714
kctl->private_free = snd_usb_mixer_elem_free;
17151715
snd_usb_mixer_add_control(&cval->head, kctl);
@@ -2042,7 +2042,7 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid,
20422042

20432043
/* Check for jack detection. */
20442044
if (uac_v2v3_control_is_readable(bmctls, control))
2045-
build_connector_control(state, &iterm, true);
2045+
build_connector_control(state->mixer, &iterm, true);
20462046

20472047
return 0;
20482048
}
@@ -2918,6 +2918,23 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer,
29182918
UAC3_BADD_FU_ID7, map->map);
29192919
}
29202920

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+
29212938
return 0;
29222939
}
29232940

@@ -2990,7 +3007,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
29903007

29913008
if (uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls),
29923009
UAC2_TE_CONNECTOR)) {
2993-
build_connector_control(&state, &state.oterm,
3010+
build_connector_control(state.mixer, &state.oterm,
29943011
false);
29953012
}
29963013
} else { /* UAC_VERSION_3 */
@@ -3017,7 +3034,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
30173034

30183035
if (uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls),
30193036
UAC3_TE_INSERTION)) {
3020-
build_connector_control(&state, &state.oterm,
3037+
build_connector_control(state.mixer, &state.oterm,
30213038
false);
30223039
}
30233040
}
@@ -3321,10 +3338,12 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
33213338
err = snd_usb_mixer_controls(mixer);
33223339
if (err < 0)
33233340
goto _error;
3324-
err = snd_usb_mixer_status_create(mixer);
3325-
if (err < 0)
3326-
goto _error;
33273341
}
3342+
3343+
err = snd_usb_mixer_status_create(mixer);
3344+
if (err < 0)
3345+
goto _error;
3346+
33283347
err = create_keep_iface_ctl(mixer);
33293348
if (err < 0)
33303349
goto _error;

0 commit comments

Comments
 (0)