1 /*********************************************************************
2 *
3 * Linux multisound pinnacle/fiji driver for ALSA.
4 *
5 * 2002/06/30 Karsten Wiese:
6 * for now this is only used to build a pinnacle / fiji driver.
7 * the OSS parent of this code is designed to also support
8 * the multisound classic via the file msnd_classic.c.
9 * to make it easier for some brave heart to implemt classic
10 * support in alsa, i left all the MSND_CLASSIC tokens in this file.
11 * but for now this untested & undone.
12 *
13 *
14 * ripped from linux kernel 2.4.18 by Karsten Wiese.
15 *
16 * the following is a copy of the 2.4.18 OSS FREE file-heading comment:
17 *
18 * Turtle Beach MultiSound Sound Card Driver for Linux
19 * msnd_pinnacle.c / msnd_classic.c
20 *
21 * -- If MSND_CLASSIC is defined:
22 *
23 * -> driver for Turtle Beach Classic/Monterey/Tahiti
24 *
25 * -- Else
26 *
27 * -> driver for Turtle Beach Pinnacle/Fiji
28 *
29 * 12-3-2000 Modified IO port validation Steve Sycamore
30 *
31 * Copyright (C) 1998 Andrew Veliath
32 *
33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or
36 * (at your option) any later version.
37 *
38 * This program is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 * GNU General Public License for more details.
42 *
43 * You should have received a copy of the GNU General Public License
44 * along with this program; if not, write to the Free Software
45 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
46 *
47 ********************************************************************/
48
49 #include <linux/kernel.h>
50 #include <linux/module.h>
51 #include <linux/interrupt.h>
52 #include <linux/types.h>
53 #include <linux/delay.h>
54 #include <linux/ioport.h>
55 #include <linux/firmware.h>
56 #include <linux/isa.h>
57 #include <linux/isapnp.h>
58 #include <linux/irq.h>
59 #include <linux/io.h>
60
61 #include <sound/core.h>
62 #include <sound/initval.h>
63 #include <sound/asound.h>
64 #include <sound/pcm.h>
65 #include <sound/mpu401.h>
66
67 #ifdef MSND_CLASSIC
68 # ifndef __alpha__
69 # define SLOWIO
70 # endif
71 #endif
72 #include "msnd.h"
73 #ifdef MSND_CLASSIC
74 # include "msnd_classic.h"
75 # define LOGNAME "msnd_classic"
76 # define DEV_NAME "msnd-classic"
77 #else
78 # include "msnd_pinnacle.h"
79 # define LOGNAME "snd_msnd_pinnacle"
80 # define DEV_NAME "msnd-pinnacle"
81 #endif
82
set_default_audio_parameters(struct snd_msnd * chip)83 static void set_default_audio_parameters(struct snd_msnd *chip)
84 {
85 chip->play_sample_size = DEFSAMPLESIZE;
86 chip->play_sample_rate = DEFSAMPLERATE;
87 chip->play_channels = DEFCHANNELS;
88 chip->capture_sample_size = DEFSAMPLESIZE;
89 chip->capture_sample_rate = DEFSAMPLERATE;
90 chip->capture_channels = DEFCHANNELS;
91 }
92
snd_msnd_eval_dsp_msg(struct snd_msnd * chip,u16 wMessage)93 static void snd_msnd_eval_dsp_msg(struct snd_msnd *chip, u16 wMessage)
94 {
95 switch (HIBYTE(wMessage)) {
96 case HIMT_PLAY_DONE: {
97 if (chip->banksPlayed < 3)
98 snd_printdd("%08X: HIMT_PLAY_DONE: %i\n",
99 (unsigned)jiffies, LOBYTE(wMessage));
100
101 if (chip->last_playbank == LOBYTE(wMessage)) {
102 snd_printdd("chip.last_playbank == LOBYTE(wMessage)\n");
103 break;
104 }
105 chip->banksPlayed++;
106
107 if (test_bit(F_WRITING, &chip->flags))
108 snd_msnd_DAPQ(chip, 0);
109
110 chip->last_playbank = LOBYTE(wMessage);
111 chip->playDMAPos += chip->play_period_bytes;
112 if (chip->playDMAPos > chip->playLimit)
113 chip->playDMAPos = 0;
114 snd_pcm_period_elapsed(chip->playback_substream);
115
116 break;
117 }
118 case HIMT_RECORD_DONE:
119 if (chip->last_recbank == LOBYTE(wMessage))
120 break;
121 chip->last_recbank = LOBYTE(wMessage);
122 chip->captureDMAPos += chip->capturePeriodBytes;
123 if (chip->captureDMAPos > (chip->captureLimit))
124 chip->captureDMAPos = 0;
125
126 if (test_bit(F_READING, &chip->flags))
127 snd_msnd_DARQ(chip, chip->last_recbank);
128
129 snd_pcm_period_elapsed(chip->capture_substream);
130 break;
131
132 case HIMT_DSP:
133 switch (LOBYTE(wMessage)) {
134 #ifndef MSND_CLASSIC
135 case HIDSP_PLAY_UNDER:
136 #endif
137 case HIDSP_INT_PLAY_UNDER:
138 snd_printd(KERN_WARNING LOGNAME ": Play underflow %i\n",
139 chip->banksPlayed);
140 if (chip->banksPlayed > 2)
141 clear_bit(F_WRITING, &chip->flags);
142 break;
143
144 case HIDSP_INT_RECORD_OVER:
145 snd_printd(KERN_WARNING LOGNAME ": Record overflow\n");
146 clear_bit(F_READING, &chip->flags);
147 break;
148
149 default:
150 snd_printd(KERN_WARNING LOGNAME
151 ": DSP message %d 0x%02x\n",
152 LOBYTE(wMessage), LOBYTE(wMessage));
153 break;
154 }
155 break;
156
157 case HIMT_MIDI_IN_UCHAR:
158 if (chip->msndmidi_mpu)
159 snd_msndmidi_input_read(chip->msndmidi_mpu);
160 break;
161
162 default:
163 snd_printd(KERN_WARNING LOGNAME ": HIMT message %d 0x%02x\n",
164 HIBYTE(wMessage), HIBYTE(wMessage));
165 break;
166 }
167 }
168
snd_msnd_interrupt(int irq,void * dev_id)169 static irqreturn_t snd_msnd_interrupt(int irq, void *dev_id)
170 {
171 struct snd_msnd *chip = dev_id;
172 void *pwDSPQData = chip->mappedbase + DSPQ_DATA_BUFF;
173 u16 head, tail, size;
174
175 /* Send ack to DSP */
176 /* inb(chip->io + HP_RXL); */
177
178 /* Evaluate queued DSP messages */
179 head = readw(chip->DSPQ + JQS_wHead);
180 tail = readw(chip->DSPQ + JQS_wTail);
181 size = readw(chip->DSPQ + JQS_wSize);
182 if (head > size || tail > size)
183 goto out;
184 while (head != tail) {
185 snd_msnd_eval_dsp_msg(chip, readw(pwDSPQData + 2 * head));
186 if (++head > size)
187 head = 0;
188 writew(head, chip->DSPQ + JQS_wHead);
189 }
190 out:
191 /* Send ack to DSP */
192 inb(chip->io + HP_RXL);
193 return IRQ_HANDLED;
194 }
195
196
snd_msnd_reset_dsp(long io,unsigned char * info)197 static int snd_msnd_reset_dsp(long io, unsigned char *info)
198 {
199 int timeout = 100;
200
201 outb(HPDSPRESET_ON, io + HP_DSPR);
202 msleep(1);
203 #ifndef MSND_CLASSIC
204 if (info)
205 *info = inb(io + HP_INFO);
206 #endif
207 outb(HPDSPRESET_OFF, io + HP_DSPR);
208 msleep(1);
209 while (timeout-- > 0) {
210 if (inb(io + HP_CVR) == HP_CVR_DEF)
211 return 0;
212 msleep(1);
213 }
214 snd_printk(KERN_ERR LOGNAME ": Cannot reset DSP\n");
215
216 return -EIO;
217 }
218
snd_msnd_probe(struct snd_card * card)219 static int snd_msnd_probe(struct snd_card *card)
220 {
221 struct snd_msnd *chip = card->private_data;
222 unsigned char info;
223 #ifndef MSND_CLASSIC
224 char *xv, *rev = NULL;
225 char *pin = "TB Pinnacle", *fiji = "TB Fiji";
226 char *pinfiji = "TB Pinnacle/Fiji";
227 #endif
228
229 if (!request_region(chip->io, DSP_NUMIO, "probing")) {
230 snd_printk(KERN_ERR LOGNAME ": I/O port conflict\n");
231 return -ENODEV;
232 }
233
234 if (snd_msnd_reset_dsp(chip->io, &info) < 0) {
235 release_region(chip->io, DSP_NUMIO);
236 return -ENODEV;
237 }
238
239 #ifdef MSND_CLASSIC
240 strcpy(card->shortname, "Classic/Tahiti/Monterey");
241 strcpy(card->longname, "Turtle Beach Multisound");
242 printk(KERN_INFO LOGNAME ": %s, "
243 "I/O 0x%lx-0x%lx, IRQ %d, memory mapped to 0x%lX-0x%lX\n",
244 card->shortname,
245 chip->io, chip->io + DSP_NUMIO - 1,
246 chip->irq,
247 chip->base, chip->base + 0x7fff);
248 #else
249 switch (info >> 4) {
250 case 0xf:
251 xv = "<= 1.15";
252 break;
253 case 0x1:
254 xv = "1.18/1.2";
255 break;
256 case 0x2:
257 xv = "1.3";
258 break;
259 case 0x3:
260 xv = "1.4";
261 break;
262 default:
263 xv = "unknown";
264 break;
265 }
266
267 switch (info & 0x7) {
268 case 0x0:
269 rev = "I";
270 strcpy(card->shortname, pin);
271 break;
272 case 0x1:
273 rev = "F";
274 strcpy(card->shortname, pin);
275 break;
276 case 0x2:
277 rev = "G";
278 strcpy(card->shortname, pin);
279 break;
280 case 0x3:
281 rev = "H";
282 strcpy(card->shortname, pin);
283 break;
284 case 0x4:
285 rev = "E";
286 strcpy(card->shortname, fiji);
287 break;
288 case 0x5:
289 rev = "C";
290 strcpy(card->shortname, fiji);
291 break;
292 case 0x6:
293 rev = "D";
294 strcpy(card->shortname, fiji);
295 break;
296 case 0x7:
297 rev = "A-B (Fiji) or A-E (Pinnacle)";
298 strcpy(card->shortname, pinfiji);
299 break;
300 }
301 strcpy(card->longname, "Turtle Beach Multisound Pinnacle");
302 printk(KERN_INFO LOGNAME ": %s revision %s, Xilinx version %s, "
303 "I/O 0x%lx-0x%lx, IRQ %d, memory mapped to 0x%lX-0x%lX\n",
304 card->shortname,
305 rev, xv,
306 chip->io, chip->io + DSP_NUMIO - 1,
307 chip->irq,
308 chip->base, chip->base + 0x7fff);
309 #endif
310
311 release_region(chip->io, DSP_NUMIO);
312 return 0;
313 }
314
snd_msnd_init_sma(struct snd_msnd * chip)315 static int snd_msnd_init_sma(struct snd_msnd *chip)
316 {
317 static int initted;
318 u16 mastVolLeft, mastVolRight;
319 unsigned long flags;
320
321 #ifdef MSND_CLASSIC
322 outb(chip->memid, chip->io + HP_MEMM);
323 #endif
324 outb(HPBLKSEL_0, chip->io + HP_BLKS);
325 /* Motorola 56k shared memory base */
326 chip->SMA = chip->mappedbase + SMA_STRUCT_START;
327
328 if (initted) {
329 mastVolLeft = readw(chip->SMA + SMA_wCurrMastVolLeft);
330 mastVolRight = readw(chip->SMA + SMA_wCurrMastVolRight);
331 } else
332 mastVolLeft = mastVolRight = 0;
333 memset_io(chip->mappedbase, 0, 0x8000);
334
335 /* Critical section: bank 1 access */
336 spin_lock_irqsave(&chip->lock, flags);
337 outb(HPBLKSEL_1, chip->io + HP_BLKS);
338 memset_io(chip->mappedbase, 0, 0x8000);
339 outb(HPBLKSEL_0, chip->io + HP_BLKS);
340 spin_unlock_irqrestore(&chip->lock, flags);
341
342 /* Digital audio play queue */
343 chip->DAPQ = chip->mappedbase + DAPQ_OFFSET;
344 snd_msnd_init_queue(chip->DAPQ, DAPQ_DATA_BUFF, DAPQ_BUFF_SIZE);
345
346 /* Digital audio record queue */
347 chip->DARQ = chip->mappedbase + DARQ_OFFSET;
348 snd_msnd_init_queue(chip->DARQ, DARQ_DATA_BUFF, DARQ_BUFF_SIZE);
349
350 /* MIDI out queue */
351 chip->MODQ = chip->mappedbase + MODQ_OFFSET;
352 snd_msnd_init_queue(chip->MODQ, MODQ_DATA_BUFF, MODQ_BUFF_SIZE);
353
354 /* MIDI in queue */
355 chip->MIDQ = chip->mappedbase + MIDQ_OFFSET;
356 snd_msnd_init_queue(chip->MIDQ, MIDQ_DATA_BUFF, MIDQ_BUFF_SIZE);
357
358 /* DSP -> host message queue */
359 chip->DSPQ = chip->mappedbase + DSPQ_OFFSET;
360 snd_msnd_init_queue(chip->DSPQ, DSPQ_DATA_BUFF, DSPQ_BUFF_SIZE);
361
362 /* Setup some DSP values */
363 #ifndef MSND_CLASSIC
364 writew(1, chip->SMA + SMA_wCurrPlayFormat);
365 writew(chip->play_sample_size, chip->SMA + SMA_wCurrPlaySampleSize);
366 writew(chip->play_channels, chip->SMA + SMA_wCurrPlayChannels);
367 writew(chip->play_sample_rate, chip->SMA + SMA_wCurrPlaySampleRate);
368 #endif
369 writew(chip->play_sample_rate, chip->SMA + SMA_wCalFreqAtoD);
370 writew(mastVolLeft, chip->SMA + SMA_wCurrMastVolLeft);
371 writew(mastVolRight, chip->SMA + SMA_wCurrMastVolRight);
372 #ifndef MSND_CLASSIC
373 writel(0x00010000, chip->SMA + SMA_dwCurrPlayPitch);
374 writel(0x00000001, chip->SMA + SMA_dwCurrPlayRate);
375 #endif
376 writew(0x303, chip->SMA + SMA_wCurrInputTagBits);
377
378 initted = 1;
379
380 return 0;
381 }
382
383
upload_dsp_code(struct snd_card * card)384 static int upload_dsp_code(struct snd_card *card)
385 {
386 struct snd_msnd *chip = card->private_data;
387 const struct firmware *init_fw = NULL, *perm_fw = NULL;
388 int err;
389
390 outb(HPBLKSEL_0, chip->io + HP_BLKS);
391
392 err = request_firmware(&init_fw, INITCODEFILE, card->dev);
393 if (err < 0) {
394 printk(KERN_ERR LOGNAME ": Error loading " INITCODEFILE);
395 goto cleanup1;
396 }
397 err = request_firmware(&perm_fw, PERMCODEFILE, card->dev);
398 if (err < 0) {
399 printk(KERN_ERR LOGNAME ": Error loading " PERMCODEFILE);
400 goto cleanup;
401 }
402
403 memcpy_toio(chip->mappedbase, perm_fw->data, perm_fw->size);
404 if (snd_msnd_upload_host(chip, init_fw->data, init_fw->size) < 0) {
405 printk(KERN_WARNING LOGNAME ": Error uploading to DSP\n");
406 err = -ENODEV;
407 goto cleanup;
408 }
409 printk(KERN_INFO LOGNAME ": DSP firmware uploaded\n");
410 err = 0;
411
412 cleanup:
413 release_firmware(perm_fw);
414 cleanup1:
415 release_firmware(init_fw);
416 return err;
417 }
418
419 #ifdef MSND_CLASSIC
reset_proteus(struct snd_msnd * chip)420 static void reset_proteus(struct snd_msnd *chip)
421 {
422 outb(HPPRORESET_ON, chip->io + HP_PROR);
423 msleep(TIME_PRO_RESET);
424 outb(HPPRORESET_OFF, chip->io + HP_PROR);
425 msleep(TIME_PRO_RESET_DONE);
426 }
427 #endif
428
snd_msnd_initialize(struct snd_card * card)429 static int snd_msnd_initialize(struct snd_card *card)
430 {
431 struct snd_msnd *chip = card->private_data;
432 int err, timeout;
433
434 #ifdef MSND_CLASSIC
435 outb(HPWAITSTATE_0, chip->io + HP_WAIT);
436 outb(HPBITMODE_16, chip->io + HP_BITM);
437
438 reset_proteus(chip);
439 #endif
440 err = snd_msnd_init_sma(chip);
441 if (err < 0) {
442 printk(KERN_WARNING LOGNAME ": Cannot initialize SMA\n");
443 return err;
444 }
445
446 err = snd_msnd_reset_dsp(chip->io, NULL);
447 if (err < 0)
448 return err;
449
450 err = upload_dsp_code(card);
451 if (err < 0) {
452 printk(KERN_WARNING LOGNAME ": Cannot upload DSP code\n");
453 return err;
454 }
455
456 timeout = 200;
457
458 while (readw(chip->mappedbase)) {
459 msleep(1);
460 if (!timeout--) {
461 snd_printd(KERN_ERR LOGNAME ": DSP reset timeout\n");
462 return -EIO;
463 }
464 }
465
466 snd_msndmix_setup(chip);
467 return 0;
468 }
469
snd_msnd_dsp_full_reset(struct snd_card * card)470 static int snd_msnd_dsp_full_reset(struct snd_card *card)
471 {
472 struct snd_msnd *chip = card->private_data;
473 int rv;
474
475 if (test_bit(F_RESETTING, &chip->flags) || ++chip->nresets > 10)
476 return 0;
477
478 set_bit(F_RESETTING, &chip->flags);
479 snd_msnd_dsp_halt(chip, NULL); /* Unconditionally halt */
480
481 rv = snd_msnd_initialize(card);
482 if (rv)
483 printk(KERN_WARNING LOGNAME ": DSP reset failed\n");
484 snd_msndmix_force_recsrc(chip, 0);
485 clear_bit(F_RESETTING, &chip->flags);
486 return rv;
487 }
488
snd_msnd_dev_free(struct snd_device * device)489 static int snd_msnd_dev_free(struct snd_device *device)
490 {
491 snd_printdd("snd_msnd_chip_free()\n");
492 return 0;
493 }
494
snd_msnd_send_dsp_cmd_chk(struct snd_msnd * chip,u8 cmd)495 static int snd_msnd_send_dsp_cmd_chk(struct snd_msnd *chip, u8 cmd)
496 {
497 if (snd_msnd_send_dsp_cmd(chip, cmd) == 0)
498 return 0;
499 snd_msnd_dsp_full_reset(chip->card);
500 return snd_msnd_send_dsp_cmd(chip, cmd);
501 }
502
snd_msnd_calibrate_adc(struct snd_msnd * chip,u16 srate)503 static int snd_msnd_calibrate_adc(struct snd_msnd *chip, u16 srate)
504 {
505 snd_printdd("snd_msnd_calibrate_adc(%i)\n", srate);
506 writew(srate, chip->SMA + SMA_wCalFreqAtoD);
507 if (chip->calibrate_signal == 0)
508 writew(readw(chip->SMA + SMA_wCurrHostStatusFlags)
509 | 0x0001, chip->SMA + SMA_wCurrHostStatusFlags);
510 else
511 writew(readw(chip->SMA + SMA_wCurrHostStatusFlags)
512 & ~0x0001, chip->SMA + SMA_wCurrHostStatusFlags);
513 if (snd_msnd_send_word(chip, 0, 0, HDEXAR_CAL_A_TO_D) == 0 &&
514 snd_msnd_send_dsp_cmd_chk(chip, HDEX_AUX_REQ) == 0) {
515 schedule_timeout_interruptible(msecs_to_jiffies(333));
516 return 0;
517 }
518 printk(KERN_WARNING LOGNAME ": ADC calibration failed\n");
519 return -EIO;
520 }
521
522 /*
523 * ALSA callback function, called when attempting to open the MIDI device.
524 */
snd_msnd_mpu401_open(struct snd_mpu401 * mpu)525 static int snd_msnd_mpu401_open(struct snd_mpu401 *mpu)
526 {
527 snd_msnd_enable_irq(mpu->private_data);
528 snd_msnd_send_dsp_cmd(mpu->private_data, HDEX_MIDI_IN_START);
529 return 0;
530 }
531
snd_msnd_mpu401_close(struct snd_mpu401 * mpu)532 static void snd_msnd_mpu401_close(struct snd_mpu401 *mpu)
533 {
534 snd_msnd_send_dsp_cmd(mpu->private_data, HDEX_MIDI_IN_STOP);
535 snd_msnd_disable_irq(mpu->private_data);
536 }
537
538 static long mpu_io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
539 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
540
snd_msnd_attach(struct snd_card * card)541 static int snd_msnd_attach(struct snd_card *card)
542 {
543 struct snd_msnd *chip = card->private_data;
544 int err;
545 static struct snd_device_ops ops = {
546 .dev_free = snd_msnd_dev_free,
547 };
548
549 err = request_irq(chip->irq, snd_msnd_interrupt, 0, card->shortname,
550 chip);
551 if (err < 0) {
552 printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", chip->irq);
553 return err;
554 }
555 if (request_region(chip->io, DSP_NUMIO, card->shortname) == NULL) {
556 free_irq(chip->irq, chip);
557 return -EBUSY;
558 }
559
560 if (!request_mem_region(chip->base, BUFFSIZE, card->shortname)) {
561 printk(KERN_ERR LOGNAME
562 ": unable to grab memory region 0x%lx-0x%lx\n",
563 chip->base, chip->base + BUFFSIZE - 1);
564 release_region(chip->io, DSP_NUMIO);
565 free_irq(chip->irq, chip);
566 return -EBUSY;
567 }
568 chip->mappedbase = ioremap_nocache(chip->base, 0x8000);
569 if (!chip->mappedbase) {
570 printk(KERN_ERR LOGNAME
571 ": unable to map memory region 0x%lx-0x%lx\n",
572 chip->base, chip->base + BUFFSIZE - 1);
573 err = -EIO;
574 goto err_release_region;
575 }
576
577 err = snd_msnd_dsp_full_reset(card);
578 if (err < 0)
579 goto err_release_region;
580
581 /* Register device */
582 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
583 if (err < 0)
584 goto err_release_region;
585
586 err = snd_msnd_pcm(card, 0, NULL);
587 if (err < 0) {
588 printk(KERN_ERR LOGNAME ": error creating new PCM device\n");
589 goto err_release_region;
590 }
591
592 err = snd_msndmix_new(card);
593 if (err < 0) {
594 printk(KERN_ERR LOGNAME ": error creating new Mixer device\n");
595 goto err_release_region;
596 }
597
598
599 if (mpu_io[0] != SNDRV_AUTO_PORT) {
600 struct snd_mpu401 *mpu;
601
602 err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
603 mpu_io[0],
604 MPU401_MODE_INPUT |
605 MPU401_MODE_OUTPUT,
606 mpu_irq[0],
607 &chip->rmidi);
608 if (err < 0) {
609 printk(KERN_ERR LOGNAME
610 ": error creating new Midi device\n");
611 goto err_release_region;
612 }
613 mpu = chip->rmidi->private_data;
614
615 mpu->open_input = snd_msnd_mpu401_open;
616 mpu->close_input = snd_msnd_mpu401_close;
617 mpu->private_data = chip;
618 }
619
620 disable_irq(chip->irq);
621 snd_msnd_calibrate_adc(chip, chip->play_sample_rate);
622 snd_msndmix_force_recsrc(chip, 0);
623
624 err = snd_card_register(card);
625 if (err < 0)
626 goto err_release_region;
627
628 return 0;
629
630 err_release_region:
631 if (chip->mappedbase)
632 iounmap(chip->mappedbase);
633 release_mem_region(chip->base, BUFFSIZE);
634 release_region(chip->io, DSP_NUMIO);
635 free_irq(chip->irq, chip);
636 return err;
637 }
638
639
snd_msnd_unload(struct snd_card * card)640 static void snd_msnd_unload(struct snd_card *card)
641 {
642 struct snd_msnd *chip = card->private_data;
643
644 iounmap(chip->mappedbase);
645 release_mem_region(chip->base, BUFFSIZE);
646 release_region(chip->io, DSP_NUMIO);
647 free_irq(chip->irq, chip);
648 snd_card_free(card);
649 }
650
651 #ifndef MSND_CLASSIC
652
653 /* Pinnacle/Fiji Logical Device Configuration */
654
snd_msnd_write_cfg(int cfg,int reg,int value)655 static int snd_msnd_write_cfg(int cfg, int reg, int value)
656 {
657 outb(reg, cfg);
658 outb(value, cfg + 1);
659 if (value != inb(cfg + 1)) {
660 printk(KERN_ERR LOGNAME ": snd_msnd_write_cfg: I/O error\n");
661 return -EIO;
662 }
663 return 0;
664 }
665
snd_msnd_write_cfg_io0(int cfg,int num,u16 io)666 static int snd_msnd_write_cfg_io0(int cfg, int num, u16 io)
667 {
668 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
669 return -EIO;
670 if (snd_msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io)))
671 return -EIO;
672 if (snd_msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io)))
673 return -EIO;
674 return 0;
675 }
676
snd_msnd_write_cfg_io1(int cfg,int num,u16 io)677 static int snd_msnd_write_cfg_io1(int cfg, int num, u16 io)
678 {
679 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
680 return -EIO;
681 if (snd_msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io)))
682 return -EIO;
683 if (snd_msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io)))
684 return -EIO;
685 return 0;
686 }
687
snd_msnd_write_cfg_irq(int cfg,int num,u16 irq)688 static int snd_msnd_write_cfg_irq(int cfg, int num, u16 irq)
689 {
690 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
691 return -EIO;
692 if (snd_msnd_write_cfg(cfg, IREG_IRQ_NUMBER, LOBYTE(irq)))
693 return -EIO;
694 if (snd_msnd_write_cfg(cfg, IREG_IRQ_TYPE, IRQTYPE_EDGE))
695 return -EIO;
696 return 0;
697 }
698
snd_msnd_write_cfg_mem(int cfg,int num,int mem)699 static int snd_msnd_write_cfg_mem(int cfg, int num, int mem)
700 {
701 u16 wmem;
702
703 mem >>= 8;
704 wmem = (u16)(mem & 0xfff);
705 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
706 return -EIO;
707 if (snd_msnd_write_cfg(cfg, IREG_MEMBASEHI, HIBYTE(wmem)))
708 return -EIO;
709 if (snd_msnd_write_cfg(cfg, IREG_MEMBASELO, LOBYTE(wmem)))
710 return -EIO;
711 if (wmem && snd_msnd_write_cfg(cfg, IREG_MEMCONTROL,
712 MEMTYPE_HIADDR | MEMTYPE_16BIT))
713 return -EIO;
714 return 0;
715 }
716
snd_msnd_activate_logical(int cfg,int num)717 static int snd_msnd_activate_logical(int cfg, int num)
718 {
719 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
720 return -EIO;
721 if (snd_msnd_write_cfg(cfg, IREG_ACTIVATE, LD_ACTIVATE))
722 return -EIO;
723 return 0;
724 }
725
snd_msnd_write_cfg_logical(int cfg,int num,u16 io0,u16 io1,u16 irq,int mem)726 static int snd_msnd_write_cfg_logical(int cfg, int num, u16 io0,
727 u16 io1, u16 irq, int mem)
728 {
729 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
730 return -EIO;
731 if (snd_msnd_write_cfg_io0(cfg, num, io0))
732 return -EIO;
733 if (snd_msnd_write_cfg_io1(cfg, num, io1))
734 return -EIO;
735 if (snd_msnd_write_cfg_irq(cfg, num, irq))
736 return -EIO;
737 if (snd_msnd_write_cfg_mem(cfg, num, mem))
738 return -EIO;
739 if (snd_msnd_activate_logical(cfg, num))
740 return -EIO;
741 return 0;
742 }
743
snd_msnd_pinnacle_cfg_reset(int cfg)744 static int snd_msnd_pinnacle_cfg_reset(int cfg)
745 {
746 int i;
747
748 /* Reset devices if told to */
749 printk(KERN_INFO LOGNAME ": Resetting all devices\n");
750 for (i = 0; i < 4; ++i)
751 if (snd_msnd_write_cfg_logical(cfg, i, 0, 0, 0, 0))
752 return -EIO;
753
754 return 0;
755 }
756 #endif
757
758 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
759 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
760
761 module_param_array(index, int, NULL, S_IRUGO);
762 MODULE_PARM_DESC(index, "Index value for msnd_pinnacle soundcard.");
763 module_param_array(id, charp, NULL, S_IRUGO);
764 MODULE_PARM_DESC(id, "ID string for msnd_pinnacle soundcard.");
765
766 static long io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
767 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
768 static long mem[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
769
770 #ifndef MSND_CLASSIC
771 static long cfg[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
772
773 /* Extra Peripheral Configuration (Default: Disable) */
774 static long ide_io0[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
775 static long ide_io1[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
776 static int ide_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
777
778 static long joystick_io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
779 /* If we have the digital daugherboard... */
780 static int digital[SNDRV_CARDS];
781
782 /* Extra Peripheral Configuration */
783 static int reset[SNDRV_CARDS];
784 #endif
785
786 static int write_ndelay[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 };
787
788 static int calibrate_signal;
789
790 #ifdef CONFIG_PNP
791 static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
792 module_param_array(isapnp, bool, NULL, 0444);
793 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
794 #define has_isapnp(x) isapnp[x]
795 #else
796 #define has_isapnp(x) 0
797 #endif
798
799 MODULE_AUTHOR("Karsten Wiese <annabellesgarden@yahoo.de>");
800 MODULE_DESCRIPTION("Turtle Beach " LONGNAME " Linux Driver");
801 MODULE_LICENSE("GPL");
802 MODULE_FIRMWARE(INITCODEFILE);
803 MODULE_FIRMWARE(PERMCODEFILE);
804
805 module_param_array(io, long, NULL, S_IRUGO);
806 MODULE_PARM_DESC(io, "IO port #");
807 module_param_array(irq, int, NULL, S_IRUGO);
808 module_param_array(mem, long, NULL, S_IRUGO);
809 module_param_array(write_ndelay, int, NULL, S_IRUGO);
810 module_param(calibrate_signal, int, S_IRUGO);
811 #ifndef MSND_CLASSIC
812 module_param_array(digital, int, NULL, S_IRUGO);
813 module_param_array(cfg, long, NULL, S_IRUGO);
814 module_param_array(reset, int, 0, S_IRUGO);
815 module_param_array(mpu_io, long, NULL, S_IRUGO);
816 module_param_array(mpu_irq, int, NULL, S_IRUGO);
817 module_param_array(ide_io0, long, NULL, S_IRUGO);
818 module_param_array(ide_io1, long, NULL, S_IRUGO);
819 module_param_array(ide_irq, int, NULL, S_IRUGO);
820 module_param_array(joystick_io, long, NULL, S_IRUGO);
821 #endif
822
823
snd_msnd_isa_match(struct device * pdev,unsigned int i)824 static int snd_msnd_isa_match(struct device *pdev, unsigned int i)
825 {
826 if (io[i] == SNDRV_AUTO_PORT)
827 return 0;
828
829 if (irq[i] == SNDRV_AUTO_PORT || mem[i] == SNDRV_AUTO_PORT) {
830 printk(KERN_WARNING LOGNAME ": io, irq and mem must be set\n");
831 return 0;
832 }
833
834 #ifdef MSND_CLASSIC
835 if (!(io[i] == 0x290 ||
836 io[i] == 0x260 ||
837 io[i] == 0x250 ||
838 io[i] == 0x240 ||
839 io[i] == 0x230 ||
840 io[i] == 0x220 ||
841 io[i] == 0x210 ||
842 io[i] == 0x3e0)) {
843 printk(KERN_ERR LOGNAME ": \"io\" - DSP I/O base must be set "
844 " to 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x290, "
845 "or 0x3E0\n");
846 return 0;
847 }
848 #else
849 if (io[i] < 0x100 || io[i] > 0x3e0 || (io[i] % 0x10) != 0) {
850 printk(KERN_ERR LOGNAME
851 ": \"io\" - DSP I/O base must within the range 0x100 "
852 "to 0x3E0 and must be evenly divisible by 0x10\n");
853 return 0;
854 }
855 #endif /* MSND_CLASSIC */
856
857 if (!(irq[i] == 5 ||
858 irq[i] == 7 ||
859 irq[i] == 9 ||
860 irq[i] == 10 ||
861 irq[i] == 11 ||
862 irq[i] == 12)) {
863 printk(KERN_ERR LOGNAME
864 ": \"irq\" - must be set to 5, 7, 9, 10, 11 or 12\n");
865 return 0;
866 }
867
868 if (!(mem[i] == 0xb0000 ||
869 mem[i] == 0xc8000 ||
870 mem[i] == 0xd0000 ||
871 mem[i] == 0xd8000 ||
872 mem[i] == 0xe0000 ||
873 mem[i] == 0xe8000)) {
874 printk(KERN_ERR LOGNAME ": \"mem\" - must be set to "
875 "0xb0000, 0xc8000, 0xd0000, 0xd8000, 0xe0000 or "
876 "0xe8000\n");
877 return 0;
878 }
879
880 #ifndef MSND_CLASSIC
881 if (cfg[i] == SNDRV_AUTO_PORT) {
882 printk(KERN_INFO LOGNAME ": Assuming PnP mode\n");
883 } else if (cfg[i] != 0x250 && cfg[i] != 0x260 && cfg[i] != 0x270) {
884 printk(KERN_INFO LOGNAME
885 ": Config port must be 0x250, 0x260 or 0x270 "
886 "(or unspecified for PnP mode)\n");
887 return 0;
888 }
889 #endif /* MSND_CLASSIC */
890
891 return 1;
892 }
893
snd_msnd_isa_probe(struct device * pdev,unsigned int idx)894 static int snd_msnd_isa_probe(struct device *pdev, unsigned int idx)
895 {
896 int err;
897 struct snd_card *card;
898 struct snd_msnd *chip;
899
900 if (has_isapnp(idx)
901 #ifndef MSND_CLASSIC
902 || cfg[idx] == SNDRV_AUTO_PORT
903 #endif
904 ) {
905 printk(KERN_INFO LOGNAME ": Assuming PnP mode\n");
906 return -ENODEV;
907 }
908
909 err = snd_card_new(pdev, index[idx], id[idx], THIS_MODULE,
910 sizeof(struct snd_msnd), &card);
911 if (err < 0)
912 return err;
913
914 chip = card->private_data;
915 chip->card = card;
916
917 #ifdef MSND_CLASSIC
918 switch (irq[idx]) {
919 case 5:
920 chip->irqid = HPIRQ_5; break;
921 case 7:
922 chip->irqid = HPIRQ_7; break;
923 case 9:
924 chip->irqid = HPIRQ_9; break;
925 case 10:
926 chip->irqid = HPIRQ_10; break;
927 case 11:
928 chip->irqid = HPIRQ_11; break;
929 case 12:
930 chip->irqid = HPIRQ_12; break;
931 }
932
933 switch (mem[idx]) {
934 case 0xb0000:
935 chip->memid = HPMEM_B000; break;
936 case 0xc8000:
937 chip->memid = HPMEM_C800; break;
938 case 0xd0000:
939 chip->memid = HPMEM_D000; break;
940 case 0xd8000:
941 chip->memid = HPMEM_D800; break;
942 case 0xe0000:
943 chip->memid = HPMEM_E000; break;
944 case 0xe8000:
945 chip->memid = HPMEM_E800; break;
946 }
947 #else
948 printk(KERN_INFO LOGNAME ": Non-PnP mode: configuring at port 0x%lx\n",
949 cfg[idx]);
950
951 if (!request_region(cfg[idx], 2, "Pinnacle/Fiji Config")) {
952 printk(KERN_ERR LOGNAME ": Config port 0x%lx conflict\n",
953 cfg[idx]);
954 snd_card_free(card);
955 return -EIO;
956 }
957 if (reset[idx])
958 if (snd_msnd_pinnacle_cfg_reset(cfg[idx])) {
959 err = -EIO;
960 goto cfg_error;
961 }
962
963 /* DSP */
964 err = snd_msnd_write_cfg_logical(cfg[idx], 0,
965 io[idx], 0,
966 irq[idx], mem[idx]);
967
968 if (err)
969 goto cfg_error;
970
971 /* The following are Pinnacle specific */
972
973 /* MPU */
974 if (mpu_io[idx] != SNDRV_AUTO_PORT
975 && mpu_irq[idx] != SNDRV_AUTO_IRQ) {
976 printk(KERN_INFO LOGNAME
977 ": Configuring MPU to I/O 0x%lx IRQ %d\n",
978 mpu_io[idx], mpu_irq[idx]);
979 err = snd_msnd_write_cfg_logical(cfg[idx], 1,
980 mpu_io[idx], 0,
981 mpu_irq[idx], 0);
982
983 if (err)
984 goto cfg_error;
985 }
986
987 /* IDE */
988 if (ide_io0[idx] != SNDRV_AUTO_PORT
989 && ide_io1[idx] != SNDRV_AUTO_PORT
990 && ide_irq[idx] != SNDRV_AUTO_IRQ) {
991 printk(KERN_INFO LOGNAME
992 ": Configuring IDE to I/O 0x%lx, 0x%lx IRQ %d\n",
993 ide_io0[idx], ide_io1[idx], ide_irq[idx]);
994 err = snd_msnd_write_cfg_logical(cfg[idx], 2,
995 ide_io0[idx], ide_io1[idx],
996 ide_irq[idx], 0);
997
998 if (err)
999 goto cfg_error;
1000 }
1001
1002 /* Joystick */
1003 if (joystick_io[idx] != SNDRV_AUTO_PORT) {
1004 printk(KERN_INFO LOGNAME
1005 ": Configuring joystick to I/O 0x%lx\n",
1006 joystick_io[idx]);
1007 err = snd_msnd_write_cfg_logical(cfg[idx], 3,
1008 joystick_io[idx], 0,
1009 0, 0);
1010
1011 if (err)
1012 goto cfg_error;
1013 }
1014 release_region(cfg[idx], 2);
1015
1016 #endif /* MSND_CLASSIC */
1017
1018 set_default_audio_parameters(chip);
1019 #ifdef MSND_CLASSIC
1020 chip->type = msndClassic;
1021 #else
1022 chip->type = msndPinnacle;
1023 #endif
1024 chip->io = io[idx];
1025 chip->irq = irq[idx];
1026 chip->base = mem[idx];
1027
1028 chip->calibrate_signal = calibrate_signal ? 1 : 0;
1029 chip->recsrc = 0;
1030 chip->dspq_data_buff = DSPQ_DATA_BUFF;
1031 chip->dspq_buff_size = DSPQ_BUFF_SIZE;
1032 if (write_ndelay[idx])
1033 clear_bit(F_DISABLE_WRITE_NDELAY, &chip->flags);
1034 else
1035 set_bit(F_DISABLE_WRITE_NDELAY, &chip->flags);
1036 #ifndef MSND_CLASSIC
1037 if (digital[idx])
1038 set_bit(F_HAVEDIGITAL, &chip->flags);
1039 #endif
1040 spin_lock_init(&chip->lock);
1041 err = snd_msnd_probe(card);
1042 if (err < 0) {
1043 printk(KERN_ERR LOGNAME ": Probe failed\n");
1044 snd_card_free(card);
1045 return err;
1046 }
1047
1048 err = snd_msnd_attach(card);
1049 if (err < 0) {
1050 printk(KERN_ERR LOGNAME ": Attach failed\n");
1051 snd_card_free(card);
1052 return err;
1053 }
1054 dev_set_drvdata(pdev, card);
1055
1056 return 0;
1057
1058 #ifndef MSND_CLASSIC
1059 cfg_error:
1060 release_region(cfg[idx], 2);
1061 snd_card_free(card);
1062 return err;
1063 #endif
1064 }
1065
snd_msnd_isa_remove(struct device * pdev,unsigned int dev)1066 static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev)
1067 {
1068 snd_msnd_unload(dev_get_drvdata(pdev));
1069 return 0;
1070 }
1071
1072 static struct isa_driver snd_msnd_driver = {
1073 .match = snd_msnd_isa_match,
1074 .probe = snd_msnd_isa_probe,
1075 .remove = snd_msnd_isa_remove,
1076 /* FIXME: suspend, resume */
1077 .driver = {
1078 .name = DEV_NAME
1079 },
1080 };
1081
1082 #ifdef CONFIG_PNP
snd_msnd_pnp_detect(struct pnp_card_link * pcard,const struct pnp_card_device_id * pid)1083 static int snd_msnd_pnp_detect(struct pnp_card_link *pcard,
1084 const struct pnp_card_device_id *pid)
1085 {
1086 static int idx;
1087 struct pnp_dev *pnp_dev;
1088 struct pnp_dev *mpu_dev;
1089 struct snd_card *card;
1090 struct snd_msnd *chip;
1091 int ret;
1092
1093 for ( ; idx < SNDRV_CARDS; idx++) {
1094 if (has_isapnp(idx))
1095 break;
1096 }
1097 if (idx >= SNDRV_CARDS)
1098 return -ENODEV;
1099
1100 /*
1101 * Check that we still have room for another sound card ...
1102 */
1103 pnp_dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL);
1104 if (!pnp_dev)
1105 return -ENODEV;
1106
1107 mpu_dev = pnp_request_card_device(pcard, pid->devs[1].id, NULL);
1108 if (!mpu_dev)
1109 return -ENODEV;
1110
1111 if (!pnp_is_active(pnp_dev) && pnp_activate_dev(pnp_dev) < 0) {
1112 printk(KERN_INFO "msnd_pinnacle: device is inactive\n");
1113 return -EBUSY;
1114 }
1115
1116 if (!pnp_is_active(mpu_dev) && pnp_activate_dev(mpu_dev) < 0) {
1117 printk(KERN_INFO "msnd_pinnacle: MPU device is inactive\n");
1118 return -EBUSY;
1119 }
1120
1121 /*
1122 * Create a new ALSA sound card entry, in anticipation
1123 * of detecting our hardware ...
1124 */
1125 ret = snd_card_new(&pcard->card->dev,
1126 index[idx], id[idx], THIS_MODULE,
1127 sizeof(struct snd_msnd), &card);
1128 if (ret < 0)
1129 return ret;
1130
1131 chip = card->private_data;
1132 chip->card = card;
1133
1134 /*
1135 * Read the correct parameters off the ISA PnP bus ...
1136 */
1137 io[idx] = pnp_port_start(pnp_dev, 0);
1138 irq[idx] = pnp_irq(pnp_dev, 0);
1139 mem[idx] = pnp_mem_start(pnp_dev, 0);
1140 mpu_io[idx] = pnp_port_start(mpu_dev, 0);
1141 mpu_irq[idx] = pnp_irq(mpu_dev, 0);
1142
1143 set_default_audio_parameters(chip);
1144 #ifdef MSND_CLASSIC
1145 chip->type = msndClassic;
1146 #else
1147 chip->type = msndPinnacle;
1148 #endif
1149 chip->io = io[idx];
1150 chip->irq = irq[idx];
1151 chip->base = mem[idx];
1152
1153 chip->calibrate_signal = calibrate_signal ? 1 : 0;
1154 chip->recsrc = 0;
1155 chip->dspq_data_buff = DSPQ_DATA_BUFF;
1156 chip->dspq_buff_size = DSPQ_BUFF_SIZE;
1157 if (write_ndelay[idx])
1158 clear_bit(F_DISABLE_WRITE_NDELAY, &chip->flags);
1159 else
1160 set_bit(F_DISABLE_WRITE_NDELAY, &chip->flags);
1161 #ifndef MSND_CLASSIC
1162 if (digital[idx])
1163 set_bit(F_HAVEDIGITAL, &chip->flags);
1164 #endif
1165 spin_lock_init(&chip->lock);
1166 ret = snd_msnd_probe(card);
1167 if (ret < 0) {
1168 printk(KERN_ERR LOGNAME ": Probe failed\n");
1169 goto _release_card;
1170 }
1171
1172 ret = snd_msnd_attach(card);
1173 if (ret < 0) {
1174 printk(KERN_ERR LOGNAME ": Attach failed\n");
1175 goto _release_card;
1176 }
1177
1178 pnp_set_card_drvdata(pcard, card);
1179 ++idx;
1180 return 0;
1181
1182 _release_card:
1183 snd_card_free(card);
1184 return ret;
1185 }
1186
snd_msnd_pnp_remove(struct pnp_card_link * pcard)1187 static void snd_msnd_pnp_remove(struct pnp_card_link *pcard)
1188 {
1189 snd_msnd_unload(pnp_get_card_drvdata(pcard));
1190 pnp_set_card_drvdata(pcard, NULL);
1191 }
1192
1193 static int isa_registered;
1194 static int pnp_registered;
1195
1196 static struct pnp_card_device_id msnd_pnpids[] = {
1197 /* Pinnacle PnP */
1198 { .id = "BVJ0440", .devs = { { "TBS0000" }, { "TBS0001" } } },
1199 { .id = "" } /* end */
1200 };
1201
1202 MODULE_DEVICE_TABLE(pnp_card, msnd_pnpids);
1203
1204 static struct pnp_card_driver msnd_pnpc_driver = {
1205 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
1206 .name = "msnd_pinnacle",
1207 .id_table = msnd_pnpids,
1208 .probe = snd_msnd_pnp_detect,
1209 .remove = snd_msnd_pnp_remove,
1210 };
1211 #endif /* CONFIG_PNP */
1212
snd_msnd_init(void)1213 static int __init snd_msnd_init(void)
1214 {
1215 int err;
1216
1217 err = isa_register_driver(&snd_msnd_driver, SNDRV_CARDS);
1218 #ifdef CONFIG_PNP
1219 if (!err)
1220 isa_registered = 1;
1221
1222 err = pnp_register_card_driver(&msnd_pnpc_driver);
1223 if (!err)
1224 pnp_registered = 1;
1225
1226 if (isa_registered)
1227 err = 0;
1228 #endif
1229 return err;
1230 }
1231
snd_msnd_exit(void)1232 static void __exit snd_msnd_exit(void)
1233 {
1234 #ifdef CONFIG_PNP
1235 if (pnp_registered)
1236 pnp_unregister_card_driver(&msnd_pnpc_driver);
1237 if (isa_registered)
1238 #endif
1239 isa_unregister_driver(&snd_msnd_driver);
1240 }
1241
1242 module_init(snd_msnd_init);
1243 module_exit(snd_msnd_exit);
1244
1245