Re: via 686a audio driver rate locked at 48Khz

2001-03-02 Thread Jeff Garzik

Sergei Haller wrote:
> 
> On Wed, 28 Feb 2001, Jeff Garzik wrote:
> 
> > Wayne Whitney wrote:
> > > I have a system with an MSI-6321 motherboard with the Via 686a
> > > southbridge, and I'm having a little trouble with the via82cxxx_audio
> > > sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
> > > sound.  I saw a patch here a week or two ago for 'rate locking', so I
> > > tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
> > > hand correctly).
> >
> > FYI I sent that change to Linus just now, and posted a quick update on
> > the Web site:  http://sourceforge.net/projects/gkernel/
> 
> with this 1.1.14b I still can't cat wav files to /dev/dsp but
> the aRts deamon (from kde2.0.1) works if I set it to 48000Hz

Unless the wav file is at 48000 Hz and you set the rate to 48000 Hz,
that's correct.  You'll need arts or esd or a sound app that supports
locked rates.

Jeff


-- 
Jeff Garzik   | "You see, in this world there's two kinds of
Building 1024 |  people, my friend: Those with loaded guns
MandrakeSoft  |  and those who dig. You dig."  --Blondie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: via 686a audio driver rate locked at 48Khz

2001-03-02 Thread Sergei Haller

On Wed, 28 Feb 2001, Jeff Garzik wrote:

> Wayne Whitney wrote:
> > I have a system with an MSI-6321 motherboard with the Via 686a
> > southbridge, and I'm having a little trouble with the via82cxxx_audio
> > sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
> > sound.  I saw a patch here a week or two ago for 'rate locking', so I
> > tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
> > hand correctly).
>
> FYI I sent that change to Linus just now, and posted a quick update on
> the Web site:  http://sourceforge.net/projects/gkernel/

with this 1.1.14b I still can't cat wav files to /dev/dsp but
the aRts deamon (from kde2.0.1) works if I set it to 48000Hz

> > That patch makes some things work fine (e.g. playing a .wav file), but
> > others sound lousy (e.g. playing a 44.1KHz mp3 with xmms).  Am I correct
> > in thinking that it sounds lousy because of the translation from 44.1KHz
> > sampling to 48KHz sampling?

xmms is playing also using the aRts output plugin.


c ya
Sergei


 eMail:   [EMAIL PROTECTED]

Be careful of reading health books, you might die of a misprint.
-- Mark Twain

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: via 686a audio driver rate locked at 48Khz

2001-03-02 Thread Sergei Haller

On Wed, 28 Feb 2001, Jeff Garzik wrote:

 Wayne Whitney wrote:
  I have a system with an MSI-6321 motherboard with the Via 686a
  southbridge, and I'm having a little trouble with the via82cxxx_audio
  sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
  sound.  I saw a patch here a week or two ago for 'rate locking', so I
  tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
  hand correctly).

 FYI I sent that change to Linus just now, and posted a quick update on
 the Web site:  http://sourceforge.net/projects/gkernel/

with this 1.1.14b I still can't cat wav files to /dev/dsp but
the aRts deamon (from kde2.0.1) works if I set it to 48000Hz

  That patch makes some things work fine (e.g. playing a .wav file), but
  others sound lousy (e.g. playing a 44.1KHz mp3 with xmms).  Am I correct
  in thinking that it sounds lousy because of the translation from 44.1KHz
  sampling to 48KHz sampling?

xmms is playing also using the aRts output plugin.


c ya
Sergei


 eMail:   [EMAIL PROTECTED]

Be careful of reading health books, you might die of a misprint.
-- Mark Twain

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: via 686a audio driver rate locked at 48Khz

2001-03-02 Thread Jeff Garzik

Sergei Haller wrote:
 
 On Wed, 28 Feb 2001, Jeff Garzik wrote:
 
  Wayne Whitney wrote:
   I have a system with an MSI-6321 motherboard with the Via 686a
   southbridge, and I'm having a little trouble with the via82cxxx_audio
   sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
   sound.  I saw a patch here a week or two ago for 'rate locking', so I
   tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
   hand correctly).
 
  FYI I sent that change to Linus just now, and posted a quick update on
  the Web site:  http://sourceforge.net/projects/gkernel/
 
 with this 1.1.14b I still can't cat wav files to /dev/dsp but
 the aRts deamon (from kde2.0.1) works if I set it to 48000Hz

Unless the wav file is at 48000 Hz and you set the rate to 48000 Hz,
that's correct.  You'll need arts or esd or a sound app that supports
locked rates.

Jeff


-- 
Jeff Garzik   | "You see, in this world there's two kinds of
Building 1024 |  people, my friend: Those with loaded guns
MandrakeSoft  |  and those who dig. You dig."  --Blondie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: via 686a audio driver rate locked at 48Khz

