Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 8/9] ASoC: qcom: lpass-tx-macro: Add support for Hawi
Date: Sun, 22 Nov 2026 19:00:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-228218@kernel.org> (raw)
In-Reply-To: <20261123-add_shikra_support-v7-8-7bf3aa089fc6@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] ASoC: qcom: lpass-tx-macro: missing lpr clock handling in
  tx_macro_probe()
- [Medium] ASoC: qcom: lpass-tx-macro: no-op ADPT disable in
  tx_macro_enable_dec()
- [Medium] ASoC: qcom: lpass-tx-macro: missing RX_SWR_MIC routes and
  broken mux check
- [Low] ASoC: qcom: lpass-tx-macro: mixing __free() with goto in
  tx_macro_probe()
- [Low] ASoC: qcom: lpass-tx-macro: stale REGCACHE_MAPLE claim in commit
  message
--

commit f5a6e2235e16debb6b0952a1f083110a90b3bd33
Author: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>

ASoC: qcom: lpass-tx-macro: Add support for Hawi

This commit adds support for the Bolero v4.0 (LPASS v15.0) TX macro on
Qualcomm Hawi platforms, including v4.0 register defaults, ADPT control
handling, and version-specific DAPM widgets and routes.

> Add the v4.0 register defaults and extend the regmap accessors and
> maximum register offset only for the v4.0 match data. Use REGCACHE_MAPLE
> for the TX macro regmap since the register defaults are sparse and the
> v4.0 layout extends the register range.

