Subject: Re: autri0: Codec timeout. Busy reading AC'97 codec.
To: tedu <grendel@zeitbombe.org>
From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
List: tech-kern
Date: 09/11/2002 18:50:54
On Mon, 9 Sep 2002, tedu wrote:
> mplayer polls the mixer to determine the volume over and over.  The autri
> chip can't keep up and goes nuts.  You can fix the ac97.c file so it
> doesn't read from the device unnecessarily.
> http://www.zeitbombe.org/ac97.diff
> That's against OpenBSD, but it's simple enough to do by hand if it doesn't
> apply.

I tried the patch below, but it seems that ac97_write() never gets invoked
with ac97_writethrough=1. While playing a divx w/ mplayer, there don't
seem to be any calls to ac97_write(), at least no printf traces are in
dmesg. I get a few at bootup, but none when using mplayer. No idea what's
going on, I don't know the guts of the driver.

I tried looking at the OpenBSD ac97.c, but it seems quite different from
ours. ;(


  - Hubert


Index: ac97.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/ac97.c,v
retrieving revision 1.24
diff -u -r1.24 ac97.c
--- ac97.c	2002/01/23 14:50:45	1.24
+++ ac97.c	2002/09/11 16:47:34
@@ -392,6 +392,8 @@
 #define DPRINTFN(n,x)
 #endif

+static int ac97_writethrough;
+
 void
 ac97_read(as, reg, val)
 	struct ac97_softc *as;
@@ -418,6 +420,11 @@
 	u_int8_t reg;
 	u_int16_t val;
 {
+	printf ("ac97_write: ac97_writethrough=%d, val=%d, reg=%d\n", ac97_writethrough, val, reg); /*HF*/
+
+	if(ac97_writethrough == 0 && as->shadow_reg[reg >> 1] == val) {
+		return 0;
+	}

 	as->shadow_reg[reg >> 1] = val;

@@ -433,10 +440,12 @@

 	memset(as->shadow_reg, 0, sizeof(as->shadow_reg));

+	ac97_writethrough = 1;
 	for (idx = 0; idx < SOURCE_INFO_SIZE; idx++) {
 		si = &source_info[idx];
 		ac97_write(as, si->reg, si->default_value);
 	}
+	ac97_writethrough = 0;
 }

 void
@@ -447,10 +456,12 @@
 	int idx;
 	const struct ac97_source_info *si;

+	ac97_writethrough = 1;
 	for (idx = 0; idx < SOURCE_INFO_SIZE; idx++) {
 		si = &source_info[idx];
 		ac97_write(as, si->reg, as->shadow_reg[si->reg >> 1]);
 	}
+	ac97_writethrough = 0;
 }

 int

-- 
Want to get a clue on IPv6 but don't know where to start? Try this:
* Basics -> http://www.onlamp.com/pub/a/onlamp/2001/05/24/ipv6_tutorial.html
* Setup  -> http://www.onlamp.com/pub/a/onlamp/2001/06/01/ipv6_tutorial.html
Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/