Update of /cvsroot/alsa/alsa-kernel/pci
In directory sc8-pr-cvs1:/tmp/cvs-serv16537/pci

Modified Files:
        via82xx.c 
Log Message:
- added the check of DXS supports (so far, empty).
  the default value of dxs_support is again 0.
- fixed the description.



Index: via82xx.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/via82xx.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- via82xx.c   27 Aug 2003 16:12:03 -0000      1.47
+++ via82xx.c   28 Aug 2003 15:07:25 -0000      1.48
@@ -74,7 +74,7 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
 static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
 static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
-static int dxs_support[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 3};
+static int dxs_support[SNDRV_CARDS];
 
 MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge.");
@@ -286,6 +286,15 @@
 /*
  */
 
+#define VIA_DXS_AUTO   0
+#define VIA_DXS_ENABLE 1
+#define VIA_DXS_DISABLE        2
+#define VIA_DXS_48K    3
+
+
+/*
+ */
+
 typedef struct _snd_via82xx via82xx_t;
 typedef struct via_dev viadev_t;
 #define chip_t via82xx_t
@@ -1944,6 +1953,41 @@
        { VIA_REV_8235, "VIA 8235", TYPE_VIA8233 },
 };
 
+/*
+ * auto detection of DXS channel supports.
+ */
+struct dxs_whitelist {
+       unsigned short vendor;
+       unsigned short device; 
+       int action;     /* new dxs_support value */
+};
+
+static int __devinit check_dxs_list(struct pci_dev *pci)
+{
+       static struct dxs_whitelist whitelist[] = {
+               // { .vendor = xxxx, .device = yyyy, .action = x },
+               { } /* terminator */
+       };
+       struct dxs_whitelist *w;
+       unsigned short subsystem_vendor;
+       unsigned short subsystem_device;
+
+       pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor);
+       pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device);
+
+       for (w = whitelist; w->vendor; w++)
+               if (w->vendor == subsystem_vendor &&
+                   w->device == subsystem_device)
+                       return w->action;
+
+       /*
+        * not detected, try 48k rate only to be sure.
+        */
+       printk(KERN_INFO "via82xx: Assuming DXS channels with 48k fixed sample 
rate.\n");
+       printk(KERN_INFO "         Please try dxs_support=1 option and report if it 
works on your machine.\n");
+       return VIA_DXS_48K;
+};
+
 static int __devinit snd_via82xx_probe(struct pci_dev *pci,
                                       const struct pci_device_id *pci_id)
 {
@@ -1984,13 +2028,16 @@
                                break;
                        }
                }
+               if (dxs_support[dev] == VIA_DXS_AUTO)
+                       dxs_support[dev] = check_dxs_list(pci);
                /* force to use VIA8233 or 8233A model according to
                 * dxs_support module option
                 */
-               if (dxs_support[dev] == 1)
-                       chip_type = TYPE_VIA8233;
-               else if (dxs_support[dev] == 2)
+               if (dxs_support[dev] == VIA_DXS_DISABLE)
                        chip_type = TYPE_VIA8233A;
+               else
+                       chip_type = TYPE_VIA8233;
+
                if (chip_type == TYPE_VIA8233A)
                        strcpy(card->driver, "VIA8233A");
                else



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to