2001-02-28 Thread Jeff Garzik

Wayne Whitney wrote:
> I have a system with an MSI-6321 motherboard with the Via 686a
> southbridge, and I'm having a little trouble with the via82cxxx_audio
> sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
> sound.  I saw a patch here a week or two ago for 'rate locking', so I
> tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
> hand correctly).

FYI I sent that change to Linus just now, and posted a quick update on
the Web site:  http://sourceforge.net/projects/gkernel/

> That patch makes some things work fine (e.g. playing a .wav file), but
> others sound lousy (e.g. playing a 44.1KHz mp3 with xmms).  Am I correct
> in thinking that it sounds lousy because of the translation from 44.1KHz
> sampling to 48KHz sampling?

Probably..  If you are locked at 48 Khz, -something- has to upsample to
48 Khz if your audio samples are at a different frequency.  Of course
you might also be needing more CPU cycles or memory due to the required
upsampling.

> If so, is there any hope of supporting
> Variable Rate on this hardware?

To be honest I don't know yet.  I haven't fully assured myself that the
driver is doing things 100% correctly to set up variable rate.  There
-are- codecs locked at 48 Khz, so users with those codecs are stuck at
48 Khz..


> Below is copious debugging output, although not the output of
> via-audio-diag, as I could not find it on sourceforge (and the gtf.org URL
> is gone).

It's in the tarball in the download section of
http://sourceforge.net/projects/gkernel/

Jeff


-- 
Jeff Garzik   | "You see, in this world there's two kinds of
Building 1024 |  people, my friend: Those with loaded guns
MandrakeSoft  |  and those who dig. You dig."  --Blondie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



via 686a audio driver rate locked at 48Khz

2001-02-28 Thread Wayne Whitney


Hi,

I have a system with an MSI-6321 motherboard with the Via 686a
southbridge, and I'm having a little trouble with the via82cxxx_audio
sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
sound.  I saw a patch here a week or two ago for 'rate locking', so I
tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
hand correctly).

That patch makes some things work fine (e.g. playing a .wav file), but
others sound lousy (e.g. playing a 44.1KHz mp3 with xmms).  Am I correct
in thinking that it sounds lousy because of the translation from 44.1KHz
sampling to 48KHz sampling?  If so, is there any hope of supporting
Variable Rate on this hardware?

Below is copious debugging output, although not the output of
via-audio-diag, as I could not find it on sourceforge (and the gtf.org URL
is gone).

Thanks,
Wayne



(1) The relevant part of lspci -n -x -vvv:

00:07.5 Class 0401: 1106:3058 (rev 20)
Subsystem: 1106:3058
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort-
SERR- 


-#undef VIA_DEBUG   /* define to enable debugging output and checks */
+/* #undef VIA_DEBUG/* define to enable debugging output and checks */
+#define VIA_DEBUG
+#define VIA_PROC_FS 1
+
 #ifdef VIA_DEBUG
 /* note: prints function name for you */
 #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
@@ -282,6 +285,8 @@

unsigned rev_h : 1;

+   int locked_rate : 1;
+
struct semaphore syscall_sem;
struct semaphore open_sem;

@@ -508,10 +513,16 @@
 static int via_set_rate (struct ac97_codec *ac97,
 struct via_channel *chan, unsigned rate)
 {
+   struct via_info *card = ac97->private_data;
int rate_reg;

DPRINTK ("ENTER, rate = %d\n", rate);

+   if (card->locked_rate) {
+   chan->rate = 48000;
+   goto out;
+   }
+
if (rate > 48000)   rate = 48000;
if (rate < 4000)rate = 4000;

@@ -535,6 +546,13 @@
 */
chan->rate = via_ac97_read_reg (ac97, rate_reg);

+   if (chan->rate == 0) {
+   card->locked_rate = 1;
+   chan->rate = 48000;
+   printk (KERN_WARNING PFX "Codec rate locked at 48Khz\n");
+   }
+
+out:
DPRINTK ("EXIT, returning rate %d Hz\n", chan->rate);
return chan->rate;
 }
@@ -1421,15 +1439,19 @@
/* WARNING: this line is magic.  Remove this
 * and things break. */
