mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rhodes, David" <drhodes@opensource.cirrus.com>
To: "Stefan Binding" <sbinding@opensource.cirrus.com>,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	"David Rhodes" <david.rhodes@cirrus.com>,
	"Richard Fitzgerald" <rf@opensource.cirrus.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>
Cc: kernel@collabora.com, linux-sound@vger.kernel.org,
	patches@opensource.cirrus.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: cs35l41: Restore register state after system sleep
Date: Wed, 17 Jun 2026 12:40:14 -0500	[thread overview]
Message-ID: <a824dfcc-71cf-4ac9-b17c-563ba857cc83@opensource.cirrus.com> (raw)
In-Reply-To: <adcf487e-a6c1-4439-b986-c421e206d6fe@opensource.cirrus.com>

On 6/16/26 11:31 AM, Stefan Binding wrote:
> Hi,
> 
> I have some concerns about this patch.
> 
> This driver is used for more than just the Steam Deck, so we would need to ensure that this patch doesn't break those systems.
> There are some potential complexities around cs35l41 with respect to Boost and DSP enablement that need careful thought when supporting system sleep.
> 
> The HDA equivalent driver for cs35l41 does have support for system sleep, but this driver works very differently.
> 
> I recommend reaching out to David Rhodes <david.rhodes@cirrus.com> for more information on the ASoC driver for CS35L41.
> Please also cc patches@opensource.cirrus.com.
> 
> Thanks,
> 
> Stefan
> 
> On 15/06/2026 15:54, Nícolas F. R. A. Prado wrote:
>> Currently, on the Steam Deck LCD when the system goes into hibernation
>> and resumes back, the speakers are silent when playing with:
>>
>>    aplay -D plughw:acp5x,1 /usr/share/sounds/alsa/Front_Left.wav
>>
>> A crude workaround was to, after resuming the system, bypassing the
>> regmap cache on the cs35l41 devices, before playing:
>>
>>    echo 1 > /sys/kernel/debug/regmap/spi-VLV1776\:00/cache_bypass
>>    echo 1 > /sys/kernel/debug/regmap/spi-VLV1776\:01/cache_bypass
>>
>> That indicated that the hardware registers had gone out of sync with
>> the regmap cache due to the power down in system hibernation.
>>
>> Fix the issue by, before system sleep, marking the regcache as cache
>> only, and after system sleep, resetting the hardware and restoring the
>> hardware registers from the regcache.
>>
>> This gets the sound working on the Steam Deck LCD after resume from S4.
>>
>> While the issue was only observed on S4 on this platform, the callbacks
>> for suspend/resume are also set in the same way to account for platforms
>> that might power down the chip on S3 as well.
>>
>> Note that this change does not take care of restoring the DSP state,
>> since the affected platform does not use the DSP and it couldn't be
>> tested, so it is only shut down on resume so it can be reinitialized in
>> a future DSP preload event.
>>
>> Assisted-by: Copilot:claude-sonnet-4.6
>> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Hi Nicholas,

I share Stefan's concerns about this patch affecting other devices. I 
also wonder if there is a less crude workaround for your system's behavior.

The existing driver uses runtime_suspend/runtime_resume to enter and 
exit a low power 'hibernation' mode 
(wm_adsp_hibernate/cs35l41_enter_hibernate). In this mode the part will 
lose some configuration so the regmap is put into cache_only for the 
duration of the sleep and synced when waking up.

Are you sure the device is not just missing a runtime_resume after the 
system is in S4? This whole sequence of sys operations should only be 
needed if the amp is completely losing power.

Thanks,
David

  reply	other threads:[~2026-06-17 17:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 14:54 Nícolas F. R. A. Prado
2026-06-15 17:42 ` Mark Brown
2026-06-16 16:31 ` Stefan Binding
2026-06-17 17:40   ` Rhodes, David [this message]
2026-07-21 20:08     ` Nícolas F. R. A. Prado
2026-07-23 17:27       ` Rhodes, David

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=a824dfcc-71cf-4ac9-b17c-563ba857cc83@opensource.cirrus.com \
    --to=drhodes@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=david.rhodes@cirrus.com \
    --cc=kernel@collabora.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=rf@opensource.cirrus.com \
    --cc=sbinding@opensource.cirrus.com \
    --cc=tiwai@suse.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®