http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / Documentation / sound / oss / README.modules
1 Building a modular sound driver
2 ================================
3
4   The following information is current as of linux-2.1.85. Check the other
5 readme files, especially README.OSS, for information not specific to
6 making sound modular.
7
8   First, configure your kernel. This is an idea of what you should be
9 setting in the sound section:
10
11 <M> Sound card support 
12
13 <M> 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support 
14
15   I have SoundBlaster. Select your card from the list.
16
17 <M> Generic OPL2/OPL3 FM synthesizer support 
18 <M> FM synthesizer (YM3812/OPL-3) support 
19
20   If you don't set these, you will probably find you can play .wav files
21 but not .midi. As the help for them says, set them unless you know your
22 card does not use one of these chips for FM support.
23
24   Once you are configured, make zlilo, modules, modules_install; reboot.
25 Note that it is no longer necessary or possible to configure sound in the
26 drivers/sound dir. Now one simply configures and makes one's kernel and
27 modules in the usual way.
28
29  Then, add to your /etc/modprobe.conf something like:
30
31 alias char-major-14-* sb
32 install sb /sbin/modprobe -i sb && /sbin/modprobe adlib_card
33 options sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330
34 options adlib_card io=0x388     # FM synthesizer
35
36  Alternatively, if you have compiled in kernel level ISAPnP support:
37
38 alias char-major-14 sb
39 post-install sb /sbin/modprobe "-k" "adlib_card"
40 options adlib_card io=0x388
41
42   The effect of this is that the sound driver and all necessary bits and
43 pieces autoload on demand, assuming you use kerneld (a sound choice) and
44 autoclean when not in use. Also, options for the device drivers are
45 set. They will not work without them. Change as appropriate for your card.
46 If you are not yet using the very cool kerneld, you will have to "modprobe
47 -k sb" yourself to get things going. Eventually things may be fixed so
48 that this kludgery is not necessary; for the time being, it seems to work
49 well.
50
51   Replace 'sb' with the driver for your card, and give it the right
52 options. To find the filename of the driver, look in
53 /lib/modules/<kernel-version>/misc. Mine looks like:
54
55 adlib_card.o # This is the generic OPLx driver
56 opl3.o # The OPL3 driver
57 sb.o # <<The SoundBlaster driver. Yours may differ.>>
58 sound.o # The sound driver
59 uart401.o # Used by sb, maybe other cards
60
61  Whichever card you have, try feeding it the options that would be the
62 default if you were making the driver wired, not as modules. You can look
63 at the init_module() code for the card to see what args are expected.
64
65  Note that at present there is no way to configure the io, irq and other
66 parameters for the modular drivers as one does for the wired drivers.. One
67 needs to pass the modules the necessary parameters as arguments, either
68 with /etc/modprobe.conf or with command-line args to modprobe, e.g.
69
70 modprobe sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330
71 modprobe adlib_card io=0x388
72
73  recommend using /etc/modprobe.conf.
74
75 Persistent DMA Buffers:
76
77 The sound modules normally allocate DMA buffers during open() and
78 deallocate them during close(). Linux can often have problems allocating
79 DMA buffers for ISA cards on machines with more than 16MB RAM. This is
80 because ISA DMA buffers must exist below the 16MB boundary and it is quite
81 possible that we can't find a large enough free block in this region after
82 the machine has been running for any amount of time. The way to avoid this
83 problem is to allocate the DMA buffers during module load and deallocate
84 them when the module is unloaded. For this to be effective we need to load
85 the sound modules right after the kernel boots, either manually or by an
86 init script, and keep them around until we shut down. This is a little
87 wasteful of RAM, but it guarantees that sound always works.
88
89 To make the sound driver use persistent DMA buffers we need to pass the
90 sound.o module a "dmabuf=1" command-line argument. This is normally done
91 in /etc/modprobe.conf like so:
92
93 options sound           dmabuf=1
94
95 If you have 16MB or less RAM or a PCI sound card, this is wasteful and
96 unnecessary. It is possible that machine with 16MB or less RAM will find
97 this option useful, but if your machine is so memory-starved that it
98 cannot find a 64K block free, you will be wasting even more RAM by keeping
99 the sound modules loaded and the DMA buffers allocated when they are not
100 needed. The proper solution is to upgrade your RAM. But you do also have
101 this improper solution as well. Use it wisely.
102
103   I'm afraid I know nothing about anything but my setup, being more of a
104 text-mode guy anyway. If you have options for other cards or other helpful
105 hints, send them to me, Jim Bray, jb@as220.org, http://as220.org/jb.