aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-11-24 09:36:13 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:01:51 -0500
commite2b6d13be4ac3b564ac642a76756f6cf1a7b7b99 (patch)
tree66115320e4b09ed2c62acc07666cc684fba48706 /sound/pci
parentf41bea84c030793b502aa2526bb22476788e731e (diff)
[ALSA] nm256 - Use quirk list helper function
Clean up nm256-quirk lookup using snd_pci_quirk_lookup(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/nm256/nm256.c56
1 files changed, 22 insertions, 34 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 879e31a9f9c6..03b3a4792f73 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1628,23 +1628,15 @@ __error:
1628} 1628}
1629 1629
1630 1630
1631struct nm256_quirk {
1632 unsigned short vendor;
1633 unsigned short device;
1634 int type;
1635};
1636
1637enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 }; 1631enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 };
1638 1632
1639static struct nm256_quirk nm256_quirks[] __devinitdata = { 1633static struct snd_pci_quirk nm256_quirks[] __devinitdata = {
1640 /* HP omnibook 4150 has cs4232 codec internally */ 1634 /* HP omnibook 4150 has cs4232 codec internally */
1641 { .vendor = 0x103c, .device = 0x0007, .type = NM_BLACKLISTED }, 1635 SND_PCI_QUIRK(0x103c, 0x0007, "HP omnibook 4150", NM_BLACKLISTED),
1642 /* Sony PCG-F305 */ 1636 /* Reset workarounds to avoid lock-ups */
1643 { .vendor = 0x104d, .device = 0x8041, .type = NM_RESET_WORKAROUND }, 1637 SND_PCI_QUIRK(0x104d, 0x8041, "Sony PCG-F305", NM_RESET_WORKAROUND),
1644 /* Dell Latitude LS */ 1638 SND_PCI_QUIRK(0x1028, 0x0080, "Dell Latitude LS", NM_RESET_WORKAROUND),
1645 { .vendor = 0x1028, .device = 0x0080, .type = NM_RESET_WORKAROUND }, 1639 SND_PCI_QUIRK(0x1028, 0x0091, "Dell Latitude CSx", NM_RESET_WORKAROUND_2),
1646 /* Dell Latitude CSx */
1647 { .vendor = 0x1028, .device = 0x0091, .type = NM_RESET_WORKAROUND_2 },
1648 { } /* terminator */ 1640 { } /* terminator */
1649}; 1641};
1650 1642
@@ -1655,26 +1647,22 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1655 struct snd_card *card; 1647 struct snd_card *card;
1656 struct nm256 *chip; 1648 struct nm256 *chip;
1657 int err; 1649 int err;
1658 struct nm256_quirk *q; 1650 const struct snd_pci_quirk *q;
1659 u16 subsystem_vendor, subsystem_device; 1651
1660 1652 q = snd_pci_quirk_lookup(pci, nm256_quirks);
1661 pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); 1653 if (q) {
1662 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device); 1654 snd_printdd(KERN_INFO "nm256: Enabled quirk for %s.\n", q->name);
1663 1655 switch (q->value) {
1664 for (q = nm256_quirks; q->vendor; q++) { 1656 case NM_BLACKLISTED:
1665 if (q->vendor == subsystem_vendor && q->device == subsystem_device) { 1657 printk(KERN_INFO "nm256: The device is blacklisted. "
1666 switch (q->type) { 1658 "Loading stopped\n");
1667 case NM_BLACKLISTED: 1659 return -ENODEV;
1668 printk(KERN_INFO "nm256: The device is blacklisted. " 1660 case NM_RESET_WORKAROUND_2:
1669 "Loading stopped\n"); 1661 reset_workaround_2 = 1;
1670 return -ENODEV; 1662 /* Fall-through */
1671 case NM_RESET_WORKAROUND_2: 1663 case NM_RESET_WORKAROUND:
1672 reset_workaround_2 = 1; 1664 reset_workaround = 1;
1673 /* Fall-through */ 1665 break;
1674 case NM_RESET_WORKAROUND:
1675 reset_workaround = 1;
1676 break;
1677 }
1678 } 1666 }
1679 } 1667 }
1680 1668