Subject: Re: auvia problem (Re: VIA chipsets still suck.)
To: None <port-i386@netbsd.org>
From: TAMURA Kent <kent@netbsd.org>
List: port-i386
Date: 10/02/2002 01:18:40
> > Does it sound at 48kHz-fixed sampling rate, or play
> > slower/faster sound at any sampling rate setting?
> 
> 	The audio seems to play twice as fast as it should. Someone said
> that XMMS would play it ok. I've tested under Linux and it does, but I've
> not tested it on NetBSD yet. Could this mean that only a little adjustment
> on the driver might fix the issue ?

Usually AC97 codec uses 48kHz clock.  Some motherboards
(including yours, I guess) uses non-48kHz clock.  The clock is
independent of both of codec type and chipset type.

The auvia driver assumes 48kHz clock.  The auich driver also did
so and was fixed recently by adding auich_calibrate(), which
measures actual clock.  The auvia driver needs a function
similar to auich_calibrate().

An ad-hoc fix for you may be:
--- auvia.c.orig        Sun Sep 29 23:59:26 2002
+++ auvia.c     Wed Oct  2 01:17:09 2002
@@ -555,9 +555,9 @@
                        AC97_REG_PCM_FRONT_DAC_RATE : AC97_REG_PCM_LR_ADC_RATE;

                if (!sc->sc_fixed_rate) {
-                       auvia_write_codec(sc, reg, (u_int16_t) p->sample_rate);
+                       auvia_write_codec(sc, reg, (u_int16_t) p->sample_rate / 2);
                        auvia_read_codec(sc, reg, &regval);
-                       p->sample_rate = regval;
+                       p->sample_rate = regval * 2;
                } else
                        p->sample_rate = sc->sc_fixed_rate;

-- 
TAMURA Kent <kent2002@hauN.org> <kent@netbsd.org>