Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
Date: Thu, 26 Nov 2026 12:15:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-235483@kernel.org> (raw)
In-Reply-To: <20261126115738.1765949-2-srinivas.kandagatla@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] ASoC: qcom: q6asm-dai S24_3LE and S32_LE formats break DPCM
  backends
- [Low] ASoC: qcom: unused V2 PCM media format macro and structs in
  q6asm.c
- [Low] ASoC: qcom: missing Fixes trailer on q6asm 24-bit PCM bug fix
--

commit 881370cd9680d91d1348c565e596cf8d97c2b69b
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>

> ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
>
> q6asm uses ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 for every LINEAR_PCM
> stream. V2 has no sample_word_size, so the DSP defaults to
> word_size = 32 and expects the 24-bit sample MSB-justified, while
> ALSA S24_LE is LSB-justified. The 8-bit shift costs ~48 dB.
>
> Switch to V4 or V5. Pick V5 when ac->q6asm->ainfo.api_version >= 2,
> V4 otherwise. Both carry sample_word_size; mode stays 0 so the DSP
> picks the default Q factor.
>
> Apply on playback (q6asm_media_format_block_multi_ch_pcm,
> q6asm_open_write) and capture (q6asm_enc_cfg_blk_pcm_format_support,
> __q6asm_open_read).
>
> Drop S24_LE from the MultiMedia FE PCM. Advertise S24_3LE on
> capture, S24_3LE and S32_LE on playback. S24_LE can't be made to
> work zero-copy: the firmware ignores the Q-factor override. plughw
> converts S24_LE to S24_3LE transparently.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>

[Severity: Low]
Since this fixes 24-bit PCM level handling in Q6ASM, should it carry
Fixes tags?

  Fixes: 68fd8480bb7b ("ASoC: qdsp6: q6asm: Add support to audio stream apis")
  Fixes: 2a9e92d371db ("ASoC: qdsp6: q6asm: Add q6asm dai driver")

> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
> index 3840669867351..57cbce2bb0cb7 100644
> --- a/sound/soc/qcom/qdsp6/q6asm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
[ ... ]
> @@ -139,7 +141,8 @@ static const struct snd_pcm_hardware q6asm_dai_hardware_playback = {
>  				  SNDRV_PCM_RATE_176400 |		\
>  				  SNDRV_PCM_RATE_192000),		\
>  			.formats = (SNDRV_PCM_FMTBIT_S16_LE |		\
> -					SNDRV_PCM_FMTBIT_S24_LE),	\
> +				    SNDRV_PCM_FMTBIT_S24_3LE |		\
> +				    SNDRV_PCM_FMTBIT_S32_LE),		\
>  			.channels_min = 1,				\
>  			.channels_max = 8,				\
>  			.rate_min =     8000,				\
> @@ -151,7 +154,7 @@ static const struct snd_pcm_hardware q6asm_dai_hardware_playback = {
>  				  SNDRV_PCM_RATE_12000 |		\
>  				  SNDRV_PCM_RATE_24000),		\
>  			.formats = (SNDRV_PCM_FMTBIT_S16_LE |		\
> -				    SNDRV_PCM_FMTBIT_S24_LE),		\
> +				    SNDRV_PCM_FMTBIT_S24_3LE),		\

[Severity: High]
Does replacing SNDRV_PCM_FMTBIT_S24_LE with SNDRV_PCM_FMTBIT_S24_3LE and
adding SNDRV_PCM_FMTBIT_S32_LE break DPCM backends on boards whose
be_hw_params_fixup callback does not override SNDRV_PCM_HW_PARAM_FORMAT?

dpcm_be_dai_hw_params() copies the frontend hw_params to each connected
backend before calling snd_soc_link_be_hw_params_fixup().  Because
apq8096_be_hw_params_fixup() and sc7180_qdsp_be_hw_params_fixup() only fix
up rate and channels, SNDRV_PCM_FORMAT_S24_3LE and SNDRV_PCM_FORMAT_S32_LE
propagate directly into the backend hw_params callbacks.

In sound/soc/qcom/qdsp6/q6routing.c, routing_hw_params() only handles
SNDRV_PCM_FORMAT_S16_LE and SNDRV_PCM_FORMAT_S24_LE (and commit "ASoC:
qcom: q6dsp: add S24_LE and S32_LE to MI2S playback DAIs" later in this
series only adds SNDRV_PCM_FORMAT_S32_LE), leaving
session->bits_per_sample unset (0 or stale) for S24_3LE when
q6routing_stream_open() calls q6adm_open():

sound/soc/qcom/qdsp6/q6routing.c:routing_hw_params() {
	...
	switch (params_format(params)) {
	case SNDRV_PCM_FORMAT_S16_LE:
			session->bits_per_sample = 16;
		break;
	case SNDRV_PCM_FORMAT_S24_LE:
			session->bits_per_sample = 24;
		break;
	default:
		break;
	}
	...
}

Similarly, in sound/soc/qcom/qdsp6/q6afe-dai.c, q6slim_hw_params() rejects
SNDRV_PCM_FORMAT_S24_3LE with -EINVAL, and q6hdmi_hw_params() only handles
S16_LE and S24_LE, leaving hdmi->bit_width uninitialized for both S24_3LE
and S32_LE.

> diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c
> index d042132caf034..ee1930e41d4b6 100644
> --- a/sound/soc/qcom/qdsp6/q6asm.c
> +++ b/sound/soc/qcom/qdsp6/q6asm.c
> @@ -40,6 +40,10 @@
>  #define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2	0x00010DA3
>  #define ASM_SESSION_CMD_RUN_V2			0x00010DAA
>  #define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2	0x00010DA5
> +#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4	0x0001320C
> +#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5	0x00013222

[Severity: Low]
With both playback and capture switched to V4/V5,
ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2, struct
asm_multi_channel_pcm_fmt_blk_v2, and struct
asm_multi_channel_pcm_enc_cfg_v2 are now unused and can be removed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126115738.1765949-1-srinivas.kandagatla@oss.qualcomm.com?part=1

      reply	other threads:[~2026-11-26 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:57 [PATCH 1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5 Srinivas Kandagatla
2026-11-26 12:15 ` sashiko-bot [this message]

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=sashiko-outbox-235483@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=srinivas.kandagatla@oss.qualcomm.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