All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wesley Cheng <quic_wcheng@quicinc.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	<srinivas.kandagatla@linaro.org>, <mathias.nyman@intel.com>,
	<perex@perex.cz>, <lgirdwood@gmail.com>, <andersson@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <gregkh@linuxfoundation.org>,
	<Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>,
	<bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>,
	<agross@kernel.org>
Cc: <devicetree@vger.kernel.org>, <alsa-devel@alsa-project.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <quic_jackp@quicinc.com>,
	<quic_plai@quicinc.com>
Subject: Re: [RFC PATCH v2 09/22] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp
Date: Tue, 31 Jan 2023 18:40:50 -0800	[thread overview]
Message-ID: <fa35124c-682f-8045-6733-c71f9ce8df9e@quicinc.com> (raw)
In-Reply-To: <ebf8ebed-ef79-bf18-4635-360f916877a6@linux.intel.com>

Hi Pierre,

On 1/30/2023 3:59 PM, Pierre-Louis Bossart wrote:
> 
> 
> On 1/30/23 16:54, Wesley Cheng wrote:
>> Hi Pierre,
>>
>> On 1/26/2023 7:38 AM, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 1/25/23 21:14, Wesley Cheng wrote:
>>>> The QC ADSP is able to support USB playback endpoints, so that the main
>>>> application processor can be placed into lower CPU power modes.  This
>>>> adds
>>>> the required AFE port configurations and port start command to start an
>>>> audio session.
>>>>
>>>> Specifically, the QC ADSP can support all potential endpoints that are
>>>> exposed by the audio data interface.  This includes, feedback endpoints
>>>> (both implicit and explicit) as well as the isochronous (data)
>>>> endpoints.
>>>> The size of audio samples sent per USB frame (microframe) will be
>>>> adjusted
>>>> based on information received on the feedback endpoint.
>>>
>>> I think you meant "support all potential endpoint types"
>>>
>>> It's likely that some USB devices have more endpoints than what the DSP
>>> can handle, no?
>>>
>>
>> True, as we discussed before, we only handle the endpoints for the audio
>> interface.  Other endpoints, such as HID, or control is still handled by
>> the main processor.
> 
> The number of isoc/audio endpoints can be larger than 1 per direction,
> it's not uncommon for a USB device to have multiple connectors on the
> front side for instruments, mics, monitor speakers, you name it. Just
> google 'motu' or 'rme usb' and you'll see examples of USB devices that
> are very different from plain vanilla headsets.
> 

Thanks for the reference.

I tried to do some research on the RME USB audio devices, and they 
mentioned that they do have a "class compliant mode," which is for 
compatibility w/ Linux hosts.  I didn't see a vendor specific USB SND 
driver matching the USB VID/PID either, so I am assuming that it uses 
the USB SND driver as is.(and that Linux doesn't currently support their 
vendor specific mode)  In that case, the device should conform to the 
UAC2.0 spec (same statement seen on UAC3.0), which states in Section 
4.9.1 Standard AS Interface Descriptor Table 4-26:

"4 bNumEndpoints 1 Number Number of endpoints used by this
interface (excluding endpoint 0). Must be
either 0 (no data endpoint), 1 (data
endpoint) or 2 (data and explicit feedback
endpoint)."

So each audio streaming interface should only have 1 data and 
potentially 1 feedback.  However, this device does expose a large number 
of channels (I saw up to 18 channels), which the USB backend won't be 
able to support.  I still need to check how ASoC behaves if I pass in a 
profile that the backend can't support.

Maybe in the non-class compliant/vendor based class driver, they have 
the support for multiple EPs per data interface?  I don't have one of 
these devices on hand, so I can't confirm that.

