Linux Audio

Check our new training course

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