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