ALSA: Tascam US-16x08 DSP mixer quirk
PATCH v5 1/1 ALSA: Tascam US-16x08 DSP mixer quirk
Add mixer quirk for Tascam US-16x08 usb interface. Even that this an usb compliant device,
the input channels and DSP functions (EQ/Compressor) arn't accessible by default.
v5 fixes some wrong snd_kcontrol_new xx.put return codes
--- sound/usb/Makefile | 1 + sound/usb/mixer_quirks.c | 5 + sound/usb/mixer_us16x08.c | 1425 +++++++++++++++++++++++++++++++++++++++++++++ sound/usb/mixer_us16x08.h | 122 ++++ 4 files changed, 1553 insertions(+) create mode 100644 sound/usb/mixer_us16x08.c create mode 100644 sound/usb/mixer_us16x08.h
sound/usb/Makefile +1 -0
@@ -10,6 +10,7 @@ snd-usb-audio-objs := card.o \ mixer.o \ mixer_quirks.o \ mixer_scarlett.o \ + mixer_us16x08.o \ pcm.o \ proc.o \ quirks.o \
sound/usb/mixer_quirks.c +5 -0
@@ -43,6 +43,7 @@#include "mixer.h" #include "mixer_quirks.h" #include "mixer_scarlett.h" +#include "mixer_us16x08.h" #include "helper.h" extern struct snd_kcontrol_new *snd_usb_feature_unit_ctl;
@@ -1729,6 +1730,10 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)return err;switch (mixer->chip->usb_id) { +/* Tascam US-16x08 */ +case USB_ID (0x0644 ,0x8047 ): + err =snd_us16x08_controls_create (mixer); +break ;case USB_ID (0x041e ,0x3020 ):case USB_ID (0x041e ,0x3040 ):case USB_ID (0x041e ,0x3042 ):
sound/usb/mixer_us16x08.c new file +1425 -0
1,425 lines not on this page · raw message
sound/usb/mixer_us16x08.h new file +122 -0
122 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 9 lines · OnkelDead
Add mixer quirk for Tascam US-16x08 usb interface. Even that this an usb compliant device,
the input channels and DSP functions (EQ/Compressor) arn't accessible by default.v5 fixes some wrong
snd_kcontrol_newxx.put return codesSigned-off-by Detlef Urban <[email protected]>
Thanks, now it looks really better than previous versions! One very minor issue in the coding style is:
sound/usb/mixer_us16x08.c line 215
Quoted 9 lines
sound/usb/mixer_us16x08.c new file +9
-0+static int snd_us16x08_route_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct snd_usb_audio *chip = elem->head.mixer->chip; + +int index = ucontrol->id.index; +char buf[sizeof (route_msg)]; +int val, val_org, err =0 ;
Don't put a blank line among the variable definitions / declarations.
Also, another question is:
sound/usb/mixer_us16x08.c line 246
Quoted 10 lines
sound/usb/mixer_us16x08.c new file +10
-0+ err =snd_us16x08_send_urb (chip, buf,sizeof (route_msg)); + +if (err >0 ) { + elem->cached |=1 << index; + elem->cache_val[index] = val; + }else { +usb_audio_err (chip,"Failed to set routing, err:%d\n" , err); + } + +return err >0 ?1 :0 ;
How often such an error would happen? If it may really happen (not only in theory), it'd result in a flood of kernel error messages, and we may need to suppress it. OTOH, if this is really an error, the callback should return an error code instead of silently ignoring it, so that user-space can catch the error, too.
That said, it's a question whether you want to ignore it intentionally, or it should be reported back to the upper level.
And the last issue is what I already mentioned: the control names. For example:
sound/usb/mixer_us16x08.c line 1072
Quoted 8 lines
sound/usb/mixer_us16x08.c new file +8
-0+/* table of EQ controls */ +static struct snd_us16x08_control_params eq_controls[] = { + {/* EQ switch */ + .kcontrol_new = &snd_us16x08_eq_switch_ctl, + .control_id =SND_US16X08_ID_EQENABLE , + .type =USB_MIXER_BOOLEAN , + .num_channels =16 , + .name ="EQ enable" ,
... which is a very non-standard name. There is some standard naming rule, as defined in Documentation/sound/designs/control-names.rst. Although we don't limit the control API usage strictly, it'd be better to align with the rule; i.e. at least putting the proper suffix for "Switch", "Volume", etc.
By covering these issues, I'd love to put this stuff into 4.11 if you can resubmit it in time.
thanks,
Takashi