Commit 9407f45d authored by Chris Wulff's avatar Chris Wulff Committed by Greg Kroah-Hartman

ALSA: usb-audio: Create a registration quirk for Kingston HyperX Amp (0951:16d8)

[ Upstream commit 55f73261 ]

Create a quirk that allows special processing and/or
skipping the call to snd_card_register.

For HyperX AMP, which uses two interfaces, but only has
a capture stream in the second, this allows the capture
stream to merge with the first PCM.
Signed-off-by: default avatarChris Wulff <crwulff@gmail.com>
Link: https://lore.kernel.org/r/20200314165449.4086-3-crwulff@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d1a0c5bc
...@@ -668,10 +668,14 @@ static int usb_audio_probe(struct usb_interface *intf, ...@@ -668,10 +668,14 @@ static int usb_audio_probe(struct usb_interface *intf,
goto __error; goto __error;
} }
/* we are allowed to call snd_card_register() many times */ /* we are allowed to call snd_card_register() many times, but first
err = snd_card_register(chip->card); * check to see if a device needs to skip it or do anything special
if (err < 0) */
goto __error; if (snd_usb_registration_quirk(chip, ifnum) == 0) {
err = snd_card_register(chip->card);
if (err < 0)
goto __error;
}
usb_chip[chip->index] = chip; usb_chip[chip->index] = chip;
chip->num_interfaces++; chip->num_interfaces++;
......
...@@ -1508,3 +1508,17 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, ...@@ -1508,3 +1508,17 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
break; break;
} }
} }
int snd_usb_registration_quirk(struct snd_usb_audio *chip,
int iface)
{
switch (chip->usb_id) {
case USB_ID(0x0951, 0x16d8): /* Kingston HyperX AMP */
/* Register only when we reach interface 2 so that streams can
* merge correctly into PCMs from interface 0
*/
return (iface != 2);
}
/* Register as normal */
return 0;
}
...@@ -46,4 +46,7 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, ...@@ -46,4 +46,7 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
struct audioformat *fp, struct audioformat *fp,
int stream); int stream);
int snd_usb_registration_quirk(struct snd_usb_audio *chip,
int iface);
#endif /* __USBAUDIO_QUIRKS_H */ #endif /* __USBAUDIO_QUIRKS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment