Commit 7536c301f8817214629e80fa06b5b5c93df3ad52
Committed by
Takashi Iwai
1 parent
284a8dd6f0
Exists in
master
and in
20 other branches
ALSA: snd-usb-audio: Replace mixer for Electrix Ebox-44
The mixer units from the firmware are corrupt, and even where they are valid they presents mono controls as L and R channels of stereo. Signed-off-by: Mark Hills <mark@pogo.org.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 2 changed files with 80 additions and 0 deletions Side-by-side Diff
sound/usb/mixer_maps.c
... | ... | @@ -288,6 +288,15 @@ |
288 | 288 | { 0 } /* terminator */ |
289 | 289 | }; |
290 | 290 | |
291 | +static struct usbmix_name_map ebox44_map[] = { | |
292 | + { 4, NULL }, /* FU */ | |
293 | + { 6, NULL }, /* MU */ | |
294 | + { 7, NULL }, /* FU */ | |
295 | + { 10, NULL }, /* FU */ | |
296 | + { 11, NULL }, /* MU */ | |
297 | + { 0 } | |
298 | +}; | |
299 | + | |
291 | 300 | /* "Gamesurround Muse Pocket LT" looks same like "Sound Blaster MP3+" |
292 | 301 | * most importand difference is SU[8], it should be set to "Capture Source" |
293 | 302 | * to make alsamixer and PA working properly. |
... | ... | @@ -370,6 +379,10 @@ |
370 | 379 | .id = USB_ID(0x13e5, 0x0001), |
371 | 380 | .map = scratch_live_map, |
372 | 381 | .ignore_ctl_error = 1, |
382 | + }, | |
383 | + { | |
384 | + .id = USB_ID(0x200c, 0x1018), | |
385 | + .map = ebox44_map, | |
373 | 386 | }, |
374 | 387 | { 0 } /* terminator */ |
375 | 388 | }; |
sound/usb/mixer_quirks.c
... | ... | @@ -557,6 +557,69 @@ |
557 | 557 | return 0; |
558 | 558 | } |
559 | 559 | |
560 | +static int snd_ebox44_create_ctl(struct usb_mixer_interface *mixer, | |
561 | + int unitid, int control, int cmask, | |
562 | + int val_type, const char *name) | |
563 | +{ | |
564 | + struct usb_mixer_elem_info *cval; | |
565 | + struct snd_kcontrol *kctl; | |
566 | + | |
567 | + cval = kzalloc(sizeof(*cval), GFP_KERNEL); | |
568 | + if (!cval) | |
569 | + return -ENOMEM; | |
570 | + | |
571 | + cval->id = unitid; | |
572 | + cval->mixer = mixer; | |
573 | + | |
574 | + cval->val_type = val_type; | |
575 | + cval->channels = 1; | |
576 | + cval->control = control; | |
577 | + cval->cmask = cmask; | |
578 | + | |
579 | + /* Volume controls will override these values */ | |
580 | + cval->min = 0; | |
581 | + cval->max = 1; | |
582 | + cval->res = 0; | |
583 | + | |
584 | + cval->dBmin = 0; | |
585 | + cval->dBmax = 0; | |
586 | + | |
587 | + kctl = snd_ctl_new1(snd_usb_feature_unit_ctl, cval); | |
588 | + if (!kctl) { | |
589 | + kfree(cval); | |
590 | + return -ENOMEM; | |
591 | + } | |
592 | + | |
593 | + snprintf(kctl->id.name, sizeof(kctl->id.name), name); | |
594 | + kctl->private_free = usb_mixer_elem_free; | |
595 | + return snd_usb_mixer_add_control(mixer, kctl); | |
596 | +} | |
597 | + | |
598 | +/* | |
599 | + * Create mixer for Electrix Ebox-44 | |
600 | + * | |
601 | + * The mixer units from this device are corrupt, and even where they | |
602 | + * are valid they presents mono controls as L and R channels of | |
603 | + * stereo. So we create a good mixer in code. | |
604 | + */ | |
605 | + | |
606 | +static int snd_ebox44_create_mixer(struct usb_mixer_interface *mixer) | |
607 | +{ | |
608 | + snd_ebox44_create_ctl(mixer, 4, 1, 0x0, USB_MIXER_INV_BOOLEAN, "Headphone Playback Switch"); | |
609 | + snd_ebox44_create_ctl(mixer, 4, 2, 0x1, USB_MIXER_S16, "Headphone A Mix Playback Volume"); | |
610 | + snd_ebox44_create_ctl(mixer, 4, 2, 0x2, USB_MIXER_S16, "Headphone B Mix Playback Volume"); | |
611 | + | |
612 | + snd_ebox44_create_ctl(mixer, 7, 1, 0x0, USB_MIXER_INV_BOOLEAN, "Output Playback Switch"); | |
613 | + snd_ebox44_create_ctl(mixer, 7, 2, 0x1, USB_MIXER_S16, "Output A Playback Volume"); | |
614 | + snd_ebox44_create_ctl(mixer, 7, 2, 0x2, USB_MIXER_S16, "Output B Playback Volume"); | |
615 | + | |
616 | + snd_ebox44_create_ctl(mixer, 10, 1, 0x0, USB_MIXER_INV_BOOLEAN, "Input Capture Switch"); | |
617 | + snd_ebox44_create_ctl(mixer, 10, 2, 0x1, USB_MIXER_S16, "Input A Capture Volume"); | |
618 | + snd_ebox44_create_ctl(mixer, 10, 2, 0x2, USB_MIXER_S16, "Input B Capture Volume"); | |
619 | + | |
620 | + return 0; | |
621 | +} | |
622 | + | |
560 | 623 | void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, |
561 | 624 | unsigned char samplerate_id) |
562 | 625 | { |
... | ... | @@ -618,6 +681,10 @@ |
618 | 681 | err = snd_nativeinstruments_create_mixer(mixer, |
619 | 682 | snd_nativeinstruments_ta10_mixers, |
620 | 683 | ARRAY_SIZE(snd_nativeinstruments_ta10_mixers)); |
684 | + break; | |
685 | + | |
686 | + case USB_ID(0x200c, 0x1018): /* Electrix Ebox-44 */ | |
687 | + err = snd_ebox44_create_mixer(mixer); | |
621 | 688 | break; |
622 | 689 | } |
623 | 690 |