Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [RFC PATCH 4/8] ASoC: SDCA: add PDE pre/post-pmu hooks to hw_ops
Date: Wed, 22 Jul 2026 23:56:06 +0000	[thread overview]
Message-ID: <20260722235606.A4E9C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260722234221.884765-5-srinivas.kandagatla@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Errors returned from the new `pde_pre_pmu` and `pde_post_pmu` hooks are incorrectly swallowed or shadowed, allowing DAPM transitions to proceed with invalid hardware state.
--

--- Patch [4]: [RFC PATCH 4/8] ASoC: SDCA: add PDE pre/post-pmu hooks to hw_ops ---
commit 9ebbdf1f4165266d78edf14f3e10a54fa79025c5
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>

ASoC: SDCA: add PDE pre/post-pmu hooks to hw_ops

This patch adds pde_pre_pmu and pde_post_pmu callbacks to struct
sdca_class_hw_ops. These hooks allow codec drivers to stage state and
commit pending writes before and after DAPM PDE power-domain transitions.

> diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c
> index ac688cd629706..795498b9a314b 100644
> --- a/sound/soc/sdca/sdca_asoc.c
> +++ b/sound/soc/sdca/sdca_asoc.c

[ ... ]

> @@ -432,6 +433,8 @@ static int entity_pde_event(struct snd_soc_dapm_widget *widget,
>  {
>  	struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
>  	struct sdca_entity *entity = widget->priv;
> +	struct sdca_class_drv *core;
> +	unsigned int fn;
>  	int from, to;
>  	int ret;
>  
> @@ -439,6 +442,19 @@ static int entity_pde_event(struct snd_soc_dapm_widget *widget,
>  		return -EIO;
>  
>  	switch (event) {
> +	case SND_SOC_DAPM_PRE_PMU:
> +		core = dev_get_drvdata(component->dev->parent);
> +		if (core && core->hw_ops && core->hw_ops->pde_pre_pmu) {
> +			fn = SDW_SDCA_CTL_FUNC(widget->reg);
> +			ret = core->hw_ops->pde_pre_pmu(core->sdw,
> +							component->regmap, fn,
> +							SDW_SDCA_CTL_ENT(widget->reg));
> +			if (ret)
> +				dev_warn(component->dev,
> +					 "%s: pde_pre_pmu failed: %d\n",
> +					 entity->label, ret);
> +		}
> +		return 0;

[Severity: Medium]
Should this return ret instead of 0 when pde_pre_pmu() fails? 

Returning 0 allows the DAPM power sequence to proceed even though the 
prerequisite state might be invalid.

>  	case SND_SOC_DAPM_POST_PMD:
>  		from = widget->on_val;
>  		to = widget->off_val;

[ ... ]

> @@ -451,6 +467,20 @@ static int entity_pde_event(struct snd_soc_dapm_widget *widget,
>  		return 0;
>  	}
>  
> +	if (event == SND_SOC_DAPM_POST_PMU) {
> +		core = dev_get_drvdata(component->dev->parent);
> +		if (core && core->hw_ops && core->hw_ops->pde_post_pmu) {
> +			fn = SDW_SDCA_CTL_FUNC(widget->reg);
> +			ret = core->hw_ops->pde_post_pmu(core->sdw,
> +							 component->regmap, fn,
> +							 SDW_SDCA_CTL_ENT(widget->reg));
> +			if (ret)
> +				dev_warn(component->dev,
> +					 "%s: pde_post_pmu failed: %d\n",
> +					 entity->label, ret);
> +		}
> +	}
> +
>  	ret = sdca_asoc_pde_poll_actual_ps(component->dev, component->regmap,
>  					   SDW_SDCA_CTL_FUNC(widget->reg),
>  					   SDW_SDCA_CTL_ENT(widget->reg),

[Severity: Medium]
Does this overwrite the error from pde_post_pmu()? 

If pde_post_pmu() fails, ret is logged in the warning above, but then 
immediately overwritten by the return value of sdca_asoc_pde_poll_actual_ps(), 
losing the original failure context.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722234221.884765-1-srinivas.kandagatla@oss.qualcomm.com?part=4

  reply	other threads:[~2026-07-22 23:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 23:42 [RFC PATCH 0/8] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Srinivas Kandagatla
2026-07-22 23:42 ` [RFC PATCH 1/8] ASoC: SDCA: hw_params: program upstream Input Terminals for OT DAI Srinivas Kandagatla
2026-07-22 23:54   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 2/8] ASoC: SDCA: allow building without ACPI Srinivas Kandagatla
2026-07-22 23:59   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 3/8] ASoC: SDCA: expose class helpers with hw_ops for non-DisCo platforms Srinivas Kandagatla
2026-07-22 23:58   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 4/8] ASoC: SDCA: add PDE pre/post-pmu hooks to hw_ops Srinivas Kandagatla
2026-07-22 23:56   ` sashiko-bot [this message]
2026-07-22 23:42 ` [RFC PATCH 5/8] ASoC: SDCA: class_function: xlate sound-dai cell by entity index Srinivas Kandagatla
2026-07-22 23:57   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 6/8] ASoC: SDCA: register SDCA_FUNCTION_TYPE_SIMPLE_JACK in class function driver Srinivas Kandagatla
2026-07-22 23:56   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 7/8] dt-bindings: sound: qcom: add Tambora WCD9378 SDCA codec Srinivas Kandagatla
2026-07-22 23:51   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 8/8] ASoC: codecs: add Qualcomm Tambora (WCD9378) " Srinivas Kandagatla
2026-07-23  0:03   ` 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=20260722235606.A4E9C1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    /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