[Severity: Low]
This isn't a bug, but the commit message says this patch switches the TX
macro regmap to REGCACHE_MAPLE, whereas that change was already made in
8ed9306885eb ("ASoC: codecs: lpass-tx-macro: switch cache to
REGCACHE_MAPLE").

> diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
> index 6f2af4907cb84..6cc700db7d04e 100644
> --- a/sound/soc/codecs/lpass-tx-macro.c
> +++ b/sound/soc/codecs/lpass-tx-macro.c

[ ... ]

> @@ -480,6 +504,26 @@ static struct reg_default tx_defaults[] = {
>  	{ CDC_TX7_TX_PATH_SEC6, 0x00},
>  };
>  
> +static const struct reg_default tx_4_0_defaults[] = {
> +	{ CDC_TX_INP_MUX_ADC_MUX0_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX1_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX2_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX3_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX4_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX5_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX6_CFG2, 0x00},
> +	{ CDC_TX_INP_MUX_ADC_MUX7_CFG2, 0x00},
> +	{ CDC_TX0_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX1_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX2_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX3_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX4_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX5_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX6_TX_PATH_CFG2, 0x03},
> +	{ CDC_TX7_TX_PATH_CFG2, 0x03},
> +	{ CDC_ADPT0_ADPT_CTRL, 0x00},
> +};

[ ... ]

> @@ -975,6 +1044,10 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
>  
>  	switch (event) {
>  	case SND_SOC_DAPM_PRE_PMU:
> +		/* Disable the ADPT block before enabling the decimator */
> +		if (tx->data->has_adpt)
> +			snd_soc_component_write_field(component, CDC_ADPT0_ADPT_CTRL,
> +						      CDC_TX_ADPT_CTRL_EN_MASK, 0x0);

[Severity: Medium]
Does snd_soc_component_write_field() ever write to CDC_ADPT0_ADPT_CTRL
here?

tx_4_0_defaults[] initializes CDC_ADPT0_ADPT_CTRL to 0x00 in the
REGCACHE_MAPLE cache, and the register is not volatile and is never
written elsewhere.  Clearing CDC_TX_ADPT_CTRL_EN_MASK via
snd_soc_component_write_field() sees the cached value already at 0x00 and
becomes a no-op, and regcache_sync() also skips registers whose cached
value matches their default, leaving the ADPT block in its hardware reset
state (compare lpass-va-macro.c, where va_4_0_defaults sets
CDC_VA_CDC_ADPT0_ADPT_CTRL to 0x51).

[ ... ]

> @@ -2073,6 +2149,418 @@ static const struct snd_soc_dapm_route tx_audio_map_v9_2[] = {
>  	{"TX SMIC MUX7", "SWR_MIC11", "TX SWR_INPUT11"},
>  };
>  
> +static const char * const adc_mux_text_v9_3[] = {
> +	"MSM_DMIC", "SWR_MIC", "ANC_FB_TUNE1", "RX_SWR_MIC"
> +};

[ ... ]

> +static const struct snd_soc_dapm_route tx_audio_map_v15[] = {
> +	/* DEC0 */
> +	{"TX DEC0 MUX", "SWR_MIC", "TX SMIC MUX0"},
> +	{"TX SMIC MUX0", NULL, "TX_SWR_CLK"},

[Severity: Medium]
Are DAPM routes missing for the "RX_SWR_MIC" option added in
adc_mux_text_v9_3[]?

Neither tx_audio_map[] nor tx_audio_map_v15[] defines a route for
"RX_SWR_MIC" on TX DEC0 MUX through TX DEC7 MUX, so selecting "RX_SWR_MIC"
disconnects all inputs to the mux and prevents the decimator widget from
powering up.

In addition, tx_macro_enable_dec() and is_amic_enabled() test the register
value with "& SWR_MIC" (where SWR_MIC is 1):

sound/soc/codecs/lpass-tx-macro.c:tx_macro_enable_dec() {
    ...
		adc_mux_reg = CDC_TX_INP_MUX_ADC_MUXn_CFG1(decimator);
		if (snd_soc_component_read(component, adc_mux_reg) & SWR_MIC) {
    ...
}

Because "RX_SWR_MIC" is at enum index 3, that bitwise check also matches
when "RX_SWR_MIC" is selected and treats it as "SWR_MIC".

[ ... ]

> @@ -2296,6 +2797,9 @@ static int tx_macro_probe(struct platform_device *pdev)
>  	struct device_node *np = dev->of_node;
>  	struct tx_macro *tx;
>  	void __iomem *base;
> +	struct reg_default *reg_defaults __free(kfree) = NULL;
> +	struct regmap_config *reg_config __free(kfree) = NULL;
> +	size_t def_count;
>  	int ret, reg;
>  
>  	tx = devm_kzalloc_obj(dev, *tx);
> @@ -2350,7 +2854,40 @@ static int tx_macro_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config);
> +	reg_config = kmemdup(&tx_regmap_config, sizeof(*reg_config), GFP_KERNEL);
> +	if (!reg_config) {
> +		ret = -ENOMEM;
> +		goto err;
> +	}

[Severity: Low]
This isn't a bug, but tx_macro_probe() mixes __free(kfree) variables with
goto-based error handling and declares reg_config = NULL at the top of the
function instead of defining and initializing it at its kmemdup() call (or
converting lpass_macro_pds_init() cleanup to devm_add_action_or_reset() as
in lpass-rx-macro.c).

[ ... ]

> @@ -2528,6 +3077,9 @@ static const struct of_device_id tx_macro_dt_match[] = {
>  	}, {
>  		.compatible = "qcom,sm8550-lpass-tx-macro",
>  		.data = &lpass_ver_11,
> +	}, {
> +		.compatible = "qcom,hawi-lpass-tx-macro",
> +		.data = &lpass_ver_15,
>  	}, {

[Severity: High]
Does tx_macro_probe() fail to acquire the "lpr" clock on
qcom,hawi-lpass-tx-macro?

The Devicetree binding for qcom,hawi-lpass-tx-macro added in 5979f967ae4f
("ASoC: dt-bindings: qcom: Add Hawi LPASS macro codecs") specifies
clock-names as "mclk", "lpr", "dcodec", and "fsgen", replacing "macro"
with "lpr".  However, tx_macro_probe() only looks up the optional "macro"
clock:

sound/soc/codecs/lpass-tx-macro.c:tx_macro_probe() {
    ...
	tx->macro = devm_clk_get_optional(dev, "macro");
	if (IS_ERR(tx->macro))
		return dev_err_probe(dev, PTR_ERR(tx->macro), "unable to get macro clock\n");
    ...
}

Since 8af1ecd5b81c ("ASoC: codecs: lpass-tx-macro: manage clocks in
runtime PM") switched the driver from of_pm_clk_add_clks() to explicit
clock management, the "lpr" vote clock is never acquired or enabled on
Hawi, leaving LPASS CPU subsystem sleep enabled during register accesses.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-add_shikra_support-v7-0-7bf3aa089fc6@oss.qualcomm.com?part=8

  reply	other threads:[~2026-11-22 19:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 18:41 [PATCH v7 0/9] ASoC: qcom: Add shikra and Hawi LPASS macro support Mohammad Rafi Shaik
2026-11-22 18:41 ` [PATCH v7 1/9] ASoC: dt-bindings: qcom: Add Shikra RX and VA macro codecs Mohammad Rafi Shaik
2026-11-22 18:41 ` [PATCH v7 2/9] ASoC: qcom: lpass-macro-common: Add missing v2.9 version string Mohammad Rafi Shaik
2026-11-22 18:41 ` [PATCH v7 3/9] ASoC: qcom: lpass-rx-macro: Add shikra compatible Mohammad Rafi Shaik
2026-11-22 18:41 ` [PATCH v7 4/9] ASoC: qcom: lpass-va-macro: " Mohammad Rafi Shaik
2026-11-22 19:01   ` sashiko-bot
2026-11-22 18:41 ` [PATCH v7 5/9] ASoC: qcom: lpass-va-macro: Add SoundWire microphone support Mohammad Rafi Shaik
2026-11-22 18:55   ` sashiko-bot
2026-11-22 18:41 ` [PATCH v7 6/9] ASoC: dt-bindings: qcom: Add Hawi LPASS macro codecs Mohammad Rafi Shaik
2026-11-22 18:41 ` [PATCH v7 7/9] ASoC: dt-bindings: qcom: Add Maili " Mohammad Rafi Shaik
2026-11-22 18:41 ` [PATCH v7 8/9] ASoC: qcom: lpass-tx-macro: Add support for Hawi Mohammad Rafi Shaik
2026-11-22 19:00   ` sashiko-bot [this message]
2026-11-22 18:41 ` [PATCH v7 9/9] ASoC: qcom: lpass: " Mohammad Rafi Shaik
2026-11-22 18:57   ` sashiko-bot

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=sashiko-outbox-228218@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@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