mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Fabian Renn-Giles <fabian@fielding.dev>,
	srini@kernel.org, broonie@kernel.org
Cc: lgirdwood@gmail.com, neil.armstrong@linaro.org,
	krzysztof.kozlowski@oss.qualcomm.com,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: qcom: qdsp6: clear stale channel_map entries
Date: Wed, 28 Oct 2026 10:21:58 +0000	[thread overview]
Message-ID: <6c423837-b665-4635-9984-a3efc28a7922@oss.qualcomm.com> (raw)
In-Reply-To: <20261028100708.6808-1-fabian@fielding.dev>



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


      reply	other threads:[~2026-10-28 10:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 10:07 Fabian Renn-Giles
2026-10-28 10:21 ` Srinivas Kandagatla [this message]

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=6c423837-b665-4635-9984-a3efc28a7922@oss.qualcomm.com \
    --to=srinivas.kandagatla@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=fabian@fielding.dev \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=srini@kernel.org \
    /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®