Re: 2.4.4 Sound corruption [PATCH]

2001-04-30 Thread Charl P. Botha

On Mon, Apr 30, 2001 at 05:58:40PM +0100, Alan Cox wrote:
> > Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
> > sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
> > send this anywhere else as well?
> 
> It seems very broken
> 
> > -   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_8363_0,  
> quirk_vialatency },
> > +   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C686,  
> quirk_vialatency },
> 
> You are hacking the wrong chip..

That's the first version I sent which was admittedly broken.  About 20
minutes later I sent the fixed version (mail with subject: "Re: 2.4.4 Sound
corruption [PATCH] NEW, ignore previous patch").  In case you can't find
this, I've re-attached the patch.

Regards,
Charl

-- 
charl p. botha  | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/


--- quirks.c-2.4.4  Mon Apr 30 01:50:36 2001
+++ quirks.cMon Apr 30 03:54:08 2001
@@ -88,23 +88,44 @@
  * VIA Apollo KT133 needs PCI latency patch
  * Made according to a windows driver based patch by George E. Breese
  * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
+ *  Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for
+ *  the info on which Mr Breese based his work.
  */
 static void __init quirk_vialatency(struct pci_dev *dev)
 {
u8 r70;
-
-   printk(KERN_INFO "Applying VIA PCI latency patch.\n");
-   /*
-*In register 0x70, mask off bit 2 (PCI Master read caching)
-*and 1 (Delay Transaction)
+   u8 rev;
+   struct pci_dev *vt82c686;
+   
+   
+   /* we want to look for a VT82C686 south bridge, and then apply the via latency
+* patch if we find that it's a 686B (by revision) <[EMAIL PROTECTED]>
 */
-   pci_read_config_byte(dev, 0x70, );
-   r70 &= 0xf9;
-   pci_write_config_byte(dev, 0x70, r70);
-   /*
-*Turn off PCI Latency timeout (set to 0 clocks)
-*/
-   pci_write_config_byte(dev, 0x75, 0x80);
+   vt82c686 = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
+   if (vt82c686)   
+   {
+   pci_read_config_byte(vt82c686, PCI_CLASS_REVISION, );
+   /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
+   if (rev >= 0x40 && rev <= 0x4f)
+   {
+   printk(KERN_INFO "Applying VIA PCI latency patch (found 
+VT82C686B).\n");
+   /*
+*In register 0x70, mask off bit 2 (PCI Master read 
+caching)
+*and 1 (Delay Transaction)
+*/
+   pci_read_config_byte(dev, 0x70, );
+   r70 &= 0xf9;
+   pci_write_config_byte(dev, 0x70, r70);
+   /*
+*Turn off PCI Latency timeout (set to 0 clocks)
+*/
+   pci_write_config_byte(dev, 0x75, 0x80);
+   }
+   else
+   {
+   printk(KERN_INFO "Found VT82C686A, not applying VIA latency 
+patch.\n");
+   }
+   } /* if (vt82c686) ... */
 }
 
 /*



Re: 2.4.4 Sound corruption [PATCH]

2001-04-30 Thread Alan Cox

> Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
> sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
> send this anywhere else as well?

It seems very broken

> - { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_8363_0,  
> quirk_vialatency },
> + { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C686,  
> quirk_vialatency },

You are hacking the wrong chip..
-
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: 2.4.4 Sound corruption [PATCH]

2001-04-30 Thread Alan Cox

 Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
 sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
 send this anywhere else as well?

It seems very broken

 - { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_8363_0,  
 quirk_vialatency },
 + { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C686,  
 quirk_vialatency },

You are hacking the wrong chip..
-
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: 2.4.4 Sound corruption [PATCH]

2001-04-30 Thread Charl P. Botha

On Mon, Apr 30, 2001 at 05:58:40PM +0100, Alan Cox wrote:
  Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
  sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
  send this anywhere else as well?
 
 It seems very broken
 
  -   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_8363_0,  
 quirk_vialatency },
  +   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C686,  
 quirk_vialatency },
 
 You are hacking the wrong chip..

That's the first version I sent which was admittedly broken.  About 20
minutes later I sent the fixed version (mail with subject: Re: 2.4.4 Sound
corruption [PATCH] NEW, ignore previous patch).  In case you can't find
this, I've re-attached the patch.

Regards,
Charl

-- 
charl p. botha  | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/


--- quirks.c-2.4.4  Mon Apr 30 01:50:36 2001
+++ quirks.cMon Apr 30 03:54:08 2001
@@ -88,23 +88,44 @@
  * VIA Apollo KT133 needs PCI latency patch
  * Made according to a windows driver based patch by George E. Breese
  * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
+ *  Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for
+ *  the info on which Mr Breese based his work.
  */
 static void __init quirk_vialatency(struct pci_dev *dev)
 {
u8 r70;
-
-   printk(KERN_INFO Applying VIA PCI latency patch.\n);
-   /*
-*In register 0x70, mask off bit 2 (PCI Master read caching)
-*and 1 (Delay Transaction)
+   u8 rev;
+   struct pci_dev *vt82c686;
+   
+   
+   /* we want to look for a VT82C686 south bridge, and then apply the via latency
+* patch if we find that it's a 686B (by revision) [EMAIL PROTECTED]
 */
-   pci_read_config_byte(dev, 0x70, r70);
-   r70 = 0xf9;
-   pci_write_config_byte(dev, 0x70, r70);
-   /*
-*Turn off PCI Latency timeout (set to 0 clocks)
-*/
-   pci_write_config_byte(dev, 0x75, 0x80);
+   vt82c686 = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
+   if (vt82c686)   
+   {
+   pci_read_config_byte(vt82c686, PCI_CLASS_REVISION, rev);
+   /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
+   if (rev = 0x40  rev = 0x4f)
+   {
+   printk(KERN_INFO Applying VIA PCI latency patch (found 
+VT82C686B).\n);
+   /*
+*In register 0x70, mask off bit 2 (PCI Master read 
+caching)
+*and 1 (Delay Transaction)
+*/
+   pci_read_config_byte(dev, 0x70, r70);
+   r70 = 0xf9;
+   pci_write_config_byte(dev, 0x70, r70);
+   /*
+*Turn off PCI Latency timeout (set to 0 clocks)
+*/
+   pci_write_config_byte(dev, 0x75, 0x80);
+   }
+   else
+   {
+   printk(KERN_INFO Found VT82C686A, not applying VIA latency 
+patch.\n);
+   }
+   } /* if (vt82c686) ... */
 }
 
 /*



Re: 2.4.4 Sound corruption [PATCH] NEW, ignore previous patch

2001-04-29 Thread Charl P. Botha

Please IGNORE the previous patch, it was faulty (I blame it on the time of
day).  The one attached with this is guaranteed to be perfect(tm).

On Mon, Apr 30, 2001 at 03:06:26AM +0200, Charl P. Botha wrote:
> Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
> sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
> send this anywhere else as well?

-- 
charl p. botha  | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/


--- quirks.c-2.4.4  Mon Apr 30 01:50:36 2001
+++ quirks.cMon Apr 30 03:54:08 2001
@@ -88,23 +88,44 @@
  * VIA Apollo KT133 needs PCI latency patch
  * Made according to a windows driver based patch by George E. Breese
  * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
+ *  Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for
+ *  the info on which Mr Breese based his work.
  */
 static void __init quirk_vialatency(struct pci_dev *dev)
 {
u8 r70;
-
-   printk(KERN_INFO "Applying VIA PCI latency patch.\n");
-   /*
-*In register 0x70, mask off bit 2 (PCI Master read caching)
-*and 1 (Delay Transaction)
+   u8 rev;
+   struct pci_dev *vt82c686;
+   
+   
+   /* we want to look for a VT82C686 south bridge, and then apply the via latency
+* patch if we find that it's a 686B (by revision) <[EMAIL PROTECTED]>
 */
-   pci_read_config_byte(dev, 0x70, );
-   r70 &= 0xf9;
-   pci_write_config_byte(dev, 0x70, r70);
-   /*
-*Turn off PCI Latency timeout (set to 0 clocks)
-*/
-   pci_write_config_byte(dev, 0x75, 0x80);
+   vt82c686 = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
+   if (vt82c686)   
+   {
+   pci_read_config_byte(vt82c686, PCI_CLASS_REVISION, );
+   /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
+   if (rev >= 0x40 && rev <= 0x4f)
+   {
+   printk(KERN_INFO "Applying VIA PCI latency patch (found 
+VT82C686B).\n");
+   /*
+*In register 0x70, mask off bit 2 (PCI Master read 
+caching)
+*and 1 (Delay Transaction)
+*/
+   pci_read_config_byte(dev, 0x70, );
+   r70 &= 0xf9;
+   pci_write_config_byte(dev, 0x70, r70);
+   /*
+*Turn off PCI Latency timeout (set to 0 clocks)
+*/
+   pci_write_config_byte(dev, 0x75, 0x80);
+   }
+   else
+   {
+   printk(KERN_INFO "Found VT82C686A, not applying VIA latency 
+patch.\n");
+   }
+   } /* if (vt82c686) ... */
 }
 
 /*



Re: 2.4.4 Sound corruption [PATCH]

2001-04-29 Thread Charl P. Botha

Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
send this anywhere else as well?

On Sun, Apr 29, 2001 at 05:29:05PM -0700, Dan Hollis wrote:
> On Mon, 30 Apr 2001, Charl P. Botha wrote:
> > I have removed this code and everything is now fine on my system.  The
> > problem is that the 686A and 686B have the same PCI IDs, else I would have
> > submitted a patch.
> 
> 686a is rev 0x10 - 0x2f, 686b is rev 0x40 - 0x4f.
> 
> The fixup code should take this into account.
> 
> -Dan

-- 
charl p. botha  | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/


--- quirks.c-2.4.4  Mon Apr 30 01:50:36 2001
+++ quirks.cMon Apr 30 03:01:28 2001
@@ -88,23 +88,36 @@
  * VIA Apollo KT133 needs PCI latency patch
  * Made according to a windows driver based patch by George E. Breese
  * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
+ *  Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for
+ *  the info on which Mr Breese based his work.
  */
 static void __init quirk_vialatency(struct pci_dev *dev)
 {
u8 r70;
+   u8 rev;
 
-   printk(KERN_INFO "Applying VIA PCI latency patch.\n");
-   /*
-*In register 0x70, mask off bit 2 (PCI Master read caching)
-*and 1 (Delay Transaction)
-*/
-   pci_read_config_byte(dev, 0x70, );
-   r70 &= 0xf9;
-   pci_write_config_byte(dev, 0x70, r70);
-   /*
-*Turn off PCI Latency timeout (set to 0 clocks)
-*/
-   pci_write_config_byte(dev, 0x75, 0x80);
+   /* we test for 686B by revision, only apply patch then ([EMAIL PROTECTED]) */
+   pci_read_config_byte(dev, PCI_CLASS_REVISION, );
+/* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
+   if (rev >= 0x40 && rev <= 0x4f)
+   {
+   printk(KERN_INFO "Applying VIA PCI latency patch (found 
+VT82C686B).\n");
+   /*
+   *In register 0x70, mask off bit 2 (PCI Master read caching)
+   *and 1 (Delay Transaction)
+   */
+   pci_read_config_byte(dev, 0x70, );
+   r70 &= 0xf9;
+   pci_write_config_byte(dev, 0x70, r70);
+   /*
+*Turn off PCI Latency timeout (set to 0 clocks)
+*/
+   pci_write_config_byte(dev, 0x75, 0x80);
+   }
+   else
+   {
+   printk(KERN_INFO "Found VT82C686A, not applying VIA latency patch.\n");
+   }
 }
 
 /*
@@ -312,7 +325,7 @@
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_82443BX_2, 
 quirk_natoma },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,   PCI_DEVICE_ID_SI_5597, 
 quirk_nopcipci },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,   PCI_DEVICE_ID_SI_496,  
 quirk_nopcipci },
-   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_8363_0,  
 quirk_vialatency },
+   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C686,  
+ quirk_vialatency },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C597_0,
 quirk_viaetbf },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C597_0,
 quirk_vt82c598_id },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C586_3,
 quirk_vt82c586_acpi },



Re: 2.4.4 Sound corruption [PATCH]

2001-04-29 Thread Charl P. Botha

Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
send this anywhere else as well?

On Sun, Apr 29, 2001 at 05:29:05PM -0700, Dan Hollis wrote:
 On Mon, 30 Apr 2001, Charl P. Botha wrote:
  I have removed this code and everything is now fine on my system.  The
  problem is that the 686A and 686B have the same PCI IDs, else I would have
  submitted a patch.
 
 686a is rev 0x10 - 0x2f, 686b is rev 0x40 - 0x4f.
 
 The fixup code should take this into account.
 
 -Dan

-- 
charl p. botha  | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/


--- quirks.c-2.4.4  Mon Apr 30 01:50:36 2001
+++ quirks.cMon Apr 30 03:01:28 2001
@@ -88,23 +88,36 @@
  * VIA Apollo KT133 needs PCI latency patch
  * Made according to a windows driver based patch by George E. Breese
  * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
+ *  Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for
+ *  the info on which Mr Breese based his work.
  */
 static void __init quirk_vialatency(struct pci_dev *dev)
 {
u8 r70;
+   u8 rev;
 
-   printk(KERN_INFO Applying VIA PCI latency patch.\n);
-   /*
-*In register 0x70, mask off bit 2 (PCI Master read caching)
-*and 1 (Delay Transaction)
-*/
-   pci_read_config_byte(dev, 0x70, r70);
-   r70 = 0xf9;
-   pci_write_config_byte(dev, 0x70, r70);
-   /*
-*Turn off PCI Latency timeout (set to 0 clocks)
-*/
-   pci_write_config_byte(dev, 0x75, 0x80);
+   /* we test for 686B by revision, only apply patch then ([EMAIL PROTECTED]) */
+   pci_read_config_byte(dev, PCI_CLASS_REVISION, rev);
+/* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
+   if (rev = 0x40  rev = 0x4f)
+   {
+   printk(KERN_INFO Applying VIA PCI latency patch (found 
+VT82C686B).\n);
+   /*
+   *In register 0x70, mask off bit 2 (PCI Master read caching)
+   *and 1 (Delay Transaction)
+   */
+   pci_read_config_byte(dev, 0x70, r70);
+   r70 = 0xf9;
+   pci_write_config_byte(dev, 0x70, r70);
+   /*
+*Turn off PCI Latency timeout (set to 0 clocks)
+*/
+   pci_write_config_byte(dev, 0x75, 0x80);
+   }
+   else
+   {
+   printk(KERN_INFO Found VT82C686A, not applying VIA latency patch.\n);
+   }
 }
 
 /*
@@ -312,7 +325,7 @@
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_82443BX_2, 
 quirk_natoma },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,   PCI_DEVICE_ID_SI_5597, 
 quirk_nopcipci },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,   PCI_DEVICE_ID_SI_496,  
 quirk_nopcipci },
-   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_8363_0,  
 quirk_vialatency },
+   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C686,  
+ quirk_vialatency },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C597_0,
 quirk_viaetbf },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C597_0,
 quirk_vt82c598_id },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA,  PCI_DEVICE_ID_VIA_82C586_3,
 quirk_vt82c586_acpi },



Re: 2.4.4 Sound corruption [PATCH] NEW, ignore previous patch

2001-04-29 Thread Charl P. Botha

Please IGNORE the previous patch, it was faulty (I blame it on the time of
day).  The one attached with this is guaranteed to be perfect(tm).

On Mon, Apr 30, 2001 at 03:06:26AM +0200, Charl P. Botha wrote:
 Attached is a patch to the quirks.c in linux kernel 2.4.4 that fixes the
 sound corruption problem (thanks to Dan Hollis for the info).  Do I have to
 send this anywhere else as well?

-- 
charl p. botha  | computer graphics and cad/cam 
http://cpbotha.net/ | http://www.cg.its.tudelft.nl/


--- quirks.c-2.4.4  Mon Apr 30 01:50:36 2001
+++ quirks.cMon Apr 30 03:54:08 2001
@@ -88,23 +88,44 @@
  * VIA Apollo KT133 needs PCI latency patch
  * Made according to a windows driver based patch by George E. Breese
  * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
+ *  Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for
+ *  the info on which Mr Breese based his work.
  */
 static void __init quirk_vialatency(struct pci_dev *dev)
 {
u8 r70;
-
-   printk(KERN_INFO Applying VIA PCI latency patch.\n);
-   /*
-*In register 0x70, mask off bit 2 (PCI Master read caching)
-*and 1 (Delay Transaction)
+   u8 rev;
+   struct pci_dev *vt82c686;
+   
+   
+   /* we want to look for a VT82C686 south bridge, and then apply the via latency
+* patch if we find that it's a 686B (by revision) [EMAIL PROTECTED]
 */
-   pci_read_config_byte(dev, 0x70, r70);
-   r70 = 0xf9;
-   pci_write_config_byte(dev, 0x70, r70);
-   /*
-*Turn off PCI Latency timeout (set to 0 clocks)
-*/
-   pci_write_config_byte(dev, 0x75, 0x80);
+   vt82c686 = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
+   if (vt82c686)   
+   {
+   pci_read_config_byte(vt82c686, PCI_CLASS_REVISION, rev);
+   /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
+   if (rev = 0x40  rev = 0x4f)
+   {
+   printk(KERN_INFO Applying VIA PCI latency patch (found 
+VT82C686B).\n);
+   /*
+*In register 0x70, mask off bit 2 (PCI Master read 
+caching)
+*and 1 (Delay Transaction)
+*/
+   pci_read_config_byte(dev, 0x70, r70);
+   r70 = 0xf9;
+   pci_write_config_byte(dev, 0x70, r70);
+   /*
+*Turn off PCI Latency timeout (set to 0 clocks)
+*/
+   pci_write_config_byte(dev, 0x75, 0x80);
+   }
+   else
+   {
+   printk(KERN_INFO Found VT82C686A, not applying VIA latency 
+patch.\n);
+   }
+   } /* if (vt82c686) ... */
 }
 
 /*