Re: [alsa-devel] [PATCH 4/4] ALSA: usb: add UAC3 BADD profiles support

From: Andrew Chant
Date: Thu Apr 19 2018 - 05:43:46 EST


On Sat, Apr 14, 2018 at 6:24 AM, Ruslan Bilovol
<ruslan.bilovol@xxxxxxxxx> wrote:
> Recently released USB Audio Class 3.0 specification
> contains BADD (Basic Audio Device Definition) document
> which describes pre-defined UAC3 configurations.
>
> BADD support is mandatory for UAC3 devices, it should be
> implemented as a separate USB device configuration.
> As per BADD document, class-specific descriptors
> shall not be included in the Deviceâs Configuration
> descriptor ("inferred"), but host can guess them
> from BADD profile number, number of endpoints and
> their max packed sizes.
>
> This patch adds support of all BADD profiles from the spec
>
> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@xxxxxxxxx>
> ---
> sound/usb/card.c | 14 +++
> sound/usb/clock.c | 9 +-
> sound/usb/mixer.c | 313 +++++++++++++++++++++++++++++++++++++++++++++++--
> sound/usb/mixer_maps.c | 65 ++++++++++
> sound/usb/stream.c | 83 +++++++++++--
> sound/usb/usbaudio.h | 2 +
> 6 files changed, 466 insertions(+), 20 deletions(-)

> --- a/sound/usb/mixer_maps.c
> +++ b/sound/usb/mixer_maps.c
> @@ -482,3 +482,68 @@ struct usbmix_ctl_map {
> { 0 } /* terminator */
> };
>
> +/*
> + * Control map entries for UAC3 BADD profiles
> + */
> +
> +static struct usbmix_name_map uac3_badd_generic_io_map[] = {
> + { UAC3_BADD_FU_ID2, "Generic Out Playback" },
> + { UAC3_BADD_FU_ID5, "Generic In Capture" },
> + { 0 } /* terminator */
> +};
> +static struct usbmix_name_map uac3_badd_headphone_map[] = {
> + { UAC3_BADD_FU_ID2, "Headphone Playback" },
> + { 0 } /* terminator */
> +};
> +static struct usbmix_name_map uac3_badd_speaker_map[] = {
> + { UAC3_BADD_FU_ID2, "Speaker Playback" },
> + { 0 } /* terminator */
> +};
> +static struct usbmix_name_map uac3_badd_microphone_map[] = {
> + { UAC3_BADD_FU_ID5, "Mic Capture" },
> + { 0 } /* terminator */
> +};
> +/* Covers also 'headset adapter' profile */
> +static struct usbmix_name_map uac3_badd_headset_map[] = {
> + { UAC3_BADD_FU_ID2, "Headset Playback" },
> + { UAC3_BADD_FU_ID5, "Headset Capture" },
> + { UAC3_BADD_FU_ID7, "Side Tone Mixing" },
Can you please call this "Sidetone"?
This better matches other Sidetone control names in the sound tree and
makes it compatible with existing Android userspace usage.