Skip to contentSkip to conversation

ASoC: Avoid writing to WM8971_RESET in wm8971_resume

RFC PATCH Applied Axel Lin 2 participants 2 messages Oct 3, 2011 – Oct 4, 2011

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

RFC PATCH 1/1 ASoC: Avoid writing to WM8971_RESET in wm8971_resume

Writing to WM8971_RESET resets all registers to the default state. Thus we should avoid writing to WM8971_RESET on resume.

---
Hi,
While reading the code, I don't understand why we need to do (in wm8971_resume):

for (i = 0; i < ARRAY_SIZE(wm8971_reg); i++) {
        if (i + 1 == WM8971_RESET)
                continue;

My understanding is that we want to avoid writing to WM8971_RESET on resume. Thus I send this patch for review.
I don't have the hardware for testing, I'd appreciate if someone can test this patch.

Thanks,
Axel

 sound/soc/codecs/wm8971.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/wm8971.c +1 -1
index 572bb80..7ec4165 100644
@@ -612,7 +612,7 @@ static int wm8971_resume(struct snd_soc_codec *codec)
 
 	/* Sync reg_cache with the hardware */
 	for (i = 0; i < ARRAY_SIZE(wm8971_reg); i++) {
-		if (i + 1 == WM8971_RESET)
+		if (i == WM8971_RESET)
 			continue;
 		data[0] = (i << 1) | ((cache[i] >> 8) & 0x0001);
 		data[1] = cache[i] & 0x00ff;
Signature · 1 line
1.7.4.1
Applied
#1 lore raw
Quoted 7 lines · Axel Lin

While reading the code, I don't understand why we need to do (in wm8971_resume):

for (i = 0; i < ARRAY_SIZE(wm8971_reg); i++) {
        if (i + 1 == WM8971_RESET)
                continue;

My understanding is that we want to avoid writing to WM8971_RESET on resume.

Yeah, this looks like a leftover from some older code which omitted register zero from the cache for some small memory savings. Now things are using the standard cache code rather than custom cache code this is buggy.

Applied, thanks.