[PATCH] ASoC: qcom: qdsp6: clear stale channel_map entries

From: Fabian Renn-Giles

Date: Wed Oct 28 2026 - 06:08:31 EST


Since commit c663014e452d ("ASoC: qcom: audioreach: compute active
channel maps from channel_map"), the codec DMA active_channels_mask is
built from the non-zero entries of the channel_map instead of from
num_channels.

audioreach_set_default_channel_mapping() only writes the first
num_channels entries, and q6dma_set_channel_map() only the first
tx_num/rx_num entries. The per-DAI module_config in q6apm-lpass-dais is
persistent, so entries written by an earlier, wider configuration
survive a later narrower one. E.g. after a 4 channel setup, a 2 channel
capture on VA_CODEC_DMA_TX_0 keeps the map 01 02 04 05 and sends
active_channels_mask = 0xf with num_channels = 2. The DSP rejects the
graph start:

qcom-apm gprsvc:service:2:1: DSP returned error[1001002] 1
q6apm-lpass-dais ...: Failed to start APM port 110
MultiMedia4 Capture: ASoC error (-22): at dpcm_be_dai_trigger()

which breaks the built-in DMIC capture on the Lenovo Yoga Slim 7x
(X1E80100).

Clear the whole channel_map before filling it in both places.

Note: this is my very first contribution to the linux kernel so I
may be new to some of the processes. I apologize in advance.

Fixes: c663014e452d ("ASoC: qcom: audioreach: compute active channel maps from channel_map")
Signed-off-by: Fabian Renn-Giles <fabian@xxxxxxxxxxxx>
Assisted-by: Claude:claude-sonnet-5-5
---
Tested on a Lenovo Yoga Slim 7x (X1E80100): built-in DMIC capture on
VA_CODEC_DMA_TX_0 (MultiMedia4 Capture) failed with the DSP error above;
with this patch repeated arecord runs work. Based on broonie/sound.git
for-next (d34a818a331f).

sound/soc/qcom/qdsp6/audioreach.c | 6 ++++++
sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 2 ++
2 files changed, 8 insertions(+)

diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index d2dc5d37bccf..4ac65d9b5543 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -308,6 +308,12 @@ EXPORT_SYMBOL_GPL(audioreach_alloc_apm_cmd_pkt);

void audioreach_set_default_channel_mapping(u8 *ch_map, int num_channels)
{
+ /*
+ * The active channel mask is derived from the non-zero entries, so
+ * stale entries from a previous, wider configuration must not survive.
+ */
+ memset(ch_map, 0, AR_PCM_MAX_NUM_CHANNEL);
+
if (num_channels == 1) {
ch_map[0] = PCM_CHANNEL_FL;
} else if (num_channels == 2) {
diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
index 83f2711bceea..12f139af8ca0 100644
--- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
+++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
@@ -99,6 +99,7 @@ static int q6dma_set_channel_map(struct snd_soc_dai *dai,
tx_num);
return -EINVAL;
}
+ memset(cfg->channel_map, 0, sizeof(cfg->channel_map));
for (i = 0; i < tx_num; i++)
cfg->channel_map[i] = tx_ch_mask[i];

@@ -123,6 +124,7 @@ static int q6dma_set_channel_map(struct snd_soc_dai *dai,
rx_num);
return -EINVAL;
}
+ memset(cfg->channel_map, 0, sizeof(cfg->channel_map));
for (i = 0; i < rx_num; i++)
cfg->channel_map[i] = rx_ch_mask[i];


base-commit: d34a818a331f7e270fa9dc3db3d96f6a0d4fa7ab
--
2.55.0