All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Wesley Cheng <quic_wcheng@quicinc.com>,
	mathias.nyman@intel.com, gregkh@linuxfoundation.org,
	lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, agross@kernel.org, andersson@kernel.org,
	konrad.dybcio@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	srinivas.kandagatla@linaro.org, bgoswami@quicinc.com,
	Thinh.Nguyen@synopsys.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v9 26/34] ASoC: qcom: qdsp6: q6afe: Split USB AFE dev_token param into separate API
Date: Tue, 17 Oct 2023 17:39:04 -0500	[thread overview]
Message-ID: <c6a003eb-213d-4456-bc6a-e07c08c57396@linux.intel.com> (raw)
In-Reply-To: <20231017200109.11407-27-quic_wcheng@quicinc.com>



On 10/17/23 15:01, Wesley Cheng wrote:
> The Q6USB backend can carry information about the available USB SND cards
> and PCM devices 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.  Separate this into a dedicated API, so the USB
> backend can set the dev_token accordingly.  The audio DSP does not utilize
> this information until the AFE port start command is sent, which is done
> during the PCM prepare phase.
> 
> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> ---
>  sound/soc/qcom/qdsp6/q6afe.c | 49 +++++++++++++++++++++++++-----------
>  sound/soc/qcom/qdsp6/q6afe.h |  1 +
>  2 files changed, 36 insertions(+), 14 deletions(-)
> 
> diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
> index 72c4e6fe20c4..f09a756246f8 100644
> --- a/sound/soc/qcom/qdsp6/q6afe.c
> +++ b/sound/soc/qcom/qdsp6/q6afe.c
> @@ -1394,10 +1394,42 @@ void q6afe_tdm_port_prepare(struct q6afe_port *port,
>  }
>  EXPORT_SYMBOL_GPL(q6afe_tdm_port_prepare);
>  
> -static int afe_port_send_usb_dev_param(struct q6afe_port *port, struct q6afe_usb_cfg *cfg)
> +/**
> + * afe_port_send_usb_dev_param() - Send USB dev token
> + *
> + * @port: Instance of afe port
> + * @cardidx: USB SND card index to reference
> + * @pcmidx: USB SND PCM device index to reference
> + *
> + * The USB dev token carries information about which USB SND card instance and
> + * PCM device to execute the offload on.  This information is carried through
> + * to the stream enable QMI request, which is handled by the offload class
> + * driver.  The information is parsed to determine which USB device to query
> + * the required resources for.
> + */
> +int afe_port_send_usb_dev_param(struct q6afe_port *port, int cardidx, int pcmidx)
>  {
> -	union afe_port_config *pcfg = &port->port_cfg;
>  	struct afe_param_id_usb_audio_dev_params usb_dev;
> +	int ret;
> +
> +	memset(&usb_dev, 0, sizeof(usb_dev));
> +
> +	usb_dev.cfg_minor_version = AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
> +	usb_dev.dev_token = (cardidx << 16) | (pcmidx << 8);
> +	ret = q6afe_port_set_param_v2(port, &usb_dev,
> +				AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS,
> +				AFE_MODULE_AUDIO_DEV_INTERFACE, sizeof(usb_dev));
> +	if (ret)
> +		dev_err(port->afe->dev, "%s: AFE device param cmd failed %d\n",
> +			__func__, ret);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(afe_port_send_usb_dev_param);
> +
> +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 = 0;
> @@ -1408,20 +1440,9 @@ static int afe_port_send_usb_dev_param(struct q6afe_port *port, struct q6afe_usb
>  		goto exit;
>  	}
>  
> -	memset(&usb_dev, 0, sizeof(usb_dev));
>  	memset(&lpcm_fmt, 0, sizeof(lpcm_fmt));
>  	memset(&svc_int, 0, sizeof(svc_int));
>  
> -	usb_dev.cfg_minor_version = AFE_API_MINOR_VERSION_USB_AUDIO_CONFIG;
> -	ret = q6afe_port_set_param_v2(port, &usb_dev,
> -				      AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS,
> -				      AFE_MODULE_AUDIO_DEV_INTERFACE, sizeof(usb_dev));
> -	if (ret) {
> -		dev_err(port->afe->dev, "%s: AFE device param cmd failed %d\n",
> -			__func__, ret);
> -		goto exit;
> -	}
> -

this feels like a questionable patch split. Why not introduce the new
helper earlier and avoid adding code then modifying the same code?

>  	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,
> @@ -1463,7 +1484,7 @@ void q6afe_usb_port_prepare(struct q6afe_port *port,
>  	pcfg->usb_cfg.num_channels = cfg->num_channels;
>  	pcfg->usb_cfg.bit_width = cfg->bit_width;
>  
> -	afe_port_send_usb_dev_param(port, cfg);
> +	afe_port_send_usb_params(port, cfg);
>  }
>  EXPORT_SYMBOL_GPL(q6afe_usb_port_prepare);
>  
> diff --git a/sound/soc/qcom/qdsp6/q6afe.h b/sound/soc/qcom/qdsp6/q6afe.h
> index ef47b4ae9e27..2ce5ba9dba69 100644
> --- a/sound/soc/qcom/qdsp6/q6afe.h
> +++ b/sound/soc/qcom/qdsp6/q6afe.h
> @@ -263,6 +263,7 @@ void q6afe_tdm_port_prepare(struct q6afe_port *port, struct q6afe_tdm_cfg *cfg);
>  void q6afe_cdc_dma_port_prepare(struct q6afe_port *port,
>  				struct q6afe_cdc_dma_cfg *cfg);
>  
> +int afe_port_send_usb_dev_param(struct q6afe_port *port, int cardidx, int pcmidx);
>  int q6afe_port_set_sysclk(struct q6afe_port *port, int clk_id,
>  			  int clk_src, int clk_root,
>  			  unsigned int freq, int dir);

  reply	other threads:[~2023-10-17 23:25 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 20:00 [PATCH v9 00/34] Introduce QC USB SND audio offloading support Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 01/34] xhci: split free interrupter into separate remove and free parts Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 02/34] xhci: add support to allocate several interrupters Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 03/34] xhci: add helper to stop endpoint and wait for completion Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 04/34] xhci: sideband: add initial api to register a sideband entity Wesley Cheng
