openvortex-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openvortex-dev] Re: [Alsa-devel] au8830+via & alsa 0.9.7c


From: Wilfried Weissmann
Subject: [Openvortex-dev] Re: [Alsa-devel] au8830+via & alsa 0.9.7c
Date: Sat, 25 Oct 2003 22:51:58 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1

Manuel Jander wrote:
Hello,


are there plans to include the pci fix into the driver? i think the cs46xx does something similar by detecting if it is run on a thinkpad and enabling some workaround if required. it should be pretty straightforward. just look if the pci-id of the via northbridge can be found on the pci bus and then set the registers according to the test result. if you want a patch for that then i could make one at the next weekend.


Send the patch if you can. I'm too busy working on 3D support, and don't
want to get distracted now. Thats why i'm very glad if some else
contributes code :D

and here it is! i implemented the pci latency and the bridge fix. both are required on my computer to use the card properly. the fixes are only done when the via kt133 agp bridge is found on the pci bus. infos about the tweaks can be found here:

http://myweb.tiscali.co.uk/chris.day/guides/vortex.htm
http://myweb.tiscali.co.uk/chris.day/guides/vtxagp.htm

use the snd-au88?0 module parameter "pcifix" to override the default settings. the following values are valid:

* 255: autodetect what has to be done (this is the default)
* 0: disable all tweaks
* 1: only apply aureal pci latency fix
* 2: only apply the via agp bridge "PCI #2 Master Control" fix
* 3: apply both fixes

the attached patch applies against alsa 0.9.7c.

regards,
wilfried
--- alsa-driver-0.9.7c/pci/au88x0/au88x0.c      2003-10-06 16:01:04.000000000 
+0200
+++ alsa-driver-0.9.7c-ww/pci/au88x0/au88x0.c   2003-10-25 22:31:09.000000000 
+0200
@@ -26,6 +26,7 @@
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
+static int pcifix[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 255 };
 
 MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
@@ -36,6 +37,9 @@ MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
 MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
+MODULE_PARM(pcifix, "1-255i");
+MODULE_PARM_DESC(pcifix, "Enable VIA-workaround for " CARD_NAME " soundcard.");
+MODULE_PARM_SYNTAX(pcifix, SNDRV_ENABLED 
",allows:{{0,Disabled},{1,Latency},{2,Bridge},{3,Both},{255,Auto}},default:4,dialog:check");
 
 MODULE_DESCRIPTION("Aureal vortex");
 MODULE_CLASSES("{sound}");
@@ -61,6 +65,56 @@ __setup("snd-au88x0=", alsa_card_vortex_
 
 MODULE_DEVICE_TABLE(pci, snd_vortex_ids);
 
+static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) {
+       struct pci_dev *via=NULL;
+               /* autodetect if workarounds are required */
+       while( (via = pci_find_device(PCI_VENDOR_ID_VIA,
+                               PCI_DEVICE_ID_VIA_8365_1, via)) ) {
+               if(fix == 255) {
+                       printk(KERN_INFO CARD_NAME
+                               ": detected VIA KT133/KM133. activating 
workaround...\n");
+                       fix = 3; // do latency and via bridge workaround
+               }
+               break;
+       }
+       
+       int rc;
+
+               /* fix vortex latency */
+       if(fix & 0x01) {
+               if( !(rc = pci_write_config_byte(vortex, 0x40, 0xff)) ) {
+                       printk(KERN_INFO CARD_NAME
+                                       ": vortex latency is 0xff\n");
+               }
+               else {
+                       printk(KERN_WARNING CARD_NAME ": could not set vortex 
latency: pci error 0x%x\n", rc);
+               }
+       }
+
+               /* fix via agp bridge */
+       if(via && (fix & 0x02)) {
+               u8 value;
+
+                       /*
+                        * only set the bit (Extend PCI#2 Internal Master for
+                        * Efficient Handling of Dummy Requests) if the can
+                        * read the config and it is not already set
+                        */
+
+               if( !(rc = pci_read_config_byte(via, 0x42, &value)) && (
+                       (value & 0x10) ||
+                       !(rc=pci_write_config_byte(via, 0x42, value|0x10)) ) ) {
+
+                       printk(KERN_INFO CARD_NAME
+                                       ": bridge config is 0x%x\n",
+                                       value|0x10);
+               }
+               else {
+                       printk(KERN_WARNING CARD_NAME ": could not set vortex 
latency: pci error 0x%x\n", rc);
+               }
+       }
+}
+
 
 // component-destructor
 // (see "Management of Cards and Components")
@@ -198,6 +252,7 @@ snd_vortex_probe(struct pci_dev *pci, co
         snd_card_free(card);
         return err;
     }
+    snd_vortex_workaround(pci, pcifix[dev]);
     // (4) Alloc components.
     // ADB pcm.
     if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_ADB)) < 0) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]