1 From: Takashi Iwai <tiwai@suse.de>
2 Subject: ALSA: Backport snd_pci_quirk*() extension
6 Backport the extension of snd_pci_quirk*() helper for updating the
7 HD-audio stuff. To avoid the conflict, all renamed and localized into
10 Signed-off-by: Takashi Iwai <tiwai@suse.de>
13 sound/pci/hda/hda_codec.c | 15 +++++++++++++
14 sound/pci/hda/hda_codec.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 66 insertions(+)
17 --- a/sound/pci/hda/hda_codec.c
18 +++ b/sound/pci/hda/hda_codec.c
19 @@ -3432,3 +3432,18 @@
20 buf[j] = '\0'; /* necessary when j == 0 */
24 +const struct snd_pci_quirk *
25 +snd_hda_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
27 + const struct snd_pci_quirk *q;
29 + for (q = list; q->subvendor; q++) {
30 + if (q->subvendor != pci->subsystem_vendor)
32 + if (!q->subdevice ||
33 + (pci->subsystem_device & q->subdevice_mask) == q->subdevice)
38 --- a/sound/pci/hda/hda_codec.h
39 +++ b/sound/pci/hda/hda_codec.h
41 #include <sound/pcm.h>
42 #include <sound/hwdep.h>
46 + * quirk with mask; backported
49 +/* PCI quirk list helper */
50 +struct snd_hda_quirk {
51 + unsigned short subvendor; /* PCI subvendor ID */
52 + unsigned short subdevice; /* PCI subdevice ID */
53 + unsigned short subdevice_mask; /* bitmask to match */
54 + int value; /* value */
55 +#ifdef CONFIG_SND_DEBUG_VERBOSE
56 + const char *name; /* name of the device (optional) */
60 +#define snd_pci_quirk snd_hda_quirk
61 +#undef _SND_PCI_QUIRK_ID_MASK
62 +#undef _SND_PCI_QUIRK_ID
63 +#undef SND_PCI_QUIRK_ID
65 +#undef SND_PCI_QUIRK_MASK
66 +#undef SND_PCI_QUIRK_VENDOR
68 +#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \
69 + .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
70 +#define _SND_PCI_QUIRK_ID(vend, dev) \
71 + _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
72 +#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
73 +#ifdef CONFIG_SND_DEBUG_VERBOSE
74 +#define SND_PCI_QUIRK(vend,dev,xname,val) \
75 + {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
76 +#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
77 + {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
78 +#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
79 + {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
80 + .value = (val), .name = (xname)}
82 +#define SND_PCI_QUIRK(vend,dev,xname,val) \
83 + {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
84 +#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
85 + {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
86 +#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
87 + {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
90 +const struct snd_pci_quirk *
91 +snd_hda_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
93 +#define snd_pci_quirk_lookup snd_hda_quirk_lookup
95 #if defined(CONFIG_PM) || defined(CONFIG_SND_HDA_POWER_SAVE)
96 #define SND_HDA_NEEDS_RESUME /* resume control code is required */