aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-01-30 11:27:45 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-09 11:19:11 -0500
commit8bd4bb7a35e8ebb015a531218614c48e10a3c4ee (patch)
treef784818fdca481fd681f90c69ab006dda3a0871e
parent18e352e4a73465349711a9324767e1b2453383e2 (diff)
ALSA: Add subdevice_mask field to quirk entries
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>
-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 f632484bc743..f67952a61a2d 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -446,21 +446,33 @@ static inline int __snd_bug_on(int cond)
446struct snd_pci_quirk { 446struct snd_pci_quirk {
447 unsigned short subvendor; /* PCI subvendor ID */ 447 unsigned short subvendor; /* PCI subvendor ID */
448 unsigned short subdevice; /* PCI subdevice ID */ 448 unsigned short subdevice; /* PCI subdevice ID */
449 unsigned short subdevice_mask; /* bitmask to match */
449 int value; /* value */ 450 int value; /* value */
450#ifdef CONFIG_SND_DEBUG_VERBOSE 451#ifdef CONFIG_SND_DEBUG_VERBOSE
451 const char *name; /* name of the device (optional) */ 452 const char *name; /* name of the device (optional) */
452#endif 453#endif
453}; 454};
454 455
455#define _SND_PCI_QUIRK_ID(vend,dev) \ 456#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \
456 .subvendor = (vend), .subdevice = (dev) 457 .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
458#define _SND_PCI_QUIRK_ID(vend, dev) \
459 _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
457#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} 460#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
458#ifdef CONFIG_SND_DEBUG_VERBOSE 461#ifdef CONFIG_SND_DEBUG_VERBOSE
459#define SND_PCI_QUIRK(vend,dev,xname,val) \ 462#define SND_PCI_QUIRK(vend,dev,xname,val) \
460 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} 463 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
464#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
465 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
466#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
467 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
468 .value = (val), .name = (xname)}
461#else 469#else
462#define SND_PCI_QUIRK(vend,dev,xname,val) \ 470#define SND_PCI_QUIRK(vend,dev,xname,val) \
463 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} 471 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
472#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
473 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
474#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
475 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
464#endif 476#endif
465 477
466const struct snd_pci_quirk * 478const 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