Loading...
1/*
2 * C-Media CMI8788 driver for Asus Xonar cards
3 *
4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
5 *
6 *
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.
9 *
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.
14 *
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
18 */
19
20#include <linux/pci.h>
21#include <linux/delay.h>
22#include <linux/module.h>
23#include <sound/core.h>
24#include <sound/initval.h>
25#include <sound/pcm.h>
26#include "xonar.h"
27
28MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
29MODULE_DESCRIPTION("Asus Virtuoso driver");
30MODULE_LICENSE("GPL v2");
31MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}");
32
33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
35static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36
37module_param_array(index, int, NULL, 0444);
38MODULE_PARM_DESC(index, "card index");
39module_param_array(id, charp, NULL, 0444);
40MODULE_PARM_DESC(id, "ID string");
41module_param_array(enable, bool, NULL, 0444);
42MODULE_PARM_DESC(enable, "enable card");
43
44static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = {
45 { OXYGEN_PCI_SUBID(0x1043, 0x8269) },
46 { OXYGEN_PCI_SUBID(0x1043, 0x8275) },
47 { OXYGEN_PCI_SUBID(0x1043, 0x82b7) },
48 { OXYGEN_PCI_SUBID(0x1043, 0x8314) },
49 { OXYGEN_PCI_SUBID(0x1043, 0x8327) },
50 { OXYGEN_PCI_SUBID(0x1043, 0x834f) },
51 { OXYGEN_PCI_SUBID(0x1043, 0x835c) },
52 { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
53 { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
54 { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
55 { OXYGEN_PCI_SUBID(0x1043, 0x8522) },
56 { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
57 { }
58};
59MODULE_DEVICE_TABLE(pci, xonar_ids);
60
61static int get_xonar_model(struct oxygen *chip,
62 const struct pci_device_id *id)
63{
64 if (get_xonar_pcm179x_model(chip, id) >= 0)
65 return 0;
66 if (get_xonar_cs43xx_model(chip, id) >= 0)
67 return 0;
68 if (get_xonar_wm87x6_model(chip, id) >= 0)
69 return 0;
70 return -EINVAL;
71}
72
73static int xonar_probe(struct pci_dev *pci,
74 const struct pci_device_id *pci_id)
75{
76 static int dev;
77 int err;
78
79 if (dev >= SNDRV_CARDS)
80 return -ENODEV;
81 if (!enable[dev]) {
82 ++dev;
83 return -ENOENT;
84 }
85 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
86 xonar_ids, get_xonar_model);
87 if (err >= 0)
88 ++dev;
89 return err;
90}
91
92static struct pci_driver xonar_driver = {
93 .name = KBUILD_MODNAME,
94 .id_table = xonar_ids,
95 .probe = xonar_probe,
96 .remove = oxygen_pci_remove,
97#ifdef CONFIG_PM_SLEEP
98 .driver = {
99 .pm = &oxygen_pci_pm,
100 },
101#endif
102 .shutdown = oxygen_pci_shutdown,
103};
104
105module_pci_driver(xonar_driver);
1/*
2 * C-Media CMI8788 driver for Asus Xonar cards
3 *
4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
5 *
6 *
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.
9 *
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.
14 *
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
18 */
19
20#include <linux/pci.h>
21#include <linux/delay.h>
22#include <linux/module.h>
23#include <sound/core.h>
24#include <sound/initval.h>
25#include <sound/pcm.h>
26#include "xonar.h"
27
28MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
29MODULE_DESCRIPTION("Asus Virtuoso driver");
30MODULE_LICENSE("GPL v2");
31MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}");
32
33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
35static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36
37module_param_array(index, int, NULL, 0444);
38MODULE_PARM_DESC(index, "card index");
39module_param_array(id, charp, NULL, 0444);
40MODULE_PARM_DESC(id, "ID string");
41module_param_array(enable, bool, NULL, 0444);
42MODULE_PARM_DESC(enable, "enable card");
43
44static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = {
45 { OXYGEN_PCI_SUBID(0x1043, 0x8269) },
46 { OXYGEN_PCI_SUBID(0x1043, 0x8275) },
47 { OXYGEN_PCI_SUBID(0x1043, 0x82b7) },
48 { OXYGEN_PCI_SUBID(0x1043, 0x8314) },
49 { OXYGEN_PCI_SUBID(0x1043, 0x8327) },
50 { OXYGEN_PCI_SUBID(0x1043, 0x834f) },
51 { OXYGEN_PCI_SUBID(0x1043, 0x835c) },
52 { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
53 { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
54 { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
55 { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
56 { }
57};
58MODULE_DEVICE_TABLE(pci, xonar_ids);
59
60static int __devinit get_xonar_model(struct oxygen *chip,
61 const struct pci_device_id *id)
62{
63 if (get_xonar_pcm179x_model(chip, id) >= 0)
64 return 0;
65 if (get_xonar_cs43xx_model(chip, id) >= 0)
66 return 0;
67 if (get_xonar_wm87x6_model(chip, id) >= 0)
68 return 0;
69 return -EINVAL;
70}
71
72static int __devinit xonar_probe(struct pci_dev *pci,
73 const struct pci_device_id *pci_id)
74{
75 static int dev;
76 int err;
77
78 if (dev >= SNDRV_CARDS)
79 return -ENODEV;
80 if (!enable[dev]) {
81 ++dev;
82 return -ENOENT;
83 }
84 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
85 xonar_ids, get_xonar_model);
86 if (err >= 0)
87 ++dev;
88 return err;
89}
90
91static struct pci_driver xonar_driver = {
92 .name = KBUILD_MODNAME,
93 .id_table = xonar_ids,
94 .probe = xonar_probe,
95 .remove = __devexit_p(oxygen_pci_remove),
96#ifdef CONFIG_PM
97 .suspend = oxygen_pci_suspend,
98 .resume = oxygen_pci_resume,
99#endif
100 .shutdown = oxygen_pci_shutdown,
101};
102
103module_pci_driver(xonar_driver);