2 * Driver for Trident 4DWave DX/NX & SiS SI7018 Audio PCI soundcard
4 * Driver was originated by Trident <audio@tridentmicro.com>
5 * Fri Feb 19 15:55:28 MST 1999
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <sound/driver.h>
25 #include <linux/init.h>
26 #include <linux/pci.h>
27 #include <linux/time.h>
28 #include <linux/moduleparam.h>
29 #include <sound/core.h>
30 #include <sound/trident.h>
31 #include <sound/initval.h>
33 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, <audio@tridentmicro.com>");
34 MODULE_DESCRIPTION("Trident 4D-WaveDX/NX & SiS SI7018");
35 MODULE_LICENSE("GPL");
36 MODULE_SUPPORTED_DEVICE("{{Trident,4DWave DX},"
37 "{Trident,4DWave NX},"
38 "{SiS,SI7018 PCI Audio},"
39 "{Best Union,Miss Melody 4DWave PCI},"
41 "{Warpspeed,ONSpeed 4DWave PCI},"
42 "{Aztech Systems,PCI 64-Q3D},"
44 "{CHIC,True Sound 4Dwave},"
45 "{Shark,Predator4D-PCI},"
46 "{Jaton,SonicWave 4D},"
47 "{Hoontech,SoundTrack Digital 4DWave NX}}");
49 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
50 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
51 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
52 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32};
53 static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192};
55 module_param_array(index, int, NULL, 0444);
56 MODULE_PARM_DESC(index, "Index value for Trident 4DWave PCI soundcard.");
57 module_param_array(id, charp, NULL, 0444);
58 MODULE_PARM_DESC(id, "ID string for Trident 4DWave PCI soundcard.");
59 module_param_array(enable, bool, NULL, 0444);
60 MODULE_PARM_DESC(enable, "Enable Trident 4DWave PCI soundcard.");
61 module_param_array(pcm_channels, int, NULL, 0444);
62 MODULE_PARM_DESC(pcm_channels, "Number of hardware channels assigned for PCM.");
63 module_param_array(wavetable_size, int, NULL, 0444);
64 MODULE_PARM_DESC(wavetable_size, "Maximum memory size in kB for wavetable synth.");
66 static struct pci_device_id snd_trident_ids[] = {
67 { 0x1023, 0x2000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Trident 4DWave DX PCI Audio */
68 { 0x1023, 0x2001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* Trident 4DWave NX PCI Audio */
69 { 0x1039, 0x7018, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* SiS SI7018 PCI Audio */
73 MODULE_DEVICE_TABLE(pci, snd_trident_ids);
75 static int __devinit snd_trident_probe(struct pci_dev *pci,
76 const struct pci_device_id *pci_id)
79 struct snd_card *card;
80 struct snd_trident *trident;
84 if (dev >= SNDRV_CARDS)
91 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
95 if ((err = snd_trident_create(card, pci,
97 ((pci->vendor << 16) | pci->device) == TRIDENT_DEVICE_ID_SI7018 ? 1 : 2,
103 card->private_data = trident;
105 switch (trident->device) {
106 case TRIDENT_DEVICE_ID_DX:
107 str = "TRID4DWAVEDX";
109 case TRIDENT_DEVICE_ID_NX:
110 str = "TRID4DWAVENX";
112 case TRIDENT_DEVICE_ID_SI7018:
118 strcpy(card->driver, str);
119 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
120 strcpy(card->shortname, "SiS ");
122 strcpy(card->shortname, "Trident ");
124 strcat(card->shortname, card->driver);
125 sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d",
126 card->shortname, trident->port, trident->irq);
128 if ((err = snd_trident_pcm(trident, pcm_dev++, NULL)) < 0) {
132 switch (trident->device) {
133 case TRIDENT_DEVICE_ID_DX:
134 case TRIDENT_DEVICE_ID_NX:
135 if ((err = snd_trident_foldback_pcm(trident, pcm_dev++, NULL)) < 0) {
141 if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) {
142 if ((err = snd_trident_spdif_pcm(trident, pcm_dev++, NULL)) < 0) {
147 if (trident->device != TRIDENT_DEVICE_ID_SI7018 &&
148 (err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE,
149 trident->midi_port, 1,
150 trident->irq, 0, &trident->rmidi)) < 0) {
155 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
156 if ((err = snd_trident_attach_synthesizer(trident)) < 0) {
162 snd_trident_create_gameport(trident);
164 if ((err = snd_card_register(card)) < 0) {
168 pci_set_drvdata(pci, card);
173 static void __devexit snd_trident_remove(struct pci_dev *pci)
175 snd_card_free(pci_get_drvdata(pci));
176 pci_set_drvdata(pci, NULL);
179 static struct pci_driver driver = {
180 .name = "Trident4DWaveAudio",
181 .id_table = snd_trident_ids,
182 .probe = snd_trident_probe,
183 .remove = __devexit_p(snd_trident_remove),
185 .suspend = snd_trident_suspend,
186 .resume = snd_trident_resume,
190 static int __init alsa_card_trident_init(void)
192 return pci_register_driver(&driver);
195 static void __exit alsa_card_trident_exit(void)
197 pci_unregister_driver(&driver);
200 module_init(alsa_card_trident_init)
201 module_exit(alsa_card_trident_exit)