* [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 12:15 ` sashiko-bot
0 siblings, 1 reply; 2+ 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 related [flat|nested] 2+ 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 12:15 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-26 12:15 UTC (permalink / raw)
To: Srinivas Kandagatla; +Cc: linux-sound
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 12:15 UTC | newest]
Thread overview: 2+ 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 12:15 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox