Re: [PATCH v5 18/32] sound: usb: Introduce QC USB SND offloading support

From: Wesley Cheng
Date: Mon Sep 11 2023 - 16:55:55 EST


Hi Takashi,

On 9/7/2023 8:51 AM, Takashi Iwai wrote:
On Tue, 29 Aug 2023 23:06:43 +0200,
Wesley Cheng wrote:

Several Qualcomm SoCs have a dedicated audio DSP, which has the ability to
support USB sound devices. This vendor driver will implement the required
handshaking with the DSP, in order to pass along required resources that
will be utilized by the DSP's USB SW. The communication channel used for
this handshaking will be using the QMI protocol. Required resources
include:
- Allocated secondary event ring address
- EP transfer ring address
- Interrupter number

The above information will allow for the audio DSP to execute USB transfers
over the USB bus. It will also be able to support devices that have an
implicit feedback and sync endpoint as well. Offloading these data
transfers will allow the main/applications processor to enter lower CPU
power modes, and sustain a longer duration in those modes.

Audio offloading is initiated with the following sequence:
1. Userspace configures to route audio playback to USB backend and starts
playback on the platform soundcard.
2. The Q6DSP AFE will communicate to the audio DSP to start the USB AFE
port.
3. This results in a QMI packet with a STREAM enable command.
4. The QC audio offload driver will fetch the required resources, and pass
this information as part of the QMI response to the STREAM enable command.
5. Once the QMI response is received the audio DSP will start queuing data
on the USB bus.

Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
---
sound/usb/Kconfig | 15 +
sound/usb/Makefile | 2 +-
sound/usb/qcom/Makefile | 2 +
sound/usb/qcom/qc_audio_offload.c | 1813 +++++++++++++++++++++++++++++
4 files changed, 1831 insertions(+), 1 deletion(-)
create mode 100644 sound/usb/qcom/Makefile
create mode 100644 sound/usb/qcom/qc_audio_offload.c

diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig
index 4a9569a3a39a..da5838656baa 100644
--- a/sound/usb/Kconfig
+++ b/sound/usb/Kconfig
@@ -176,6 +176,21 @@ config SND_BCD2000
To compile this driver as a module, choose M here: the module
will be called snd-bcd2000.
+config QC_USB_AUDIO_OFFLOAD

Keep SND_ prefix for consistency. And, at best, align with the module
name.

+ tristate "Qualcomm Audio Offload driver"
+ depends on QCOM_QMI_HELPERS && SND_USB_AUDIO && USB_XHCI_SIDEBAND
+ select SND_PCM
+ help
+ Say Y here to enable the Qualcomm USB audio offloading feature.
+
+ This module sets up the required QMI stream enable/disable
+ responses to requests generated by the audio DSP. It passes the
+ USB transfer resource references, so that the audio DSP can issue
+ USB transfers to the host controller.
+
+ To compile this driver as a module, choose M here: the module
+ will be called qc-audio-offload.

Hmm, you renamed it differently, no? In the below:

--- /dev/null
+++ b/sound/usb/qcom/Makefile
@@ -0,0 +1,2 @@
+snd-usb-audio-qmi-objs := usb_audio_qmi_v01.o qc_audio_offload.o
+obj-$(CONFIG_QC_USB_AUDIO_OFFLOAD) += snd-usb-audio-qmi.o

... it's called snd-usb-audio-qmi.


Will fix this, thanks.

Thanks
Wesley Cheng