adlib_card.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * sound/oss/adlib_card.c
  3. *
  4. * Detection routine for the AdLib card.
  5. *
  6. * Copyright (C) by Hannu Savolainen 1993-1997
  7. *
  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.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/init.h>
  14. #include "sound_config.h"
  15. #include "opl3.h"
  16. static void __init attach_adlib_card(struct address_info *hw_config)
  17. {
  18. hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp, THIS_MODULE);
  19. }
  20. static int __init probe_adlib(struct address_info *hw_config)
  21. {
  22. return opl3_detect(hw_config->io_base, hw_config->osp);
  23. }
  24. static struct address_info cfg;
  25. static int __initdata io = -1;
  26. module_param(io, int, 0);
  27. static int __init init_adlib(void)
  28. {
  29. cfg.io_base = io;
  30. if (cfg.io_base == -1) {
  31. printk(KERN_ERR "adlib: must specify I/O address.\n");
  32. return -EINVAL;
  33. }
  34. if (probe_adlib(&cfg) == 0)
  35. return -ENODEV;
  36. attach_adlib_card(&cfg);
  37. return 0;
  38. }
  39. static void __exit cleanup_adlib(void)
  40. {
  41. sound_unload_synthdev(cfg.slots[0]);
  42. }
  43. module_init(init_adlib);
  44. module_exit(cleanup_adlib);
  45. #ifndef MODULE
  46. static int __init setup_adlib(char *str)
  47. {
  48. /* io */
  49. int ints[2];
  50. str = get_options(str, ARRAY_SIZE(ints), ints);
  51. io = ints[1];
  52. return 1;
  53. }
  54. __setup("adlib=", setup_adlib);
  55. #endif
  56. MODULE_LICENSE("GPL");