public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] ASoC: Avoid writing to WM8971_RESET in wm8971_resume
@ 2011-10-03 23:44 Axel Lin
  2011-10-04 15:04 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-10-03 23:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kenneth Kiraly, Mark Brown, Liam Girdwood, alsa-devel

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

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
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(-)

diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 572bb80..7ec4165 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -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;
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC][PATCH] ASoC: Avoid writing to WM8971_RESET in wm8971_resume
  2011-10-03 23:44 [RFC][PATCH] ASoC: Avoid writing to WM8971_RESET in wm8971_resume Axel Lin
@ 2011-10-04 15:04 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-10-04 15:04 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Kenneth Kiraly, Liam Girdwood, alsa-devel

On Tue, Oct 04, 2011 at 07:44:22AM +0800, Axel Lin wrote:

> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-04 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 23:44 [RFC][PATCH] ASoC: Avoid writing to WM8971_RESET in wm8971_resume Axel Lin
2011-10-04 15:04 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox