Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stefan Binding" <sbinding@opensource.cirrus.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v3 4/8] ALSA: hda/cs35l41: Split System Suspend/Resume callbacks
Date: Thu, 03 Dec 2026 15:41:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-248136@kernel.org> (raw)
In-Reply-To: <20261203141359.150688-5-sbinding@opensource.cirrus.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ALSA: hda/cs35l41: missing hibernate exit on aborted suspend
  for I2C amps
--

commit 675e655a22615ff2d728d6c5f5bc78c54e5f9d4f
Author: Stefan Binding <sbinding@opensource.cirrus.com>

ALSA: hda/cs35l41: Split System Suspend/Resume callbacks

This commit splits the CS35L41 HDA system sleep handling across
suspend/resume, suspend_late/resume_early, and suspend_noirq/resume_noirq
callbacks.  It moves reset GPIO assertion and deassertion into suspend_late
and resume_early, and disables the shared IRQ across suspend and resume.

> diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c
> index 2e2bf231d3fc4..b30f000dab71d 100644
> --- a/sound/hda/codecs/side-codecs/cs35l41_hda.c
> +++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c

[ ... ]

> +static int cs35l41_system_resume_early(struct device *dev)
> +{
> +	struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
> +
> +	if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH)
> +		return 0; /* don't block the whole system resume */
> +
>  	if (cs35l41->reset_gpio) {
> +		dev_info(cs35l41->dev, "Deasserting Reset\n");
>  		gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
>  		usleep_range(2000, 2100);
>  		gpiod_set_value_cansleep(cs35l41->reset_gpio, 1);
> +		usleep_range(2000, 2100);
>  	}
>  
> -	usleep_range(2000, 2100);
> +	return 0;
> +}
> +
> +static int cs35l41_system_resume(struct device *dev)
> +{
> +	struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
> +	int ret;
> +
> +	dev_dbg(cs35l41->dev, "System Resume\n");
> +
> +	if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH)
> +		return 0; /* don't block the whole system resume */
>  
>  	regcache_cache_only(cs35l41->regmap, false);
>  
>  	ret = cs35l41_reset_and_boot(cs35l41->dev, cs35l41->regmap);

[Severity: Medium]
Can an aborted system suspend leave an I2C amp in hibernation when
cs35l41_reset_and_boot() runs here?

cs35l41_system_suspend() hibernates the amp via pm_runtime_force_suspend()
and clears cs_dsp.running.  If suspend aborts before suspend_late() runs
(e.g. another device fails dpm_suspend()), cs35l41_system_resume_early() is
skipped and reset_gpio is never pulsed.

cs35l41_system_resume() still runs and calls cs35l41_reset_and_boot()
without exiting hibernation.  On I2C, writing CS35L41_SFT_RESET while
hibernating can NAK or be ignored, failing resume with -ETIMEDOUT or
leaving the amp stuck in hibernation with cs_dsp.running already cleared.

Commit "ALSA: hda/cs35l41: Ensure SPI devices are always reset during
system suspend" exits hibernation before resetting SPI devices, but leaves
I2C devices unhandled.  Calling cs35l41_exit_hibernate() before
cs35l41_reset_and_boot() when resume_early() did not run would avoid this.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203141359.150688-1-sbinding@opensource.cirrus.com?part=4

  reply	other threads:[~2026-12-03 15:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 14:13 [PATCH v3 0/8] Fixes and improvements in CS35L41 HDA driver for System Suspend/Resume Stefan Binding
2026-12-03 14:13 ` [PATCH v3 1/8] ALSA: hda: cs35l41: Remove redundant lock_system_sleep() calls Stefan Binding
2026-12-03 14:13 ` [PATCH v3 2/8] ASoC: cs35l41: Prevent software reset when using SPI Stefan Binding
2026-12-03 14:55   ` sashiko-bot
2026-12-03 15:25   ` Mark Brown
2026-12-03 14:13 ` [PATCH v3 3/8] ALSA: hda: cs35l41: Unset irq if not used or configured Stefan Binding
2026-12-03 14:13 ` [PATCH v3 4/8] ALSA: hda/cs35l41: Split System Suspend/Resume callbacks Stefan Binding
2026-12-03 15:41   ` sashiko-bot [this message]
2026-12-03 14:13 ` [PATCH v3 5/8] ALSA: hda/cs35l41: Remove support for alternative firmware types Stefan Binding
2026-12-03 14:13 ` [PATCH v3 6/8] ALSA: hda/cs35l41: Store filenames of successfully loaded firmware and tunings Stefan Binding
2026-12-03 14:13 ` [PATCH v3 7/8] ALSA: hda/cs35l41: rework how firmware requests are queued and flushed to prevent races Stefan Binding
2026-12-03 14:13 ` [PATCH v3 8/8] ALSA: hda/cs35l41: Ensure SPI devices are always reset during system suspend Stefan Binding

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-248136@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sbinding@opensource.cirrus.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