From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: marcht@proton.me, Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] ASoC: qcom: audioreach: use a 32-bit container for S24_LE PCM
Date: Sun, 15 Nov 2026 11:52:17 +0000 [thread overview]
Message-ID: <9cb2cc9e-7224-48d6-84d2-308ce31fd93d@oss.qualcomm.com> (raw)
In-Reply-To: <20261111-q6apm-fixes-v1-1-1beb5702b372@proton.me>
On 11/11/26 10:54 AM, Marc Herrero via B4 Relay wrote:
> From: Marc Herrero <marcht@proton.me>
>
> SNDRV_PCM_FORMAT_S24_LE carries 24 valid bits in a 32-bit container, but
> audioreach_shmem_set_media_format() and audioreach_pcm_set_media_format()
> set bits_per_sample = bit_width = 24 in PARAM_ID_MEDIA_FORMAT and
> PARAM_ID_PCM_OUTPUT_FORMAT_CFG, which tells the DSP that the samples are
> packed 3-byte words.
>
> q6apm-dai advertises S24_LE, so with a topology that allows it on a
> playback front end the DSP walks the buffer with the wrong stride. On
> QCS6490 (Radxa Dragon Q6A) this crashes the ADSP audio_process:
>
> PDM: service 'audio_process' crash: 'EX:audio_process:0x2:...'
> q6apm-lpass-dais ...: Failed to start APM port 113
> remoteproc remoteproc0: crash detected in adsp: type fatal error
>
> Use the container size (32) for 24-bit data and keep bit_width = 24,
> alignment = PCM_LSB_ALIGNED and q_factor = 23. With this change S24_LE
> playback works on the headphone path (codec DMA RX -> LPASS RX macro ->
> WCD9385), tested with the back end at S16_LE, S24_LE and S32_LE and at
> 48, 96 and 192 kHz.
>
> The DSP then reads each 32-bit word as Q23, so S24_LE samples must be
> sign-extended into the top byte, as alsa-lib's conversions do.
>
> Fixes: 25ab80db6b13 ("ASoC: qdsp6: audioreach: add module configuration command helpers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Marc Herrero <marcht@proton.me>
> ---
Thanks Marc for fixing this,
> sound/soc/qcom/qdsp6/audioreach.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
> index d2dc5d37bccf..937506edf34a 100644
> --- a/sound/soc/qcom/qdsp6/audioreach.c
> +++ b/sound/soc/qcom/qdsp6/audioreach.c
> @@ -1216,7 +1216,7 @@ static int audioreach_pcm_set_media_format(struct q6apm_graph *graph,
> media_cfg->interleaved = module->interleave_type;
> media_cfg->num_channels = mcfg->num_channels;
> media_cfg->q_factor = mcfg->bit_width - 1;
> - media_cfg->bits_per_sample = mcfg->bit_width;
> + media_cfg->bits_per_sample = mcfg->bit_width == 24 ? 32 : mcfg->bit_width;
I think it will be worth adding a comment about the wire format vs the
sample format so it helps others.
other than that it looks good to me.
Reviewed-by: Srinivas Kandagatla<srinivas.kandagatla@oss.qualcomm.com>
--Srini
> /* Convert the physical mapping to a logical mapping of the channels */
> for (i = 0, j = 0; i < AR_PCM_MAX_NUM_CHANNEL && j < mcfg->num_channels; i++) {
> if (!mcfg->channel_map[i])
> @@ -1308,7 +1308,7 @@ static int audioreach_shmem_set_media_format(struct q6apm_graph *graph,
> cfg->sample_rate = mcfg->sample_rate;
> cfg->bit_width = mcfg->bit_width;
> cfg->alignment = PCM_LSB_ALIGNED;
> - cfg->bits_per_sample = mcfg->bit_width;
> + cfg->bits_per_sample = mcfg->bit_width == 24 ? 32 : mcfg->bit_width;
> cfg->q_factor = mcfg->bit_width - 1;
> cfg->endianness = PCM_LITTLE_ENDIAN;
> cfg->num_channels = mcfg->num_channels;
>
next prev parent reply other threads:[~2026-11-15 11:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 10:54 [PATCH 0/2] ASoC: qcom: audioreach: fix S24_LE playback and route mixer disconnects Marc Herrero via B4 Relay
2026-11-11 10:54 ` [PATCH 1/2] ASoC: qcom: audioreach: use a 32-bit container for S24_LE PCM Marc Herrero via B4 Relay
2026-11-15 11:52 ` Srinivas Kandagatla [this message]
2026-11-11 10:54 ` [PATCH 2/2] ASoC: qcom: audioreach: only disconnect the route a mixer control owns Marc Herrero via B4 Relay
2026-11-12 19:01 ` Mark Brown
2026-11-15 10:50 ` Srinivas Kandagatla
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=9cb2cc9e-7224-48d6-84d2-308ce31fd93d@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=marcht@proton.me \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=srini@kernel.org \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®