]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: Add subdevice_mask field to quirk entries
authorTakashi Iwai <tiwai@suse.de>
Fri, 30 Jan 2009 16:27:45 +0000 (17:27 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 Feb 2009 16:19:11 +0000 (17:19 +0100)
Introduced a new field, subdevice_mask, which specifies the bitmask
to match with the given subdevice ID.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/core.h
sound/core/misc.c

index f632484bc7439171d1b682788305981b66e074f4..f67952a61a2dad3f7a1817e21cc61edb9686177d 100644 (file)
@@ -446,21 +446,33 @@ static inline int __snd_bug_on(int cond)
 struct snd_pci_quirk {
        unsigned short subvendor;       /* PCI subvendor ID */
        unsigned short subdevice;       /* PCI subdevice ID */
+       unsigned short subdevice_mask;  /* bitmask to match */
        int value;                      /* value */
 #ifdef CONFIG_SND_DEBUG_VERBOSE
        const char *name;               /* name of the device (optional) */
 #endif
 };
 
-#define _SND_PCI_QUIRK_ID(vend,dev) \
-       .subvendor = (vend), .subdevice = (dev)
+#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev)        \
+       .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
+#define _SND_PCI_QUIRK_ID(vend, dev) \
+       _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
 #define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
 #ifdef CONFIG_SND_DEBUG_VERBOSE
 #define SND_PCI_QUIRK(vend,dev,xname,val) \
        {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
+#define SND_PCI_QUIRK_VENDOR(vend, xname, val)                 \
+       {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
+#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val)                        \
+       {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev),                       \
+                       .value = (val), .name = (xname)}
 #else
 #define SND_PCI_QUIRK(vend,dev,xname,val) \
        {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
+#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val)                        \
+       {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
+#define SND_PCI_QUIRK_VENDOR(vend, xname, val)                 \
+       {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
 #endif
 
 const struct snd_pci_quirk *
index 38524f615d9428fc5f8614e9e6b5752eb430fc14..a9710e0c97afe74e800660fe1697c9d100c18539 100644 (file)
@@ -95,12 +95,14 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
 {
        const struct snd_pci_quirk *q;
 
-       for (q = list; q->subvendor; q++)
-               if (q->subvendor == pci->subsystem_vendor &&
-                   (!q->subdevice || q->subdevice == pci->subsystem_device))
+       for (q = list; q->subvendor; q++) {
+               if (q->subvendor != pci->subsystem_vendor)
+                       continue;
+               if (!q->subdevice ||
+                   (pci->subsystem_device & q->subdevice_mask) == q->subdevice)
                        return q;
+       }
        return NULL;
 }
-
 EXPORT_SYMBOL(snd_pci_quirk_lookup);
 #endif