>>> And that brings me back to the question: what is a port and the
>>> relationship between port/backend/endpoints?
>>>
>>> Sorry for being picky on terminology, but if I learned something in days
>>> in standardization it's that there shouldn't be any ambiguity on
>>> concepts, otherwise everyone is lost at some point.
>>>
>>
>> No worries, I can understand where you're coming from :).  After
>> re-reading some of the notations used, I can see where people may be
>> confused.
>>
>>>
>>>>    static struct afe_port_map port_maps[AFE_PORT_MAX] = {
>>>> +    [USB_RX] = { AFE_PORT_ID_USB_RX, USB_RX, 1, 1},
>>>>        [HDMI_RX] = { AFE_PORT_ID_MULTICHAN_HDMI_RX, HDMI_RX, 1, 1},
>>>>        [SLIMBUS_0_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX,
>>>>                    SLIMBUS_0_RX, 1, 1},
>>>
>>> And if I look here a port seems to be a very specific AFE concept
>>> related to interface type? Do we even need to refer to a port in the USB
>>> parts?
>>>
>>
>> Well, this is a design specific to how the Q6 AFE is implemented.  There
>> is a concept for an AFE port to be opened.  However, as mentioned
>> earlier, the "port" term used in soc-usb should be more for how many USB
>> devices can be supported.
>>
>> If there was a case the audio DSP would support more than one USB
>> device, I believe another AFE port would need to be added.
> 
> 
> would the suggested infrastructure work though, even if the DSP could
> deal with multiple endpoints on different devices ? You have static
> mutexes and ops, can that scale to more than one USB device?

The mutex is only for registering the card, and ensuring atomic access 
to the list.  I don't see how that would block support for having 
multiple devices being registered to soc-usb.  ops are stored per 
backend device.

Greg did want me to re-look at the soc-usb device management, so I will 
have to rework some of these things.  It would be nice to see if we can 
get it to work like how the headphone jack works, ie interaction between 
soc-jack and core/jack.c.

Thanks
Wesley Cheng

WARNING: multiple messages have this Message-ID (diff)
From: Wesley Cheng <quic_wcheng@quicinc.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	<srinivas.kandagatla@linaro.org>, <mathias.nyman@intel.com>,
	<perex@perex.cz>, <lgirdwood@gmail.com>, <andersson@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <gregkh@linuxfoundation.org>,
	<Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>,
	<bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>,
	<agross@kernel.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, quic_jackp@quicinc.com,
	quic_plai@quicinc.com
Subject: Re: [RFC PATCH v2 09/22] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp
Date: Tue, 31 Jan 2023 18:40:50 -0800	[thread overview]
Message-ID: <fa35124c-682f-8045-6733-c71f9ce8df9e@quicinc.com> (raw)
In-Reply-To: <ebf8ebed-ef79-bf18-4635-360f916877a6@linux.intel.com>

Hi Pierre,

On 1/30/2023 3:59 PM, Pierre-Louis Bossart wrote:
> 
> 
> On 1/30/23 16:54, Wesley Cheng wrote:
>> Hi Pierre,
>>
>> On 1/26/2023 7:38 AM, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 1/25/23 21:14, Wesley Cheng wrote:
>>>> The QC ADSP is able to support USB playback endpoints, so that the main
>>>> application processor can be placed into lower CPU power modes.  This
>>>> adds
>>>> the required AFE port configurations and port start command to start an
>>>> audio session.
>>>>
>>>> Specifically, the QC ADSP can support all potential endpoints that are
>>>> exposed by the audio data interface.  This includes, feedback endpoints
>>>> (both implicit and explicit) as well as the isochronous (data)
>>>> endpoints.
>>>> The size of audio samples sent per USB frame (microframe) will be
>>>> adjusted
>>>> based on information received on the feedback endpoint.
>>>
>>> I think you meant "support all potential endpoint types"
>>>
>>> It's likely that some USB devices have more endpoints than what the DSP
>>> can handle, no?
>>>
>>
>> True, as we discussed before, we only handle the endpoints for the audio
>> interface.  Other endpoints, such as HID, or control is still handled by
>> the main processor.
> 
> The number of isoc/audio endpoints can be larger than 1 per direction,
> it's not uncommon for a USB device to have multiple connectors on the
> front side for instruments, mics, monitor speakers, you name it. Just
> google 'motu' or 'rme usb' and you'll see examples of USB devices that
> are very different from plain vanilla headsets.
> 

Thanks for the reference.

I tried to do some research on the RME USB audio devices, and they 
mentioned that they do have a "class compliant mode," which is for 
compatibility w/ Linux hosts.  I didn't see a vendor specific USB SND 
driver matching the USB VID/PID either, so I am assuming that it uses 
the USB SND driver as is.(and that Linux doesn't currently support their 
vendor specific mode)  In that case, the device should conform to the 
UAC2.0 spec (same statement seen on UAC3.0), which states in Section 
4.9.1 Standard AS Interface Descriptor Table 4-26:

"4 bNumEndpoints 1 Number Number of endpoints used by this
interface (excluding endpoint 0). Must be
either 0 (no data endpoint), 1 (data
endpoint) or 2 (data and explicit feedback
endpoint)."

So each audio streaming interface should only have 1 data and 
potentially 1 feedback.  However, this device does expose a large number 
of channels (I saw up to 18 channels), which the USB backend won't be 
able to support.  I still need to check how ASoC behaves if I pass in a 
profile that the backend can't support.

Maybe in the non-class compliant/vendor based class driver, they have 
the support for multiple EPs per data interface?  I don't have one of 
these devices on hand, so I can't confirm that.

>>> And that brings me back to the question: what is a port and the
>>> relationship between port/backend/endpoints?
>>>
>>> Sorry for being picky on terminology, but if I learned something in days
>>> in standardization it's that there shouldn't be any ambiguity on
>>> concepts, otherwise everyone is lost at some point.
>>>
>>
>> No worries, I can understand where you're coming from :).  After
>> re-reading some of the notations used, I can see where people may be
>> confused.
>>
>>>
>>>>    static struct afe_port_map port_maps[AFE_PORT_MAX] = {
>>>> +    [USB_RX] = { AFE_PORT_ID_USB_RX, USB_RX, 1, 1},
>>>>        [HDMI_RX] = { AFE_PORT_ID_MULTICHAN_HDMI_RX, HDMI_RX, 1, 1},
>>>>        [SLIMBUS_0_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX,
>>>>                    SLIMBUS_0_RX, 1, 1},
>>>
>>> And if I look here a port seems to be a very specific AFE concept
>>> related to interface type? Do we even need to refer to a port in the USB
>>> parts?
>>>
>>
>> Well, this is a design specific to how the Q6 AFE is implemented.  There
>> is a concept for an AFE port to be opened.  However, as mentioned
>> earlier, the "port" term used in soc-usb should be more for how many USB
>> devices can be supported.
>>
>> If there was a case the audio DSP would support more than one USB
>> device, I believe another AFE port would need to be added.
> 
> 
> would the suggested infrastructure work though, even if the DSP could
> deal with multiple endpoints on different devices ? You have static
> mutexes and ops, can that scale to more than one USB device?

The mutex is only for registering the card, and ensuring atomic access 
to the list.  I don't see how that would block support for having 
multiple devices being registered to soc-usb.  ops are stored per 
backend device.

Greg did want me to re-look at the soc-usb device management, so I will 
have to rework some of these things.  It would be nice to see if we can 
get it to work like how the headphone jack works, ie interaction between 
soc-jack and core/jack.c.

Thanks
Wesley Cheng

  reply	other threads:[~2023-02-01  2:41 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26  3:14 [RFC PATCH v2 00/22] Introduce QC USB SND audio offloading support Wesley Cheng
2023-01-26  3:14 ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 01/22] xhci: fix event ring segment table related masks and variables in header Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 02/22] xhci: remove xhci_test_trb_in_td_math early development check Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  7:48   ` Greg KH
2023-01-26  7:48     ` Greg KH
2023-01-26  3:14 ` [RFC PATCH v2 03/22] xhci: Refactor interrupter code for initial multi interrupter support Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 04/22] xhci: Add support to allocate several interrupters Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 05/22] usb: xhci: Add XHCI APIs to support USB offloading Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 06/22] usb: host: xhci-mem: Cleanup pending secondary event ring events Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 07/22] ASoC: Add SOC USB APIs for adding an USB backend Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 15:32   ` Pierre-Louis Bossart
2023-01-30 22:36     ` Wesley Cheng
2023-01-30 22:36       ` Wesley Cheng
2023-01-28 13:26   ` Greg KH
2023-01-28 13:26     ` Greg KH
2023-01-29  6:54     ` Zhou Furong
2023-01-29  6:54       ` Zhou Furong
2023-01-29  7:09       ` Greg KH
2023-01-29  7:09         ` Greg KH
2023-01-30  8:34         ` Zhou Furong
2023-01-30  8:34           ` Zhou Furong
2023-01-30  9:27           ` Greg KH
2023-01-30  9:27             ` Greg KH
2023-02-10 22:46     ` Wesley Cheng
2023-02-10 22:46       ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 08/22] ASoC: dt-bindings: Add USB_RX port Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 11:55   ` Krzysztof Kozlowski
2023-01-26 11:55     ` Krzysztof Kozlowski
2023-01-30 21:52     ` Wesley Cheng
2023-01-30 21:52       ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 09/22] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 15:07   ` Srinivas Kandagatla
2023-01-26 15:07     ` Srinivas Kandagatla
2023-01-26 15:38   ` Pierre-Louis Bossart
2023-01-30 22:54     ` Wesley Cheng
2023-01-30 22:54       ` Wesley Cheng
2023-01-30 23:59       ` Pierre-Louis Bossart
2023-02-01  2:40         ` Wesley Cheng [this message]
2023-02-01  2:40           ` Wesley Cheng
2023-02-01  3:02           ` Pierre-Louis Bossart
2023-02-03  1:23             ` Wesley Cheng
2023-02-03  1:23               ` Wesley Cheng
2023-02-03  1:44               ` Wesley Cheng
2023-02-03  1:44                 ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 10/22] ASoC: qdsp6: q6afe: Increase APR timeout Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 15:09   ` Srinivas Kandagatla
2023-01-26 15:09     ` Srinivas Kandagatla
2023-01-26  3:14 ` [RFC PATCH v2 11/22] ASoC: qcom: Add USB backend ASoC driver for Q6 Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 15:44   ` Pierre-Louis Bossart
2023-01-30 22:59     ` Wesley Cheng
2023-01-30 22:59       ` Wesley Cheng
2023-01-30 23:50       ` Pierre-Louis Bossart
2023-01-26 16:35   ` Srinivas Kandagatla
2023-01-26 16:35     ` Srinivas Kandagatla
2023-01-26  3:14 ` [RFC PATCH v2 12/22] sound: usb: card: Introduce USB SND platform op callbacks Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 15:50   ` Pierre-Louis Bossart
2023-01-30 23:00     ` Wesley Cheng
2023-01-30 23:00       ` Wesley Cheng
2023-01-28 13:28   ` Greg KH
2023-01-28 13:28     ` Greg KH
2023-02-10 22:49     ` Wesley Cheng
2023-02-10 22:49       ` Wesley Cheng
2023-02-28  2:59       ` Wesley Cheng
2023-02-28  2:59         ` Wesley Cheng
2023-02-28  7:30         ` Greg KH
2023-02-28  7:30           ` Greg KH
2023-02-28  9:19           ` Wesley Cheng
2023-02-28  9:19             ` Wesley Cheng
2023-02-28 15:29             ` Greg KH
2023-02-28 15:29               ` Greg KH
2023-02-20 17:11   ` Albert Wang
2023-02-20 17:11     ` Albert Wang
2023-01-26  3:14 ` [RFC PATCH v2 13/22] sound: usb: Export USB SND APIs for modules Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 14/22] dt-bindings: usb: dwc3: Add snps,num-hc-interrupters definition Wesley Cheng
2023-01-26  3:14   ` [RFC PATCH v2 14/22] dt-bindings: usb: dwc3: Add snps, num-hc-interrupters definition Wesley Cheng
2023-01-26 12:01   ` [RFC PATCH v2 14/22] dt-bindings: usb: dwc3: Add snps,num-hc-interrupters definition Krzysztof Kozlowski
2023-01-26 12:01     ` Krzysztof Kozlowski
2023-01-30 22:02     ` Wesley Cheng
2023-01-30 22:02       ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 15/22] usb: dwc3: Add DT parameter to specify maximum number of interrupters Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 16/22] sound: usb: Introduce QC USB SND offloading support Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 16:07   ` Pierre-Louis Bossart
2023-01-28 13:32   ` Greg KH
2023-01-28 13:32     ` Greg KH
2023-02-11  0:03     ` Wesley Cheng
2023-02-11  0:03       ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 17/22] sound: usb: card: Check for support for requested audio format Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 18/22] sound: soc: soc-usb: Add PCM format check API for USB backend Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 19/22] sound: soc: qcom: qusb6: Ensure PCM format is supported by USB audio device Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 20/22] sound: usb: Prevent starting of audio stream if in use Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 16:12   ` Pierre-Louis Bossart
2023-02-07  1:15     ` Wesley Cheng
2023-02-07  1:15       ` Wesley Cheng
2023-02-07 13:29       ` Pierre-Louis Bossart
2023-02-07 13:29         ` Pierre-Louis Bossart
2023-02-11  9:52         ` Wesley Cheng
2023-02-11  9:52           ` Wesley Cheng
2023-02-13 15:22           ` Pierre-Louis Bossart
2023-02-13 20:12             ` Wesley Cheng
2023-02-13 20:12               ` Wesley Cheng
2023-01-26  3:14 ` [RFC PATCH v2 21/22] ASoC: dt-bindings: Add Q6USB backend bindings Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 12:03   ` Krzysztof Kozlowski
2023-01-26 12:03     ` Krzysztof Kozlowski
2023-01-26 16:01   ` Srinivas Kandagatla
2023-01-26 16:01     ` Srinivas Kandagatla
2023-01-26  3:14 ` [RFC PATCH v2 22/22] ASoC: dt-bindings: Update example for enabling USB offload on SM8250 Wesley Cheng
2023-01-26  3:14   ` Wesley Cheng
2023-01-26 12:05   ` Krzysztof Kozlowski
2023-01-26 12:05     ` Krzysztof Kozlowski
2023-01-26  9:23 ` [RFC PATCH v2 00/22] Introduce QC USB SND audio offloading support Mathias Nyman
2023-01-26  9:23   ` Mathias Nyman
2023-01-30 21:51   ` Wesley Cheng
2023-01-30 21:51     ` Wesley Cheng
2023-01-26 16:22 ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa35124c-682f-8045-6733-c71f9ce8df9e@quicinc.com \
    --to=quic_wcheng@quicinc.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=agross@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andersson@kernel.org \
    --cc=bgoswami@quicinc.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_plai@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.