1 |
/* |
/* |
2 |
* ALSA driver for the Aureal Vortex family of soundprocessors. |
* ALSA driver for the Aureal Vortex family of soundprocessors. |
3 |
* Author: Manuel Jander (mjander@embedded.cl) |
* Author: Manuel Jander (mjander@embedded.cl) |
4 |
* |
* |
5 |
* This driver is the result of the OpenVortex Project from Savannah |
* This driver is the result of the OpenVortex Project from Savannah |
6 |
* (savannah.nongnu.org/projects/openvortex). I would like to thank |
* (savannah.nongnu.org/projects/openvortex). I would like to thank |
7 |
* the developers of OpenVortex, Jeff Muizelar and Kester Maddock, from |
* the developers of OpenVortex, Jeff Muizelar and Kester Maddock, from |
13 |
* |
* |
14 |
* Now at least i can play Legacy DOOM with MIDI music :-) |
* Now at least i can play Legacy DOOM with MIDI music :-) |
15 |
*/ |
*/ |
16 |
|
|
17 |
#include "au88x0.h" |
#include "au88x0.h" |
18 |
#include <linux/init.h> |
#include <linux/init.h> |
19 |
#include <linux/pci.h> |
#include <linux/pci.h> |
21 |
#define SNDRV_GET_ID |
#define SNDRV_GET_ID |
22 |
#include <sound/initval.h> |
#include <sound/initval.h> |
23 |
|
|
|
|
|
24 |
// module parameters (see "Module Parameters") |
// module parameters (see "Module Parameters") |
25 |
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
26 |
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
60 |
|
|
61 |
MODULE_DEVICE_TABLE(pci, snd_vortex_ids); |
MODULE_DEVICE_TABLE(pci, snd_vortex_ids); |
62 |
|
|
63 |
|
|
64 |
// chip-specific destructor |
// chip-specific destructor |
65 |
// (see "PCI Resource Managements") |
// (see "PCI Resource Managements") |
66 |
static int snd_vortex_free(vortex_t * vortex) { |
static int snd_vortex_free(vortex_t * vortex) { |
67 |
|
|
68 |
vortex_gameport_unregister(vortex); |
vortex_gameport_unregister(vortex); |
69 |
vortex_core_shutdown(vortex); |
vortex_core_shutdown(vortex); |
70 |
// Take down PCI interface. |
// Take down PCI interface. |
97 |
|
|
98 |
*rchip = NULL; |
*rchip = NULL; |
99 |
|
|
100 |
// check PCI availability (DMA). |
// check PCI availability (DMA). |
101 |
if ((err = pci_enable_device(pci)) < 0) |
if ((err = pci_enable_device(pci)) < 0) |
102 |
return err; |
return err; |
103 |
if (!pci_dma_supported(pci, VORTEX_DMA_MASK)) { |
if (!pci_dma_supported(pci, VORTEX_DMA_MASK)) { |
145 |
return -EBUSY; |
return -EBUSY; |
146 |
} |
} |
147 |
chip->port0 = request_region(pci_resource_start(pci, 1), 8, CARD_NAME_SHORT); |
chip->port0 = request_region(pci_resource_start(pci, 1), 8, CARD_NAME_SHORT); |
148 |
|
|
149 |
if (check_region(pci_resource_start(pci, 2), 8)) { |
if (check_region(pci_resource_start(pci, 2), 8)) { |
150 |
snd_vortex_free(chip); |
snd_vortex_free(chip); |
151 |
printk(KERN_ERR "cannot allocate the I/O port1.\n"); |
printk(KERN_ERR "cannot allocate the I/O port1.\n"); |
152 |
return -EBUSY; |
return -EBUSY; |
153 |
} |
} |
154 |
chip->port1 = request_region(pci_resource_start(pci, 2), 8, CARD_NAME_SHORT); |
chip->port1 = request_region(pci_resource_start(pci, 2), 8, CARD_NAME_SHORT); |
155 |
|
|
156 |
if (request_irq(pci->irq, vortex_interrupt, SA_INTERRUPT | SA_SHIRQ, |
if (request_irq(pci->irq, vortex_interrupt, SA_INTERRUPT | SA_SHIRQ, |
157 |
CARD_NAME_SHORT, (void *) chip)) { |
CARD_NAME_SHORT, (void *) chip)) { |
158 |
snd_vortex_free(chip); |
snd_vortex_free(chip); |
159 |
printk(KERN_ERR "cannot grab irq\n"); |
printk(KERN_ERR "cannot grab irq\n"); |
216 |
if ((err = snd_vortex_mixer(chip)) < 0) { |
if ((err = snd_vortex_mixer(chip)) < 0) { |
217 |
snd_card_free(card); |
snd_card_free(card); |
218 |
return err; |
return err; |
219 |
} |
} |
220 |
if ((err = snd_vortex_midi(chip)) < 0) { |
if ((err = snd_vortex_midi(chip)) < 0) { |
221 |
snd_card_free(card); |
snd_card_free(card); |
222 |
return err; |
return err; |
263 |
static void __devexit snd_vortex_remove(struct pci_dev *pci) { |
static void __devexit snd_vortex_remove(struct pci_dev *pci) { |
264 |
vortex_t *vortex = snd_magic_cast(vortex_t, |
vortex_t *vortex = snd_magic_cast(vortex_t, |
265 |
pci_get_drvdata(pci), return); |
pci_get_drvdata(pci), return); |
266 |
|
|
267 |
if (vortex) { |
if (vortex) { |
268 |
// Release ALSA stuff. |
// Release ALSA stuff. |
269 |
snd_card_free(vortex->card); |
snd_card_free(vortex->card); |
270 |
// Free Vortex struct. |
// Free Vortex struct. |
271 |
pci_set_drvdata(pci, NULL); |
pci_set_drvdata(pci, NULL); |
272 |
} else |
} else |
273 |
printk("snd_vortex_remove called more than one time!\n"); |
printk("snd_vortex_remove called more than one time!\n"); |
302 |
module_init(alsa_card_vortex_init) |
module_init(alsa_card_vortex_init) |
303 |
module_exit(alsa_card_vortex_exit) |
module_exit(alsa_card_vortex_exit) |
304 |
|
|
305 |
// for old kernels only |
// for old kernels only |
306 |
EXPORT_NO_SYMBOLS; |
EXPORT_NO_SYMBOLS; |