All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Prasad Kumpatla" <prasad.kumpatla@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 7/7] ASoC: qcom: sc8280xp: add TDM hw_params support
Date: Tue, 04 Aug 2026 07:23:42 +0000	[thread overview]
Message-ID: <20260804072343.61C701F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260804070307.117119-8-prasad.kumpatla@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] sc8280xp_tdm_hw_params() fails to ignore -ENOTSUPP errors from snd_soc_dai_set_fmt() and snd_soc_dai_set_sysclk(), causing unconditional stream failures for TDM DAIs.
- [Medium] The return value of snd_soc_tdm_params_to_bclk() is incorrectly stored in an unsigned integer, causing potential negative error codes to bypass the error check and be used as huge clock frequencies.
- [Medium] sc8280xp_tdm_hw_params() sets the audio format for the CPU DAI but fails to configure the format for the codec DAIs.
--

--- Patch [7]: [PATCH v7 7/7] ASoC: qcom: sc8280xp: add TDM hw_params support ---
commit f81d8adf5e4da9f01c411fd511ee11515191c223
Author: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>

ASoC: qcom: sc8280xp: add TDM hw_params support

This commit adds TDM backend handling to the sc8280xp machine driver.
It parses standard DAI TDM slot properties and derives the LPASS backend
bit clock from the runtime parameters.

> diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
> index c3ce3e05b2608..597c0d887d2f4 100644
> --- a/sound/soc/qcom/sc8280xp.c
> +++ b/sound/soc/qcom/sc8280xp.c
[ ... ]
> @@ -106,6 +106,63 @@ static inline int sc8280xp_get_bclk_freq(struct snd_pcm_hw_params *params)
> +static int sc8280xp_tdm_hw_params(struct snd_pcm_substream *substream,
> +				  struct snd_pcm_hw_params *params)
> +{
[ ... ]
> +	if (!cpu_cfg.slots)
> +		return 0;
> +
> +	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
> +	if (ret)
> +		return ret;

[Severity: High]
Does this strictly require the CPU DAI to support set_fmt? Since the QCOM DSP
TDM DAIs (q6tdm_ops) do not implement the set_fmt callback, 
snd_soc_dai_set_fmt() will return -ENOTSUPP. Should this explicitly ignore
-ENOTSUPP, similar to how it is handled in the MI2S path, to avoid failing
stream initialization unconditionally?

[Severity: Medium]
Additionally, this sets the audio format for the CPU DAI, but does it omit
configuring the format for the codec DAIs? Without setting the format for
the codec DAIs (like data->priv->codec_dai_fmt used in the MI2S path), will
the codec remain in its default format and cause a mismatch with the CPU DAI?

> +
> +	ret = qcom_snd_apply_dai_tdm_slots_cfg(rtd, &cpu_cfg, &codec_cfg);
> +	if (ret)
> +		return ret;
> +
> +	bclk_freq = snd_soc_tdm_params_to_bclk(params, cpu_cfg.slot_width, cpu_cfg.slots, 1);
> +	if (!bclk_freq)
> +		return -EINVAL;

[Severity: Medium]
Can snd_soc_tdm_params_to_bclk() return a negative error code like -EINVAL
here? Since bclk_freq is an unsigned int, a negative return value would
underflow into a large positive integer. This would bypass the !bclk_freq
check and potentially pass an invalid massive frequency to the system clock
provider.

[ ... ]
> +	if (data->priv->codec_sysclk_set) {
> +		for_each_rtd_codec_dais(rtd, i, codec_dai) {
> +			ret = snd_soc_dai_set_sysclk(codec_dai, 0, bclk_freq,
> +						     SND_SOC_CLOCK_IN);
> +			if (ret) {
> +				dev_err(rtd->dev, "%s: failed to set codec sysclk on %s: %d\n",
> +					__func__, codec_dai->name, ret);
> +				return ret;
> +			}
> +		}
> +	}

[Severity: High]
Will this codec sysclk setup loop fail stream initialization if any codec in
the link does not support setting sysclk? Similar to the set_fmt call above,
if snd_soc_dai_set_sysclk() returns -ENOTSUPP, should that error be explicitly
ignored rather than treated as a fatal error?

> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260804070307.117119-1-prasad.kumpatla@oss.qualcomm.com?part=7

  reply	other threads:[~2026-08-04  7:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  7:03 [PATCH v7 0/7] ASoC: qcom: add AudioReach TDM backend support Prasad Kumpatla
2026-08-04  7:03 ` [PATCH v7 1/7] ASoC: qcom: qdsp6: add topology-driven Audio IF support Prasad Kumpatla
2026-08-04  7:16   ` sashiko-bot
2026-08-04 17:46   ` Cezary Rojewski
2026-08-04 17:50     ` Mark Brown
2026-08-04 17:58       ` Cezary Rojewski
2026-08-04  7:03 ` [PATCH v7 2/7] ASoC: qcom: q6apm-lpass-dais: add TDM DAI operations Prasad Kumpatla
2026-08-04  7:03 ` [PATCH v7 3/7] dt-bindings: sound: qcom,q6dsp-lpass-ports: add Audio IF clocks Prasad Kumpatla
2026-08-04  7:08   ` sashiko-bot
2026-08-04 20:16   ` Rob Herring
2026-08-05  4:40     ` Prasad Kumpatla
2026-08-05  6:10       ` Krzysztof Kozlowski
2026-08-05  6:29         ` Prasad Kumpatla
2026-08-05  6:33           ` Krzysztof Kozlowski
2026-08-05  6:36             ` Krzysztof Kozlowski
2026-08-05  6:50             ` Prasad Kumpatla
2026-08-04  7:03 ` [PATCH v7 4/7] ASoC: qcom: q6prm: add Audio IF clock IDs Prasad Kumpatla
2026-08-04  7:11   ` sashiko-bot
2026-08-04  7:03 ` [PATCH v7 5/7] dt-bindings: sound: qcom,sm8250: allow TDM slot properties Prasad Kumpatla
2026-08-04  7:17   ` sashiko-bot
2026-08-04  7:03 ` [PATCH v7 6/7] ASoC: qcom: common: add DAI-node TDM slot helpers Prasad Kumpatla
2026-08-04  7:18   ` sashiko-bot
2026-08-04  7:03 ` [PATCH v7 7/7] ASoC: qcom: sc8280xp: add TDM hw_params support Prasad Kumpatla
2026-08-04  7:23   ` sashiko-bot [this message]
2026-08-04 16:32 ` [PATCH v7 0/7] ASoC: qcom: add AudioReach TDM backend support Mark Brown

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=20260804072343.61C701F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=prasad.kumpatla@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.