1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * ALSA driver for the Aureal Vortex family of soundprocessors.
4*4882a593Smuzhiyun * Author: Manuel Jander (mjander@embedded.cl)
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * This driver is the result of the OpenVortex Project from Savannah
7*4882a593Smuzhiyun * (savannah.nongnu.org/projects/openvortex). I would like to thank
8*4882a593Smuzhiyun * the developers of OpenVortex, Jeff Muizelaar and Kester Maddock, from
9*4882a593Smuzhiyun * whom i got plenty of help, and their codebase was invaluable.
10*4882a593Smuzhiyun * Thanks to the ALSA developers, they helped a lot working out
11*4882a593Smuzhiyun * the ALSA part.
12*4882a593Smuzhiyun * Thanks also to Sourceforge for maintaining the old binary drivers,
13*4882a593Smuzhiyun * and the forum, where developers could comunicate.
14*4882a593Smuzhiyun *
15*4882a593Smuzhiyun * Now at least i can play Legacy DOOM with MIDI music :-)
16*4882a593Smuzhiyun */
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun #include "au88x0.h"
19*4882a593Smuzhiyun #include <linux/init.h>
20*4882a593Smuzhiyun #include <linux/pci.h>
21*4882a593Smuzhiyun #include <linux/slab.h>
22*4882a593Smuzhiyun #include <linux/interrupt.h>
23*4882a593Smuzhiyun #include <linux/module.h>
24*4882a593Smuzhiyun #include <linux/dma-mapping.h>
25*4882a593Smuzhiyun #include <sound/initval.h>
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun // module parameters (see "Module Parameters")
28*4882a593Smuzhiyun static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
29*4882a593Smuzhiyun static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
30*4882a593Smuzhiyun static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
31*4882a593Smuzhiyun static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 };
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun module_param_array(index, int, NULL, 0444);
34*4882a593Smuzhiyun MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
35*4882a593Smuzhiyun module_param_array(id, charp, NULL, 0444);
36*4882a593Smuzhiyun MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
37*4882a593Smuzhiyun module_param_array(enable, bool, NULL, 0444);
38*4882a593Smuzhiyun MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
39*4882a593Smuzhiyun module_param_array(pcifix, int, NULL, 0444);
40*4882a593Smuzhiyun MODULE_PARM_DESC(pcifix, "Enable VIA-workaround for " CARD_NAME " soundcard.");
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun MODULE_DESCRIPTION("Aureal vortex");
43*4882a593Smuzhiyun MODULE_LICENSE("GPL");
44*4882a593Smuzhiyun MODULE_SUPPORTED_DEVICE("{{Aureal Semiconductor Inc., Aureal Vortex Sound Processor}}");
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun MODULE_DEVICE_TABLE(pci, snd_vortex_ids);
47*4882a593Smuzhiyun
vortex_fix_latency(struct pci_dev * vortex)48*4882a593Smuzhiyun static void vortex_fix_latency(struct pci_dev *vortex)
49*4882a593Smuzhiyun {
50*4882a593Smuzhiyun int rc;
51*4882a593Smuzhiyun if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) {
52*4882a593Smuzhiyun dev_info(&vortex->dev, "vortex latency is 0xff\n");
53*4882a593Smuzhiyun } else {
54*4882a593Smuzhiyun dev_warn(&vortex->dev,
55*4882a593Smuzhiyun "could not set vortex latency: pci error 0x%x\n", rc);
56*4882a593Smuzhiyun }
57*4882a593Smuzhiyun }
58*4882a593Smuzhiyun
vortex_fix_agp_bridge(struct pci_dev * via)59*4882a593Smuzhiyun static void vortex_fix_agp_bridge(struct pci_dev *via)
60*4882a593Smuzhiyun {
61*4882a593Smuzhiyun int rc;
62*4882a593Smuzhiyun u8 value;
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun /*
65*4882a593Smuzhiyun * only set the bit (Extend PCI#2 Internal Master for
66*4882a593Smuzhiyun * Efficient Handling of Dummy Requests) if the can
67*4882a593Smuzhiyun * read the config and it is not already set
68*4882a593Smuzhiyun */
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun if (!(rc = pci_read_config_byte(via, 0x42, &value))
71*4882a593Smuzhiyun && ((value & 0x10)
72*4882a593Smuzhiyun || !(rc = pci_write_config_byte(via, 0x42, value | 0x10)))) {
73*4882a593Smuzhiyun dev_info(&via->dev, "bridge config is 0x%x\n", value | 0x10);
74*4882a593Smuzhiyun } else {
75*4882a593Smuzhiyun dev_warn(&via->dev,
76*4882a593Smuzhiyun "could not set vortex latency: pci error 0x%x\n", rc);
77*4882a593Smuzhiyun }
78*4882a593Smuzhiyun }
79*4882a593Smuzhiyun
snd_vortex_workaround(struct pci_dev * vortex,int fix)80*4882a593Smuzhiyun static void snd_vortex_workaround(struct pci_dev *vortex, int fix)
81*4882a593Smuzhiyun {
82*4882a593Smuzhiyun struct pci_dev *via = NULL;
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun /* autodetect if workarounds are required */
85*4882a593Smuzhiyun if (fix == 255) {
86*4882a593Smuzhiyun /* VIA KT133 */
87*4882a593Smuzhiyun via = pci_get_device(PCI_VENDOR_ID_VIA,
88*4882a593Smuzhiyun PCI_DEVICE_ID_VIA_8365_1, NULL);
89*4882a593Smuzhiyun /* VIA Apollo */
90*4882a593Smuzhiyun if (via == NULL) {
91*4882a593Smuzhiyun via = pci_get_device(PCI_VENDOR_ID_VIA,
92*4882a593Smuzhiyun PCI_DEVICE_ID_VIA_82C598_1, NULL);
93*4882a593Smuzhiyun /* AMD Irongate */
94*4882a593Smuzhiyun if (via == NULL)
95*4882a593Smuzhiyun via = pci_get_device(PCI_VENDOR_ID_AMD,
96*4882a593Smuzhiyun PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
97*4882a593Smuzhiyun }
98*4882a593Smuzhiyun if (via) {
99*4882a593Smuzhiyun dev_info(&vortex->dev,
100*4882a593Smuzhiyun "Activating latency workaround...\n");
101*4882a593Smuzhiyun vortex_fix_latency(vortex);
102*4882a593Smuzhiyun vortex_fix_agp_bridge(via);
103*4882a593Smuzhiyun }
104*4882a593Smuzhiyun } else {
105*4882a593Smuzhiyun if (fix & 0x1)
106*4882a593Smuzhiyun vortex_fix_latency(vortex);
107*4882a593Smuzhiyun if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
108*4882a593Smuzhiyun PCI_DEVICE_ID_VIA_8365_1, NULL)))
109*4882a593Smuzhiyun vortex_fix_agp_bridge(via);
110*4882a593Smuzhiyun if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
111*4882a593Smuzhiyun PCI_DEVICE_ID_VIA_82C598_1, NULL)))
112*4882a593Smuzhiyun vortex_fix_agp_bridge(via);
113*4882a593Smuzhiyun if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD,
114*4882a593Smuzhiyun PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
115*4882a593Smuzhiyun vortex_fix_agp_bridge(via);
116*4882a593Smuzhiyun }
117*4882a593Smuzhiyun pci_dev_put(via);
118*4882a593Smuzhiyun }
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun // component-destructor
121*4882a593Smuzhiyun // (see "Management of Cards and Components")
snd_vortex_dev_free(struct snd_device * device)122*4882a593Smuzhiyun static int snd_vortex_dev_free(struct snd_device *device)
123*4882a593Smuzhiyun {
124*4882a593Smuzhiyun vortex_t *vortex = device->device_data;
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun vortex_gameport_unregister(vortex);
127*4882a593Smuzhiyun vortex_core_shutdown(vortex);
128*4882a593Smuzhiyun // Take down PCI interface.
129*4882a593Smuzhiyun free_irq(vortex->irq, vortex);
130*4882a593Smuzhiyun iounmap(vortex->mmio);
131*4882a593Smuzhiyun pci_release_regions(vortex->pci_dev);
132*4882a593Smuzhiyun pci_disable_device(vortex->pci_dev);
133*4882a593Smuzhiyun kfree(vortex);
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun return 0;
136*4882a593Smuzhiyun }
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun // chip-specific constructor
139*4882a593Smuzhiyun // (see "Management of Cards and Components")
140*4882a593Smuzhiyun static int
snd_vortex_create(struct snd_card * card,struct pci_dev * pci,vortex_t ** rchip)141*4882a593Smuzhiyun snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
142*4882a593Smuzhiyun {
143*4882a593Smuzhiyun vortex_t *chip;
144*4882a593Smuzhiyun int err;
145*4882a593Smuzhiyun static const struct snd_device_ops ops = {
146*4882a593Smuzhiyun .dev_free = snd_vortex_dev_free,
147*4882a593Smuzhiyun };
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun *rchip = NULL;
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun // check PCI availability (DMA).
152*4882a593Smuzhiyun if ((err = pci_enable_device(pci)) < 0)
153*4882a593Smuzhiyun return err;
154*4882a593Smuzhiyun if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
155*4882a593Smuzhiyun dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
156*4882a593Smuzhiyun dev_err(card->dev, "error to set DMA mask\n");
157*4882a593Smuzhiyun pci_disable_device(pci);
158*4882a593Smuzhiyun return -ENXIO;
159*4882a593Smuzhiyun }
160*4882a593Smuzhiyun
161*4882a593Smuzhiyun chip = kzalloc(sizeof(*chip), GFP_KERNEL);
162*4882a593Smuzhiyun if (chip == NULL) {
163*4882a593Smuzhiyun pci_disable_device(pci);
164*4882a593Smuzhiyun return -ENOMEM;
165*4882a593Smuzhiyun }
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun chip->card = card;
168*4882a593Smuzhiyun
169*4882a593Smuzhiyun // initialize the stuff
170*4882a593Smuzhiyun chip->pci_dev = pci;
171*4882a593Smuzhiyun chip->io = pci_resource_start(pci, 0);
172*4882a593Smuzhiyun chip->vendor = pci->vendor;
173*4882a593Smuzhiyun chip->device = pci->device;
174*4882a593Smuzhiyun chip->card = card;
175*4882a593Smuzhiyun chip->irq = -1;
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun // (1) PCI resource allocation
178*4882a593Smuzhiyun // Get MMIO area
179*4882a593Smuzhiyun //
180*4882a593Smuzhiyun if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0)
181*4882a593Smuzhiyun goto regions_out;
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun chip->mmio = pci_ioremap_bar(pci, 0);
184*4882a593Smuzhiyun if (!chip->mmio) {
185*4882a593Smuzhiyun dev_err(card->dev, "MMIO area remap failed.\n");
186*4882a593Smuzhiyun err = -ENOMEM;
187*4882a593Smuzhiyun goto ioremap_out;
188*4882a593Smuzhiyun }
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun /* Init audio core.
191*4882a593Smuzhiyun * This must be done before we do request_irq otherwise we can get spurious
192*4882a593Smuzhiyun * interrupts that we do not handle properly and make a mess of things */
193*4882a593Smuzhiyun if ((err = vortex_core_init(chip)) != 0) {
194*4882a593Smuzhiyun dev_err(card->dev, "hw core init failed\n");
195*4882a593Smuzhiyun goto core_out;
196*4882a593Smuzhiyun }
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun if ((err = request_irq(pci->irq, vortex_interrupt,
199*4882a593Smuzhiyun IRQF_SHARED, KBUILD_MODNAME,
200*4882a593Smuzhiyun chip)) != 0) {
201*4882a593Smuzhiyun dev_err(card->dev, "cannot grab irq\n");
202*4882a593Smuzhiyun goto irq_out;
203*4882a593Smuzhiyun }
204*4882a593Smuzhiyun chip->irq = pci->irq;
205*4882a593Smuzhiyun card->sync_irq = chip->irq;
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun pci_set_master(pci);
208*4882a593Smuzhiyun // End of PCI setup.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun // Register alsa root device.
211*4882a593Smuzhiyun if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
212*4882a593Smuzhiyun goto alloc_out;
213*4882a593Smuzhiyun }
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun *rchip = chip;
216*4882a593Smuzhiyun
217*4882a593Smuzhiyun return 0;
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun alloc_out:
220*4882a593Smuzhiyun free_irq(chip->irq, chip);
221*4882a593Smuzhiyun irq_out:
222*4882a593Smuzhiyun vortex_core_shutdown(chip);
223*4882a593Smuzhiyun core_out:
224*4882a593Smuzhiyun iounmap(chip->mmio);
225*4882a593Smuzhiyun ioremap_out:
226*4882a593Smuzhiyun pci_release_regions(chip->pci_dev);
227*4882a593Smuzhiyun regions_out:
228*4882a593Smuzhiyun pci_disable_device(chip->pci_dev);
229*4882a593Smuzhiyun //FIXME: this not the right place to unregister the gameport
230*4882a593Smuzhiyun vortex_gameport_unregister(chip);
231*4882a593Smuzhiyun kfree(chip);
232*4882a593Smuzhiyun return err;
233*4882a593Smuzhiyun }
234*4882a593Smuzhiyun
235*4882a593Smuzhiyun // constructor -- see "Constructor" sub-section
236*4882a593Smuzhiyun static int
snd_vortex_probe(struct pci_dev * pci,const struct pci_device_id * pci_id)237*4882a593Smuzhiyun snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
238*4882a593Smuzhiyun {
239*4882a593Smuzhiyun static int dev;
240*4882a593Smuzhiyun struct snd_card *card;
241*4882a593Smuzhiyun vortex_t *chip;
242*4882a593Smuzhiyun int err;
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun // (1)
245*4882a593Smuzhiyun if (dev >= SNDRV_CARDS)
246*4882a593Smuzhiyun return -ENODEV;
247*4882a593Smuzhiyun if (!enable[dev]) {
248*4882a593Smuzhiyun dev++;
249*4882a593Smuzhiyun return -ENOENT;
250*4882a593Smuzhiyun }
251*4882a593Smuzhiyun // (2)
252*4882a593Smuzhiyun err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
253*4882a593Smuzhiyun 0, &card);
254*4882a593Smuzhiyun if (err < 0)
255*4882a593Smuzhiyun return err;
256*4882a593Smuzhiyun
257*4882a593Smuzhiyun // (3)
258*4882a593Smuzhiyun if ((err = snd_vortex_create(card, pci, &chip)) < 0) {
259*4882a593Smuzhiyun snd_card_free(card);
260*4882a593Smuzhiyun return err;
261*4882a593Smuzhiyun }
262*4882a593Smuzhiyun snd_vortex_workaround(pci, pcifix[dev]);
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun // Card details needed in snd_vortex_midi
265*4882a593Smuzhiyun strcpy(card->driver, CARD_NAME_SHORT);
266*4882a593Smuzhiyun sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT);
267*4882a593Smuzhiyun sprintf(card->longname, "%s at 0x%lx irq %i",
268*4882a593Smuzhiyun card->shortname, chip->io, chip->irq);
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun // (4) Alloc components.
271*4882a593Smuzhiyun err = snd_vortex_mixer(chip);
272*4882a593Smuzhiyun if (err < 0) {
273*4882a593Smuzhiyun snd_card_free(card);
274*4882a593Smuzhiyun return err;
275*4882a593Smuzhiyun }
276*4882a593Smuzhiyun // ADB pcm.
277*4882a593Smuzhiyun err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_PCM);
278*4882a593Smuzhiyun if (err < 0) {
279*4882a593Smuzhiyun snd_card_free(card);
280*4882a593Smuzhiyun return err;
281*4882a593Smuzhiyun }
282*4882a593Smuzhiyun #ifndef CHIP_AU8820
283*4882a593Smuzhiyun // ADB SPDIF
284*4882a593Smuzhiyun if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_SPDIF, 1)) < 0) {
285*4882a593Smuzhiyun snd_card_free(card);
286*4882a593Smuzhiyun return err;
287*4882a593Smuzhiyun }
288*4882a593Smuzhiyun // A3D
289*4882a593Smuzhiyun if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_A3D, NR_A3D)) < 0) {
290*4882a593Smuzhiyun snd_card_free(card);
291*4882a593Smuzhiyun return err;
292*4882a593Smuzhiyun }
293*4882a593Smuzhiyun #endif
294*4882a593Smuzhiyun /*
295*4882a593Smuzhiyun // ADB I2S
296*4882a593Smuzhiyun if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_I2S, 1)) < 0) {
297*4882a593Smuzhiyun snd_card_free(card);
298*4882a593Smuzhiyun return err;
299*4882a593Smuzhiyun }
300*4882a593Smuzhiyun */
301*4882a593Smuzhiyun #ifndef CHIP_AU8810
302*4882a593Smuzhiyun // WT pcm.
303*4882a593Smuzhiyun if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_WT, NR_WT)) < 0) {
304*4882a593Smuzhiyun snd_card_free(card);
305*4882a593Smuzhiyun return err;
306*4882a593Smuzhiyun }
307*4882a593Smuzhiyun #endif
308*4882a593Smuzhiyun if ((err = snd_vortex_midi(chip)) < 0) {
309*4882a593Smuzhiyun snd_card_free(card);
310*4882a593Smuzhiyun return err;
311*4882a593Smuzhiyun }
312*4882a593Smuzhiyun
313*4882a593Smuzhiyun vortex_gameport_register(chip);
314*4882a593Smuzhiyun
315*4882a593Smuzhiyun #if 0
316*4882a593Smuzhiyun if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_VORTEX_SYNTH,
317*4882a593Smuzhiyun sizeof(snd_vortex_synth_arg_t), &wave) < 0
318*4882a593Smuzhiyun || wave == NULL) {
319*4882a593Smuzhiyun dev_err(card->dev, "Can't initialize Aureal wavetable synth\n");
320*4882a593Smuzhiyun } else {
321*4882a593Smuzhiyun snd_vortex_synth_arg_t *arg;
322*4882a593Smuzhiyun
323*4882a593Smuzhiyun arg = SNDRV_SEQ_DEVICE_ARGPTR(wave);
324*4882a593Smuzhiyun strcpy(wave->name, "Aureal Synth");
325*4882a593Smuzhiyun arg->hwptr = vortex;
326*4882a593Smuzhiyun arg->index = 1;
327*4882a593Smuzhiyun arg->seq_ports = seq_ports[dev];
328*4882a593Smuzhiyun arg->max_voices = max_synth_voices[dev];
329*4882a593Smuzhiyun }
330*4882a593Smuzhiyun #endif
331*4882a593Smuzhiyun
332*4882a593Smuzhiyun // (5)
333*4882a593Smuzhiyun if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
334*4882a593Smuzhiyun &(chip->device))) < 0) {
335*4882a593Smuzhiyun snd_card_free(card);
336*4882a593Smuzhiyun return err;
337*4882a593Smuzhiyun }
338*4882a593Smuzhiyun if ((err = pci_read_config_word(pci, PCI_VENDOR_ID,
339*4882a593Smuzhiyun &(chip->vendor))) < 0) {
340*4882a593Smuzhiyun snd_card_free(card);
341*4882a593Smuzhiyun return err;
342*4882a593Smuzhiyun }
343*4882a593Smuzhiyun chip->rev = pci->revision;
344*4882a593Smuzhiyun #ifdef CHIP_AU8830
345*4882a593Smuzhiyun if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {
346*4882a593Smuzhiyun dev_alert(card->dev,
347*4882a593Smuzhiyun "The revision (%x) of your card has not been seen before.\n",
348*4882a593Smuzhiyun chip->rev);
349*4882a593Smuzhiyun dev_alert(card->dev,
350*4882a593Smuzhiyun "Please email the results of 'lspci -vv' to openvortex-dev@nongnu.org.\n");
351*4882a593Smuzhiyun snd_card_free(card);
352*4882a593Smuzhiyun err = -ENODEV;
353*4882a593Smuzhiyun return err;
354*4882a593Smuzhiyun }
355*4882a593Smuzhiyun #endif
356*4882a593Smuzhiyun
357*4882a593Smuzhiyun // (6)
358*4882a593Smuzhiyun if ((err = snd_card_register(card)) < 0) {
359*4882a593Smuzhiyun snd_card_free(card);
360*4882a593Smuzhiyun return err;
361*4882a593Smuzhiyun }
362*4882a593Smuzhiyun // (7)
363*4882a593Smuzhiyun pci_set_drvdata(pci, card);
364*4882a593Smuzhiyun dev++;
365*4882a593Smuzhiyun vortex_connect_default(chip, 1);
366*4882a593Smuzhiyun vortex_enable_int(chip);
367*4882a593Smuzhiyun return 0;
368*4882a593Smuzhiyun }
369*4882a593Smuzhiyun
370*4882a593Smuzhiyun // destructor -- see "Destructor" sub-section
snd_vortex_remove(struct pci_dev * pci)371*4882a593Smuzhiyun static void snd_vortex_remove(struct pci_dev *pci)
372*4882a593Smuzhiyun {
373*4882a593Smuzhiyun snd_card_free(pci_get_drvdata(pci));
374*4882a593Smuzhiyun }
375*4882a593Smuzhiyun
376*4882a593Smuzhiyun // pci_driver definition
377*4882a593Smuzhiyun static struct pci_driver vortex_driver = {
378*4882a593Smuzhiyun .name = KBUILD_MODNAME,
379*4882a593Smuzhiyun .id_table = snd_vortex_ids,
380*4882a593Smuzhiyun .probe = snd_vortex_probe,
381*4882a593Smuzhiyun .remove = snd_vortex_remove,
382*4882a593Smuzhiyun };
383*4882a593Smuzhiyun
384*4882a593Smuzhiyun module_pci_driver(vortex_driver);
385