]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ALSA: usb-audio: Add insertion control for UAC3 BADD
authorJorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Thu, 14 Jun 2018 14:05:57 +0000 (15:05 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 14 Jun 2018 16:03:52 +0000 (18:03 +0200)
The HEADSET ADAPTER profile for BADD devices is meant to support
Insertion Control for the Input and Output Terminals of the headset.

This patch defines the BADD inferred input and output terminals and
builds the connector controls.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c

index 34fef71e033059d4559b2c99d2a4bfa3f4ef3b94..03b8a2ac93c86e2e568b873ac2e315e1b3766aec 100644 (file)
@@ -2918,6 +2918,23 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer,
                                       UAC3_BADD_FU_ID7, map->map);
        }
 
+       /* Insertion Control */
+       if (f->subclass == UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER) {
+               struct usb_audio_term iterm, oterm;
+
+               /* Input Term - Insertion control */
+               memset(&iterm, 0, sizeof(iterm));
+               iterm.id = UAC3_BADD_IT_ID4;
+               iterm.type = UAC_BIDIR_TERMINAL_HEADSET;
+               build_connector_control(mixer, &iterm, true);
+
+               /* Output Term - Insertion control */
+               memset(&oterm, 0, sizeof(oterm));
+               oterm.id = UAC3_BADD_OT_ID3;
+               oterm.type = UAC_BIDIR_TERMINAL_HEADSET;
+               build_connector_control(mixer, &oterm, false);
+       }
+
        return 0;
 }