Re: [PATCH v30 28/30] ALSA: usb-audio: Add USB offload route kcontrol

Takashi Iwai
2024-11-20T12:12:26Z

On Wed, 06 Nov 2024 20:34:11 +0100,
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@quicinc.com>

IIRC, this representation of kcontrol was one argued issue; Pierre
expressed the concern about the complexity of the kcontrol.
I didn't follow exactly, but did we get consensus?

Apart from that: the Kconfig defition below ...

> +config SND_USB_OFFLOAD_MIXER
> + tristate "USB Audio Offload mixer control"
> + help
> + Say Y to enable the USB audio offloading mixer controls. This
> + exposes an USB offload capable kcontrol to signal to applications
> + about which platform sound card can support USB audio offload.
> + The returning values specify the mapped ASoC card and PCM device
> + the USB audio device is associated to.

... and Makefile addition below ...

> --- a/sound/usb/Makefile
> +++ b/sound/usb/Makefile
> @@ -36,3 +36,5 @@ obj-$(CONFIG_SND_USB_US122L) += snd-usbmidi-lib.o
>
> obj-$(CONFIG_SND) += misc/ usx2y/ caiaq/ 6fire/ hiface/ bcd2000/ qcom/
> obj-$(CONFIG_SND_USB_LINE6) += line6/
> +
> +obj-$(CONFIG_SND_USB_OFFLOAD_MIXER) += mixer_usb_offload.o

... indicates that this code will be an individual module, although
it's solely used from snd-usb-audio-qmi driver. This should be rather
a boolean and moved to sound/usb/qcom/, and linked to
snd-usb-audio-qmi driver itself, e.g.

--- a/sound/usb/qcom/Makefile
+++ b/sound/usb/qcom/Makefile
@@ -1,2 +1,3 @@
snd-usb-audio-qmi-objs := usb_audio_qmi_v01.o qc_audio_offload.o
+snd-usb-audio-qmi-$(CONFIG_SND_USB_OFFLOAD_MIXER) += mixer_usb_offload.o
obj-$(CONFIG_SND_USB_AUDIO_QMI) += snd-usb-audio-qmi.o

Then you can drop EXPORT_SYMBOL_GPL(), too.

thanks,

Takashi