mm-only debug patch...
[mmotm.git] / sound / pci / oxygen / virtuoso.c
blob6accaf9580b2c6cd556c93d99a4a8fda12449229
1 /*
2 * C-Media CMI8788 driver for Asus Xonar cards
4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
7 * This driver is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, version 2.
10 * This driver is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this driver; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/pci.h>
21 #include <linux/delay.h>
22 #include <sound/core.h>
23 #include <sound/initval.h>
24 #include <sound/pcm.h>
25 #include "xonar.h"
27 MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
28 MODULE_DESCRIPTION("Asus AVx00 driver");
29 MODULE_LICENSE("GPL v2");
30 MODULE_SUPPORTED_DEVICE("{{Asus,AV100},{Asus,AV200}}");
32 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
33 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
34 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36 module_param_array(index, int, NULL, 0444);
37 MODULE_PARM_DESC(index, "card index");
38 module_param_array(id, charp, NULL, 0444);
39 MODULE_PARM_DESC(id, "ID string");
40 module_param_array(enable, bool, NULL, 0444);
41 MODULE_PARM_DESC(enable, "enable card");
43 static struct pci_device_id xonar_ids[] __devinitdata = {
44 { OXYGEN_PCI_SUBID(0x1043, 0x8269) },
45 { OXYGEN_PCI_SUBID(0x1043, 0x8275) },
46 { OXYGEN_PCI_SUBID(0x1043, 0x82b7) },
47 { OXYGEN_PCI_SUBID(0x1043, 0x8314) },
48 { OXYGEN_PCI_SUBID(0x1043, 0x8327) },
49 { OXYGEN_PCI_SUBID(0x1043, 0x834f) },
50 { OXYGEN_PCI_SUBID(0x1043, 0x835c) },
51 { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
52 { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
53 { }
55 MODULE_DEVICE_TABLE(pci, xonar_ids);
57 static int __devinit get_xonar_model(struct oxygen *chip,
58 const struct pci_device_id *id)
60 if (get_xonar_pcm179x_model(chip, id) >= 0)
61 return 0;
62 if (get_xonar_cs43xx_model(chip, id) >= 0)
63 return 0;
64 return -EINVAL;
67 static int __devinit xonar_probe(struct pci_dev *pci,
68 const struct pci_device_id *pci_id)
70 static int dev;
71 int err;
73 if (dev >= SNDRV_CARDS)
74 return -ENODEV;
75 if (!enable[dev]) {
76 ++dev;
77 return -ENOENT;
79 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
80 xonar_ids, get_xonar_model);
81 if (err >= 0)
82 ++dev;
83 return err;
86 static struct pci_driver xonar_driver = {
87 .name = "AV200",
88 .id_table = xonar_ids,
89 .probe = xonar_probe,
90 .remove = __devexit_p(oxygen_pci_remove),
91 #ifdef CONFIG_PM
92 .suspend = oxygen_pci_suspend,
93 .resume = oxygen_pci_resume,
94 #endif
97 static int __init alsa_card_xonar_init(void)
99 return pci_register_driver(&xonar_driver);
102 static void __exit alsa_card_xonar_exit(void)
104 pci_unregister_driver(&xonar_driver);
107 module_init(alsa_card_xonar_init)
108 module_exit(alsa_card_xonar_exit)