ASoC: codecs: rt9120: Propagate regcache_sync() errors

regcache_sync() can fail while replaying cached register state after
runtime resume. rt9120_runtime_resume() currently ignores that failure
and returns success.

Propagate the error, restore cache-only/dirty state, and power the
device back down on sync failure.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260704035548.67713-1-pengpeng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Pengpeng Hou 2026-07-04 11:55:48 +08:00 committed by Mark Brown
parent 2c5e237e7e
commit aeb606a643
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -606,12 +606,19 @@ static int rt9120_runtime_suspend(struct device *dev)
static int rt9120_runtime_resume(struct device *dev)
{
struct rt9120_data *data = dev_get_drvdata(dev);
int ret;
if (data->pwdnn_gpio) {
gpiod_set_value(data->pwdnn_gpio, 1);
msleep(RT9120_CHIPON_WAITMS);
regcache_cache_only(data->regmap, false);
regcache_sync(data->regmap);
ret = regcache_sync(data->regmap);
if (ret) {
regcache_cache_only(data->regmap, true);
regcache_mark_dirty(data->regmap);
gpiod_set_value(data->pwdnn_gpio, 0);
return ret;
}
}
return 0;