ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors

regcache_sync() can fail while replaying cached register state after
SoundWire resume or attach handling. tas2783 currently ignores that
failure.

Propagate the error and restore cache-only/dirty state on failure.

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

View File

@ -1099,7 +1099,13 @@ static s32 tas2783_sdca_dev_resume(struct device *dev)
}
regcache_cache_only(tas_dev->regmap, false);
regcache_sync(tas_dev->regmap);
ret = regcache_sync(tas_dev->regmap);
if (ret) {
regcache_cache_only(tas_dev->regmap, true);
regcache_mark_dirty(tas_dev->regmap);
return ret;
}
return 0;
}
@ -1210,6 +1216,7 @@ static s32 tas_update_status(struct sdw_slave *slave,
{
struct tas2783_prv *tas_dev = dev_get_drvdata(&slave->dev);
struct device *dev = &slave->dev;
int ret;
dev_dbg(dev, "Peripheral status = %s",
status == SDW_SLAVE_UNATTACHED ? "unattached" :
@ -1227,7 +1234,12 @@ static s32 tas_update_status(struct sdw_slave *slave,
/* updated the cache data to device */
regcache_cache_only(tas_dev->regmap, false);
regcache_sync(tas_dev->regmap);
ret = regcache_sync(tas_dev->regmap);
if (ret) {
regcache_cache_only(tas_dev->regmap, true);
regcache_mark_dirty(tas_dev->regmap);
return ret;
}
/* perform I/O transfers required for Slave initialization */
return tas_io_init(&slave->dev, slave);