aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/core.h16
-rw-r--r--sound/core/misc.c10
2 files changed, 20 insertions, 6 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 25420c3b5513..59491f22da94 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -458,21 +458,33 @@ static inline int __snd_bug_on(int cond)
458struct snd_pci_quirk { 458struct snd_pci_quirk {
459 unsigned short subvendor; /* PCI subvendor ID */ 459 unsigned short subvendor; /* PCI subvendor ID */
460 unsigned short subdevice; /* PCI subdevice ID */ 460 unsigned short subdevice; /* PCI subdevice ID */
461 unsigned short subdevice_mask; /* bitmask to match */
461 int value; /* value */ 462 int value; /* value */
462#ifdef CONFIG_SND_DEBUG_VERBOSE 463#ifdef CONFIG_SND_DEBUG_VERBOSE
463 const char *name; /* name of the device (optional) */ 464 const char *name; /* name of the device (optional) */
464#endif 465#endif
465}; 466};
466 467
467#define _SND_PCI_QUIRK_ID(vend,dev) \ 468#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \
468 .subvendor = (vend), .subdevice = (dev) 469 .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
470#define _SND_PCI_QUIRK_ID(vend, dev) \
471 _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
469#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} 472#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
470#ifdef CONFIG_SND_DEBUG_VERBOSE 473#ifdef CONFIG_SND_DEBUG_VERBOSE
471#define SND_PCI_QUIRK(vend,dev,xname,val) \ 474#define SND_PCI_QUIRK(vend,dev,xname,val) \
472 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} 475 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
476#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
477 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
478#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
479 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
480 .value = (val), .name = (xname)}
473#else 481#else
474#define SND_PCI_QUIRK(vend,dev,xname,val) \ 482#define SND_PCI_QUIRK(vend,dev,xname,val) \
475 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} 483 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
484#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
485 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
486#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
487 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
476#endif 488#endif
477 489
478const struct snd_pci_quirk * 490const struct snd_pci_quirk *
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 38524f615d94..a9710e0c97af 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -95,12 +95,14 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
95{ 95{
96 const struct snd_pci_quirk *q; 96 const struct snd_pci_quirk *q;
97 97
98 for (q = list; q->subvendor; q++) 98 for (q = list; q->subvendor; q++) {
99 if (q->subvendor == pci->subsystem_vendor && 99 if (q->subvendor != pci->subsystem_vendor)
100 (!q->subdevice || q->subdevice == pci->subsystem_device)) 100 continue;
101 if (!q->subdevice ||
102 (pci->subsystem_device & q->subdevice_mask) == q->subdevice)
101 return q; 103 return q;
104 }
102 return NULL; 105 return NULL;
103} 106}
104
105EXPORT_SYMBOL(snd_pci_quirk_lookup); 107EXPORT_SYMBOL(snd_pci_quirk_lookup);
106#endif 108#endif