| 1 |
From: Takashi Iwai <tiwai@suse.de>
|
| 2 |
Date: Fri, 30 Jan 2009 16:27:45 +0000 (+0100)
|
| 3 |
Subject: ALSA: Add subdevice_mask field to quirk entries
|
| 4 |
X-Git-Tag: v2.6.30-rc1~676^2~28^2
|
| 5 |
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=8bd4bb7a35e8ebb015a531218614c48e10a3c4ee
|
| 6 |
|
| 7 |
ALSA: Add subdevice_mask field to quirk entries
|
| 8 |
|
| 9 |
Introduced a new field, subdevice_mask, which specifies the bitmask
|
| 10 |
to match with the given subdevice ID.
|
| 11 |
|
| 12 |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
| 13 |
---
|
| 14 |
|
| 15 |
diff --git a/include/sound/core.h b/include/sound/core.h
|
| 16 |
index f632484..f67952a 100644
|
| 17 |
--- a/include/sound/core.h
|
| 18 |
+++ b/include/sound/core.h
|
| 19 |
@@ -446,21 +446,33 @@ static inline int __snd_bug_on(int cond)
|
| 20 |
struct snd_pci_quirk {
|
| 21 |
unsigned short subvendor; /* PCI subvendor ID */
|
| 22 |
unsigned short subdevice; /* PCI subdevice ID */
|
| 23 |
+ unsigned short subdevice_mask; /* bitmask to match */
|
| 24 |
int value; /* value */
|
| 25 |
#ifdef CONFIG_SND_DEBUG_VERBOSE
|
| 26 |
const char *name; /* name of the device (optional) */
|
| 27 |
#endif
|
| 28 |
};
|
| 29 |
|
| 30 |
-#define _SND_PCI_QUIRK_ID(vend,dev) \
|
| 31 |
- .subvendor = (vend), .subdevice = (dev)
|
| 32 |
+#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \
|
| 33 |
+ .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
|
| 34 |
+#define _SND_PCI_QUIRK_ID(vend, dev) \
|
| 35 |
+ _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
|
| 36 |
#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
|
| 37 |
#ifdef CONFIG_SND_DEBUG_VERBOSE
|
| 38 |
#define SND_PCI_QUIRK(vend,dev,xname,val) \
|
| 39 |
{_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
|
| 40 |
+#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
|
| 41 |
+ {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
|
| 42 |
+#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
|
| 43 |
+ {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
|
| 44 |
+ .value = (val), .name = (xname)}
|
| 45 |
#else
|
| 46 |
#define SND_PCI_QUIRK(vend,dev,xname,val) \
|
| 47 |
{_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
|
| 48 |
+#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
|
| 49 |
+ {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
|
| 50 |
+#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
|
| 51 |
+ {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
|
| 52 |
#endif
|
| 53 |
|
| 54 |
const struct snd_pci_quirk *
|
| 55 |
diff --git a/sound/core/misc.c b/sound/core/misc.c
|
| 56 |
index 38524f6..a9710e0 100644
|
| 57 |
--- a/sound/core/misc.c
|
| 58 |
+++ b/sound/core/misc.c
|
| 59 |
@@ -95,12 +95,14 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
|
| 60 |
{
|
| 61 |
const struct snd_pci_quirk *q;
|
| 62 |
|
| 63 |
- for (q = list; q->subvendor; q++)
|
| 64 |
- if (q->subvendor == pci->subsystem_vendor &&
|
| 65 |
- (!q->subdevice || q->subdevice == pci->subsystem_device))
|
| 66 |
+ for (q = list; q->subvendor; q++) {
|
| 67 |
+ if (q->subvendor != pci->subsystem_vendor)
|
| 68 |
+ continue;
|
| 69 |
+ if (!q->subdevice ||
|
| 70 |
+ (pci->subsystem_device & q->subdevice_mask) == q->subdevice)
|
| 71 |
return q;
|
| 72 |
+ }
|
| 73 |
return NULL;
|
| 74 |
}
|
| 75 |
-
|
| 76 |
EXPORT_SYMBOL(snd_pci_quirk_lookup);
|
| 77 |
#endif
|