ALSA: usb-audio: Add support for Presonus Studio 1810c
PATCH 1/1 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
Signed-off-by Nick Kossifidis <[email protected]>
--- sound/usb/Makefile | 1 + sound/usb/format.c | 17 ++ sound/usb/mixer_quirks.c | 5 + sound/usb/mixer_s1810c.c | 565 +++++++++++++++++++++++++++++++++++++++ sound/usb/mixer_s1810c.h | 6 + sound/usb/quirks.c | 34 +++ 6 files changed, 628 insertions(+) create mode 100644 sound/usb/mixer_s1810c.c create mode 100644 sound/usb/mixer_s1810c.h
sound/usb/Makefile +1 -0
@@ -13,6 +13,7 @@ snd-usb-audio-objs := card.o \ mixer_scarlett.o \ mixer_scarlett_gen2.o \ mixer_us16x08.o \ + mixer_s1810c.o \ pcm.o \ power.o \ proc.o \
sound/usb/format.c +17 -0
@@ -262,6 +262,23 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, }for (rate = min; rate <= max; rate += res) { + +/* +* Presonus Studio 1810c anounces invalid +* sampling rates for its streams. +*/ +if (chip->usb_id ==USB_ID (0x0194f ,0x010c ) && + ((rate >48000 && fp->altsetting ==1 ) || + ((rate <88200 || rate >96000 ) + && fp->altsetting ==2 ) || + ((rate <176400 || rate >192000 ) + && fp->altsetting ==3 ))) { +if (res) +continue ; +else +break ; + } +if (fp->rate_table) fp->rate_table[nr_rates] = rate;if (!fp->rate_min || rate < fp->rate_min)
sound/usb/mixer_quirks.c +5 -0
@@ -34,6 +34,7 @@#include "mixer_scarlett.h" #include "mixer_scarlett_gen2.h" #include "mixer_us16x08.h" +#include "mixer_s1810c.h" #include "helper.h" struct std_mono_table {
@@ -2277,6 +2278,10 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)case USB_ID (0x2a39 ,0x3fd4 ):/* RME */ err =snd_rme_controls_create (mixer);break ; + +case USB_ID (0x0194f ,0x010c ):/* Presonus Studio 1810c */ + err =snd_sc1810_init_mixer (mixer); +break ; }return err;
sound/usb/mixer_s1810c.c new file +565 -0
565 lines not on this page · raw message
sound/usb/mixer_s1810c.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Presonus Studio 1810c driver for ALSA +* Copyright (C) 2019 Nick Kossifidis <[email protected]> +*/ +int snd_sc1810_init_mixer (struct usb_mixer_interface *mixer);
sound/usb/quirks.c +34 -0
@@ -1216,6 +1216,36 @@ 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) +{ +/* +* Playback: +* 1: 6 Analog + 2 S/PDIF +* 2: 6 Analog + 2 S/PDIF +* 3: 6 Analog +* +* Capture: +* 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 ==1 && altno !=1 ) +return 1 ; +else if (chip->setup ==2 && altno !=3 ) +return 1 ; +else if (altno !=2 ) +return 1 ; + +return 0 ; +} +int snd_usb_apply_interface_quirk (struct snd_usb_audio *chip,int iface,int altno)
@@ -1229,6 +1259,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 ; }
Signature · 6 lines
2.23.0 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel