Re: [PATCH] ASoC: cs35l41: Restore register state after system sleep

From: Mark Brown

Date: Mon Jun 15 2026 - 13:42:13 EST


On Mon, Jun 15, 2026 at 10:54:10AM -0400, 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:

> static int cs35l41_sys_resume(struct device *dev)
> {
> struct cs35l41_private *cs35l41 = dev_get_drvdata(dev);
> + int ret;
> +
> + dev_dbg(cs35l41->dev, "System resume, restoring state\n");
> +
> + regcache_cache_only(cs35l41->regmap, false);
> +
> + ret = cs35l41_boot(cs35l41);
> + if (ret)
> + return ret;

The error handling in this function needs some attention, we probably
ought to go back to cache only mode here for example.

> + ret = cs35l41_init_boost(cs35l41->dev, cs35l41->regmap,
> + &cs35l41->hw_cfg);
> + if (ret)
> + return ret;
>
> - dev_dbg(cs35l41->dev, "System resume, reenabling IRQ\n");
> enable_irq(cs35l41->irq);

We can also leave the IRQ disabled now which might be fun if it's
shared. Not sure there's a good solution to that though, and we're in
trouble if resume fails anyway.

> - SYSTEM_SLEEP_PM_OPS(cs35l41_sys_suspend, cs35l41_sys_resume)
> + .suspend = pm_sleep_ptr(cs35l41_sys_suspend),
> + .resume = pm_sleep_ptr(cs35l41_sys_resume),
> + .freeze = pm_sleep_ptr(cs35l41_sys_suspend),
> + .thaw = pm_sleep_ptr(cs35l41_sys_thaw),

This undoes far less than freeze does...

Attachment: signature.asc
Description: PGP signature