Opti 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. Support for the OPTi 82C931 chip
  2. --------------------------------
  3. Note: parts of this README file apply also to other
  4. cards that use the mad16 driver.
  5. Some items in this README file are based on features
  6. added to the sound driver after Linux-2.1.91 was out.
  7. By the time of writing this I do not know which official
  8. kernel release will include these features.
  9. Please do not report inconsistencies on older Linux
  10. kernels.
  11. The OPTi 82C931 is supported in its non-PnP mode.
  12. Usually you do not need to set jumpers, etc. The sound driver
  13. will check the card status and if it is required it will
  14. force the card into a mode in which it can be programmed.
  15. If you have another OS installed on your computer it is recommended
  16. that Linux and the other OS use the same resources.
  17. Also, it is recommended that resources specified in /etc/modprobe.d/*.conf
  18. and resources specified in /etc/isapnp.conf agree.
  19. Compiling the sound driver
  20. --------------------------
  21. I highly recommend that you build a modularized sound driver.
  22. This document does not cover a sound-driver which is built in
  23. the kernel.
  24. Sound card support should be enabled as a module (chose m).
  25. Answer 'm' for these items:
  26. Generic OPL2/OPL3 FM synthesizer support (CONFIG_SOUND_ADLIB)
  27. Microsoft Sound System support (CONFIG_SOUND_MSS)
  28. Support for OPTi MAD16 and/or Mozart based cards (CONFIG_SOUND_MAD16)
  29. FM synthesizer (YM3812/OPL-3) support (CONFIG_SOUND_YM3812)
  30. The configuration menu may ask for addresses, IRQ lines or DMA
  31. channels. If the card is used as a module the module loading
  32. options will override these values.
  33. For the OPTi 931 you can answer 'n' to:
  34. Support MIDI in older MAD16 based cards (requires SB) (CONFIG_SOUND_MAD16_OLDCARD)
  35. If you do need MIDI support in a Mozart or C928 based card you
  36. need to answer 'm' to the above question. In that case you will
  37. also need to answer 'm' to:
  38. '100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support' (CONFIG_SOUND_SB)
  39. Go on and compile your kernel and modules. Install the modules. Run depmod -a.
  40. Using isapnptools
  41. -----------------
  42. In most systems with a PnP BIOS you do not need to use isapnp. The
  43. initialization provided by the BIOS is sufficient for the driver
  44. to pick up the card and continue initialization.
  45. If that fails, or if you have other PnP cards, you need to use isapnp
  46. to initialize the card.
  47. This was tested with isapnptools-1.11 but I recommend that you use
  48. isapnptools-1.13 (or newer). Run pnpdump to dump the information
  49. about your PnP cards. Then edit the resulting file and select
  50. the options of your choice. This file is normally installed as
  51. /etc/isapnp.conf.
  52. The driver has one limitation with respect to I/O port resources:
  53. IO3 base must be 0x0E0C. Although isapnp allows other ports, this
  54. address is hard-coded into the driver.
  55. Using kmod and autoloading the sound driver
  56. -------------------------------------------
  57. Config files in '/etc/modprobe.d/' are used as below:
  58. alias mixer0 mad16
  59. alias audio0 mad16
  60. alias midi0 mad16
  61. alias synth0 opl3
  62. options sb mad16=1
  63. options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0
  64. options opl3 io=0x388
  65. install mad16 /sbin/modprobe -i mad16 && /sbin/ad1848_mixer_reroute 14 8 15 3 16 6
  66. If you have an MPU daughtercard or onboard MPU you will want to add to the
  67. "options mad16" line - eg
  68. options mad16 irq=5 dma=0 dma16=3 io=0x530 mpu_io=0x330 mpu_irq=9
  69. To set the I/O and IRQ of the MPU.
  70. Explain:
  71. alias mixer0 mad16
  72. alias audio0 mad16
  73. alias midi0 mad16
  74. alias synth0 opl3
  75. When any sound device is opened the kernel requests auto-loading
  76. of char-major-14. There is a built-in alias that translates this
  77. request to loading the main sound module.
  78. The sound module in its turn will request loading of a sub-driver
  79. for mixer, audio, midi or synthesizer device. The first 3 are
  80. supported by the mad16 driver. The synth device is supported
  81. by the opl3 driver.
  82. There is currently no way to autoload the sound device driver
  83. if more than one card is installed.
  84. options sb mad16=1
  85. This is left for historical reasons. If you enable the
  86. config option 'Support MIDI in older MAD16 based cards (requires SB)'
  87. or if you use an older mad16 driver it will force loading of the
  88. SoundBlaster driver. This option tells the SB driver not to look
  89. for a SB card but to wait for the mad16 driver.
  90. options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0
  91. options opl3 io=0x388
  92. post-install mad16 /sbin/ad1848_mixer_reroute 14 8 15 3 16 6
  93. This sets resources and options for the mad16 and opl3 drivers.
  94. I use two DMA channels (only one is required) to enable full duplex.
  95. joystick=1 enables the joystick port. cdtype=0 disables the cd port.
  96. You can also set mpu_io and mpu_irq in the mad16 options for the
  97. uart401 driver.
  98. This tells modprobe to run /sbin/ad1848_mixer_reroute after
  99. mad16 is successfully loaded and initialized. The source
  100. for ad1848_mixer_reroute is appended to the end of this readme
  101. file. It is impossible for the sound driver to know the actual
  102. connections to the mixer. The 3 inputs intended for cd, synth
  103. and line-in are mapped to the generic inputs line1, line2 and
  104. line3. This program reroutes these mixer channels to their
  105. right names (note the right mapping depends on the actual sound
  106. card that you use).
  107. The numeric parameters mean:
  108. 14=line1 8=cd - reroute line1 to the CD input.
  109. 15=line2 3=synth - reroute line2 to the synthesizer input.
  110. 16=line3 6=line - reroute line3 to the line input.
  111. For reference on other input names look at the file
  112. /usr/include/linux/soundcard.h.
  113. Using a joystick
  114. -----------------
  115. You must enable a joystick in the mad16 options. (also
  116. in /etc/isapnp.conf if you use it).
  117. Tested with regular analog joysticks.
  118. A CDROM drive connected to the sound card
  119. -----------------------------------------
  120. The 82C931 chip has support only for secondary ATAPI cdrom.
  121. (cdtype=8). Loading the mad16 driver resets the C931 chip
  122. and if a cdrom was already mounted it may cause a complete
  123. system hang. Do not use the sound card if you have an alternative.
  124. If you do use the sound card it is important that you load
  125. the mad16 driver (use "modprobe mad16" to prevent auto-unloading)
  126. before the cdrom is accessed the first time.
  127. Using the sound driver built-in to the kernel may help here, but...
  128. Most new systems have a PnP BIOS and also two IDE controllers.
  129. The IDE controller on the sound card may be needed only on older
  130. systems (which have only one IDE controller) but these systems
  131. also do not have a PnP BIOS - requiring isapnptools and a modularized
  132. driver.
  133. Known problems
  134. --------------
  135. 1. See the section on "A CDROM drive connected to the sound card".
  136. 2. On my system the codec cannot capture companded sound samples.
  137. (eg., recording from /dev/audio). When any companded capture is
  138. requested I get stereo-16 bit samples instead. Playback of
  139. companded samples works well. Apparently this problem is not common
  140. to all C931 based cards. I do not know how to identify cards that
  141. have this problem.
  142. Source for ad1848_mixer_reroute.c
  143. ---------------------------------
  144. #include <stdio.h>
  145. #include <fcntl.h>
  146. #include <linux/soundcard.h>
  147. static char *mixer_names[SOUND_MIXER_NRDEVICES] =
  148. SOUND_DEVICE_LABELS;
  149. int
  150. main(int argc, char **argv) {
  151. int val, from, to;
  152. int i, fd;
  153. fd = open("/dev/mixer", O_RDWR);
  154. if(fd < 0) {
  155. perror("/dev/mixer");
  156. return 1;
  157. }
  158. for(i = 2; i < argc; i += 2) {
  159. from = atoi(argv[i-1]);
  160. to = atoi(argv[i]);
  161. if(to == SOUND_MIXER_NONE)
  162. fprintf(stderr, "%s: turning off mixer %s\n",
  163. argv[0], mixer_names[to]);
  164. else
  165. fprintf(stderr, "%s: rerouting mixer %s to %s\n",
  166. argv[0], mixer_names[from], mixer_names[to]);
  167. val = from << 8 | to;
  168. if(ioctl(fd, SOUND_MIXER_PRIVATE2, &val)) {
  169. perror("AD1848 mixer reroute");
  170. return 1;
  171. }
  172. }
  173. return 0;
  174. }