linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan.gerhold@linaro.org>
To: Wesley Cheng <quic_wcheng@quicinc.com>
Cc: srinivas.kandagatla@linaro.org, mathias.nyman@intel.com,
	perex@perex.cz, conor+dt@kernel.org, dmitry.torokhov@gmail.com,
	corbet@lwn.net, broonie@kernel.org, lgirdwood@gmail.com,
	krzk+dt@kernel.org, pierre-louis.bossart@linux.intel.com,
	Thinh.Nguyen@synopsys.com, tiwai@suse.com, robh@kernel.org,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-sound@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-input@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v37 22/31] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp
Date: Fri, 4 Apr 2025 11:24:20 +0200	[thread overview]
Message-ID: <Z--lRII_5_rp9tDf@linaro.org> (raw)
In-Reply-To: <20250404002728.3590501-23-quic_wcheng@quicinc.com>

On Thu, Apr 03, 2025 at 05:27:19PM -0700, 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 isochronous data
> endpoints, in either synchronous mode or asynchronous mode. In the latter
> case both implicit or explicit feedback endpoints are supported.  The size
> of audio samples sent per USB frame (microframe) will be adjusted based on
> information received on the feedback endpoint.
> 
> Some pre-requisites are needed before issuing the AFE port start command,
> such as setting the USB AFE dev_token.  This carries information about the
> available USB SND cards and PCM devices that have been discovered on the
> USB bus.  The dev_token field is used by the audio DSP to notify the USB
> offload driver of which card and PCM index to enable playback on.
> 
> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> ---
>  sound/soc/qcom/qdsp6/q6afe-dai.c         |  60 +++++++
>  sound/soc/qcom/qdsp6/q6afe.c             | 192 ++++++++++++++++++++++-
>  sound/soc/qcom/qdsp6/q6afe.h             |  36 ++++-
>  sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c |  23 +++
>  sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h |   1 +
>  sound/soc/qcom/qdsp6/q6routing.c         |  10 +-
>  6 files changed, 319 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c
> index 7d9628cda875..0f47aadaabe1 100644
> --- a/sound/soc/qcom/qdsp6/q6afe-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
> [...]
> +static int afe_port_send_usb_params(struct q6afe_port *port, struct q6afe_usb_cfg *cfg)
> +{
> +	union afe_port_config *pcfg = &port->port_cfg;
> +	struct afe_param_id_usb_audio_dev_lpcm_fmt lpcm_fmt;
> +	struct afe_param_id_usb_audio_svc_interval svc_int;
> +	int ret;
> +
> +	if (!pcfg) {
> +		dev_err(port->afe->dev, "%s: Error, no configuration data\n", __func__);
> +		ret = -EINVAL;
> +		goto exit;

Nitpick: drop the goto here, just do "return -EINVAL;"

> +	}
> +
> +	memset(&lpcm_fmt, 0, sizeof(lpcm_fmt));
> +	memset(&svc_int, 0, sizeof(svc_int));
> +
> +	lpcm_fmt.cfg_minor_version = AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
> +	lpcm_fmt.endian = pcfg->usb_cfg.endian;
> +	ret = q6afe_port_set_param_v2(port, &lpcm_fmt,
> +				      AFE_PARAM_ID_USB_AUDIO_DEV_LPCM_FMT,
> +				      AFE_MODULE_AUDIO_DEV_INTERFACE, sizeof(lpcm_fmt));
> +	if (ret) {
> +		dev_err(port->afe->dev, "%s: AFE device param cmd LPCM_FMT failed %d\n",
> +			__func__, ret);
> +		goto exit;

return ret;

> +	}
> +
> +	svc_int.cfg_minor_version = AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
> +	svc_int.svc_interval = pcfg->usb_cfg.service_interval;
> +	ret = q6afe_port_set_param_v2(port, &svc_int,
> +				      AFE_PARAM_ID_USB_AUDIO_SVC_INTERVAL,
> +				      AFE_MODULE_AUDIO_DEV_INTERFACE, sizeof(svc_int));
> +	if (ret)
> +		dev_err(port->afe->dev, "%s: AFE device param cmd svc_interval failed %d\n",
> +			__func__, ret);
> +
> +exit:

drop

> +	return ret;
> +}
> +
> [...]
> diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
> index 90228699ba7d..0def036ed3c9 100644
> --- a/sound/soc/qcom/qdsp6/q6routing.c
> +++ b/sound/soc/qcom/qdsp6/q6routing.c
> @@ -435,6 +435,7 @@ static struct session_data *get_session_from_id(struct msm_routing_data *data,
>  
>  	return NULL;
>  }
> +
>  /**
>   * q6routing_stream_close() - Deregister a stream
>   *
> @@ -515,6 +516,9 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
>  	return 1;
>  }
>  
> +static const struct snd_kcontrol_new usb_rx_mixer_controls[] = {
> +	Q6ROUTING_RX_MIXERS(USB_RX) };
> +
>  static const struct snd_kcontrol_new hdmi_mixer_controls[] = {
>  	Q6ROUTING_RX_MIXERS(HDMI_RX) };
>  
> @@ -933,6 +937,9 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
>  	SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
>  		rx_codec_dma_rx_7_mixer_controls,
>  		ARRAY_SIZE(rx_codec_dma_rx_7_mixer_controls)),
> +	SND_SOC_DAPM_MIXER("USB Mixer", SND_SOC_NOPM, 0, 0,

As I wrote on v36:

I think it would be more clear if you call this "USB_RX Audio Mixer"
instead for consistency with the other playback mixers. This would also
avoid confusion later when USB_TX is added in addition to USB_RX.

The "Audio" part in the name is redundant, but looks like all the other
playback mixers have it as well ...


> +			   usb_rx_mixer_controls,
> +			   ARRAY_SIZE(usb_rx_mixer_controls)),
>  	SND_SOC_DAPM_MIXER("MultiMedia1 Mixer", SND_SOC_NOPM, 0, 0,
>  		mmul1_mixer_controls, ARRAY_SIZE(mmul1_mixer_controls)),
>  	SND_SOC_DAPM_MIXER("MultiMedia2 Mixer", SND_SOC_NOPM, 0, 0,
> @@ -949,7 +956,6 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
>  		mmul7_mixer_controls, ARRAY_SIZE(mmul7_mixer_controls)),
>  	SND_SOC_DAPM_MIXER("MultiMedia8 Mixer", SND_SOC_NOPM, 0, 0,
>  		mmul8_mixer_controls, ARRAY_SIZE(mmul8_mixer_controls)),
> -
>  };
>  
>  static const struct snd_soc_dapm_route intercon[] = {
> @@ -1043,6 +1049,8 @@ static const struct snd_soc_dapm_route intercon[] = {
>  	{"MM_UL6", NULL, "MultiMedia6 Mixer"},
>  	{"MM_UL7", NULL, "MultiMedia7 Mixer"},
>  	{"MM_UL8", NULL, "MultiMedia8 Mixer"},
> +
> +	Q6ROUTING_RX_DAPM_ROUTE("USB Mixer", "USB_RX"),

Put this below "Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_7 Audio Mixer".

Thanks,
Stephan

  reply	other threads:[~2025-04-04  9:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04  0:26 [PATCH v37 00/31] Introduce QC USB SND audio offloading support Wesley Cheng
2025-04-04  0:26 ` [PATCH v37 01/31] xhci: sideband: add initial api to register a secondary interrupter entity Wesley Cheng
2025-04-04  0:26 ` [PATCH v37 02/31] usb: host: xhci-mem: Cleanup pending secondary event ring events Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 03/31] usb: host: xhci-mem: Allow for interrupter clients to choose specific index Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 04/31] usb: host: xhci-plat: Set XHCI max interrupters if property is present Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 05/31] usb: host: xhci: Notify xHCI sideband on transfer ring free Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 06/31] usb: dwc3: Specify maximum number of XHCI interrupters Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 07/31] ALSA: Add USB audio device jack type Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 08/31] ALSA: usb-audio: Export USB SND APIs for modules Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 09/31] ALSA: usb-audio: Check for support for requested audio format Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 10/31] ALSA: usb-audio: Save UAC sample size information Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 11/31] ALSA: usb-audio: Prevent starting of audio stream if in use Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 12/31] ALSA: usb-audio: Introduce USB SND platform op callbacks Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 13/31] ALSA: usb-audio: Allow for rediscovery of connected USB SND devices Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 14/31] ASoC: Add SoC USB APIs for adding an USB backend Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 15/31] ASoC: usb: Add PCM format check API for " Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 16/31] ASoC: usb: Create SOC USB SND jack kcontrol Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 17/31] ASoC: usb: Fetch ASoC card and pcm device information Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 18/31] ASoC: usb: Rediscover USB SND devices on USB port add Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 19/31] ASoC: doc: Add documentation for SOC USB Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 20/31] ASoC: dt-bindings: qcom,q6dsp-lpass-ports: Add USB_RX port Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 21/31] ASoC: dt-bindings: Update example for enabling USB offload on SM8250 Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 22/31] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp Wesley Cheng
2025-04-04  9:24   ` Stephan Gerhold [this message]
2025-04-07 23:01     ` Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 23/31] ASoC: qcom: qdsp6: q6afe: Increase APR timeout Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 24/31] ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6 Wesley Cheng
2025-04-04  9:54   ` Stephan Gerhold
2025-04-07 22:59     ` Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 25/31] ASoC: qcom: qdsp6: Add headphone jack for offload connection status Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 26/31] ASoC: qcom: qdsp6: Fetch USB offload mapped card and PCM device Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 27/31] ALSA: usb-audio: qcom: Add USB QMI definitions Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 28/31] ALSA: usb-audio: qcom: Introduce QC USB SND offloading support Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 29/31] ALSA: usb-audio: qcom: Don't allow USB offload path if PCM device is in use Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 30/31] ALSA: usb-audio: qcom: Add USB offload route kcontrol Wesley Cheng
2025-04-04  0:27 ` [PATCH v37 31/31] ALSA: usb-audio: qcom: Notify USB audio devices on USB offload probing Wesley Cheng

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=Z--lRII_5_rp9tDf@linaro.org \
    --to=stephan.gerhold@linaro.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@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_wcheng@quicinc.com \
    --cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).