* [PATCH] ASoC: qcom: qdsp6: clear stale channel_map entries
@ 2026-10-28 10:07 Fabian Renn-Giles
2026-10-28 10:21 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Renn-Giles @ 2026-10-28 10:07 UTC (permalink / raw)
To: srini, broonie
Cc: lgirdwood, neil.armstrong, krzysztof.kozlowski, linux-sound,
linux-arm-msm, linux-kernel, Fabian Renn-Giles
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@fielding.dev>
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: qcom: qdsp6: clear stale channel_map entries
2026-10-28 10:07 [PATCH] ASoC: qcom: qdsp6: clear stale channel_map entries Fabian Renn-Giles
@ 2026-10-28 10:21 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2026-10-28 10:21 UTC (permalink / raw)
To: Fabian Renn-Giles, srini, broonie
Cc: lgirdwood, neil.armstrong, krzysztof.kozlowski, linux-sound,
linux-arm-msm, linux-kernel
On 10/28/26 10:07 AM, Fabian Renn-Giles wrote:
> 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.
Thanks for sending the patch and Welcome.
You can move this comment after --- as it does not make sense to be in
the commit log.
>
> Fixes: c663014e452d ("ASoC: qcom: audioreach: compute active channel maps from channel_map")
> Signed-off-by: Fabian Renn-Giles <fabian@fielding.dev>
> 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)
there is patch on the list to remove this function, could you please
take a look at
https://lore.kernel.org/all/20261028024720.981971-1-zhangfei.gao@oss.qualcomm.com/
q6dsp_map_channels() already does the memset, pl recheck with that patch.
If your patch might be still relevant, please send patch against it.
--srini
> {
> + /*
> + * 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-28 10:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 10:07 [PATCH] ASoC: qcom: qdsp6: clear stale channel_map entries Fabian Renn-Giles
2026-10-28 10:21 ` 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®