blob: 008e8e5bfa37ae76e235d1c8b873b5c1f4e3ff4a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Driver for Gravis UltraSound Extreme soundcards
Jaroslav Kyselac1017a42007-10-15 09:50:19 +02003 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/init.h>
Takashi Iwai654aa662005-11-17 17:13:43 +010023#include <linux/err.h>
Rene Hermanb44dfe12007-02-19 13:07:17 +010024#include <linux/isa.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <linux/delay.h>
26#include <linux/time.h>
27#include <linux/moduleparam.h>
Takashi Iwai654aa662005-11-17 17:13:43 +010028#include <asm/dma.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <sound/core.h>
30#include <sound/gus.h>
31#include <sound/es1688.h>
32#include <sound/mpu401.h>
33#include <sound/opl3.h>
34#define SNDRV_LEGACY_AUTO_PROBE
35#define SNDRV_LEGACY_FIND_FREE_IRQ
36#define SNDRV_LEGACY_FIND_FREE_DMA
37#include <sound/initval.h>
38
Rene Hermanb44dfe12007-02-19 13:07:17 +010039#define CRD_NAME "Gravis UltraSound Extreme"
40#define DEV_NAME "gusextreme"
41
42MODULE_DESCRIPTION(CRD_NAME);
Jaroslav Kyselac1017a42007-10-15 09:50:19 +020043MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
Linus Torvalds1da177e2005-04-16 15:20:36 -070044MODULE_LICENSE("GPL");
45MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Extreme}}");
46
47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
49static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
50static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
51static long gf1_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x210,0x220,0x230,0x240,0x250,0x260,0x270 */
52static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x300,0x310,0x320 */
53static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */
54static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */
55static int gf1_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,3,5,9,11,12,15 */
56static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */
57static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
58static int joystick_dac[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 29};
59 /* 0 to 31, (0.59V-4.52V or 0.389V-2.98V) */
60static int channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 24};
61static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
62
63module_param_array(index, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010064MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070065module_param_array(id, charp, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010066MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070067module_param_array(enable, bool, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010068MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070069module_param_array(port, long, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010070MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070071module_param_array(gf1_port, long, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010072MODULE_PARM_DESC(gf1_port, "GF1 port # for " CRD_NAME " driver (optional).");
Linus Torvalds1da177e2005-04-16 15:20:36 -070073module_param_array(mpu_port, long, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010074MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070075module_param_array(irq, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010076MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070077module_param_array(mpu_irq, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010078MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070079module_param_array(gf1_irq, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010080MODULE_PARM_DESC(gf1_irq, "GF1 IRQ # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070081module_param_array(dma8, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010082MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070083module_param_array(dma1, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010084MODULE_PARM_DESC(dma1, "GF1 DMA # for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070085module_param_array(joystick_dac, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010086MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070087module_param_array(channels, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010088MODULE_PARM_DESC(channels, "GF1 channels for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070089module_param_array(pcm_channels, int, NULL, 0444);
Rene Hermanb44dfe12007-02-19 13:07:17 +010090MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver.");
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Rene Hermanb44dfe12007-02-19 13:07:17 +010092static int __devinit snd_gusextreme_match(struct device *dev, unsigned int n)
93{
94 return enable[n];
95}
Clemens Ladischf7a92752005-12-07 09:13:42 +010096
Rene Hermanb44dfe12007-02-19 13:07:17 +010097static int __devinit snd_gusextreme_es1688_create(struct snd_card *card,
Krzysztof Helt396fa822010-05-09 20:35:44 +020098 struct snd_es1688 *chip, struct device *dev, unsigned int n)
Rene Hermanb44dfe12007-02-19 13:07:17 +010099{
100 static long possible_ports[] = {0x220, 0x240, 0x260};
101 static int possible_irqs[] = {5, 9, 10, 7, -1};
102 static int possible_dmas[] = {1, 3, 0, -1};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Rene Hermanb44dfe12007-02-19 13:07:17 +0100104 int i, error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
Rene Hermanb44dfe12007-02-19 13:07:17 +0100106 if (irq[n] == SNDRV_AUTO_IRQ) {
107 irq[n] = snd_legacy_find_free_irq(possible_irqs);
108 if (irq[n] < 0) {
Takashi Iwai0418ff02008-11-03 08:51:33 +0100109 dev_err(dev, "unable to find a free IRQ for ES1688\n");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100110 return -EBUSY;
111 }
112 }
113 if (dma8[n] == SNDRV_AUTO_DMA) {
114 dma8[n] = snd_legacy_find_free_dma(possible_dmas);
115 if (dma8[n] < 0) {
Takashi Iwai0418ff02008-11-03 08:51:33 +0100116 dev_err(dev, "unable to find a free DMA for ES1688\n");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100117 return -EBUSY;
118 }
119 }
120
121 if (port[n] != SNDRV_AUTO_PORT)
Krzysztof Helt396fa822010-05-09 20:35:44 +0200122 return snd_es1688_create(card, chip, port[n], mpu_port[n],
123 irq[n], mpu_irq[n], dma8[n], ES1688_HW_1688);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100124
125 i = 0;
126 do {
127 port[n] = possible_ports[i];
Krzysztof Helt396fa822010-05-09 20:35:44 +0200128 error = snd_es1688_create(card, chip, port[n], mpu_port[n],
129 irq[n], mpu_irq[n], dma8[n], ES1688_HW_1688);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100130 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports));
131
132 return error;
133}
134
135static int __devinit snd_gusextreme_gus_card_create(struct snd_card *card,
136 struct device *dev, unsigned int n, struct snd_gus_card **rgus)
137{
138 static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1};
139 static int possible_dmas[] = {5, 6, 7, 3, 1, -1};
140
141 if (gf1_irq[n] == SNDRV_AUTO_IRQ) {
142 gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs);
143 if (gf1_irq[n] < 0) {
Takashi Iwai0418ff02008-11-03 08:51:33 +0100144 dev_err(dev, "unable to find a free IRQ for GF1\n");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100145 return -EBUSY;
146 }
147 }
148 if (dma1[n] == SNDRV_AUTO_DMA) {
149 dma1[n] = snd_legacy_find_free_dma(possible_dmas);
150 if (dma1[n] < 0) {
Takashi Iwai0418ff02008-11-03 08:51:33 +0100151 dev_err(dev, "unable to find a free DMA for GF1\n");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100152 return -EBUSY;
153 }
154 }
155 return snd_gus_create(card, gf1_port[n], gf1_irq[n], dma1[n], -1,
156 0, channels[n], pcm_channels[n], 0, rgus);
157}
158
159static int __devinit snd_gusextreme_detect(struct snd_gus_card *gus,
160 struct snd_es1688 *es1688)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161{
162 unsigned long flags;
Takashi Iwai43bcd972005-09-05 17:19:20 +0200163 unsigned char d;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
165 /*
166 * This is main stuff - enable access to GF1 chip...
167 * I'm not sure, if this will work for card which have
168 * ES1688 chip in another place than 0x220.
169 *
170 * I used reverse-engineering in DOSEMU. [--jk]
171 *
172 * ULTRINIT.EXE:
173 * 0x230 = 0,2,3
174 * 0x240 = 2,0,1
175 * 0x250 = 2,0,3
176 * 0x260 = 2,2,1
177 */
178
179 spin_lock_irqsave(&es1688->mixer_lock, flags);
180 snd_es1688_mixer_write(es1688, 0x40, 0x0b); /* don't change!!! */
181 spin_unlock_irqrestore(&es1688->mixer_lock, flags);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100182
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 spin_lock_irqsave(&es1688->reg_lock, flags);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100184 outb(gus->gf1.port & 0x040 ? 2 : 0, ES1688P(es1688, INIT1));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 outb(0, 0x201);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100186 outb(gus->gf1.port & 0x020 ? 2 : 0, ES1688P(es1688, INIT1));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 outb(0, 0x201);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100188 outb(gus->gf1.port & 0x010 ? 3 : 1, ES1688P(es1688, INIT1));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 spin_unlock_irqrestore(&es1688->reg_lock, flags);
190
191 udelay(100);
192
193 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
Takashi Iwai43bcd972005-09-05 17:19:20 +0200194 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
195 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 return -EIO;
Takashi Iwai43bcd972005-09-05 17:19:20 +0200197 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 udelay(160);
199 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
200 udelay(160);
Takashi Iwai43bcd972005-09-05 17:19:20 +0200201 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
202 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 return -EIO;
Takashi Iwai43bcd972005-09-05 17:19:20 +0200204 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205
Rene Hermanb44dfe12007-02-19 13:07:17 +0100206 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207}
208
Krzysztof Helt396fa822010-05-09 20:35:44 +0200209static int __devinit snd_gusextreme_mixer(struct snd_card *card)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210{
Takashi Iwai5e2da202005-11-17 14:36:44 +0100211 struct snd_ctl_elem_id id1, id2;
Rene Hermanb44dfe12007-02-19 13:07:17 +0100212 int error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
214 memset(&id1, 0, sizeof(id1));
215 memset(&id2, 0, sizeof(id2));
216 id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
Rene Hermanb44dfe12007-02-19 13:07:17 +0100217
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 /* reassign AUX to SYNTHESIZER */
219 strcpy(id1.name, "Aux Playback Volume");
220 strcpy(id2.name, "Synth Playback Volume");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100221 error = snd_ctl_rename_id(card, &id1, &id2);
222 if (error < 0)
223 return error;
224
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 /* reassign Master Playback Switch to Synth Playback Switch */
226 strcpy(id1.name, "Master Playback Switch");
227 strcpy(id2.name, "Synth Playback Switch");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100228 error = snd_ctl_rename_id(card, &id1, &id2);
229 if (error < 0)
230 return error;
231
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 return 0;
233}
234
Rene Hermanb44dfe12007-02-19 13:07:17 +0100235static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236{
Takashi Iwai5e2da202005-11-17 14:36:44 +0100237 struct snd_card *card;
Takashi Iwai5e2da202005-11-17 14:36:44 +0100238 struct snd_gus_card *gus;
239 struct snd_es1688 *es1688;
240 struct snd_opl3 *opl3;
Rene Hermanb44dfe12007-02-19 13:07:17 +0100241 int error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242
Krzysztof Helt396fa822010-05-09 20:35:44 +0200243 error = snd_card_create(index[n], id[n], THIS_MODULE,
244 sizeof(struct snd_es1688), &card);
Takashi Iwaic95eadd2008-12-28 16:43:35 +0100245 if (error < 0)
246 return error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247
Krzysztof Helt396fa822010-05-09 20:35:44 +0200248 es1688 = card->private_data;
249
Rene Hermanb44dfe12007-02-19 13:07:17 +0100250 if (mpu_port[n] == SNDRV_AUTO_PORT)
251 mpu_port[n] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252
Rene Hermanb44dfe12007-02-19 13:07:17 +0100253 if (mpu_irq[n] > 15)
254 mpu_irq[n] = -1;
255
Krzysztof Helt396fa822010-05-09 20:35:44 +0200256 error = snd_gusextreme_es1688_create(card, es1688, dev, n);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100257 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 goto out;
Takashi Iwai654aa662005-11-17 17:13:43 +0100259
Rene Hermanb44dfe12007-02-19 13:07:17 +0100260 if (gf1_port[n] < 0)
261 gf1_port[n] = es1688->port + 0x20;
262
263 error = snd_gusextreme_gus_card_create(card, dev, n, &gus);
264 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 goto out;
266
Rene Hermanb44dfe12007-02-19 13:07:17 +0100267 error = snd_gusextreme_detect(gus, es1688);
268 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269 goto out;
270
Rene Hermanb44dfe12007-02-19 13:07:17 +0100271 gus->joystick_dac = joystick_dac[n];
272
273 error = snd_gus_initialize(gus);
274 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 goto out;
276
Rene Hermanb44dfe12007-02-19 13:07:17 +0100277 error = -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 if (!gus->ess_flag) {
Takashi Iwai0418ff02008-11-03 08:51:33 +0100279 dev_err(dev, "GUS Extreme soundcard was not "
280 "detected at 0x%lx\n", gus->gf1.port);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 goto out;
282 }
Rene Herman442f4f32007-02-19 13:07:50 +0100283 gus->codec_flag = 1;
Rene Hermanb44dfe12007-02-19 13:07:17 +0100284
Krzysztof Helt396fa822010-05-09 20:35:44 +0200285 error = snd_es1688_pcm(card, es1688, 0, NULL);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100286 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 goto out;
288
Krzysztof Helt396fa822010-05-09 20:35:44 +0200289 error = snd_es1688_mixer(card, es1688);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100290 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 goto out;
292
293 snd_component_add(card, "ES1688");
Rene Hermanb44dfe12007-02-19 13:07:17 +0100294
295 if (pcm_channels[n] > 0) {
296 error = snd_gf1_pcm_new(gus, 1, 1, NULL);
297 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 goto out;
299 }
Rene Hermanb44dfe12007-02-19 13:07:17 +0100300
301 error = snd_gf1_new_mixer(gus);
302 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 goto out;
304
Krzysztof Helt396fa822010-05-09 20:35:44 +0200305 error = snd_gusextreme_mixer(card);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100306 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 goto out;
308
309 if (snd_opl3_create(card, es1688->port, es1688->port + 2,
Rene Hermanb44dfe12007-02-19 13:07:17 +0100310 OPL3_HW_OPL3, 0, &opl3) < 0)
Takashi Iwai0418ff02008-11-03 08:51:33 +0100311 dev_warn(dev, "opl3 not detected at 0x%lx\n", es1688->port);
Rene Hermanb44dfe12007-02-19 13:07:17 +0100312 else {
313 error = snd_opl3_hwdep_new(opl3, 0, 2, NULL);
314 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 goto out;
316 }
317
Rene Hermanb44dfe12007-02-19 13:07:17 +0100318 if (es1688->mpu_port >= 0x300) {
319 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
320 es1688->mpu_port, 0,
321 mpu_irq[n], IRQF_DISABLED, NULL);
322 if (error < 0)
323 goto out;
324 }
325
326 sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, "
327 "irq %i&%i, dma %i&%i", es1688->port,
328 gus->gf1.irq, es1688->irq, gus->gf1.dma1, es1688->dma8);
329
330 snd_card_set_dev(card, dev);
331
332 error = snd_card_register(card);
333 if (error < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 goto out;
335
Rene Hermanb44dfe12007-02-19 13:07:17 +0100336 dev_set_drvdata(dev, card);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 return 0;
338
Rene Hermanb44dfe12007-02-19 13:07:17 +0100339out: snd_card_free(card);
340 return error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341}
342
Rene Hermanb44dfe12007-02-19 13:07:17 +0100343static int __devexit snd_gusextreme_remove(struct device *dev, unsigned int n)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344{
Rene Hermanb44dfe12007-02-19 13:07:17 +0100345 snd_card_free(dev_get_drvdata(dev));
346 dev_set_drvdata(dev, NULL);
Takashi Iwai654aa662005-11-17 17:13:43 +0100347 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348}
349
Rene Hermanb44dfe12007-02-19 13:07:17 +0100350static struct isa_driver snd_gusextreme_driver = {
351 .match = snd_gusextreme_match,
Takashi Iwai654aa662005-11-17 17:13:43 +0100352 .probe = snd_gusextreme_probe,
Jean Delvare82ced6f2009-06-04 10:46:43 +0200353 .remove = __devexit_p(snd_gusextreme_remove),
Rene Hermanb44dfe12007-02-19 13:07:17 +0100354#if 0 /* FIXME */
355 .suspend = snd_gusextreme_suspend,
356 .resume = snd_gusextreme_resume,
357#endif
Takashi Iwai654aa662005-11-17 17:13:43 +0100358 .driver = {
Rene Hermanb44dfe12007-02-19 13:07:17 +0100359 .name = DEV_NAME
360 }
Takashi Iwai654aa662005-11-17 17:13:43 +0100361};
362
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363static int __init alsa_card_gusextreme_init(void)
364{
Rene Hermanb44dfe12007-02-19 13:07:17 +0100365 return isa_register_driver(&snd_gusextreme_driver, SNDRV_CARDS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366}
367
368static void __exit alsa_card_gusextreme_exit(void)
369{
Rene Hermanb44dfe12007-02-19 13:07:17 +0100370 isa_unregister_driver(&snd_gusextreme_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371}
372
Rene Hermanb44dfe12007-02-19 13:07:17 +0100373module_init(alsa_card_gusextreme_init);
374module_exit(alsa_card_gusextreme_exit);