Skip to content

Commit 0aef31b

Browse files
crwulfftiwai
authored andcommitted
ALSA: usb-audio: Fix mixer controls' USB interface for Kingston HyperX Amp (0951:16d8)
Use the USB interface of the mixer that the control was created on instead of the default control interface. This fixes the Kingston HyperX AMP (0951:16d8) which has controls on two interfaces. Signed-off-by: Chris Wulff <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 0a7efa1 commit 0aef31b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

sound/usb/mixer.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ static int uac2_ctl_value_size(int val_type)
292292
* retrieve a mixer value
293293
*/
294294

295+
static inline int mixer_ctrl_intf(struct usb_mixer_interface *mixer)
296+
{
297+
return get_iface_desc(mixer->hostif)->bInterfaceNumber;
298+
}
299+
295300
static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,
296301
int validx, int *value_ret)
297302
{
@@ -306,7 +311,7 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,
306311
return -EIO;
307312

308313
while (timeout-- > 0) {
309-
idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8);
314+
idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8);
310315
err = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,
311316
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
312317
validx, idx, buf, val_len);
@@ -354,7 +359,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
354359
if (ret)
355360
goto error;
356361

357-
idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8);
362+
idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8);
358363
ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
359364
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
360365
validx, idx, buf, size);
@@ -479,7 +484,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
479484
return -EIO;
480485

481486
while (timeout-- > 0) {
482-
idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8);
487+
idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8);
483488
err = snd_usb_ctl_msg(chip->dev,
484489
usb_sndctrlpipe(chip->dev, 0), request,
485490
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
@@ -1209,7 +1214,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
12091214
get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) {
12101215
usb_audio_err(cval->head.mixer->chip,
12111216
"%d:%d: cannot get min/max values for control %d (id %d)\n",
1212-
cval->head.id, snd_usb_ctrl_intf(cval->head.mixer->chip),
1217+
cval->head.id, mixer_ctrl_intf(cval->head.mixer),
12131218
cval->control, cval->head.id);
12141219
return -EINVAL;
12151220
}
@@ -1428,7 +1433,7 @@ static int mixer_ctl_connector_get(struct snd_kcontrol *kcontrol,
14281433
if (ret)
14291434
goto error;
14301435

1431-
idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8);
1436+
idx = mixer_ctrl_intf(cval->head.mixer) | (cval->head.id << 8);
14321437
if (cval->head.mixer->protocol == UAC_VERSION_2) {
14331438
struct uac2_connectors_ctl_blk uac2_conn;
14341439

@@ -3219,7 +3224,7 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry,
32193224
list_for_each_entry(mixer, &chip->mixer_list, list) {
32203225
snd_iprintf(buffer,
32213226
"USB Mixer: usb_id=0x%08x, ctrlif=%i, ctlerr=%i\n",
3222-
chip->usb_id, snd_usb_ctrl_intf(chip),
3227+
chip->usb_id, mixer_ctrl_intf(mixer),
32233228
mixer->ignore_ctl_error);
32243229
snd_iprintf(buffer, "Card: %s\n", chip->card->longname);
32253230
for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) {

0 commit comments

Comments
 (0)