mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ajay Kumar Nandam <ajay.nandam@oss.qualcomm.com>
To: Pengpeng Hou <hppiscas@163.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	"Fang, Yang A" <yang.a.fang@intel.com>,
	Yong Zhi <yong.zhi@intel.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	ajay.nandam@oss.qualcomm.com
Subject: Re: [PATCH v2 3/9] ASoC: nau8825: restore safe state after resume errors
Date: Wed, 14 Oct 2026 23:48:17 +0530	[thread overview]
Message-ID: <3d428a49-3952-41ec-b79e-77631a9eee7d@oss.qualcomm.com> (raw)
In-Reply-To: <20261014032452.13456-4-hppiscas@163.com>



On 10/14/2026 8:54 AM, Pengpeng Hou wrote:
> nau8825_resume() ignores regcache_sync() failure before continuing
> dependent resume operations. Restore cache-only mode, leave the cache
> dirty, and return the replay error before those operations.
> 
> Do not start crosstalk protection or enable its IRQ after a failed
> replay.
> 
> ASoC still marks the component resumed when the callback reports failure.
> Track the suspend-owned IRQ disable so another suspend does not increment
> the disable depth again after a failed resume. A later successful resume
> releases that one disable reference. This does not add automatic retry or
> change the framework's best-effort card resume policy.
> 
> The issue was found by our static-analysis tool and manually reviewed.
> 
> Fixes: 4454a8378be5 ("ASoC: nau8825: add pm function")
> Assisted-by: gpt 5
> Signed-off-by: Pengpeng Hou <hppiscas@163.com>
> ---
> Changes since v1:
> - restore cache-only mode and dirty state on replay failure
> - keep suspend-owned IRQ disables balanced across failed resume cycles
> - send as one correctly threaded series, as Mark requested
> 
> Previous series:
> https://lore.kernel.org/all/20260906034321.86080-1-hppiscas@163.com/
> 
>   sound/soc/codecs/nau8825.c |   17 ++++++++++++++---
>   sound/soc/codecs/nau8825.h |    1 +
>   2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
> index 63d927f3140902e179bd491f757f4c47e8c314b1..11c548b99ea6d758ba3843090ee65b3d9f8f8245 100644
> --- a/sound/soc/codecs/nau8825.c
> +++ b/sound/soc/codecs/nau8825.c
> @@ -2683,7 +2683,10 @@ static int __maybe_unused nau8825_suspend(struct snd_soc_component *component)
>   {
>   	struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component);
>   
> -	disable_irq(nau8825->irq);
> +	if (!nau8825->suspend_irq_disabled) {
> +		disable_irq(nau8825->irq);
> +		nau8825->suspend_irq_disabled = true;
> +	}

With this new 'suspend_irq_disabled' state, should the IRQ 
suspend/resume tracking also be tied to whether 'nau8825_setup_irq()' 
succeeded?

Thanks
Ajay Kumar Nandam

>   	snd_soc_dapm_force_bias_level(nau8825->dapm, SND_SOC_BIAS_OFF);
>   	/* Power down codec power; don't suppoet button wakeup */
>   	snd_soc_dapm_disable_pin(nau8825->dapm, "SAR");
> @@ -2701,12 +2704,20 @@ static int __maybe_unused nau8825_resume(struct snd_soc_component *component)
>   	int ret;
>   
>   	regcache_cache_only(nau8825->regmap, false);
> -	regcache_sync(nau8825->regmap);
> +	ret = regcache_sync(nau8825->regmap);
> +	if (ret) {
> +		regcache_cache_only(nau8825->regmap, true);
> +		regcache_mark_dirty(nau8825->regmap);
> +		return ret;
> +	}
>   	nau8825->xtalk_protect = true;
>   	ret = nau8825_sema_acquire(nau8825, 0);
>   	if (ret)
>   		nau8825->xtalk_protect = false;
> -	enable_irq(nau8825->irq);
> +	if (nau8825->suspend_irq_disabled) {
> +		nau8825->suspend_irq_disabled = false;
> +		enable_irq(nau8825->irq);
> +	}
>   
>   	return 0;
>   }
> diff --git a/sound/soc/codecs/nau8825.h b/sound/soc/codecs/nau8825.h
> index 2abfbb5184da80f3637f06d57a7564fbf1c7574c..8238570ed48c2b147a4a1a0d7061603f8b9b4835 100644
> --- a/sound/soc/codecs/nau8825.h
> +++ b/sound/soc/codecs/nau8825.h
> @@ -502,6 +502,7 @@ struct nau8825 {
>   	struct semaphore xtalk_sem;
>   	int sw_id;
>   	int irq;
> +	bool suspend_irq_disabled;
>   	int mclk_freq; /* 0 - mclk is disabled */
>   	int button_pressed;
>   	int micbias_voltage;
> 
> base-commit: 8ef28aef33f2d5da6959ad6b579ec3cfccc009f6
> 
> 


  reply	other threads:[~2026-10-14 18:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  3:24 [PATCH v2 0/9] ASoC: stop dependent resume work after restore failures Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 1/9] ASoC: nau8821: restore safe state after resume errors Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 2/9] ASoC: nau8824: " Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 3/9] ASoC: nau8825: " Pengpeng Hou
2026-10-14 18:18   ` Ajay Kumar Nandam [this message]
2026-10-14  3:24 ` [PATCH v2 4/9] ASoC: rt5663: " Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 5/9] ASoC: rt5682s: " Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 6/9] ASoC: rt5682: " Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 7/9] ASoC: wm8978: " Pengpeng Hou
2026-10-14  9:20   ` Charles Keepax
2026-10-14  3:24 ` [PATCH v2 8/9] ASoC: rt5640: " Pengpeng Hou
2026-10-14  3:24 ` [PATCH v2 9/9] ASoC: rt5677: " Pengpeng Hou
2026-10-14 18:43   ` Ajay Kumar Nandam

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=3d428a49-3952-41ec-b79e-77631a9eee7d@oss.qualcomm.com \
    --to=ajay.nandam@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=hppiscas@163.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=yang.a.fang@intel.com \
    --cc=yong.zhi@intel.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

all inboxes | Powered by JetHome®