Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 5/8] ASoC: qcom: lpass-va-macro: Add SoundWire microphone support
Date: Tue, 22 Sep 2026 10:00:14 +0000	[thread overview]
Message-ID: <20260922100015.032381F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260922-add_shikra_support-v1-5-6c6cb6444caf@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] ASoC: qcom: lpass-va-macro: inactive mux write hijacks active stream
- [Medium] ASoC: qcom: lpass-va-macro: dynamic mux switch leaves stale hardware state
--

commit 930ab6f652b9c31708f76061b90cd77f78ea08ce
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>

ASoC: qcom: lpass-va-macro: Add SoundWire microphone support
    
The VA decimators can currently capture audio only from DMIC inputs.
Add support for routing audio from SoundWire microphone (SMIC) inputs
as well.

> diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
> index 02dc3346924f1..79abbdd158b70 100644
> --- a/sound/soc/codecs/lpass-va-macro.c
> +++ b/sound/soc/codecs/lpass-va-macro.c
[ ... ]
> @@ -794,10 +794,22 @@ static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol,
>  		return -EINVAL;
>  	}
>  
> -	if (val != 0)
> -		snd_soc_component_update_bits(component, mic_sel_reg,
> -					      CDC_VA_TX_PATH_ADC_DMIC_SEL_MASK,
> -					      CDC_VA_TX_PATH_ADC_DMIC_SEL_DMIC);
> +	if (val != 0) {
> +		/*
> +		 * SMIC enums use shift 0 (lower nibble of CFG0),
> +		 * DMIC enums use shift 4 (upper nibble of CFG0).
> +		 * Use e->shift_l to distinguish them without relying
> +		 * on widget name comparisons.
> +		 */
> +		if (e->shift_l == 0)
> +			snd_soc_component_update_bits(component, mic_sel_reg,
> +						      CDC_VA_TX_PATH_ADC_DMIC_SEL_MASK,
> +						      CDC_VA_TX_PATH_ADC_DMIC_SEL_ADC);
> +		else
> +			snd_soc_component_update_bits(component, mic_sel_reg,
> +						      CDC_VA_TX_PATH_ADC_DMIC_SEL_MASK,
> +						      CDC_VA_TX_PATH_ADC_DMIC_SEL_DMIC);
> +	}

[Severity: High]
Does this unconditionally overwrite the shared decimator input domain bit
regardless of which path DAPM has actively routed?

If a user-space application writes a non-zero value to the inactive sub-mux
(e.g., VA SMIC MUX0) while the decimator is actively capturing from the other
source (VA DMIC MUX0), could this instantly corrupt the active audio capture
stream mid-stream?

>  
>  	return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
>  }
[ ... ]
> @@ -1004,6 +1025,17 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w,
>  
>  	switch (event) {
>  	case SND_SOC_DAPM_PRE_PMU:
> +		/*
> +		 * ADC_DMIC_SEL is shared by the DMIC and the SoundWire mic
> +		 * mux, so a mixer write to the mux that is not part of the
> +		 * active path can leave it stale. Program it from the mux
> +		 * state DAPM resolved for this decimator.
> +		 */
> +		snd_soc_component_update_bits(comp, dec_cfg_reg,
> +					      CDC_VA_TX_PATH_ADC_DMIC_SEL_MASK,
> +					      is_amic_enabled(comp, decimator) ?
> +					      CDC_VA_TX_PATH_ADC_DMIC_SEL_ADC :
> +					      CDC_VA_TX_PATH_ADC_DMIC_SEL_DMIC);

[Severity: Medium]
Does this apply the hardware state only on PRE_PMU?

If a user dynamically switches the decimator source while it is active
(e.g., changing VA DECX MUX via mixer controls), DAPM might not execute the
PRE_PMU event since the widget remains powered.

Would this leave the newly added ADC_DMIC_SEL configuration unexecuted,
causing the hardware register to remain in a stale state and breaking the
capture stream?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-add_shikra_support-v1-0-6c6cb6444caf@oss.qualcomm.com?part=5

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

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  9:42 [PATCH v4 0/8] ASoC: qcom: Add shikra and Hawi LPASS macro support Mohammad Rafi Shaik
2026-09-22  9:42 ` [PATCH v4 1/8] ASoC: dt-bindings: qcom: Add Shikra RX and VA macro codecs Mohammad Rafi Shaik
2026-09-23  8:42   ` Krzysztof Kozlowski
2026-09-28  6:26   ` Krzysztof Kozlowski
2026-09-22  9:42 ` [PATCH v4 2/8] ASoC: qcom: lpass-macro-common: Add missing v2.9 version string Mohammad Rafi Shaik
2026-09-24  5:43   ` Ajay Kumar Nandam
2026-09-22  9:42 ` [PATCH v4 3/8] ASoC: qcom: lpass-rx-macro: Add shikra compatible Mohammad Rafi Shaik
2026-09-24  6:14   ` Ajay Kumar Nandam
2026-09-22  9:42 ` [PATCH v4 4/8] ASoC: qcom: lpass-va-macro: " Mohammad Rafi Shaik
2026-09-22  9:53   ` sashiko-bot
2026-09-25  7:23   ` Ajay Kumar Nandam
2026-09-22  9:42 ` [PATCH v4 5/8] ASoC: qcom: lpass-va-macro: Add SoundWire microphone support Mohammad Rafi Shaik
2026-09-22 10:00   ` sashiko-bot [this message]
2026-09-25  9:21   ` Ajay Kumar Nandam
2026-09-22  9:42 ` [PATCH v4 6/8] ASoC: dt-bindings: qcom: Add Hawi LPASS macro codecs Mohammad Rafi Shaik
2026-09-22  9:55   ` sashiko-bot
2026-09-22  9:42 ` [PATCH v4 7/8] ASoC: qcom: lpass-tx-macro: Add support for Bolero v4.0 Mohammad Rafi Shaik
2026-09-22 10:01   ` sashiko-bot
2026-09-22 15:49   ` Mark Brown
2026-10-01 12:42     ` Prasad Kumpatla
2026-09-25 10:22   ` Ajay Kumar Nandam
2026-10-01 12:46     ` Prasad Kumpatla
2026-09-22  9:42 ` [PATCH v4 8/8] ASoC: qcom: lpass: Add support for LPASS codec v4.0 Mohammad Rafi Shaik
2026-09-25 11:02   ` Ajay Kumar Nandam
2026-10-01 12:44     ` Prasad Kumpatla

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=20260922100015.032381F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mohammad.rafi.shaik@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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