mirror of https://gitee.com/openkylin/linux.git
223 lines
7.8 KiB
Plaintext
223 lines
7.8 KiB
Plaintext
Support for the OPTi 82C931 chip
|
|
--------------------------------
|
|
Note: parts of this README file apply also to other
|
|
cards that use the mad16 driver.
|
|
|
|
Some items in this README file are based on features
|
|
added to the sound driver after Linux-2.1.91 was out.
|
|
By the time of writing this I do not know which official
|
|
kernel release will include these features.
|
|
Please do not report inconsistencies on older Linux
|
|
kernels.
|
|
|
|
The OPTi 82C931 is supported in its non-PnP mode.
|
|
Usually you do not need to set jumpers, etc. The sound driver
|
|
will check the card status and if it is required it will
|
|
force the card into a mode in which it can be programmed.
|
|
|
|
If you have another OS installed on your computer it is recommended
|
|
that Linux and the other OS use the same resources.
|
|
|
|
Also, it is recommended that resources specified in /etc/modprobe.conf
|
|
and resources specified in /etc/isapnp.conf agree.
|
|
|
|
Compiling the sound driver
|
|
--------------------------
|
|
I highly recommend that you build a modularized sound driver.
|
|
This document does not cover a sound-driver which is built in
|
|
the kernel.
|
|
|
|
Sound card support should be enabled as a module (chose m).
|
|
Answer 'm' for these items:
|
|
Generic OPL2/OPL3 FM synthesizer support (CONFIG_SOUND_ADLIB)
|
|
Microsoft Sound System support (CONFIG_SOUND_MSS)
|
|
Support for OPTi MAD16 and/or Mozart based cards (CONFIG_SOUND_MAD16)
|
|
FM synthesizer (YM3812/OPL-3) support (CONFIG_SOUND_YM3812)
|
|
|
|
The configuration menu may ask for addresses, IRQ lines or DMA
|
|
channels. If the card is used as a module the module loading
|
|
options will override these values.
|
|
|
|
For the OPTi 931 you can answer 'n' to:
|
|
Support MIDI in older MAD16 based cards (requires SB) (CONFIG_SOUND_MAD16_OLDCARD)
|
|
If you do need MIDI support in a Mozart or C928 based card you
|
|
need to answer 'm' to the above question. In that case you will
|
|
also need to answer 'm' to:
|
|
'100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support' (CONFIG_SOUND_SB)
|
|
|
|
Go on and compile your kernel and modules. Install the modules. Run depmod -a.
|
|
|
|
Using isapnptools
|
|
-----------------
|
|
In most systems with a PnP BIOS you do not need to use isapnp. The
|
|
initialization provided by the BIOS is sufficient for the driver
|
|
to pick up the card and continue initialization.
|
|
|
|
If that fails, or if you have other PnP cards, you need to use isapnp
|
|
to initialize the card.
|
|
This was tested with isapnptools-1.11 but I recommend that you use
|
|
isapnptools-1.13 (or newer). Run pnpdump to dump the information
|
|
about your PnP cards. Then edit the resulting file and select
|
|
the options of your choice. This file is normally installed as
|
|
/etc/isapnp.conf.
|
|
|
|
The driver has one limitation with respect to I/O port resources:
|
|
IO3 base must be 0x0E0C. Although isapnp allows other ports, this
|
|
address is hard-coded into the driver.
|
|
|
|
Using kmod and autoloading the sound driver
|
|
-------------------------------------------
|
|
Comment: as of linux-2.1.90 kmod is replacing kerneld.
|
|
The config file '/etc/modprobe.conf' is used as before.
|
|
|
|
This is the sound part of my /etc/modprobe.conf file.
|
|
Following that I will explain each line.
|
|
|
|
alias mixer0 mad16
|
|
alias audio0 mad16
|
|
alias midi0 mad16
|
|
alias synth0 opl3
|
|
options sb mad16=1
|
|
options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0
|
|
options opl3 io=0x388
|
|
install mad16 /sbin/modprobe -i mad16 && /sbin/ad1848_mixer_reroute 14 8 15 3 16 6
|
|
|
|
If you have an MPU daughtercard or onboard MPU you will want to add to the
|
|
"options mad16" line - eg
|
|
|
|
options mad16 irq=5 dma=0 dma16=3 io=0x530 mpu_io=0x330 mpu_irq=9
|
|
|
|
To set the I/O and IRQ of the MPU.
|
|
|
|
|
|
Explain:
|
|
|
|
alias mixer0 mad16
|
|
alias audio0 mad16
|
|
alias midi0 mad16
|
|
alias synth0 opl3
|
|
|
|
When any sound device is opened the kernel requests auto-loading
|
|
of char-major-14. There is a built-in alias that translates this
|
|
request to loading the main sound module.
|
|
|
|
The sound module in its turn will request loading of a sub-driver
|
|
for mixer, audio, midi or synthesizer device. The first 3 are
|
|
supported by the mad16 driver. The synth device is supported
|
|
by the opl3 driver.
|
|
|
|
There is currently no way to autoload the sound device driver
|
|
if more than one card is installed.
|
|
|
|
options sb mad16=1
|
|
|
|
This is left for historical reasons. If you enable the
|
|
config option 'Support MIDI in older MAD16 based cards (requires SB)'
|
|
or if you use an older mad16 driver it will force loading of the
|
|
SoundBlaster driver. This option tells the SB driver not to look
|
|
for a SB card but to wait for the mad16 driver.
|
|
|
|
options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0
|
|
options opl3 io=0x388
|
|
|
|
post-install mad16 /sbin/ad1848_mixer_reroute 14 8 15 3 16 6
|
|
|
|
This sets resources and options for the mad16 and opl3 drivers.
|
|
I use two DMA channels (only one is required) to enable full duplex.
|
|
joystick=1 enables the joystick port. cdtype=0 disables the cd port.
|
|
You can also set mpu_io and mpu_irq in the mad16 options for the
|
|
uart401 driver.
|
|
|
|
This tells modprobe to run /sbin/ad1848_mixer_reroute after
|
|
mad16 is successfully loaded and initialized. The source
|
|
for ad1848_mixer_reroute is appended to the end of this readme
|
|
file. It is impossible for the sound driver to know the actual
|
|
connections to the mixer. The 3 inputs intended for cd, synth
|
|
and line-in are mapped to the generic inputs line1, line2 and
|
|
line3. This program reroutes these mixer channels to their
|
|
right names (note the right mapping depends on the actual sound
|
|
card that you use).
|
|
The numeric parameters mean:
|
|
14=line1 8=cd - reroute line1 to the CD input.
|
|
15=line2 3=synth - reroute line2 to the synthesizer input.
|
|
16=line3 6=line - reroute line3 to the line input.
|
|
For reference on other input names look at the file
|
|
/usr/include/linux/soundcard.h.
|
|
|
|
Using a joystick
|
|
-----------------
|
|
You must enable a joystick in the mad16 options. (also
|
|
in /etc/isapnp.conf if you use it).
|
|
Tested with regular analog joysticks.
|
|
|
|
A CDROM drive connected to the sound card
|
|
-----------------------------------------
|
|
The 82C931 chip has support only for secondary ATAPI cdrom.
|
|
(cdtype=8). Loading the mad16 driver resets the C931 chip
|
|
and if a cdrom was already mounted it may cause a complete
|
|
system hang. Do not use the sound card if you have an alternative.
|
|
If you do use the sound card it is important that you load
|
|
the mad16 driver (use "modprobe mad16" to prevent auto-unloading)
|
|
before the cdrom is accessed the first time.
|
|
|
|
Using the sound driver built-in to the kernel may help here, but...
|
|
Most new systems have a PnP BIOS and also two IDE controllers.
|
|
The IDE controller on the sound card may be needed only on older
|
|
systems (which have only one IDE controller) but these systems
|
|
also do not have a PnP BIOS - requiring isapnptools and a modularized
|
|
driver.
|
|
|
|
Known problems
|
|
--------------
|
|
1. See the section on "A CDROM drive connected to the sound card".
|
|
|
|
2. On my system the codec cannot capture companded sound samples.
|
|
(eg., recording from /dev/audio). When any companded capture is
|
|
requested I get stereo-16 bit samples instead. Playback of
|
|
companded samples works well. Apparently this problem is not common
|
|
to all C931 based cards. I do not know how to identify cards that
|
|
have this problem.
|
|
|
|
Source for ad1848_mixer_reroute.c
|
|
---------------------------------
|
|
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
#include <linux/soundcard.h>
|
|
|
|
static char *mixer_names[SOUND_MIXER_NRDEVICES] =
|
|
SOUND_DEVICE_LABELS;
|
|
|
|
int
|
|
main(int argc, char **argv) {
|
|
int val, from, to;
|
|
int i, fd;
|
|
|
|
fd = open("/dev/mixer", O_RDWR);
|
|
if(fd < 0) {
|
|
perror("/dev/mixer");
|
|
return 1;
|
|
}
|
|
|
|
for(i = 2; i < argc; i += 2) {
|
|
from = atoi(argv[i-1]);
|
|
to = atoi(argv[i]);
|
|
|
|
if(to == SOUND_MIXER_NONE)
|
|
fprintf(stderr, "%s: turning off mixer %s\n",
|
|
argv[0], mixer_names[to]);
|
|
else
|
|
fprintf(stderr, "%s: rerouting mixer %s to %s\n",
|
|
argv[0], mixer_names[from], mixer_names[to]);
|
|
|
|
val = from << 8 | to;
|
|
|
|
if(ioctl(fd, SOUND_MIXER_PRIVATE2, &val)) {
|
|
perror("AD1848 mixer reroute");
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|