[PATCH] ASoC: ak4375: Power off the codec if runtime resume fails

From: Haowen Tu

Date: Fri Nov 13 2026 - 03:20:35 EST


ak4375_runtime_resume() powers on the codec and leaves cache-only mode
before synchronizing the register cache. If regcache_sync() fails, it
returns the error without undoing either operation.

The runtime PM core leaves the device suspended on a resume error, so
there is no matching runtime suspend callback to disable the supplies.
The codec remains powered and register accesses still reach the hardware
even though restoring its state failed.

Restore cache-only mode and power off the codec on a cache sync error,
leaving it in the same state as before the resume attempt.

Fixes: 53778b8292b5 ("ASoC: Add AK4375 support")
Signed-off-by: Haowen Tu <tuhaowen@xxxxxxxxxxxxx>
---
sound/soc/codecs/ak4375.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/ak4375.c b/sound/soc/codecs/ak4375.c
index 28cc41014bd9..469b81c5daca 100644
--- a/sound/soc/codecs/ak4375.c
+++ b/sound/soc/codecs/ak4375.c
@@ -460,7 +460,14 @@ static int ak4375_runtime_resume(struct device *dev)
regcache_cache_only(ak4375->regmap, false);
regcache_mark_dirty(ak4375->regmap);

- return regcache_sync(ak4375->regmap);
+ ret = regcache_sync(ak4375->regmap);
+ if (ret) {
+ regcache_cache_only(ak4375->regmap, true);
+ ak4375_power_off(ak4375);
+ return ret;
+ }
+
+ return 0;
}

static const struct snd_soc_component_driver soc_codec_dev_ak4375 = {
--
2.50.1