* [PATCH 1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
@ 2026-11-26 11:57 Srinivas Kandagatla
2026-11-26 15:40 ` Mark Brown
2026-12-01 10:52 ` Riccardo Mereu
0 siblings, 2 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2026-11-26 11:57 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Michael McAllister, Riccardo Mereu, Mohammad Rafi Shaik,
Prasad Kumpatla, linux-sound, linux-arm-msm, linux-kernel
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>
---
sound/soc/qcom/qdsp6/q6asm-dai.c | 26 +++--
sound/soc/qcom/qdsp6/q6asm.c | 184 ++++++++++++++++++++++++++-----
sound/soc/qcom/qdsp6/q6asm.h | 6 +-
3 files changed, 178 insertions(+), 38 deletions(-)
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index 384066986735..57cbce2bb0cb 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -63,6 +63,7 @@ struct q6asm_dai_rtd {
uint64_t bytes_received;
uint64_t copied_total;
uint16_t bits_per_sample;
+ uint16_t sample_word_size;
snd_pcm_uframes_t queue_ptr;
uint16_t source; /* Encoding source bit mask */
struct audio_client *audio_client;
@@ -90,7 +91,7 @@ static const struct snd_pcm_hardware q6asm_dai_hardware_capture = {
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S24_LE),
+ SNDRV_PCM_FMTBIT_S24_3LE),
.rates = SNDRV_PCM_RATE_8000_48000,
.rate_min = 8000,
.rate_max = 48000,
@@ -113,7 +114,8 @@ static const struct snd_pcm_hardware q6asm_dai_hardware_playback = {
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S24_LE),
+ SNDRV_PCM_FMTBIT_S24_3LE |
+ SNDRV_PCM_FMTBIT_S32_LE),
.rates = SNDRV_PCM_RATE_8000_192000,
.rate_min = 8000,
.rate_max = 192000,
@@ -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), \
.channels_min = 1, \
.channels_max = 4, \
.rate_min = 8000, \
@@ -284,13 +287,15 @@ static int q6asm_dai_prepare(struct snd_soc_component *component,
ret = q6asm_media_format_block_multi_ch_pcm(
prtd->audio_client, prtd->stream_id,
runtime->rate, runtime->channels, NULL,
- prtd->bits_per_sample);
+ prtd->bits_per_sample,
+ prtd->sample_word_size);
} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
ret = q6asm_enc_cfg_blk_pcm_format_support(prtd->audio_client,
prtd->stream_id,
runtime->rate,
runtime->channels,
- prtd->bits_per_sample);
+ prtd->bits_per_sample,
+ prtd->sample_word_size);
/* Queue the buffers */
for (i = 0; i < runtime->periods; i++)
@@ -507,9 +512,16 @@ static int q6asm_dai_hw_params(struct snd_soc_component *component,
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
prtd->bits_per_sample = 16;
+ prtd->sample_word_size = 16;
break;
- case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ /* 24-bit samples packed in three bytes, no padding */
prtd->bits_per_sample = 24;
+ prtd->sample_word_size = 24;
+ break;
+ case SNDRV_PCM_FORMAT_S32_LE:
+ prtd->bits_per_sample = 32;
+ prtd->sample_word_size = 32;
break;
}
diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c
index d042132caf03..ee1930e41d4b 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
+/* ADSP ASM service API version at which the V5 PCM media format is supported */
+#define ADSP_ASM_API_VERSION_V2 2
#define ASM_MEDIA_FMT_MP3 0x00010BE9
#define ASM_MEDIA_FMT_FLAC 0x00010C16
#define ASM_MEDIA_FMT_WMA_V9 0x00010DA8
@@ -99,6 +103,31 @@ struct asm_multi_channel_pcm_fmt_blk_v2 {
u8 channel_mapping[PCM_MAX_NUM_CHANNEL];
} __packed;
+/* Note: in V4 the channel map precedes endianness/mode (unlike V5) */
+struct asm_multi_channel_pcm_fmt_blk_v4 {
+ struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
+ u16 num_channels;
+ u16 bits_per_sample;
+ u32 sample_rate;
+ u16 is_signed;
+ u16 sample_word_size;
+ u8 channel_mapping[PCM_MAX_NUM_CHANNEL];
+ u16 endianness; /* 0: little endian */
+ u16 mode; /* 0: default Q factors */
+} __packed;
+
+struct asm_multi_channel_pcm_fmt_blk_v5 {
+ struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
+ u16 num_channels;
+ u16 bits_per_sample;
+ u32 sample_rate;
+ u16 is_signed;
+ u16 sample_word_size;
+ u16 endianness; /* 0: little endian */
+ u16 mode; /* 0: default Q factors */
+ u8 channel_mapping[PCM_MAX_NUM_CHANNEL];
+} __packed;
+
struct asm_flac_fmt_blk_v2 {
struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
u16 is_stream_info_present;
@@ -191,6 +220,33 @@ struct asm_multi_channel_pcm_enc_cfg_v2 {
uint8_t channel_mapping[8];
} __packed;
+/* Note: in V4 the channel map precedes endianness/mode (unlike V5) */
+struct asm_multi_channel_pcm_enc_cfg_v4 {
+ struct asm_stream_cmd_set_encdec_param encdec;
+ struct asm_enc_cfg_blk_param_v2 encblk;
+ u16 num_channels;
+ u16 bits_per_sample;
+ u32 sample_rate;
+ u16 is_signed;
+ u16 sample_word_size;
+ u8 channel_mapping[PCM_MAX_NUM_CHANNEL];
+ u16 endianness; /* 0: little endian */
+ u16 mode; /* 0: default Q factors */
+} __packed;
+
+struct asm_multi_channel_pcm_enc_cfg_v5 {
+ struct asm_stream_cmd_set_encdec_param encdec;
+ struct asm_enc_cfg_blk_param_v2 encblk;
+ u16 num_channels;
+ u16 bits_per_sample;
+ u32 sample_rate;
+ u16 is_signed;
+ u16 sample_word_size;
+ u16 endianness; /* 0: little endian */
+ u16 mode; /* 0: default Q factors */
+ u8 channel_mapping[PCM_MAX_NUM_CHANNEL];
+} __packed;
+
struct asm_data_cmd_read_v2 {
u32 buf_addr_lsw;
u32 buf_addr_msw;
@@ -912,6 +968,19 @@ static int q6asm_ac_send_cmd_sync(struct audio_client *ac, struct apr_pkt *pkt)
return rc;
}
+/*
+ * Both the V4 and V5 multichannel PCM media formats carry the sample word size
+ * needed to describe e.g. 24-bit samples held in a 32-bit word. V5 is only
+ * understood by newer ADSP firmware (ASM API version >= 2); everything else -
+ * including when the version query is unsupported and ainfo is left zeroed -
+ * uses V4, which the QDSP6 firmware has supported since its introduction. (The
+ * old V2 format, which lacks the word size, is no longer used for playback.)
+ */
+static bool q6asm_pcm_fmt_v5_supported(struct audio_client *ac)
+{
+ return ac->q6asm->ainfo.api_version >= ADSP_ASM_API_VERSION_V2;
+}
+
/**
* q6asm_open_write() - Open audio client for writing
* @ac: audio client pointer
@@ -955,7 +1024,9 @@ int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
open->dec_fmt_id = ASM_MEDIA_FMT_MP3;
break;
case FORMAT_LINEAR_PCM:
- open->dec_fmt_id = ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2;
+ open->dec_fmt_id = q6asm_pcm_fmt_v5_supported(ac) ?
+ ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 :
+ ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4;
break;
case SND_AUDIOCODEC_FLAC:
open->dec_fmt_id = ASM_MEDIA_FMT_FLAC;
@@ -1078,6 +1149,7 @@ EXPORT_SYMBOL_GPL(q6asm_run_nowait);
* @channels: number of audio channels.
* @channel_map: channel map pointer
* @bits_per_sample: bits per sample
+ * @sample_word_size: size in bits of the word that holds a sample of a channel
*
* Return: Will be an negative value on error or zero on success
*/
@@ -1085,30 +1157,60 @@ int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
uint32_t stream_id,
uint32_t rate, uint32_t channels,
u8 channel_map[PCM_MAX_NUM_CHANNEL],
- uint16_t bits_per_sample)
+ uint16_t bits_per_sample,
+ uint16_t sample_word_size)
{
- struct asm_multi_channel_pcm_fmt_blk_v2 *fmt;
+ bool use_v5 = q6asm_pcm_fmt_v5_supported(ac);
+ struct asm_multi_channel_pcm_fmt_blk_v5 *fmt_v5;
+ struct asm_multi_channel_pcm_fmt_blk_v4 *fmt_v4;
struct apr_pkt *pkt;
u8 *channel_mapping;
- int pkt_size = APR_HDR_SIZE + sizeof(*fmt);
+ int pkt_size = APR_HDR_SIZE +
+ (use_v5 ? sizeof(*fmt_v5) : sizeof(*fmt_v4));
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
pkt = p;
- fmt = p + APR_HDR_SIZE;
q6asm_add_hdr(ac, &pkt->hdr, pkt_size, true, stream_id);
-
pkt->hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
- fmt->fmt_blk.fmt_blk_size = sizeof(*fmt) - sizeof(fmt->fmt_blk);
- fmt->num_channels = channels;
- fmt->bits_per_sample = bits_per_sample;
- fmt->sample_rate = rate;
- fmt->is_signed = 1;
- channel_mapping = fmt->channel_mapping;
+ dev_dbg(ac->dev, "%s: fmt=%s rate=%u ch=%u bps=%u word=%u (asm api %u)\n",
+ __func__, use_v5 ? "V5" : "V4", rate, channels,
+ bits_per_sample, sample_word_size, ac->q6asm->ainfo.api_version);
+
+ /*
+ * Leave mode=0 (default Q factors). Per the ADSP ABI the defaults
+ * are Q15 for 16-bit, Q23 for 24-bit packed (word_size=24), and Q31
+ * for 32-bit, which match every format we advertise to userspace.
+ * The explicit override values (15/23/31) are not honoured by every
+ * firmware; the default path is the safe choice.
+ */
+ if (use_v5) {
+ fmt_v5 = p + APR_HDR_SIZE;
+ fmt_v5->fmt_blk.fmt_blk_size = sizeof(*fmt_v5) -
+ sizeof(fmt_v5->fmt_blk);
+ fmt_v5->num_channels = channels;
+ fmt_v5->bits_per_sample = bits_per_sample;
+ fmt_v5->sample_rate = rate;
+ fmt_v5->is_signed = 1;
+ fmt_v5->sample_word_size = sample_word_size;
+ fmt_v5->mode = 0; /* default Q-factor per bps/word_size */
+ channel_mapping = fmt_v5->channel_mapping;
+ } else {
+ fmt_v4 = p + APR_HDR_SIZE;
+ fmt_v4->fmt_blk.fmt_blk_size = sizeof(*fmt_v4) -
+ sizeof(fmt_v4->fmt_blk);
+ fmt_v4->num_channels = channels;
+ fmt_v4->bits_per_sample = bits_per_sample;
+ fmt_v4->sample_rate = rate;
+ fmt_v4->is_signed = 1;
+ fmt_v4->sample_word_size = sample_word_size;
+ fmt_v4->mode = 0; /* default Q-factor per bps/word_size */
+ channel_mapping = fmt_v4->channel_mapping;
+ }
if (channel_map) {
memcpy(channel_mapping, channel_map, PCM_MAX_NUM_CHANNEL);
@@ -1347,40 +1449,62 @@ EXPORT_SYMBOL_GPL(q6asm_stream_remove_trailing_silence);
* @rate: audio sample rate
* @channels: number of audio channels.
* @bits_per_sample: bits per sample
+ * @sample_word_size: size in bits of the word that holds a sample of a channel
*
* Return: Will be an negative value on error or zero on success
*/
int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
uint32_t stream_id, uint32_t rate,
uint32_t channels,
- uint16_t bits_per_sample)
+ uint16_t bits_per_sample,
+ uint16_t sample_word_size)
{
- struct asm_multi_channel_pcm_enc_cfg_v2 *enc_cfg;
+ bool use_v5 = q6asm_pcm_fmt_v5_supported(ac);
+ struct asm_multi_channel_pcm_enc_cfg_v5 *enc_v5;
+ struct asm_multi_channel_pcm_enc_cfg_v4 *enc_v4;
struct apr_pkt *pkt;
u8 *channel_mapping;
u32 frames_per_buf = 0;
- int pkt_size = APR_HDR_SIZE + sizeof(*enc_cfg);
+ int pkt_size = APR_HDR_SIZE +
+ (use_v5 ? sizeof(*enc_v5) : sizeof(*enc_v4));
void *p __free(kfree) = kzalloc(pkt_size, GFP_KERNEL);
if (!p)
return -ENOMEM;
pkt = p;
- enc_cfg = p + APR_HDR_SIZE;
q6asm_add_hdr(ac, &pkt->hdr, pkt_size, true, stream_id);
-
pkt->hdr.opcode = ASM_STREAM_CMD_SET_ENCDEC_PARAM;
- enc_cfg->encdec.param_id = ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2;
- enc_cfg->encdec.param_size = sizeof(*enc_cfg) - sizeof(enc_cfg->encdec);
- enc_cfg->encblk.frames_per_buf = frames_per_buf;
- enc_cfg->encblk.enc_cfg_blk_size = enc_cfg->encdec.param_size -
- sizeof(struct asm_enc_cfg_blk_param_v2);
-
- enc_cfg->num_channels = channels;
- enc_cfg->bits_per_sample = bits_per_sample;
- enc_cfg->sample_rate = rate;
- enc_cfg->is_signed = 1;
- channel_mapping = enc_cfg->channel_mapping;
+
+ if (use_v5) {
+ enc_v5 = p + APR_HDR_SIZE;
+ enc_v5->encdec.param_id = ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2;
+ enc_v5->encdec.param_size = sizeof(*enc_v5) -
+ sizeof(enc_v5->encdec);
+ enc_v5->encblk.frames_per_buf = frames_per_buf;
+ enc_v5->encblk.enc_cfg_blk_size = enc_v5->encdec.param_size -
+ sizeof(struct asm_enc_cfg_blk_param_v2);
+ enc_v5->num_channels = channels;
+ enc_v5->bits_per_sample = bits_per_sample;
+ enc_v5->sample_rate = rate;
+ enc_v5->is_signed = 1;
+ enc_v5->sample_word_size = sample_word_size;
+ channel_mapping = enc_v5->channel_mapping;
+ } else {
+ enc_v4 = p + APR_HDR_SIZE;
+ enc_v4->encdec.param_id = ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2;
+ enc_v4->encdec.param_size = sizeof(*enc_v4) -
+ sizeof(enc_v4->encdec);
+ enc_v4->encblk.frames_per_buf = frames_per_buf;
+ enc_v4->encblk.enc_cfg_blk_size = enc_v4->encdec.param_size -
+ sizeof(struct asm_enc_cfg_blk_param_v2);
+ enc_v4->num_channels = channels;
+ enc_v4->bits_per_sample = bits_per_sample;
+ enc_v4->sample_rate = rate;
+ enc_v4->is_signed = 1;
+ enc_v4->sample_word_size = sample_word_size;
+ channel_mapping = enc_v4->channel_mapping;
+ }
if (q6dsp_map_channels(channel_mapping, channels))
return -EINVAL;
@@ -1473,7 +1597,9 @@ static int __q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
switch (format) {
case FORMAT_LINEAR_PCM:
open->mode_flags |= 0x00;
- open->enc_cfg_id = ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2;
+ open->enc_cfg_id = q6asm_pcm_fmt_v5_supported(ac) ?
+ ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 :
+ ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4;
break;
default:
pr_err("Invalid format[%d]\n", format);
diff --git a/sound/soc/qcom/qdsp6/q6asm.h b/sound/soc/qcom/qdsp6/q6asm.h
index 6fafda5bd849..2d969dbffcff 100644
--- a/sound/soc/qcom/qdsp6/q6asm.h
+++ b/sound/soc/qcom/qdsp6/q6asm.h
@@ -106,7 +106,8 @@ int q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
uint32_t stream_id, uint32_t rate,
uint32_t channels,
- uint16_t bits_per_sample);
+ uint16_t bits_per_sample,
+ uint16_t sample_word_size);
int q6asm_read(struct audio_client *ac, uint32_t stream_id);
@@ -114,7 +115,8 @@ int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
uint32_t stream_id,
uint32_t rate, uint32_t channels,
u8 channel_map[PCM_MAX_NUM_CHANNEL],
- uint16_t bits_per_sample);
+ uint16_t bits_per_sample,
+ uint16_t sample_word_size);
int q6asm_stream_media_format_block_flac(struct audio_client *ac,
uint32_t stream_id,
struct q6asm_flac_cfg *cfg);
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
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 15:40 ` Mark Brown
2026-12-01 10:52 ` Riccardo Mereu
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-11-26 15:40 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
Michael McAllister, Riccardo Mereu, Mohammad Rafi Shaik,
Prasad Kumpatla, linux-sound, linux-arm-msm, linux-kernel
On Thu, 26 Nov 2026 11:57:37 +0000, Srinivas Kandagatla wrote:
> ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5
Thanks!
[1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
https://git.kernel.org/broonie/sound/c/f29b683543cc
[2/2] ASoC: qcom: q6dsp: add S24_LE and S32_LE to MI2S playback DAIs
https://git.kernel.org/broonie/sound/c/e03e85ff7500
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
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 15:40 ` Mark Brown
@ 2026-12-01 10:52 ` Riccardo Mereu
2026-12-01 10:57 ` Srinivas Kandagatla
1 sibling, 1 reply; 4+ messages in thread
From: Riccardo Mereu @ 2026-12-01 10:52 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, Michael McAllister, Mohammad Rafi Shaik,
Prasad Kumpatla, linux-sound, linux-arm-msm, linux-kernel
Hi Srinivas,
On Thu, Nov 26, 2026 at 11:57:37AM +0000, Srinivas Kandagatla wrote:
> Both the V4 and V5 multichannel PCM media formats carry the sample word size
I see Mark has already applied both patches, so just a test report for
the record.
Tested on the Arduino UNO Q (QRB2210), on next-20261127 with our DP
audio patches on top. ADSP firmware ADSP.VT.5.4.1.c4-00013-KAMORTA
(Debian firmware-qcom-dsp 0~20261019).
The ADSP reports ASM API version 2, so this board takes the V5 path for
both playback and capture, on every frontend and format (bps/word size
16/16, 24/24, 32/32), with no DSP errors. The 8-entry channel map in the
V5 structs works fine on this firmware.
DP playback (MultiMedia4 -> SEC_MI2S_RX -> ANX7625), checked on the I2S
lines with a logic analyser (32-bit slots, BCLK 3.072 MHz, WS 48 kHz):
format left marker right marker bit walk
S16_LE 0x40010000 0x20020000 15 bits, slot 30..16
S24_3LE 0x40000100 0x20000200 23 bits, slot 30..8
S32_LE 0x40000001 0x20000002 31 bits, slot 30..0
S24_3LE, 0xbfffff00 0xdffffe00 sign in bit 31
negated
All bit-exact, and S16/S24/S32 have the same loudness on a DP monitor
(before, S24 played about 48 dB too quiet). Headphones (codec DMA) play
S16_LE, S24_3LE and S32_LE without plug conversion, at the same level.
Headset mic capture (MultiMedia3 <- TX_CODEC_DMA_TX_3): S16_LE and
S24_3LE are now within 2 dB of each other with the same speech and sound
clean; before, S24 capture crackled. The low 8 bits of S24_3LE are
always zero here, but that is expected: the codec DMA backend runs at
S16_LE, so the DSP only pads.
PipeWire, without our S16 workaround, now opens DP and headphones at
S32_LE and the headset at S24_3LE, and all sound right.
Also fine: 20 open/close cycles in a row, 44.1 kHz S24_3LE resampled to
the 48 kHz backend, and DP plus headphones running at the same time.
Tested-by: Riccardo Mereu <r.mereu@arduino.cc>
Two nits, if you touch this code again:
> + * uses V4, which the QDSP6 firmware has supported since its introduction. (The
> + * old V2 format, which lacks the word size, is no longer used for playback.)
Capture moved to V4/V5 too (__q6asm_open_read() and
q6asm_enc_cfg_blk_pcm_format_support()), so "no longer used" without
"for playback" would be more accurate.
After this patch ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 and
struct asm_multi_channel_pcm_enc_cfg_v2 have no users left in q6asm.c.
Unrelated to this series, but found while testing: since commit
55207a5b6959 ("soundwire: qcom: add multi-master support") every boot
on this board hits the WARN_ON_ONCE() in qcom_swrm_port_target(), on the
first prepare of the codec DMA path. qcom_swrm_compute_params() leaves
port_params zeroed for ports whose qcom,ports-word-length is 0xff
(agatti.dtsi has several), and qcom_swrm_port_params() then writes
0xffffffff to DPn_BLOCK_CTRL_1(offset, 0). The write itself is old, the
WARN only made it visible. I've sent a small fix that skips those
ports: "soundwire: qcom: skip DPn_BLOCK_CTRL_1 for ports without a word
length".
https://lore.kernel.org/r/20261201104714.142340-1-r.mereu.kernel@arduino.cc
Thanks,
Riccardo
--
Privacy and Confidentiality Notice: This email and all attachments are
confidential and for the designated recipient(s) only. They may also be
privileged. If you are not the intended recipient or among the intended
recipients, you may not use, read, retransmit, disseminate, store/copy the
information in any medium or take any action in reliance upon it. Please
notify the sender that you have received it in error and immediately delete
the entire communication, including any attachments.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: qcom: q6asm: fix 24-bit PCM level via media format V4/V5
2026-12-01 10:52 ` Riccardo Mereu
@ 2026-12-01 10:57 ` Srinivas Kandagatla
0 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2026-12-01 10:57 UTC (permalink / raw)
To: Riccardo Mereu
Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Kuninori Morimoto, Michael McAllister, Mohammad Rafi Shaik,
Prasad Kumpatla, linux-sound, linux-arm-msm, linux-kernel
On 12/1/26 10:52 AM, Riccardo Mereu wrote:
> Capture moved to V4/V5 too (__q6asm_open_read() and
> q6asm_enc_cfg_blk_pcm_format_support()), so "no longer used" without
> "for playback" would be more accurate.
>
> After this patch ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 and
> struct asm_multi_channel_pcm_enc_cfg_v2 have no users left in q6asm.c.
>
> Unrelated to this series, but found while testing: since commit
> 55207a5b6959 ("soundwire: qcom: add multi-master support") every boot
> on this board hits the WARN_ON_ONCE() in qcom_swrm_port_target(), on the
> first prepare of the codec DMA path. qcom_swrm_compute_params() leaves
This got fixed in
https://lore.kernel.org/all/20261125103825.936939-1-srinivas.kandagatla@oss.qualcomm.com/
--srini
> port_params zeroed for ports whose qcom,ports-word-length is 0xff
> (agatti.dtsi has several), and qcom_swrm_port_params() then writes
> 0xffffffff to DPn_BLOCK_CTRL_1(offset, 0). The write itself is old, the
> WARN only made it visible. I've sent a small fix that skips those
> ports: "soundwire: qcom: skip DPn_BLOCK_CTRL_1 for ports without a word
> length".
>
> https://lore.kernel.org/r/20261201104714.142340-1-r.mereu.kernel@arduino.cc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-01 10:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 15:40 ` Mark Brown
2026-12-01 10:52 ` Riccardo Mereu
2026-12-01 10:57 ` Srinivas Kandagatla
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®