/* enable variable rate, variable rate MIC ADC */
-   tmp16 = via_ac97_read_reg (>ac97, 0x2A);
-   via_ac97_write_reg (>ac97, 0x2A, tmp16 | (1<<0));
-
-   pci_read_config_byte (pdev, VIA_ACLINK_CTRL, );
-   if ((tmp8 & (VIA_CR41_AC97_ENABLE | VIA_CR41_AC97_RESET)) == 0) {
-   printk (KERN_ERR PFX "cannot enable AC97 controller, aborting\n");
-   DPRINTK ("EXIT, tmp8=%X, returning -ENODEV\n", tmp8);
-   return -ENODEV;
-   }
+   /*
+* If we cannot enable VRA, we have a locked-rate codec.
+* We try again to enable VRA before assuming so, however.
+*/
+   tmp16 = via_ac97_read_reg (>ac97, AC97_EXTENDED_STATUS);
+   if ((tmp16 & 1) == 0) {
+   via_ac97_write_reg (>ac97, AC97_EXTENDED_STATUS, tmp16 | 1);
+   tmp16 = via_ac97_read_reg (>ac97, AC97_EXTENDED_STATUS);
+   if ((tmp16 & 1) == 0) {
+   card->locked_rate = 1;
+   printk (KERN_WARNING PFX "Codec rate locked at 48Khz\n");
+   }
+   }

DPRINTK ("EXIT, returning 0\n");
return 0;
@@ -1478,8 +1500,8 @@
}

/* enable variable rate, variable rate MIC ADC */
-   tmp16 = via_ac97_read_reg (>ac97, 0x2A);
-   via_ac97_write_reg (>ac97, 0x2A, tmp16 | (1<<0));
+   tmp16 = via_ac97_read_reg (>ac97, AC97_EXTENDED_STATUS);
+   via_ac97_write_reg (>ac97, AC97_EXTENDED_STATUS, tmp16 | 1);

DPRINTK ("EXIT, returning 0\n");
return 0;



(3) Kernel output from loading the patched via82cxxx_audio.o (although
this was not the first time I loaded the module since the last reboot):

init_via82cxxx_audio: ENTER
via_init_proc: ENTER
via_init_proc: EXIT, returning 0
via_init_one: ENTER
Via 686a audio driver 1.1.14a
via_ac97_init: ENTER
via_ac97_reset: ENTER
via_ac97_reset: PCI config: 01 CC 40 1C 00 05
via_ac97_reset: regs==00 00 00   00AC 
via_ac97_read_reg: ENTER
via_ac97_read_reg: EXIT, success, data=0x22a, retval=0x0
via_ac97_write_reg: ENTER
via_ac97_write_reg: EXIT
via_ac97_read_reg: ENTER
via_ac97_read_reg: EXIT, success, data=0x22a, retval=0x0
via82cxxx: Codec rate locked at 48Khz
via_ac97_reset: EXIT, returning 0
via_ac97_write_reg: ENTER
via_ac97_write_reg: EXIT
via_ac97_wait_idle: ENTER/EXIT
via_ac97_read_reg: ENTER

via 686a audio driver rate locked at 48Khz

2001-02-28 Thread Wayne Whitney


Hi,

I have a system with an MSI-6321 motherboard with the Via 686a
southbridge, and I'm having a little trouble with the via82cxxx_audio
sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
sound.  I saw a patch here a week or two ago for 'rate locking', so I
tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
hand correctly).

That patch makes some things work fine (e.g. playing a .wav file), but
others sound lousy (e.g. playing a 44.1KHz mp3 with xmms).  Am I correct
in thinking that it sounds lousy because of the translation from 44.1KHz
sampling to 48KHz sampling?  If so, is there any hope of supporting
Variable Rate on this hardware?

Below is copious debugging output, although not the output of
via-audio-diag, as I could not find it on sourceforge (and the gtf.org URL
is gone).

Thanks,
Wayne



(1) The relevant part of lspci -n -x -vvv:

00:07.5 Class 0401: 1106:3058 (rev 20)
Subsystem: 1106:3058
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium TAbort-
TAbort- MAbort- SERR- PERR-
Interrupt: pin C routed to IRQ 11
Region 0: I/O ports at 9c00 [size=256]
Region 1: I/O ports at a000 [size=4]
Region 2: I/O ports at a400 [size=4]
Capabilities: [c0] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00: 06 11 58 30 01 00 10 02 20 00 01 04 00 00 00 00
10: 01 9c 00 00 01 a0 00 00 01 a4 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 06 11 58 30
30: 00 00 00 00 c0 00 00 00 00 00 00 00 0b 03 00 00



(2) The patch I used (which also enables VIA_DEBUG and VIA_PROC_FS):

--- /usr/local/src/linux-2.4.2/drivers/sound/via82cxxx_audio.c.orig Tue Feb  6 
22:04:12 2001
+++ /usr/local/src/linux-2.4.2/drivers/sound/via82cxxx_audio.c  Wed Feb 28 10:07:01 
+2001
@@ -41,7 +41,10 @@
 #include asm/semaphore.h


-#undef VIA_DEBUG   /* define to enable debugging output and checks */
+/* #undef VIA_DEBUG/* define to enable debugging output and checks */
+#define VIA_DEBUG
+#define VIA_PROC_FS 1
+
 #ifdef VIA_DEBUG
 /* note: prints function name for you */
 #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
@@ -282,6 +285,8 @@

unsigned rev_h : 1;

