File: /usr/src/linux/drivers/sound/soundcard.c
1 /*
2 * linux/drivers/sound/soundcard.c
3 *
4 * Sound card driver for Linux
5 *
6 *
7 * Copyright (C) by Hannu Savolainen 1993-1997
8 *
9 * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
10 * Version 2 (June 1991). See the "COPYING" file distributed with this software
11 * for more info.
12 *
13 *
14 * Thomas Sailer : ioctl code reworked (vmalloc/vfree removed)
15 * integrated sound_switch.c
16 * Stefan Reinauer : integrated /proc/sound (equals to /dev/sndstat,
17 * which should disappear in the near future)
18 * Eric Dumas : devfs support (22-Jan-98) <dumas@linux.eu.org> with
19 * fixups by C. Scott Ananian <cananian@alumni.princeton.edu>
20 * Richard Gooch : moved common (non OSS-specific) devices to sound_core.c
21 * Rob Riggs : Added persistent DMA buffers support (1998/10/17)
22 * Christoph Hellwig : Some cleanup work (2000/03/01)
23 */
24
25 #include <linux/config.h>
26
27 #include "sound_config.h"
28 #include <linux/init.h>
29 #include <linux/types.h>
30 #include <linux/errno.h>
31 #include <linux/signal.h>
32 #include <linux/fcntl.h>
33 #include <linux/ctype.h>
34 #include <linux/stddef.h>
35 #include <linux/kmod.h>
36 #include <asm/dma.h>
37 #include <asm/io.h>
38 #include <asm/segment.h>
39 #include <linux/wait.h>
40 #include <linux/slab.h>
41 #include <linux/ioport.h>
42 #include <linux/devfs_fs_kernel.h>
43 #include <linux/major.h>
44 #include <linux/delay.h>
45 #include <linux/proc_fs.h>
46 #include <linux/smp_lock.h>
47
48 /*
49 * This ought to be moved into include/asm/dma.h
50 */
51 #ifndef valid_dma
52 #define valid_dma(n) ((n) >= 0 && (n) < MAX_DMA_CHANNELS && (n) != 4)
53 #endif
54
55 /*
56 * Table for permanently allocated memory (used when unloading the module)
57 */
58 caddr_t sound_mem_blocks[1024];
59 int sound_nblocks = 0;
60
61 /* Persistent DMA buffers */
62 #ifdef CONFIG_SOUND_DMAP
63 int sound_dmap_flag = 1;
64 #else
65 int sound_dmap_flag = 0;
66 #endif
67
68 static char dma_alloc_map[MAX_DMA_CHANNELS] = {0};
69
70 #define DMA_MAP_UNAVAIL 0
71 #define DMA_MAP_FREE 1
72 #define DMA_MAP_BUSY 2
73
74
75 unsigned long seq_time = 0; /* Time for /dev/sequencer */
76
77 /*
78 * Table for configurable mixer volume handling
79 */
80 static mixer_vol_table mixer_vols[MAX_MIXER_DEV];
81 static int num_mixer_volumes = 0;
82
83 int *load_mixer_volumes(char *name, int *levels, int present)
84 {
85 int i, n;
86
87 for (i = 0; i < num_mixer_volumes; i++) {
88 if (strcmp(name, mixer_vols[i].name) == 0) {
89 if (present)
90 mixer_vols[i].num = i;
91 return mixer_vols[i].levels;
92 }
93 }
94 if (num_mixer_volumes >= MAX_MIXER_DEV) {
95 printk(KERN_ERR "Sound: Too many mixers (%s)\n", name);
96 return levels;
97 }
98 n = num_mixer_volumes++;
99
100 strcpy(mixer_vols[n].name, name);
101
102 if (present)
103 mixer_vols[n].num = n;
104 else
105 mixer_vols[n].num = -1;
106
107 for (i = 0; i < 32; i++)
108 mixer_vols[n].levels[i] = levels[i];
109 return mixer_vols[n].levels;
110 }
111
112 static int set_mixer_levels(caddr_t arg)
113 {
114 /* mixer_vol_table is 174 bytes, so IMHO no reason to not allocate it on the stack */
115 mixer_vol_table buf;
116
117 if (__copy_from_user(&buf, arg, sizeof(buf)))
118 return -EFAULT;
119 load_mixer_volumes(buf.name, buf.levels, 0);
120 if (__copy_to_user(arg, &buf, sizeof(buf)))
121 return -EFAULT;
122 return 0;
123 }
124
125 static int get_mixer_levels(caddr_t arg)
126 {
127 int n;
128
129 if (__get_user(n, (int *)(&(((mixer_vol_table *)arg)->num))))
130 return -EFAULT;
131 if (n < 0 || n >= num_mixer_volumes)
132 return -EINVAL;
133 if (__copy_to_user(arg, &mixer_vols[n], sizeof(mixer_vol_table)))
134 return -EFAULT;
135 return 0;
136 }
137
138 #ifndef MIN
139 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
140 #endif
141
142 /* 4K page size but our output routines use some slack for overruns */
143 #define PROC_BLOCK_SIZE (3*1024)
144
145 static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *ppos)
146 {
147 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
148 int ret = -EINVAL;
149
150 /*
151 * The OSS drivers aren't remotely happy without this locking,
152 * and unless someone fixes them when they are about to bite the
153 * big one anyway, we might as well bandage here..
154 */
155
156 lock_kernel();
157
158 DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count));
159 switch (dev & 0x0f) {
160 case SND_DEV_DSP:
161 case SND_DEV_DSP16:
162 case SND_DEV_AUDIO:
163 ret = audio_read(dev, file, buf, count);
164 break;
165
166 case SND_DEV_SEQ:
167 case SND_DEV_SEQ2:
168 ret = sequencer_read(dev, file, buf, count);
169 break;
170
171 case SND_DEV_MIDIN:
172 ret = MIDIbuf_read(dev, file, buf, count);
173 }
174 unlock_kernel();
175 return ret;
176 }
177
178 static ssize_t sound_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
179 {
180 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
181 int ret = -EINVAL;
182
183 lock_kernel();
184 DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count));
185 switch (dev & 0x0f) {
186 case SND_DEV_SEQ:
187 case SND_DEV_SEQ2:
188 ret = sequencer_write(dev, file, buf, count);
189 break;
190
191 case SND_DEV_DSP:
192 case SND_DEV_DSP16:
193 case SND_DEV_AUDIO:
194 ret = audio_write(dev, file, buf, count);
195 break;
196
197 case SND_DEV_MIDIN:
198 ret = MIDIbuf_write(dev, file, buf, count);
199 break;
200 }
201 unlock_kernel();
202 return ret;
203 }
204
205 static int sound_open(struct inode *inode, struct file *file)
206 {
207 int dev = MINOR(inode->i_rdev);
208 int retval;
209
210 DEB(printk("sound_open(dev=%d)\n", dev));
211 if ((dev >= SND_NDEVS) || (dev < 0)) {
212 printk(KERN_ERR "Invalid minor device %d\n", dev);
213 return -ENXIO;
214 }
215 switch (dev & 0x0f) {
216 case SND_DEV_CTL:
217 dev >>= 4;
218 if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) {
219 char modname[20];
220 sprintf(modname, "mixer%d", dev);
221 request_module(modname);
222 }
223 if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL))
224 return -ENXIO;
225
226 if (mixer_devs[dev]->owner)
227 __MOD_INC_USE_COUNT (mixer_devs[dev]->owner);
228 break;
229
230 case SND_DEV_SEQ:
231 case SND_DEV_SEQ2:
232 if ((retval = sequencer_open(dev, file)) < 0)
233 return retval;
234 break;
235
236 case SND_DEV_MIDIN:
237 if ((retval = MIDIbuf_open(dev, file)) < 0)
238 return retval;
239 break;
240
241 case SND_DEV_DSP:
242 case SND_DEV_DSP16:
243 case SND_DEV_AUDIO:
244 if ((retval = audio_open(dev, file)) < 0)
245 return retval;
246 break;
247
248 default:
249 printk(KERN_ERR "Invalid minor device %d\n", dev);
250 return -ENXIO;
251 }
252
253 return 0;
254 }
255
256 static int sound_release(struct inode *inode, struct file *file)
257 {
258 int dev = MINOR(inode->i_rdev);
259
260 lock_kernel();
261 DEB(printk("sound_release(dev=%d)\n", dev));
262 switch (dev & 0x0f) {
263 case SND_DEV_CTL:
264 dev >>= 4;
265 if (mixer_devs[dev]->owner)
266 __MOD_DEC_USE_COUNT (mixer_devs[dev]->owner);
267 break;
268
269 case SND_DEV_SEQ:
270 case SND_DEV_SEQ2:
271 sequencer_release(dev, file);
272 break;
273
274 case SND_DEV_MIDIN:
275 MIDIbuf_release(dev, file);
276 break;
277
278 case SND_DEV_DSP:
279 case SND_DEV_DSP16:
280 case SND_DEV_AUDIO:
281 audio_release(dev, file);
282 break;
283
284 default:
285 printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev);
286 }
287 unlock_kernel();
288
289 return 0;
290 }
291
292 static int get_mixer_info(int dev, caddr_t arg)
293 {
294 mixer_info info;
295
296 strncpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
297 strncpy(info.name, mixer_devs[dev]->name, sizeof(info.name));
298 info.name[sizeof(info.name)-1] = 0;
299 info.modify_counter = mixer_devs[dev]->modify_counter;
300 if (__copy_to_user(arg, &info, sizeof(info)))
301 return -EFAULT;
302 return 0;
303 }
304
305 static int get_old_mixer_info(int dev, caddr_t arg)
306 {
307 _old_mixer_info info;
308
309 strncpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
310 strncpy(info.name, mixer_devs[dev]->name, sizeof(info.name));
311 info.name[sizeof(info.name)-1] = 0;
312 if (copy_to_user(arg, &info, sizeof(info)))
313 return -EFAULT;
314 return 0;
315 }
316
317 static int sound_mixer_ioctl(int mixdev, unsigned int cmd, caddr_t arg)
318 {
319 if (mixdev < 0 || mixdev >= MAX_MIXER_DEV)
320 return -ENXIO;
321 /* Try to load the mixer... */
322 if (mixer_devs[mixdev] == NULL) {
323 char modname[20];
324 sprintf(modname, "mixer%d", mixdev);
325 request_module(modname);
326 }
327 if (mixdev >= num_mixers || !mixer_devs[mixdev])
328 return -ENXIO;
329 if (cmd == SOUND_MIXER_INFO)
330 return get_mixer_info(mixdev, arg);
331 if (cmd == SOUND_OLD_MIXER_INFO)
332 return get_old_mixer_info(mixdev, arg);
333 if (_SIOC_DIR(cmd) & _SIOC_WRITE)
334 mixer_devs[mixdev]->modify_counter++;
335 if (!mixer_devs[mixdev]->ioctl)
336 return -EINVAL;
337 return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);
338 }
339
340 static int sound_ioctl(struct inode *inode, struct file *file,
341 unsigned int cmd, unsigned long arg)
342 {
343 int err, len = 0, dtype;
344 int dev = MINOR(inode->i_rdev);
345
346 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
347 /*
348 * Have to validate the address given by the process.
349 */
350 len = _SIOC_SIZE(cmd);
351 if (len < 1 || len > 65536 || arg == 0)
352 return -EFAULT;
353 if (_SIOC_DIR(cmd) & _SIOC_WRITE)
354 if ((err = verify_area(VERIFY_READ, (void *)arg, len)) < 0)
355 return err;
356 if (_SIOC_DIR(cmd) & _SIOC_READ)
357 if ((err = verify_area(VERIFY_WRITE, (void *)arg, len)) < 0)
358 return err;
359 }
360 DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
361 if (cmd == OSS_GETVERSION)
362 return __put_user(SOUND_VERSION, (int *)arg);
363
364 if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */
365 (dev & 0x0f) != SND_DEV_CTL) {
366 dtype = dev & 0x0f;
367 switch (dtype) {
368 case SND_DEV_DSP:
369 case SND_DEV_DSP16:
370 case SND_DEV_AUDIO:
371 return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,
372 cmd, (caddr_t)arg);
373
374 default:
375 return sound_mixer_ioctl(dev >> 4, cmd, (caddr_t)arg);
376 }
377 }
378 switch (dev & 0x0f) {
379 case SND_DEV_CTL:
380 if (cmd == SOUND_MIXER_GETLEVELS)
381 return get_mixer_levels((caddr_t)arg);
382 if (cmd == SOUND_MIXER_SETLEVELS)
383 return set_mixer_levels((caddr_t)arg);
384 return sound_mixer_ioctl(dev >> 4, cmd, (caddr_t)arg);
385
386 case SND_DEV_SEQ:
387 case SND_DEV_SEQ2:
388 return sequencer_ioctl(dev, file, cmd, (caddr_t)arg);
389
390 case SND_DEV_DSP:
391 case SND_DEV_DSP16:
392 case SND_DEV_AUDIO:
393 return audio_ioctl(dev, file, cmd, (caddr_t)arg);
394 break;
395
396 case SND_DEV_MIDIN:
397 return MIDIbuf_ioctl(dev, file, cmd, (caddr_t)arg);
398 break;
399
400 }
401 return -EINVAL;
402 }
403
404 static unsigned int sound_poll(struct file *file, poll_table * wait)
405 {
406 struct inode *inode = file->f_dentry->d_inode;
407 int dev = MINOR(inode->i_rdev);
408
409 DEB(printk("sound_poll(dev=%d)\n", dev));
410 switch (dev & 0x0f) {
411 case SND_DEV_SEQ:
412 case SND_DEV_SEQ2:
413 return sequencer_poll(dev, file, wait);
414
415 case SND_DEV_MIDIN:
416 return MIDIbuf_poll(dev, file, wait);
417
418 case SND_DEV_DSP:
419 case SND_DEV_DSP16:
420 case SND_DEV_AUDIO:
421 return DMAbuf_poll(file, dev >> 4, wait);
422 }
423 return 0;
424 }
425
426 static int sound_mmap(struct file *file, struct vm_area_struct *vma)
427 {
428 int dev_class;
429 unsigned long size;
430 struct dma_buffparms *dmap = NULL;
431 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
432
433 dev_class = dev & 0x0f;
434 dev >>= 4;
435
436 if (dev_class != SND_DEV_DSP && dev_class != SND_DEV_DSP16 && dev_class != SND_DEV_AUDIO) {
437 printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n");
438 return -EINVAL;
439 }
440 lock_kernel();
441 if (vma->vm_flags & VM_WRITE) /* Map write and read/write to the output buf */
442 dmap = audio_devs[dev]->dmap_out;
443 else if (vma->vm_flags & VM_READ)
444 dmap = audio_devs[dev]->dmap_in;
445 else {
446 printk(KERN_ERR "Sound: Undefined mmap() access\n");
447 unlock_kernel();
448 return -EINVAL;
449 }
450
451 if (dmap == NULL) {
452 printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n");
453 unlock_kernel();
454 return -EIO;
455 }
456 if (dmap->raw_buf == NULL) {
457 printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n");
458 unlock_kernel();
459 return -EIO;
460 }
461 if (dmap->mapping_flags) {
462 printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n");
463 unlock_kernel();
464 return -EIO;
465 }
466 if (vma->vm_pgoff != 0) {
467 printk(KERN_ERR "Sound: mmap() offset must be 0.\n");
468 unlock_kernel();
469 return -EINVAL;
470 }
471 size = vma->vm_end - vma->vm_start;
472
473 if (size != dmap->bytes_in_use) {
474 printk(KERN_WARNING "Sound: mmap() size = %ld. Should be %d\n", size, dmap->bytes_in_use);
475 }
476 if (remap_page_range(vma->vm_start, virt_to_phys(dmap->raw_buf),
477 vma->vm_end - vma->vm_start,
478 vma->vm_page_prot)) {
479 unlock_kernel();
480 return -EAGAIN;
481 }
482
483 dmap->mapping_flags |= DMA_MAP_MAPPED;
484
485 if( audio_devs[dev]->d->mmap)
486 audio_devs[dev]->d->mmap(dev);
487
488 memset(dmap->raw_buf,
489 dmap->neutral_byte,
490 dmap->bytes_in_use);
491 unlock_kernel();
492 return 0;
493 }
494
495 struct file_operations oss_sound_fops = {
496 owner: THIS_MODULE,
497 llseek: no_llseek,
498 read: sound_read,
499 write: sound_write,
500 poll: sound_poll,
501 ioctl: sound_ioctl,
502 mmap: sound_mmap,
503 open: sound_open,
504 release: sound_release,
505 };
506
507 /*
508 * Create the required special subdevices
509 */
510
511 static int create_special_devices(void)
512 {
513 int seq1,seq2;
514 seq1=register_sound_special(&oss_sound_fops, 1);
515 if(seq1==-1)
516 goto bad;
517 seq2=register_sound_special(&oss_sound_fops, 8);
518 if(seq2!=-1)
519 return 0;
520 unregister_sound_special(1);
521 bad:
522 return -1;
523 }
524
525
526 /* These device names follow the official Linux device list,
527 * Documentation/devices.txt. Let us know if there are other
528 * common names we should support for compatibility.
529 * Only those devices not created by the generic code in sound_core.c are
530 * registered here.
531 */
532 static const struct {
533 unsigned short minor;
534 char *name;
535 umode_t mode;
536 int *num;
537 } dev_list[] = { /* list of minor devices */
538 /* seems to be some confusion here -- this device is not in the device list */
539 {SND_DEV_DSP16, "dspW", S_IWUGO | S_IRUSR | S_IRGRP,
540 &num_audiodevs},
541 {SND_DEV_AUDIO, "audio", S_IWUGO | S_IRUSR | S_IRGRP,
542 &num_audiodevs},
543 };
544
545 static char *
546 soundcard_make_name(char *buf, char *name, int idx) {
547 if (idx==0)
548 sprintf(buf, "sound/%s", name);
549 else
550 sprintf(buf, "sound/%s%d", name, idx);
551 return buf;
552 }
553
554 /* Register/unregister audio entries */
555 static void soundcard_register_devfs (int do_register)
556 {
557 char name_buf[32];
558 int i, j, num;
559
560 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
561 num = (dev_list[i].num == NULL) ? 0 : *dev_list[i].num;
562 for (j = 0; j < num || j == 0; j++) {
563 soundcard_make_name (name_buf, dev_list[i].name, j);
564 if (do_register)
565 devfs_register (NULL, name_buf, DEVFS_FL_NONE,
566 SOUND_MAJOR, dev_list[i].minor+ (j* 0x10),
567 S_IFCHR | dev_list[i].mode,
568 &oss_sound_fops, NULL);
569 else {
570 devfs_handle_t de;
571
572 de = devfs_find_handle (NULL, name_buf, 0, 0,
573 DEVFS_SPECIAL_CHR, 0);
574 devfs_unregister (de);
575 }
576 }
577 }
578 }
579
580
581 static int dmabuf = 0;
582 static int dmabug = 0;
583
584 MODULE_PARM(dmabuf, "i");
585 MODULE_PARM(dmabug, "i");
586
587 static int __init oss_init(void)
588 {
589 int err;
590
591 /* drag in sound_syms.o */
592 {
593 extern char sound_syms_symbol;
594 sound_syms_symbol = 0;
595 }
596
597 #ifdef CONFIG_PCI
598 if(dmabug)
599 isa_dma_bridge_buggy = dmabug;
600 #endif
601
602 err = create_special_devices();
603 if (err) {
604 printk(KERN_ERR "sound: driver already loaded/included in kernel\n");
605 return err;
606 }
607
608 /* Protecting the innocent */
609 sound_dmap_flag = (dmabuf > 0 ? 1 : 0);
610
611 soundcard_register_devfs(1);
612
613 if (sound_nblocks >= 1024)
614 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n");
615
616 return 0;
617 }
618
619 static void __exit oss_cleanup(void)
620 {
621 int i;
622
623 if (MOD_IN_USE)
624 return;
625
626 soundcard_register_devfs (0);
627
628 unregister_sound_special(1);
629 unregister_sound_special(8);
630
631 sound_stop_timer();
632
633 sequencer_unload();
634
635 for (i = 0; i < MAX_DMA_CHANNELS; i++)
636 if (dma_alloc_map[i] != DMA_MAP_UNAVAIL) {
637 printk(KERN_ERR "Sound: Hmm, DMA%d was left allocated - fixed\n", i);
638 sound_free_dma(i);
639 }
640
641 for (i = 0; i < sound_nblocks; i++)
642 vfree(sound_mem_blocks[i]);
643
644 }
645
646 module_init(oss_init);
647 module_exit(oss_cleanup);
648
649
650 int sound_alloc_dma(int chn, char *deviceID)
651 {
652 int err;
653
654 if ((err = request_dma(chn, deviceID)) != 0)
655 return err;
656
657 dma_alloc_map[chn] = DMA_MAP_FREE;
658
659 return 0;
660 }
661
662 int sound_open_dma(int chn, char *deviceID)
663 {
664 unsigned long flags;
665
666 if (!valid_dma(chn)) {
667 printk(KERN_ERR "sound_open_dma: Invalid DMA channel %d\n", chn);
668 return 1;
669 }
670 save_flags(flags);
671 cli();
672
673 if (dma_alloc_map[chn] != DMA_MAP_FREE) {
674 printk("sound_open_dma: DMA channel %d busy or not allocated (%d)\n", chn, dma_alloc_map[chn]);
675 restore_flags(flags);
676 return 1;
677 }
678 dma_alloc_map[chn] = DMA_MAP_BUSY;
679 restore_flags(flags);
680 return 0;
681 }
682
683 void sound_free_dma(int chn)
684 {
685 if (dma_alloc_map[chn] == DMA_MAP_UNAVAIL) {
686 /* printk( "sound_free_dma: Bad access to DMA channel %d\n", chn); */
687 return;
688 }
689 free_dma(chn);
690 dma_alloc_map[chn] = DMA_MAP_UNAVAIL;
691 }
692
693 void sound_close_dma(int chn)
694 {
695 unsigned long flags;
696
697 save_flags(flags);
698 cli();
699
700 if (dma_alloc_map[chn] != DMA_MAP_BUSY) {
701 printk(KERN_ERR "sound_close_dma: Bad access to DMA channel %d\n", chn);
702 restore_flags(flags);
703 return;
704 }
705 dma_alloc_map[chn] = DMA_MAP_FREE;
706 restore_flags(flags);
707 }
708
709 static void do_sequencer_timer(unsigned long dummy)
710 {
711 sequencer_timer(0);
712 }
713
714
715 static struct timer_list seq_timer =
716 {function: do_sequencer_timer};
717
718 void request_sound_timer(int count)
719 {
720 extern unsigned long seq_time;
721
722 if (count < 0) {
723 seq_timer.expires = (-count) + jiffies;
724 add_timer(&seq_timer);
725 return;
726 }
727 count += seq_time;
728
729 count -= jiffies;
730
731 if (count < 1)
732 count = 1;
733
734 seq_timer.expires = (count) + jiffies;
735 add_timer(&seq_timer);
736 }
737
738 void sound_stop_timer(void)
739 {
740 del_timer(&seq_timer);;
741 }
742
743 void conf_printf(char *name, struct address_info *hw_config)
744 {
745 #ifndef CONFIG_SOUND_TRACEINIT
746 return;
747 #else
748 printk("<%s> at 0x%03x", name, hw_config->io_base);
749
750 if (hw_config->irq)
751 printk(" irq %d", (hw_config->irq > 0) ? hw_config->irq : -hw_config->irq);
752
753 if (hw_config->dma != -1 || hw_config->dma2 != -1)
754 {
755 printk(" dma %d", hw_config->dma);
756 if (hw_config->dma2 != -1)
757 printk(",%d", hw_config->dma2);
758 }
759 printk("\n");
760 #endif
761 }
762
763 void conf_printf2(char *name, int base, int irq, int dma, int dma2)
764 {
765 #ifndef CONFIG_SOUND_TRACEINIT
766 return;
767 #else
768 printk("<%s> at 0x%03x", name, base);
769
770 if (irq)
771 printk(" irq %d", (irq > 0) ? irq : -irq);
772
773 if (dma != -1 || dma2 != -1)
774 {
775 printk(" dma %d", dma);
776 if (dma2 != -1)
777 printk(",%d", dma2);
778 }
779 printk("\n");
780 #endif
781 }
782