diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-06 23:51:34 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-06 23:51:34 +0000 |
commit | 230e5ab6a084ed50470f101934782dbf54b0d06b (patch) | |
tree | 5dd821c8d33f450470588e7a543f74bf74306e9e /drivers/sound/adlib_card.c | |
parent | c9b1c8a64c6444d189856f1e26bdcb8b4cd0113a (diff) |
Merge with Linux 2.1.67.
Diffstat (limited to 'drivers/sound/adlib_card.c')
-rw-r--r-- | drivers/sound/adlib_card.c | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/drivers/sound/adlib_card.c b/drivers/sound/adlib_card.c index 227f140b6..a8affde7e 100644 --- a/drivers/sound/adlib_card.c +++ b/drivers/sound/adlib_card.c @@ -12,39 +12,62 @@ * for more info. */ #include <linux/config.h> +#include <linux/module.h> #include "sound_config.h" +#include "soundmodule.h" -#if defined(CONFIG_YM3812) +#if defined(CONFIG_YM3812) || defined(MODULE) -void -attach_adlib_card (struct address_info *hw_config) +void attach_adlib_card(struct address_info *hw_config) { - - opl3_init (hw_config->io_base, hw_config->osp); - request_region (hw_config->io_base, 4, "OPL3/OPL2"); + hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp); + request_region(hw_config->io_base, 4, "OPL3/OPL2"); } -int -probe_adlib (struct address_info *hw_config) +int probe_adlib(struct address_info *hw_config) { - if (check_region (hw_config->io_base, 4)) - { - DDB (printk ("opl3.c: I/O port %x already in use\n", - hw_config->io_base)); - return 0; - } + if (check_region(hw_config->io_base, 4)) { + DDB(printk("opl3.c: I/O port %x already in use\n", hw_config->io_base)); + return 0; + } + return opl3_detect(hw_config->io_base, hw_config->osp); +} - return opl3_detect (hw_config->io_base, hw_config->osp); +void unload_adlib(struct address_info *hw_config) +{ + release_region(hw_config->io_base, 4); + sound_unload_synthdev(hw_config->slots[0]); } -void -unload_adlib (struct address_info *hw_config) +#ifdef MODULE + +int io = -1; +MODULE_PARM(io, "i"); + +struct address_info cfg; + +int init_module(void) { - release_region (hw_config->io_base, 4); + if (io == -1) { + printk("adlib: must specify I/O address.\n"); + return -EINVAL; + } + cfg.io_base = io; + if (probe_adlib(&cfg) == 0) + return -ENODEV; + attach_adlib_card(&cfg); + SOUND_LOCK; + return 0; } +void cleanup_module(void) +{ + unload_adlib(&cfg); + SOUND_LOCK_END; +} #endif +#endif |