Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Change of cold reset and ac97 register cache
@ 2008-01-16 22:24 Robert Jarzmik
  2008-01-17 13:28 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Jarzmik @ 2008-01-16 22:24 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

This patch synchronizes wm9713 AC97 register cache and hardware registers 
upon reset.

The actual implementation of the wm9713 codec provides a cache of AC97
registers. After cold reset, the cache and hardware are not in sync. When
using wm9713 logic, oring a GPIO triggers many other GPIOS.

The solution of this patch reads from hardware to cache upon cold reset.
Another one would be to write the cache to hardware upon init. If decided so,
I would gladly change my patch.

--
Robert Jarzmik


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Cold reset of wm9713 --]
[-- Type: text/x-diff, Size: 888 bytes --]

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 6e3c6af..62c6c02 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1014,6 +1014,9 @@ EXPORT_SYMBOL_GPL(wm9713_dai);
 
 int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
 {
+	int i;
+	u16 *cache = codec->reg_cache;
+
 	if (try_warm && soc_ac97_ops.warm_reset) {
 		soc_ac97_ops.warm_reset(codec->ac97);
 		if (!(ac97_read(codec, 0) & 0x8000))
@@ -1023,6 +1026,14 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
 	soc_ac97_ops.reset(codec->ac97);
 	if (ac97_read(codec, 0) & 0x8000)
 		return -EIO;
+
+	for (i = 2; i < ARRAY_SIZE(wm9713_reg) << 1; i+=2) {
+		if (i == AC97_POWERDOWN || i == AC97_EXTENDED_MID ||
+		    i == AC97_EXTENDED_MSTATUS || i > 0x66)
+			continue;
+		cache[i>>1] = ac97_read(codec, i);
+	}
+	
 	return 0;
 }
 EXPORT_SYMBOL_GPL(wm9713_reset);

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2008-01-19 11:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-16 22:24 [PATCH] Change of cold reset and ac97 register cache Robert Jarzmik
2008-01-17 13:28 ` Mark Brown
     [not found]   ` <87d4s0kurn.fsf@polgara.paysbobval>
     [not found]     ` <20080118115122.GA22933@rakim.wolfsonmicro.main>
2008-01-18 19:50       ` Robert Jarzmik
2008-01-19 11:49         ` Mark Brown

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