Skip to contentSkip to conversation

ASoC: codecs: propagate component resume cache sync failures

PATCH In review Pengpeng Hou 2 participants 16 messages Sep 2 – Sep 25

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ASoC: codecs: propagate component resume cache sync failures

Commit 951af101c730 ("ASoC: report component resume callback errors") made negative component resume results visible through the existing ASoC component error helper while preserving best-effort resume.

These 14 component resume callbacks still discard the final regcache_sync() result and return success. Return that result so the common wrapper can report a failed cache replay with component context. None of these callbacks has dependent work after the sync, so the patches do not add rollback or retry semantics and do not change the successful path.

The issues were found by a tool we developed.
GPT-5 assisted with source-history review, patch construction and changelog drafting.

No dynamic reproducer was produced. The series was not built or tested on codec hardware. The 14 patches were manually reviewed, checked with checkpatch.pl and applied in order to sound/for-next at 27a50351cbc8.

The shared error-reporting contract was discussed at:
https://lore.kernel.org/r/[email protected]

Pengpeng Hou (14):
ASoC: adau17x1: return cache sync errors from resume
ASoC: ak4642: return cache sync errors from resume
ASoC: es8316: return cache sync errors from resume
ASoC: es8323: return cache sync errors from resume
ASoC: nau8540: return cache sync errors from resume
ASoC: rt1011: return cache sync errors from resume
ASoC: rt1016: return cache sync errors from resume
ASoC: rt1305: return cache sync errors from resume
ASoC: rt1308: return cache sync errors from resume
ASoC: rt1318: return cache sync errors from resume
ASoC: rt5616: return cache sync errors from resume
ASoC: rt5659: return cache sync errors from resume
ASoC: rt5660: return cache sync errors from resume
ASoC: rt5665: return cache sync errors from resume

 sound/soc/codecs/adau17x1.c | 4 +---
 sound/soc/codecs/ak4642.c   | 3 +--
 sound/soc/codecs/es8316.c   | 4 +---
 sound/soc/codecs/es8323.c   | 4 +---
 sound/soc/codecs/nau8540.c  | 4 +---
 sound/soc/codecs/rt1011.c   | 4 +---
 sound/soc/codecs/rt1016.c   | 4 +---
 sound/soc/codecs/rt1305.c   | 4 +---
 sound/soc/codecs/rt1308.c   | 4 +---
 sound/soc/codecs/rt1318.c   | 3 +--
 sound/soc/codecs/rt5616.c   | 3 +--
 sound/soc/codecs/rt5659.c   | 4 +---
 sound/soc/codecs/rt5660.c   | 4 +---
 sound/soc/codecs/rt5665.c   | 4 +---
 14 files changed, 14 insertions(+), 39 deletions(-)

base-commit: 27a50351cbc82e9f0811df417c5e7d2a72f60ef5

Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw

PATCH 1/14 ASoC: adau17x1: return cache sync errors from resume

adau17x1_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The optional switch-mode callback remains ordered before the cache replay.

The issue was found by a tool we developed.

Fixes 4101866c743a ("ASoC: Add ADAU1X61 and ADAU1X81 CODECs common code")
Assisted-by gpt 5
---
 sound/soc/codecs/adau17x1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/adau17x1.c +1 -3
index 26d7eb437ad1..00efaff44e92 100644
@@ -989,9 +989,7 @@ int adau17x1_resume(struct snd_soc_component *component)
 	if (adau->switch_mode)
 		adau->switch_mode(component->dev);
 
-	regcache_sync(adau->regmap);
-
-	return 0;
+	return regcache_sync(adau->regmap);
 }
 EXPORT_SYMBOL_GPL(adau17x1_resume);
 
Signature · 1 line
2.50.1 (Apple Git-155)
#2 lore raw

PATCH 2/14 ASoC: ak4642: return cache sync errors from resume

In reply to Pengpeng Hou

ak4642_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes a3a83d9a7cb0 ("ASoC: Add ak4642/ak4643 codec support")
Assisted-by gpt 5
---
 sound/soc/codecs/ak4642.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/ak4642.c +1 -2
index 4f86728cbe0a..40f1b1f53e84 100644
@@ -533,8 +533,7 @@ static int ak4642_resume(struct snd_soc_component *component)
 	struct regmap *regmap = dev_get_regmap(component->dev, NULL);
 
 	regcache_cache_only(regmap, false);
-	regcache_sync(regmap);
-	return 0;
+	return regcache_sync(regmap);
 }
 static int ak4642_probe(struct snd_soc_component *component)
 {
Signature · 1 line
2.50.1 (Apple Git-155)
#3 lore raw

PATCH 3/14 ASoC: es8316: return cache sync errors from resume

In reply to Pengpeng Hou

es8316_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes 4bac47a7b2f9 ("ASoC: codecs: add suspend and resume for ES8316")
Assisted-by gpt 5
---
 sound/soc/codecs/es8316.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/es8316.c +1 -3
index 24ec8b211cdb..4c33a243c1e1 100644
@@ -810,9 +810,7 @@ static int es8316_resume(struct snd_soc_component *component)
 	struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(es8316->regmap, false);
-	regcache_sync(es8316->regmap);
-
-	return 0;
+	return regcache_sync(es8316->regmap);
 }
 
 static int es8316_suspend(struct snd_soc_component *component)
Signature · 1 line
2.50.1 (Apple Git-155)
#4 lore raw

PATCH 4/14 ASoC: es8323: return cache sync errors from resume

In reply to Pengpeng Hou

es8323_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes b97391a604b9 ("ASoC: codecs: Add support for ES8323")
Assisted-by gpt 5
---
 sound/soc/codecs/es8323.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/es8323.c +1 -3
index b926340256be..03d516d70c43 100644
@@ -733,9 +733,7 @@ static int es8323_resume(struct snd_soc_component *component)
 	struct es8323_priv *es8323 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(es8323->regmap, false);
-	regcache_sync(es8323->regmap);
-
-	return 0;
+	return regcache_sync(es8323->regmap);
 }
 
 static const struct snd_soc_component_driver soc_component_dev_es8323 = {
Signature · 1 line
2.50.1 (Apple Git-155)
#5 lore raw

PATCH 5/14 ASoC: nau8540: return cache sync errors from resume

In reply to Pengpeng Hou

nau8540_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes c1644e3de45d ("ASoC: nau8540: new codec driver")
Assisted-by gpt 5
---
 sound/soc/codecs/nau8540.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/nau8540.c +1 -3
index fefbd5722c00..6c421e2386aa 100644
@@ -897,9 +897,7 @@ static int __maybe_unused nau8540_resume(struct snd_soc_component *component)
 	struct nau8540 *nau8540 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(nau8540->regmap, false);
-	regcache_sync(nau8540->regmap);
-
-	return 0;
+	return regcache_sync(nau8540->regmap);
 }
 
 static const struct snd_soc_component_driver nau8540_component_driver = {
Signature · 1 line
2.50.1 (Apple Git-155)
#6 lore raw

PATCH 6/14 ASoC: rt1011: return cache sync errors from resume

In reply to Pengpeng Hou

rt1011_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes d6e65bb7ff0d ("ASoC: rt1011: Add RT1011 amplifier driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt1011.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1011.c +1 -3
index 15488a059283..6e783c3d14ae 100644
@@ -2094,9 +2094,7 @@ static int rt1011_resume(struct snd_soc_component *component)
 	struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt1011->regmap, false);
-	regcache_sync(rt1011->regmap);
-
-	return 0;
+	return regcache_sync(rt1011->regmap);
 }
 #else
 #define rt1011_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#7 lore raw

PATCH 7/14 ASoC: rt1016: return cache sync errors from resume

In reply to Pengpeng Hou

rt1016_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes 79a4b670b4b4 ("ASoC: rt1016: Add the rt1016 support")
Assisted-by gpt 5
---
 sound/soc/codecs/rt1016.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1016.c +1 -3
index 11c8c45574a1..12b97c04d033 100644
@@ -570,9 +570,7 @@ static int rt1016_resume(struct snd_soc_component *component)
 	struct rt1016_priv *rt1016 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt1016->regmap, false);
-	regcache_sync(rt1016->regmap);
-
-	return 0;
+	return regcache_sync(rt1016->regmap);
 }
 #else
 #define rt1016_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#8 lore raw

PATCH 8/14 ASoC: rt1305: return cache sync errors from resume

In reply to Pengpeng Hou

rt1305_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes 29bc643ddd7e ("ASoC: rt1305: Add RT1305/RT1306 amplifier driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt1305.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1305.c +1 -3
index 2d5fad76cf52..601cbf9eb1e2 100644
@@ -896,9 +896,7 @@ static int rt1305_resume(struct snd_soc_component *component)
 	struct rt1305_priv *rt1305 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt1305->regmap, false);
-	regcache_sync(rt1305->regmap);
-
-	return 0;
+	return regcache_sync(rt1305->regmap);
 }
 #else
 #define rt1305_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#9 lore raw

PATCH 9/14 ASoC: rt1308: return cache sync errors from resume

In reply to Pengpeng Hou

rt1308_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes 2b9def8c0d92 ("ASoC: rt1308: Add RT1308 amplifier driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt1308.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt1308.c +1 -3
index 630946cd7cdf..df95cfbd76d6 100644
@@ -715,9 +715,7 @@ static int rt1308_resume(struct snd_soc_component *component)
 	struct rt1308_priv *rt1308 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt1308->regmap, false);
-	regcache_sync(rt1308->regmap);
-
-	return 0;
+	return regcache_sync(rt1308->regmap);
 }
 #else
 #define rt1308_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#10 lore raw

PATCH 10/14 ASoC: rt1318: return cache sync errors from resume

In reply to Pengpeng Hou

rt1318_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes fe1ff61487ac ("ASoC: rt1318: Add RT1318 audio amplifier driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt1318.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/rt1318.c +1 -2
index 55607f1b9a1e..3dcec7564b82 100644
@@ -1075,8 +1075,7 @@ static int rt1318_resume(struct snd_soc_component *component)
 	struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt1318->regmap, false);
