ALSA: usb-audio: more control quirks for M-Audio FastTrack devices

Make use of the freshly introduced methods to re-use standard mixer
handling and add some controls that are hidden but implemented in a
standard conform way on M-Audio's FastTrack devices.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Original-code-by: Felix Homann <linuxaudio@showlabor.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Daniel Mack 2011-05-25 09:09:03 +02:00 committed by Takashi Iwai
parent 014950b013
commit d5a0bf6cc5
2 changed files with 72 additions and 2 deletions

View File

@ -40,6 +40,8 @@
#include "mixer_quirks.h" #include "mixer_quirks.h"
#include "helper.h" #include "helper.h"
extern struct snd_kcontrol_new *snd_usb_feature_unit_ctl;
/* /*
* Sound Blaster remote control configuration * Sound Blaster remote control configuration
* *
@ -492,6 +494,69 @@ static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface *mixer,
return err; return err;
} }
/* M-Audio FastTrack Ultra quirks */
/* private_free callback */
static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
{
kfree(kctl->private_data);
kctl->private_data = NULL;
}
static int snd_maudio_ftu_create_ctl(struct usb_mixer_interface *mixer,
int in, int out, const char *name)
{
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
if (!cval)
return -ENOMEM;
cval->id = 5;
cval->mixer = mixer;
cval->val_type = USB_MIXER_S16;
cval->channels = 1;
cval->control = out + 1;
cval->cmask = 1 << in;
kctl = snd_ctl_new1(snd_usb_feature_unit_ctl, cval);
if (!kctl) {
kfree(cval);
return -ENOMEM;
}
snprintf(kctl->id.name, sizeof(kctl->id.name), name);
kctl->private_free = usb_mixer_elem_free;
return snd_usb_mixer_add_control(mixer, kctl);
}
static int snd_maudio_ftu_create_mixer(struct usb_mixer_interface *mixer)
{
char name[64];
int in, out, err;
for (out = 0; out < 8; out++) {
for (in = 0; in < 8; in++) {
snprintf(name, sizeof(name),
"AIn%d - Out%d Capture Volume", in + 1, out + 1);
err = snd_maudio_ftu_create_ctl(mixer, in, out, name);
if (err < 0)
return err;
}
for (in = 8; in < 16; in++) {
snprintf(name, sizeof(name),
"DIn%d - Out%d Playback Volume", in - 7, out + 1);
err = snd_maudio_ftu_create_ctl(mixer, in, out, name);
if (err < 0)
return err;
}
}
return 0;
}
void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
unsigned char samplerate_id) unsigned char samplerate_id)
{ {
@ -533,6 +598,11 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
snd_audigy2nx_proc_read); snd_audigy2nx_proc_read);
break; break;
case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
err = snd_maudio_ftu_create_mixer(mixer);
break;
case USB_ID(0x0b05, 0x1739): case USB_ID(0x0b05, 0x1739):
case USB_ID(0x0b05, 0x1743): case USB_ID(0x0b05, 0x1743):
err = snd_xonar_u1_controls_create(mixer); err = snd_xonar_u1_controls_create(mixer);

View File

@ -1988,7 +1988,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = & (const struct snd_usb_audio_quirk[]) { .data = & (const struct snd_usb_audio_quirk[]) {
{ {
.ifnum = 0, .ifnum = 0,
.type = QUIRK_IGNORE_INTERFACE .type = QUIRK_AUDIO_STANDARD_MIXER,
}, },
{ {
.ifnum = 1, .ifnum = 1,
@ -2055,7 +2055,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = & (const struct snd_usb_audio_quirk[]) { .data = & (const struct snd_usb_audio_quirk[]) {
{ {
.ifnum = 0, .ifnum = 0,
.type = QUIRK_IGNORE_INTERFACE .type = QUIRK_AUDIO_STANDARD_MIXER,
}, },
{ {
.ifnum = 1, .ifnum = 1,