ALSA: usb-audio: Add support for Presonus Studio 1810c

This patch adds support for Presonus Studio 1810c, a usb interface
that's UAC2 compliant with a few quirks and a few extra hw-specific
controls. I've tested all 3 altsettings and the added switch
controls and they work as expected.

More infos on the card:
https://www.presonus.com/products/Studio-1810c

Note that this work is based on packet inspection with
usbmon. I just wanted to get this card to work for using
it on our open-source radio station:
https://github.com/UoC-Radio

v2 address issues reported by Takashi:
* Properly get/set enum type controls
* Prevent race condition on switch_get/set
* Various control naming changes
* Various coding style fixes

v3 improve readability of sample rate filtering
and some other minor changes.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Link: https://lore.kernel.org/r/5e47481a.1c69fb81.befb3.8dac@mx.google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Nick Kossifidis
2020-02-15 03:23:35 +02:00
committed by Takashi Iwai
szülő 146f66975b
commit 8dc5efe3d1
6 fájl változott, egészen pontosan 681 új sor hozzáadva és 0 régi sor törölve

Fájl megtekintése

@@ -1252,6 +1252,38 @@ static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip,
return 0; /* keep this altsetting */
}
static int s1810c_skip_setting_quirk(struct snd_usb_audio *chip,
int iface, int altno)
{
/*
* Altno settings:
*
* Playback (Interface 1):
* 1: 6 Analog + 2 S/PDIF
* 2: 6 Analog + 2 S/PDIF
* 3: 6 Analog
*
* Capture (Interface 2):
* 1: 8 Analog + 2 S/PDIF + 8 ADAT
* 2: 8 Analog + 2 S/PDIF + 4 ADAT
* 3: 8 Analog
*/
/*
* I'll leave 2 as the default one and
* use device_setup to switch to the
* other two.
*/
if ((chip->setup == 0 || chip->setup > 2) && altno != 2)
return 1;
else if (chip->setup == 1 && altno != 1)
return 1;
else if (chip->setup == 2 && altno != 3)
return 1;
return 0;
}
int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
int iface,
int altno)
@@ -1265,6 +1297,10 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
/* fasttrackpro usb: skip altsets incompatible with device_setup */
if (chip->usb_id == USB_ID(0x0763, 0x2012))
return fasttrackpro_skip_setting_quirk(chip, iface, altno);
/* presonus studio 1810c: skip altsets incompatible with device_setup */
if (chip->usb_id == USB_ID(0x0194f, 0x010c))
return s1810c_skip_setting_quirk(chip, iface, altno);
return 0;
}