-	regcache_sync(rt1318->regmap);
-	return 0;
+	return regcache_sync(rt1318->regmap);
 }
 #else
 #define rt1318_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#11 lore raw

PATCH 11/14 ASoC: rt5616: return cache sync errors from resume

In reply to Pengpeng Hou

rt5616_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes b1d15059957d ("ASoC: rt5616: add rt5616 codec driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt5616.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/rt5616.c +1 -2
index 46ee412dc81d..73a3d1d008f4 100644
@@ -1248,8 +1248,7 @@ static int rt5616_resume(struct snd_soc_component *component)
 	struct rt5616_priv *rt5616 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt5616->regmap, false);
-	regcache_sync(rt5616->regmap);
-	return 0;
+	return regcache_sync(rt5616->regmap);
 }
 #else
 #define rt5616_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#12 lore raw

PATCH 12/14 ASoC: rt5659: return cache sync errors from resume

In reply to Pengpeng Hou

rt5659_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes d3cb2de2479b ("ASoC: rt5659: add rt5659 codec driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt5659.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5659.c +1 -3
index 3097ee6d4e89..915b6b4b2630 100644
@@ -3703,9 +3703,7 @@ static int rt5659_resume(struct snd_soc_component *component)
 	struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt5659->regmap, false);
-	regcache_sync(rt5659->regmap);
-
-	return 0;
+	return regcache_sync(rt5659->regmap);
 }
 #else
 #define rt5659_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#13 lore raw

PATCH 13/14 ASoC: rt5660: return cache sync errors from resume

In reply to Pengpeng Hou

rt5660_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The power-off resume delay remains ordered before the cache replay.

The issue was found by a tool we developed.

Fixes 2b26dd4c1fc5 ("ASoC: rt5660: add rt5660 codec driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt5660.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5660.c +1 -3
index edf2e3e346e4..830498c947e0 100644
@@ -1148,9 +1148,7 @@ static int rt5660_resume(struct snd_soc_component *component)
 		msleep(350);
 
 	regcache_cache_only(rt5660->regmap, false);
-	regcache_sync(rt5660->regmap);
-
-	return 0;
+	return regcache_sync(rt5660->regmap);
 }
 #else
 #define rt5660_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
#14 lore raw

PATCH 14/14 ASoC: rt5665: return cache sync errors from resume

In reply to Pengpeng Hou

rt5665_resume() restores cached registers during component resume but discards the regcache_sync() result and returns success. A failed replay can therefore leave the hardware register state stale without reaching the component error reporting path.

Return the cache synchronization result. The ASoC component wrapper reports a negative callback result and retains the established best-effort resume state, so this adds observability without introducing rollback or retry semantics.

The successful resume path is unchanged.

The issue was found by a tool we developed.

Fixes 33ada14a26c8 ("ASoC: add rt5665 codec driver")
Assisted-by gpt 5
---
 sound/soc/codecs/rt5665.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/rt5665.c +1 -3
index 1d987472ba42..6e4967ed12c3 100644
@@ -4388,9 +4388,7 @@ static int rt5665_resume(struct snd_soc_component *component)
 	struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component);
 
 	regcache_cache_only(rt5665->regmap, false);
-	regcache_sync(rt5665->regmap);
-
-	return 0;
+	return regcache_sync(rt5665->regmap);
 }
 #else
 #define rt5665_suspend NULL
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer
#15 lore raw
In reply to Pengpeng Hou
Quoted 6 lines · Pengpeng Hou

ASoC: codecs: propagate component resume cache sync failures

Commit 951af101c730 ("ASoC: report component resume callback errors") made negative component resume results visible through the existing ASoC component error helper while preserving best-effort resume.

Quoted 7 lines

These 14 component resume callbacks still discard the final regcache_sync() result and return success. Return that result so the common wrapper can report a failed cache replay with component context. None of these callbacks has dependent work after the sync, so the patches do not add rollback or retry semantics and do not change the successful path.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4

Thanks!

[01/14] ASoC: adau17x1: return cache sync errors from resume

        https://git.kernel.org/broonie/sound/c/8ca84987c11d
[02/14] ASoC: ak4642: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/7142c34ed92f
[03/14] ASoC: es8316: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/243d0c47e57a
[04/14] ASoC: es8323: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/b7c3f95915a9
[05/14] ASoC: nau8540: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/0bf2b3411537
[06/14] ASoC: rt1011: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/432734a00bfa
[07/14] ASoC: rt1016: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/98ace05793c7
[08/14] ASoC: rt1305: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/30858325aa90
[09/14] ASoC: rt1308: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/3db3289178b9
[10/14] ASoC: rt1318: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/a5735b341c6e
[11/14] ASoC: rt5616: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/8fc9d353d537
[12/14] ASoC: rt5659: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/3a9b5bce85a1
[13/14] ASoC: rt5660: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/70fe8997b030
[14/14] ASoC: rt5665: return cache sync errors from resume
        https://git.kernel.org/broonie/sound/c/9f2933d9a437

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark