- pre4:
[davej-history.git] / drivers / sound / adlib_card.c
blob1bc2f66535db79afdaeea8b2703fc43173e39e54
1 /*
2 * sound/adlib_card.c
4 * Detection routine for the AdLib card.
6 * Copyright (C) by Hannu Savolainen 1993-1997
8 * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
9 * Version 2 (June 1991). See the "COPYING" file distributed with this software
10 * for more info.
13 #include <linux/module.h>
14 #include <linux/init.h>
16 #include "sound_config.h"
18 #include "opl3.h"
20 static void __init attach_adlib_card(struct address_info *hw_config)
22 hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp, THIS_MODULE);
23 request_region(hw_config->io_base, 4, "OPL3/OPL2");
26 static int __init probe_adlib(struct address_info *hw_config)
28 if (check_region(hw_config->io_base, 4)) {
29 DDB(printk("opl3.c: I/O port %x already in use\n", hw_config->io_base));
30 return 0;
32 return opl3_detect(hw_config->io_base, hw_config->osp);
35 static struct address_info cfg;
37 static int __initdata io = -1;
39 MODULE_PARM(io, "i");
41 static int __init init_adlib(void)
43 cfg.io_base = io;
45 if (cfg.io_base == -1) {
46 printk(KERN_ERR "adlib: must specify I/O address.\n");
47 return -EINVAL;
49 if (probe_adlib(&cfg) == 0)
50 return -ENODEV;
51 attach_adlib_card(&cfg);
53 return 0;
56 static void __exit cleanup_adlib(void)
58 release_region(cfg.io_base, 4);
59 sound_unload_synthdev(cfg.slots[0]);
63 module_init(init_adlib);
64 module_exit(cleanup_adlib);
66 #ifndef MODULE
67 static int __init setup_adlib(char *str)
69 /* io */
70 int ints[2];
71 str = get_options(str, ARRAY_SIZE(ints), ints);
73 io = ints[1];
75 return 1;
77 __setup("adlib=", setup_adlib);
78 #endif