mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
ASoC: codecs: rt5682-sdw: Propagate regcache_sync() errors
rt5682_io_init() and rt5682_dev_resume() both leave cache-only mode before replaying cached register state with regcache_sync(). Both paths ignore the sync result, which can hide a failed hardware restore. Propagate regcache_sync() failures from both paths. The first hardware init path now has a dedicated sync-failure cleanup that restores cache bypass, cache-only, and dirty-cache state before balancing the runtime PM reference. The resume path restores both regmaps to cache-only mode and marks the main cache dirty before returning the error. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260704040530.40047-1-pengpeng@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
39dadd459c
commit
446a8b7a03
|
|
@ -410,7 +410,9 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt5682->first_hw_init) {
|
||||
regcache_cache_bypass(rt5682->regmap, false);
|
||||
regcache_mark_dirty(rt5682->regmap);
|
||||
regcache_sync(rt5682->regmap);
|
||||
ret = regcache_sync(rt5682->regmap);
|
||||
if (ret)
|
||||
goto err_sync;
|
||||
|
||||
/* volatile registers */
|
||||
regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_2,
|
||||
|
|
@ -472,8 +474,16 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
/* Mark Slave initialization complete */
|
||||
rt5682->hw_init = true;
|
||||
rt5682->first_hw_init = true;
|
||||
goto out;
|
||||
|
||||
err_sync:
|
||||
regcache_cache_bypass(rt5682->regmap, false);
|
||||
regcache_cache_only(rt5682->sdw_regmap, true);
|
||||
regcache_cache_only(rt5682->regmap, true);
|
||||
regcache_mark_dirty(rt5682->regmap);
|
||||
|
||||
err_nodev:
|
||||
out:
|
||||
pm_runtime_put_autosuspend(&slave->dev);
|
||||
|
||||
dev_dbg(&slave->dev, "%s hw_init complete: %d\n", __func__, ret);
|
||||
|
|
@ -776,7 +786,13 @@ static int rt5682_dev_resume(struct device *dev)
|
|||
|
||||
regcache_cache_only(rt5682->sdw_regmap, false);
|
||||
regcache_cache_only(rt5682->regmap, false);
|
||||
regcache_sync(rt5682->regmap);
|
||||
ret = regcache_sync(rt5682->regmap);
|
||||
if (ret) {
|
||||
regcache_cache_only(rt5682->sdw_regmap, true);
|
||||
regcache_cache_only(rt5682->regmap, true);
|
||||
regcache_mark_dirty(rt5682->regmap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user