2023-10-25  3:24   ` Albert Wang
2023-10-17 20:00 ` [PATCH v9 05/34] usb: host: xhci-mem: Cleanup pending secondary event ring events Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 06/34] usb: host: xhci-mem: Allow for interrupter clients to choose specific index Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 07/34] ASoC: Add SOC USB APIs for adding an USB backend Wesley Cheng
2023-10-17 21:48   ` Pierre-Louis Bossart
2023-10-18  2:07     ` Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 08/34] ASoC: dt-bindings: qcom,q6dsp-lpass-ports: Add USB_RX port Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 09/34] ASoC: qcom: qdsp6: Introduce USB AFE port to q6dsp Wesley Cheng
2023-10-17 21:32   ` Pierre-Louis Bossart
2023-10-18  1:45     ` Wesley Cheng
2023-10-18 13:47       ` Pierre-Louis Bossart
2023-10-18 19:36         ` Wesley Cheng
2023-10-19  1:00           ` Pierre-Louis Bossart
2023-10-19 18:42             ` Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 10/34] ASoC: qdsp6: q6afe: Increase APR timeout Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 11/34] ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6 Wesley Cheng
2023-10-17 21:46   ` Pierre-Louis Bossart
2023-10-17 20:00 ` [PATCH v9 12/34] ALSA: usb-audio: Introduce USB SND platform op callbacks Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 13/34] ALSA: usb-audio: Export USB SND APIs for modules Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 14/34] dt-bindings: usb: xhci: Add num-hc-interrupters definition Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 15/34] dt-bindings: usb: dwc3: Limit " Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 16/34] usb: dwc3: Specify maximum number of XHCI interrupters Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 17/34] usb: host: xhci-plat: Set XHCI max interrupters if property is present Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 18/34] ALSA: usb-audio: qcom: Add USB QMI definitions Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 19/34] ALSA: usb-audio: qcom: Introduce QC USB SND offloading support Wesley Cheng
2023-10-17 23:21   ` Pierre-Louis Bossart
2023-10-17 20:00 ` [PATCH v9 20/34] ALSA: usb-audio: Check for support for requested audio format Wesley Cheng
2023-10-17 22:29   ` Pierre-Louis Bossart
2023-10-18 20:21     ` Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 21/34] ASoC: usb: Add PCM format check API for USB backend Wesley Cheng
2023-10-17 22:33   ` Pierre-Louis Bossart
2023-10-18 20:33     ` Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 22/34] ASoC: qcom: qdsp6: Ensure PCM format is supported by USB audio device Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 23/34] ALSA: usb-audio: Prevent starting of audio stream if in use Wesley Cheng
2023-10-17 22:37   ` Pierre-Louis Bossart
2023-10-18 20:33     ` Wesley Cheng
2023-10-17 20:00 ` [PATCH v9 24/34] ASoC: dt-bindings: Add Q6USB backend Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 25/34] ASoC: dt-bindings: Update example for enabling USB offload on SM8250 Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 26/34] ASoC: qcom: qdsp6: q6afe: Split USB AFE dev_token param into separate API Wesley Cheng
2023-10-17 22:39   ` Pierre-Louis Bossart [this message]
2023-10-19  0:10     ` Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 27/34] ALSA: usb-audio: qcom: Populate PCM and USB chip information Wesley Cheng
2023-10-17 22:41   ` Pierre-Louis Bossart
2023-10-19  0:59     ` Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 28/34] ASoC: qcom: qdsp6: Add support to track available USB PCM devices Wesley Cheng
2023-10-17 22:43   ` Pierre-Louis Bossart
2023-10-19  1:00     ` Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 29/34] ASoC: qcom: qdsp6: Add SND kcontrol to select offload device Wesley Cheng
2023-10-17 22:50   ` Pierre-Louis Bossart
2023-10-19  1:39     ` Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 30/34] ASoC: qcom: qdsp6: Add SND kcontrol for fetching offload status Wesley Cheng
2023-10-17 22:53   ` Pierre-Louis Bossart
2023-10-19  1:41     ` Wesley Cheng
2023-10-19 19:25       ` Wesley Cheng
2023-10-19 20:39         ` Pierre-Louis Bossart
2023-10-17 20:01 ` [PATCH v9 31/34] ASoC: qcom: qdsp6: Add headphone jack for offload connection status Wesley Cheng
2023-10-17 23:03   ` Pierre-Louis Bossart
2023-10-17 20:01 ` [PATCH v9 32/34] ALSA: usb-audio: qcom: Use card and PCM index from QMI request Wesley Cheng
2023-10-17 20:01 ` [PATCH v9 33/34] ALSA: usb-audio: Allow for rediscovery of connected USB SND devices Wesley Cheng
2023-10-17 23:07   ` Pierre-Louis Bossart
2023-10-17 20:01 ` [PATCH v9 34/34] ASoC: usb: Rediscover USB SND devices on USB port add Wesley Cheng
2023-10-17 23:11   ` Pierre-Louis Bossart
2023-10-23 21:54     ` Wesley Cheng
2023-10-24 13:35       ` Pierre-Louis Bossart
2023-10-25 22:31         ` Wesley Cheng
2023-10-17 20:58 ` [PATCH v9 00/34] Introduce QC USB SND audio offloading support Pierre-Louis Bossart
2023-10-18  0:25   ` Wesley Cheng
2023-10-18 13:54     ` Pierre-Louis Bossart
2023-10-18 20:20       ` 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=c6a003eb-213d-4456-bc6a-e07c08c57396@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.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=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@linaro.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=quic_wcheng@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.