+   int locked_rate : 1;
+
struct semaphore syscall_sem;
struct semaphore open_sem;

@@ -508,10 +513,16 @@
 static int via_set_rate (struct ac97_codec *ac97,
 struct via_channel *chan, unsigned rate)
 {
+   struct via_info *card = ac97-private_data;
int rate_reg;

DPRINTK ("ENTER, rate = %d\n", rate);

+   if (card-locked_rate) {
+   chan-rate = 48000;
+   goto out;
+   }
+
if (rate  48000)   rate = 48000;
if (rate  4000)rate = 4000;

@@ -535,6 +546,13 @@
 */
chan-rate = via_ac97_read_reg (ac97, rate_reg);

+   if (chan-rate == 0) {
+   card-locked_rate = 1;
+   chan-rate = 48000;
+   printk (KERN_WARNING PFX "Codec rate locked at 48Khz\n");
+   }
+
+out:
DPRINTK ("EXIT, returning rate %d Hz\n", chan-rate);
return chan-rate;
 }
@@ -1421,15 +1439,19 @@
/* WARNING: this line is magic.  Remove this
 * and things break. */
/* enable variable rate, variable rate MIC ADC */
-   tmp16 = via_ac97_read_reg (card-ac97, 0x2A);
-   via_ac97_write_reg (card-ac97, 0x2A, tmp16 | (10));
-
-   pci_read_config_byte (pdev, VIA_ACLINK_CTRL, tmp8);
-   if ((tmp8  (VIA_CR41_AC97_ENABLE | VIA_CR41_AC97_RESET)) == 0) {
-   printk (KERN_ERR PFX "cannot enable AC97 controller, aborting\n");
-   DPRINTK ("EXIT, tmp8=%X, returning -ENODEV\n", tmp8);
-   return -ENODEV;
-   }
+   /*
+* If we cannot enable VRA, we have a locked-rate codec.
+* We try again to enable VRA before assuming so, however.
+*/
+   tmp16 = via_ac97_read_reg (card-ac97, AC97_EXTENDED_STATUS);
+   if ((tmp16  1) == 0) {
+   via_ac97_write_reg (card-ac97, AC97_EXTENDED_STATUS, tmp16 | 1);
+   tmp16 = via_ac97_read_reg (card-ac97, AC97_EXTENDED_STATUS);
+   if ((tmp16  1) == 0) {
+   card-locked_rate = 1;
+   printk (KERN_WARNING PFX "Codec rate locked at 48Khz\n");
+   }
+   }

DPRINTK ("EXIT, returning 0\n");
return 0;
@@ -1478,8 +1500,8 @@
}

/* enable variable rate, variable rate MIC ADC */
-   tmp16 = via_ac97_read_reg (card-ac97, 0x2A);
-   via_ac97_write_reg (card-ac97, 0x2A, tmp16 | (10));
+   tmp16 = via_ac97_read_reg (card-ac97, AC97_EXTENDED_STATUS);
+   via_ac97_write_reg 

Re: via 686a audio driver rate locked at 48Khz

2001-02-28 Thread Jeff Garzik

Wayne Whitney wrote:
 I have a system with an MSI-6321 motherboard with the Via 686a
 southbridge, and I'm having a little trouble with the via82cxxx_audio
 sound driver.  The stock 2.4.2 driver produces only a rhythmic a buzzing
 sound.  I saw a patch here a week or two ago for 'rate locking', so I
 tried that (it didn't apply cleanly to 2.4.2, but I think I applied it by
 hand correctly).

FYI I sent that change to Linus just now, and posted a quick update on
the Web site:  http://sourceforge.net/projects/gkernel/

 That patch makes some things work fine (e.g. playing a .wav file), but
 others sound lousy (e.g. playing a 44.1KHz mp3 with xmms).  Am I correct
 in thinking that it sounds lousy because of the translation from 44.1KHz
 sampling to 48KHz sampling?

Probably..  If you are locked at 48 Khz, -something- has to upsample to
48 Khz if your audio samples are at a different frequency.  Of course
you might also be needing more CPU cycles or memory due to the required
upsampling.

 If so, is there any hope of supporting
 Variable Rate on this hardware?

To be honest I don't know yet.  I haven't fully assured myself that the
driver is doing things 100% correctly to set up variable rate.  There
-are- codecs locked at 48 Khz, so users with those codecs are stuck at
48 Khz..


 Below is copious debugging output, although not the output of
 via-audio-diag, as I could not find it on sourceforge (and the gtf.org URL
 is gone).

It's in the tarball in the download section of
http://sourceforge.net/projects/gkernel/

Jeff


-- 
Jeff Garzik   | "You see, in this world there's two kinds of
Building 1024 |  people, my friend: Those with loaded guns
MandrakeSoft  |  and those who dig. You dig."  --Blondie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/