On 1/16/25 3:28 PM, Wesley Cheng wrote: > In order to allow userspace/applications know about USB offloading status, > expose a sound kcontrol that fetches information about which sound card > and PCM index the USB device is mapped to for supporting offloading. In > the USB audio offloading framework, the ASoC BE DAI link is the entity > responsible for registering to the SOC USB layer. > > It is expected for the USB SND offloading driver to add the kcontrol to the > sound card associated with the USB audio device. An example output would > look like: > > tinymix -D 1 get 'USB Offload Playback Route PCM#0' > -1, -1 (range -1->255) > > This example signifies that there is no mapped ASoC path available for the > USB SND device. > > tinymix -D 1 get 'USB Offload Playback Route PCM#0' > 0, 0 (range -1->255) > > This example signifies that the offload path is available over ASoC sound > card index#0 and PCM device#0. > > The USB offload kcontrol will be added in addition to the existing > kcontrols identified by the USB SND mixer. The kcontrols used to modify > the USB audio device specific parameters are still valid and expected to be > used. These parameters are not mirrored to the ASoC subsystem. > > Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx> > --- > sound/usb/Kconfig | 10 ++ > sound/usb/qcom/Makefile | 4 + > sound/usb/qcom/mixer_usb_offload.c | 158 +++++++++++++++++++++++++++++ > sound/usb/qcom/mixer_usb_offload.h | 17 ++++ > sound/usb/qcom/qc_audio_offload.c | 2 + > 5 files changed, 191 insertions(+) > create mode 100644 sound/usb/qcom/mixer_usb_offload.c > create mode 100644 sound/usb/qcom/mixer_usb_offload.h > > diff --git a/sound/usb/qcom/mixer_usb_offload.c b/sound/usb/qcom/mixer_usb_offload.c > new file mode 100644 > index 000000000000..2696eb145ef5 > --- /dev/null > +++ b/sound/usb/qcom/mixer_usb_offload.c > @@ -0,0 +1,158 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved. > + */ > + > +#include <linux/usb.h> > + [snip] > + > +/** > + * snd_usb_offload_create_ctl() - Add USB offload bounded mixer > + * @chip - USB SND chip device Use ':' instead of '-'. > + * > + * Creates a sound control for a USB audio device, so that applications can > + * query for if there is an available USB audio offload path, and which > + * card is managing it. > + */ > +int snd_usb_offload_create_ctl(struct snd_usb_audio *chip) > +{ -- ~Randy