diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/sound |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'Documentation/sound')
61 files changed, 18508 insertions, 0 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt new file mode 100644 index 000000000000..71ef0498d5e0 --- /dev/null +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -0,0 +1,1505 @@ | |||
1 | |||
2 | Advanced Linux Sound Architecture - Driver | ||
3 | ========================================== | ||
4 | Configuration guide | ||
5 | |||
6 | |||
7 | Kernel Configuration | ||
8 | ==================== | ||
9 | |||
10 | To enable ALSA support you need at least to build the kernel with | ||
11 | primary sound card support (CONFIG_SOUND). Since ALSA can emulate OSS, | ||
12 | you don't have to choose any of the OSS modules. | ||
13 | |||
14 | Enable "OSS API emulation" (CONFIG_SND_OSSEMUL) and both OSS mixer and | ||
15 | PCM supports if you want to run OSS applications with ALSA. | ||
16 | |||
17 | If you want to support the WaveTable functionality on cards such as | ||
18 | SB Live! then you need to enable "Sequencer support" | ||
19 | (CONFIG_SND_SEQUENCER). | ||
20 | |||
21 | To make ALSA debug messages more verbose, enable the "Verbose printk" | ||
22 | and "Debug" options. To check for memory leaks, turn on "Debug memory" | ||
23 | too. "Debug detection" will add checks for the detection of cards. | ||
24 | |||
25 | Please note that all the ALSA ISA drivers support the Linux isapnp API | ||
26 | (if the card supports ISA PnP). You don't need to configure the cards | ||
27 | using isapnptools. | ||
28 | |||
29 | |||
30 | Creating ALSA devices | ||
31 | ===================== | ||
32 | |||
33 | This depends on your distribution, but normally you use the /dev/MAKEDEV | ||
34 | script to create the necessary device nodes. On some systems you use a | ||
35 | script named 'snddevices'. | ||
36 | |||
37 | |||
38 | Module parameters | ||
39 | ================= | ||
40 | |||
41 | The user can load modules with options. If the module supports more than | ||
42 | one card and you have more than one card of the same type then you can | ||
43 | specify multiple values for the option separated by commas. | ||
44 | |||
45 | Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | ||
46 | |||
47 | Module snd | ||
48 | ---------- | ||
49 | |||
50 | The core ALSA module. It is used by all ALSA card drivers. | ||
51 | It takes the following options which have global effects. | ||
52 | |||
53 | major - major number for sound driver | ||
54 | - Default: 116 | ||
55 | cards_limit | ||
56 | - limiting card index for auto-loading (1-8) | ||
57 | - Default: 1 | ||
58 | - For auto-loading more than one card, specify this | ||
59 | option together with snd-card-X aliases. | ||
60 | device_mode | ||
61 | - permission mask for dynamic sound device filesystem | ||
62 | - This is available only when DEVFS is enabled | ||
63 | - Default: 0666 | ||
64 | - E.g.: device_mode=0660 | ||
65 | |||
66 | |||
67 | Module snd-pcm-oss | ||
68 | ------------------ | ||
69 | |||
70 | The PCM OSS emulation module. | ||
71 | This module takes options which change the mapping of devices. | ||
72 | |||
73 | dsp_map - PCM device number maps assigned to the 1st OSS device. | ||
74 | - Default: 0 | ||
75 | adsp_map - PCM device number maps assigned to the 2st OSS device. | ||
76 | - Default: 1 | ||
77 | nonblock_open | ||
78 | - Don't block opening busy PCM devices. | ||
79 | |||
80 | For example, when dsp_map=2, /dev/dsp will be mapped to PCM #2 of | ||
81 | the card #0. Similarly, when adsp_map=0, /dev/adsp will be mapped | ||
82 | to PCM #0 of the card #0. | ||
83 | For changing the second or later card, specify the option with | ||
84 | commas, such like "dsp_map=0,1". | ||
85 | |||
86 | nonblock_open option is used to change the behavior of the PCM | ||
87 | regarding opening the device. When this option is non-zero, | ||
88 | opening a busy OSS PCM device won't be blocked but return | ||
89 | immediately with EAGAIN (just like O_NONBLOCK flag). | ||
90 | |||
91 | Module snd-rawmidi | ||
92 | ------------------ | ||
93 | |||
94 | This module takes options which change the mapping of devices. | ||
95 | similar to those of the snd-pcm-oss module. | ||
96 | |||
97 | midi_map - MIDI device number maps assigned to the 1st OSS device. | ||
98 | - Default: 0 | ||
99 | amidi_map - MIDI device number maps assigned to the 2st OSS device. | ||
100 | - Default: 1 | ||
101 | |||
102 | Common parameters for top sound card modules | ||
103 | -------------------------------------------- | ||
104 | |||
105 | Each of top level sound card module takes the following options. | ||
106 | |||
107 | index - index (slot #) of sound card | ||
108 | - Values: 0 through 7 or negative | ||
109 | - If nonnegative, assign that index number | ||
110 | - if negative, interpret as a bitmask of permissible | ||
111 | indices; the first free permitted index is assigned | ||
112 | - Default: -1 | ||
113 | id - card ID (identifier or name) | ||
114 | - Can be up to 15 characters long | ||
115 | - Default: the card type | ||
116 | - A directory by this name is created under /proc/asound/ | ||
117 | containing information about the card | ||
118 | - This ID can be used instead of the index number in | ||
119 | identifying the card | ||
120 | enable - enable card | ||
121 | - Default: enabled, for PCI and ISA PnP cards | ||
122 | |||
123 | Module snd-ad1816a | ||
124 | ------------------ | ||
125 | |||
126 | Module for sound cards based on Analog Devices AD1816A/AD1815 ISA chips. | ||
127 | |||
128 | port - port # for AD1816A chip (PnP setup) | ||
129 | mpu_port - port # for MPU-401 UART (PnP setup) | ||
130 | fm_port - port # for OPL3 (PnP setup) | ||
131 | irq - IRQ # for AD1816A chip (PnP setup) | ||
132 | mpu_irq - IRQ # for MPU-401 UART (PnP setup) | ||
133 | dma1 - first DMA # for AD1816A chip (PnP setup) | ||
134 | dma2 - second DMA # for AD1816A chip (PnP setup) | ||
135 | |||
136 | Module supports up to 8 cards, autoprobe and PnP. | ||
137 | |||
138 | Module snd-ad1848 | ||
139 | ----------------- | ||
140 | |||
141 | Module for sound cards based on AD1848/AD1847/CS4248 ISA chips. | ||
142 | |||
143 | port - port # for AD1848 chip | ||
144 | irq - IRQ # for AD1848 chip | ||
145 | dma1 - DMA # for AD1848 chip (0,1,3) | ||
146 | |||
147 | Module supports up to 8 cards. This module does not support autoprobe | ||
148 | thus main port must be specified!!! Other ports are optional. | ||
149 | |||
150 | Module snd-ali5451 | ||
151 | ------------------ | ||
152 | |||
153 | Module for ALi M5451 PCI chip. | ||
154 | |||
155 | pcm_channels - Number of hardware channels assigned for PCM | ||
156 | spdif - Support SPDIF I/O | ||
157 | - Default: disabled | ||
158 | |||
159 | Module supports autoprobe and multiple chips (max 8). | ||
160 | |||
161 | The power-management is supported. | ||
162 | |||
163 | Module snd-als100 | ||
164 | ----------------- | ||
165 | |||
166 | Module for sound cards based on Avance Logic ALS100/ALS120 ISA chips. | ||
167 | |||
168 | port - port # for ALS100 (SB16) chip (PnP setup) | ||
169 | irq - IRQ # for ALS100 (SB16) chip (PnP setup) | ||
170 | dma8 - 8-bit DMA # for ALS100 (SB16) chip (PnP setup) | ||
171 | dma16 - 16-bit DMA # for ALS100 (SB16) chip (PnP setup) | ||
172 | mpu_port - port # for MPU-401 UART (PnP setup) | ||
173 | mpu_irq - IRQ # for MPU-401 (PnP setup) | ||
174 | fm_port - port # for OPL3 FM (PnP setup) | ||
175 | |||
176 | Module supports up to 8 cards, autoprobe and PnP. | ||
177 | |||
178 | Module snd-als4000 | ||
179 | ------------------ | ||
180 | |||
181 | Module for sound cards based on Avance Logic ALS4000 PCI chip. | ||
182 | |||
183 | joystick_port - port # for legacy joystick support. | ||
184 | 0 = disabled (default), 1 = auto-detect | ||
185 | |||
186 | Module supports up to 8 cards, autoprobe and PnP. | ||
187 | |||
188 | Module snd-atiixp | ||
189 | ----------------- | ||
190 | |||
191 | Module for ATI IXP 150/200/250 AC97 controllers. | ||
192 | |||
193 | ac97_clock - AC'97 clock (defalut = 48000) | ||
194 | ac97_quirk - AC'97 workaround for strange hardware | ||
195 | See the description of intel8x0 module for details. | ||
196 | spdif_aclink - S/PDIF transfer over AC-link (default = 1) | ||
197 | |||
198 | This module supports up to 8 cards and autoprobe. | ||
199 | |||
200 | Module snd-atiixp-modem | ||
201 | ----------------------- | ||
202 | |||
203 | Module for ATI IXP 150/200/250 AC97 modem controllers. | ||
204 | |||
205 | Module supports up to 8 cards. | ||
206 | |||
207 | Note: The default index value of this module is -2, i.e. the first | ||
208 | slot is excluded. | ||
209 | |||
210 | Module snd-au8810, snd-au8820, snd-au8830 | ||
211 | ----------------------------------------- | ||
212 | |||
213 | Module for Aureal Vortex, Vortex2 and Advantage device. | ||
214 | |||
215 | pcifix - Control PCI workarounds | ||
216 | 0 = Disable all workarounds | ||
217 | 1 = Force the PCI latency of the Aureal card to 0xff | ||
218 | 2 = Force the Extend PCI#2 Internal Master for Efficient | ||
219 | Handling of Dummy Requests on the VIA KT133 AGP Bridge | ||
220 | 3 = Force both settings | ||
221 | 255 = Autodetect what is required (default) | ||
222 | |||
223 | This module supports all ADB PCM channels, ac97 mixer, SPDIF, hardware | ||
224 | EQ, mpu401, gameport. A3D and wavetable support are still in development. | ||
225 | Development and reverse engineering work is being coordinated at | ||
226 | http://savannah.nongnu.org/projects/openvortex/ | ||
227 | SPDIF output has a copy of the AC97 codec output, unless you use the | ||
228 | "spdif" pcm device, which allows raw data passthru. | ||
229 | The hardware EQ hardware and SPDIF is only present in the Vortex2 and | ||
230 | Advantage. | ||
231 | |||
232 | Note: Some ALSA mixer applicactions don't handle the SPDIF samplerate | ||
233 | control correctly. If you have problems regarding this, try | ||
234 | another ALSA compliant mixer (alsamixer works). | ||
235 | |||
236 | Module snd-azt2320 | ||
237 | ------------------ | ||
238 | |||
239 | Module for sound cards based on Aztech System AZT2320 ISA chip (PnP only). | ||
240 | |||
241 | port - port # for AZT2320 chip (PnP setup) | ||
242 | wss_port - port # for WSS (PnP setup) | ||
243 | mpu_port - port # for MPU-401 UART (PnP setup) | ||
244 | fm_port - FM port # for AZT2320 chip (PnP setup) | ||
245 | irq - IRQ # for AZT2320 (WSS) chip (PnP setup) | ||
246 | mpu_irq - IRQ # for MPU-401 UART (PnP setup) | ||
247 | dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup) | ||
248 | dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup) | ||
249 | |||
250 | Module supports up to 8 cards, PnP and autoprobe. | ||
251 | |||
252 | Module snd-azt3328 | ||
253 | ------------------ | ||
254 | |||
255 | Module for sound cards based on Aztech AZF3328 PCI chip. | ||
256 | |||
257 | joystick - Enable joystick (default off) | ||
258 | |||
259 | Module supports up to 8 cards. | ||
260 | |||
261 | Module snd-bt87x | ||
262 | ---------------- | ||
263 | |||
264 | Module for video cards based on Bt87x chips. | ||
265 | |||
266 | digital_rate - Override the default digital rate (Hz) | ||
267 | load_all - Load the driver even if the card model isn't known | ||
268 | |||
269 | Module supports up to 8 cards. | ||
270 | |||
271 | Note: The default index value of this module is -2, i.e. the first | ||
272 | slot is excluded. | ||
273 | |||
274 | Module snd-ca0106 | ||
275 | ----------------- | ||
276 | |||
277 | Module for Creative Audigy LS and SB Live 24bit | ||
278 | |||
279 | Module supports up to 8 cards. | ||
280 | |||
281 | |||
282 | Module snd-cmi8330 | ||
283 | ------------------ | ||
284 | |||
285 | Module for sound cards based on C-Media CMI8330 ISA chips. | ||
286 | |||
287 | wssport - port # for CMI8330 chip (WSS) | ||
288 | wssirq - IRQ # for CMI8330 chip (WSS) | ||
289 | wssdma - first DMA # for CMI8330 chip (WSS) | ||
290 | sbport - port # for CMI8330 chip (SB16) | ||
291 | sbirq - IRQ # for CMI8330 chip (SB16) | ||
292 | sbdma8 - 8bit DMA # for CMI8330 chip (SB16) | ||
293 | sbdma16 - 16bit DMA # for CMI8330 chip (SB16) | ||
294 | |||
295 | Module supports up to 8 cards and autoprobe. | ||
296 | |||
297 | Module snd-cmipci | ||
298 | ----------------- | ||
299 | |||
300 | Module for C-Media CMI8338 and 8738 PCI sound cards. | ||
301 | |||
302 | mpu_port - 0x300,0x310,0x320,0x330, 0 = disable (default) | ||
303 | fm_port - 0x388 (default), 0 = disable (default) | ||
304 | soft_ac3 - Sofware-conversion of raw SPDIF packets (model 033 only) | ||
305 | (default = 1) | ||
306 | joystick_port - Joystick port address (0 = disable, 1 = auto-detect) | ||
307 | |||
308 | Module supports autoprobe and multiple chips (max 8). | ||
309 | |||
310 | Module snd-cs4231 | ||
311 | ----------------- | ||
312 | |||
313 | Module for sound cards based on CS4231 ISA chips. | ||
314 | |||
315 | port - port # for CS4231 chip | ||
316 | mpu_port - port # for MPU-401 UART (optional), -1 = disable | ||
317 | irq - IRQ # for CS4231 chip | ||
318 | mpu_irq - IRQ # for MPU-401 UART | ||
319 | dma1 - first DMA # for CS4231 chip | ||
320 | dma2 - second DMA # for CS4231 chip | ||
321 | |||
322 | Module supports up to 8 cards. This module does not support autoprobe | ||
323 | thus main port must be specified!!! Other ports are optional. | ||
324 | |||
325 | The power-management is supported. | ||
326 | |||
327 | Module snd-cs4232 | ||
328 | ----------------- | ||
329 | |||
330 | Module for sound cards based on CS4232/CS4232A ISA chips. | ||
331 | |||
332 | port - port # for CS4232 chip (PnP setup - 0x534) | ||
333 | cport - control port # for CS4232 chip (PnP setup - 0x120,0x210,0xf00) | ||
334 | mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable | ||
335 | fm_port - FM port # for CS4232 chip (PnP setup - 0x388), -1 = disable | ||
336 | irq - IRQ # for CS4232 chip (5,7,9,11,12,15) | ||
337 | mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) | ||
338 | dma1 - first DMA # for CS4232 chip (0,1,3) | ||
339 | dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable | ||
340 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
341 | |||
342 | Module supports up to 8 cards. This module does not support autoprobe | ||
343 | thus main port must be specified!!! Other ports are optional. | ||
344 | |||
345 | The power-management is supported. | ||
346 | |||
347 | Module snd-cs4236 | ||
348 | ----------------- | ||
349 | |||
350 | Module for sound cards based on CS4235/CS4236/CS4236B/CS4237B/ | ||
351 | CS4238B/CS4239 ISA chips. | ||
352 | |||
353 | port - port # for CS4236 chip (PnP setup - 0x534) | ||
354 | cport - control port # for CS4236 chip (PnP setup - 0x120,0x210,0xf00) | ||
355 | mpu_port - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable | ||
356 | fm_port - FM port # for CS4236 chip (PnP setup - 0x388), -1 = disable | ||
357 | irq - IRQ # for CS4236 chip (5,7,9,11,12,15) | ||
358 | mpu_irq - IRQ # for MPU-401 UART (9,11,12,15) | ||
359 | dma1 - first DMA # for CS4236 chip (0,1,3) | ||
360 | dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable | ||
361 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
362 | |||
363 | Module supports up to 8 cards. This module does not support autoprobe | ||
364 | (if ISA PnP is not used) thus main port and control port must be | ||
365 | specified!!! Other ports are optional. | ||
366 | |||
367 | The power-management is supported. | ||
368 | |||
369 | Module snd-cs4281 | ||
370 | ----------------- | ||
371 | |||
372 | Module for Cirrus Logic CS4281 soundchip. | ||
373 | |||
374 | dual_codec - Secondary codec ID (0 = disable, default) | ||
375 | |||
376 | Module supports up to 8 cards. | ||
377 | |||
378 | The power-management is supported. | ||
379 | |||
380 | Module snd-cs46xx | ||
381 | ----------------- | ||
382 | |||
383 | Module for PCI sound cards based on CS4610/CS4612/CS4614/CS4615/CS4622/ | ||
384 | CS4624/CS4630/CS4280 PCI chips. | ||
385 | |||
386 | external_amp - Force to enable external amplifer. | ||
387 | thinkpad - Force to enable Thinkpad's CLKRUN control. | ||
388 | mmap_valid - Support OSS mmap mode (default = 0). | ||
389 | |||
390 | Module supports up to 8 cards and autoprobe. | ||
391 | Usually external amp and CLKRUN controls are detected automatically | ||
392 | from PCI sub vendor/device ids. If they don't work, give the options | ||
393 | above explicitly. | ||
394 | |||
395 | The power-management is supported. | ||
396 | |||
397 | Module snd-dt019x | ||
398 | ----------------- | ||
399 | |||
400 | Module for Diamond Technologies DT-019X / Avance Logic ALS-007 (PnP | ||
401 | only) | ||
402 | |||
403 | port - Port # (PnP setup) | ||
404 | mpu_port - Port # for MPU-401 (PnP setup) | ||
405 | fm_port - Port # for FM OPL-3 (PnP setup) | ||
406 | irq - IRQ # (PnP setup) | ||
407 | mpu_irq - IRQ # for MPU-401 (PnP setup) | ||
408 | dma8 - DMA # (PnP setup) | ||
409 | |||
410 | Module supports up to 8 cards. This module is enabled only with | ||
411 | ISA PnP support. | ||
412 | |||
413 | Module snd-dummy | ||
414 | ---------------- | ||
415 | |||
416 | Module for the dummy sound card. This "card" doesn't do any output | ||
417 | or input, but you may use this module for any application which | ||
418 | requires a sound card (like RealPlayer). | ||
419 | |||
420 | Module snd-emu10k1 | ||
421 | ------------------ | ||
422 | |||
423 | Module for EMU10K1/EMU10k2 based PCI sound cards. | ||
424 | * Sound Blaster Live! | ||
425 | * Sound Blaster PCI 512 | ||
426 | * Emu APS (partially supported) | ||
427 | * Sound Blaster Audigy | ||
428 | |||
429 | extin - bitmap of available external inputs for FX8010 (see bellow) | ||
430 | extout - bitmap of available external outputs for FX8010 (see bellow) | ||
431 | seq_ports - allocated sequencer ports (4 by default) | ||
432 | max_synth_voices - limit of voices used for wavetable (64 by default) | ||
433 | max_buffer_size - specifies the maximum size of wavetable/pcm buffers | ||
434 | given in MB unit. Default value is 128. | ||
435 | enable_ir - enable IR | ||
436 | |||
437 | Module supports up to 8 cards and autoprobe. | ||
438 | |||
439 | Input & Output configurations [extin/extout] | ||
440 | * Creative Card wo/Digital out [0x0003/0x1f03] | ||
441 | * Creative Card w/Digital out [0x0003/0x1f0f] | ||
442 | * Creative Card w/Digital CD in [0x000f/0x1f0f] | ||
443 | * Creative Card wo/Digital out + LiveDrive [0x3fc3/0x1fc3] | ||
444 | * Creative Card w/Digital out + LiveDrive [0x3fc3/0x1fcf] | ||
445 | * Creative Card w/Digital CD in + LiveDrive [0x3fcf/0x1fcf] | ||
446 | * Creative Card wo/Digital out + Digital I/O 2 [0x0fc3/0x1f0f] | ||
447 | * Creative Card w/Digital out + Digital I/O 2 [0x0fc3/0x1f0f] | ||
448 | * Creative Card w/Digital CD in + Digital I/O 2 [0x0fcf/0x1f0f] | ||
449 | * Creative Card 5.1/w Digital out + LiveDrive [0x3fc3/0x1fff] | ||
450 | * Creative Card 5.1 (c) 2003 [0x3fc3/0x7cff] | ||
451 | * Creative Card all ins and outs [0x3fff/0x7fff] | ||
452 | |||
453 | Module snd-emu10k1x | ||
454 | ------------------- | ||
455 | |||
456 | Module for Creative Emu10k1X (SB Live Dell OEM version) | ||
457 | |||
458 | Module supports up to 8 cards. | ||
459 | |||
460 | Module snd-ens1370 | ||
461 | ------------------ | ||
462 | |||
463 | Module for Ensoniq AudioPCI ES1370 PCI sound cards. | ||
464 | * SoundBlaster PCI 64 | ||
465 | * SoundBlaster PCI 128 | ||
466 | |||
467 | joystick - Enable joystick (default off) | ||
468 | |||
469 | Module supports up to 8 cards and autoprobe. | ||
470 | |||
471 | Module snd-ens1371 | ||
472 | ------------------ | ||
473 | |||
474 | Module for Ensoniq AudioPCI ES1371 PCI sound cards. | ||
475 | * SoundBlaster PCI 64 | ||
476 | * SoundBlaster PCI 128 | ||
477 | * SoundBlaster Vibra PCI | ||
478 | |||
479 | joystick_port - port # for joystick (0x200,0x208,0x210,0x218), | ||
480 | 0 = disable (default), 1 = auto-detect | ||
481 | |||
482 | Module supports up to 8 cards and autoprobe. | ||
483 | |||
484 | Module snd-es968 | ||
485 | ---------------- | ||
486 | |||
487 | Module for sound cards based on ESS ES968 chip (PnP only). | ||
488 | |||
489 | port - port # for ES968 (SB8) chip (PnP setup) | ||
490 | irq - IRQ # for ES968 (SB8) chip (PnP setup) | ||
491 | dma1 - DMA # for ES968 (SB8) chip (PnP setup) | ||
492 | |||
493 | Module supports up to 8 cards, PnP and autoprobe. | ||
494 | |||
495 | Module snd-es1688 | ||
496 | ----------------- | ||
497 | |||
498 | Module for ESS AudioDrive ES-1688 and ES-688 sound cards. | ||
499 | |||
500 | port - port # for ES-1688 chip (0x220,0x240,0x260) | ||
501 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default) | ||
502 | irq - IRQ # for ES-1688 chip (5,7,9,10) | ||
503 | mpu_irq - IRQ # for MPU-401 port (5,7,9,10) | ||
504 | dma8 - DMA # for ES-1688 chip (0,1,3) | ||
505 | |||
506 | Module supports up to 8 cards and autoprobe (without MPU-401 port). | ||
507 | |||
508 | Module snd-es18xx | ||
509 | ----------------- | ||
510 | |||
511 | Module for ESS AudioDrive ES-18xx sound cards. | ||
512 | |||
513 | port - port # for ES-18xx chip (0x220,0x240,0x260) | ||
514 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default) | ||
515 | fm_port - port # for FM (optional, not used) | ||
516 | irq - IRQ # for ES-18xx chip (5,7,9,10) | ||
517 | dma1 - first DMA # for ES-18xx chip (0,1,3) | ||
518 | dma2 - first DMA # for ES-18xx chip (0,1,3) | ||
519 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
520 | |||
521 | Module supports up to 8 cards ISA PnP and autoprobe (without MPU-401 port | ||
522 | if native ISA PnP routines are not used). | ||
523 | When dma2 is equal with dma1, the driver works as half-duplex. | ||
524 | |||
525 | The power-management is supported. | ||
526 | |||
527 | Module snd-es1938 | ||
528 | ----------------- | ||
529 | |||
530 | Module for sound cards based on ESS Solo-1 (ES1938,ES1946) chips. | ||
531 | |||
532 | Module supports up to 8 cards and autoprobe. | ||
533 | |||
534 | Module snd-es1968 | ||
535 | ----------------- | ||
536 | |||
537 | Module for sound cards based on ESS Maestro-1/2/2E (ES1968/ES1978) chips. | ||
538 | |||
539 | total_bufsize - total buffer size in kB (1-4096kB) | ||
540 | pcm_substreams_p - playback channels (1-8, default=2) | ||
541 | pcm_substreams_c - capture channels (1-8, default=0) | ||
542 | clock - clock (0 = auto-detection) | ||
543 | use_pm - support the power-management (0 = off, 1 = on, | ||
544 | 2 = auto (default)) | ||
545 | enable_mpu - enable MPU401 (0 = off, 1 = on, 2 = auto (default)) | ||
546 | joystick - enable joystick (default off) | ||
547 | |||
548 | Module supports up to 8 cards and autoprobe. | ||
549 | |||
550 | The power-management is supported. | ||
551 | |||
552 | Module snd-fm801 | ||
553 | ---------------- | ||
554 | |||
555 | Module for ForteMedia FM801 based PCI sound cards. | ||
556 | |||
557 | tea575x_tuner - Enable TEA575x tuner | ||
558 | - 1 = MediaForte 256-PCS | ||
559 | - 2 = MediaForte 256-PCPR | ||
560 | - 3 = MediaForte 64-PCR | ||
561 | - High 16-bits are video (radio) device number + 1 | ||
562 | - example: 0x10002 (MediaForte 256-PCPR, device 1) | ||
563 | |||
564 | Module supports up to 8 cards and autoprobe. | ||
565 | |||
566 | Module snd-gusclassic | ||
567 | --------------------- | ||
568 | |||
569 | Module for Gravis UltraSound Classic sound card. | ||
570 | |||
571 | port - port # for GF1 chip (0x220,0x230,0x240,0x250,0x260) | ||
572 | irq - IRQ # for GF1 chip (3,5,9,11,12,15) | ||
573 | dma1 - DMA # for GF1 chip (1,3,5,6,7) | ||
574 | dma2 - DMA # for GF1 chip (1,3,5,6,7,-1=disable) | ||
575 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | ||
576 | voices - GF1 voices limit (14-32) | ||
577 | pcm_voices - reserved PCM voices | ||
578 | |||
579 | Module supports up to 8 cards and autoprobe. | ||
580 | |||
581 | Module snd-gusextreme | ||
582 | --------------------- | ||
583 | |||
584 | Module for Gravis UltraSound Extreme (Synergy ViperMax) sound card. | ||
585 | |||
586 | port - port # for ES-1688 chip (0x220,0x230,0x240,0x250,0x260) | ||
587 | gf1_port - port # for GF1 chip (0x210,0x220,0x230,0x240,0x250,0x260,0x270) | ||
588 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable | ||
589 | irq - IRQ # for ES-1688 chip (5,7,9,10) | ||
590 | gf1_irq - IRQ # for GF1 chip (3,5,9,11,12,15) | ||
591 | mpu_irq - IRQ # for MPU-401 port (5,7,9,10) | ||
592 | dma8 - DMA # for ES-1688 chip (0,1,3) | ||
593 | dma1 - DMA # for GF1 chip (1,3,5,6,7) | ||
594 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | ||
595 | voices - GF1 voices limit (14-32) | ||
596 | pcm_voices - reserved PCM voices | ||
597 | |||
598 | Module supports up to 8 cards and autoprobe (without MPU-401 port). | ||
599 | |||
600 | Module snd-gusmax | ||
601 | ----------------- | ||
602 | |||
603 | Module for Gravis UltraSound MAX sound card. | ||
604 | |||
605 | port - port # for GF1 chip (0x220,0x230,0x240,0x250,0x260) | ||
606 | irq - IRQ # for GF1 chip (3,5,9,11,12,15) | ||
607 | dma1 - DMA # for GF1 chip (1,3,5,6,7) | ||
608 | dma2 - DMA # for GF1 chip (1,3,5,6,7,-1=disable) | ||
609 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | ||
610 | voices - GF1 voices limit (14-32) | ||
611 | pcm_voices - reserved PCM voices | ||
612 | |||
613 | Module supports up to 8 cards and autoprobe. | ||
614 | |||
615 | Module snd-hda-intel | ||
616 | -------------------- | ||
617 | |||
618 | Module for Intel HD Audio (ICH6, ICH6M, ICH7) | ||
619 | |||
620 | model - force the model name | ||
621 | |||
622 | Module supports up to 8 cards. | ||
623 | |||
624 | Each codec may have a model table for different configurations. | ||
625 | If your machine isn't listed there, the default (usually minimal) | ||
626 | configuration is set up. You can pass "model=<name>" option to | ||
627 | specify a certain model in such a case. There are different | ||
628 | models depending on the codec chip. | ||
629 | |||
630 | Model name Description | ||
631 | ---------- ----------- | ||
632 | ALC880 | ||
633 | 3stack 3-jack in back and a headphone out | ||
634 | 3stack-digout 3-jack in back, a HP out and a SPDIF out | ||
635 | 5stack 5-jack in back, 2-jack in front | ||
636 | 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out | ||
637 | w810 3-jack | ||
638 | |||
639 | CMI9880 | ||
640 | minimal 3-jack in back | ||
641 | min_fp 3-jack in back, 2-jack in front | ||
642 | full 6-jack in back, 2-jack in front | ||
643 | full_dig 6-jack in back, 2-jack in front, SPDIF I/O | ||
644 | allout 5-jack in back, 2-jack in front, SPDIF out | ||
645 | |||
646 | Module snd-hdsp | ||
647 | --------------- | ||
648 | |||
649 | Module for RME Hammerfall DSP audio interface(s) | ||
650 | |||
651 | Module supports up to 8 cards. | ||
652 | |||
653 | Note: The firmware data can be automatically loaded via hotplug | ||
654 | when CONFIG_FW_LOADER is set. Otherwise, you need to load | ||
655 | the firmware via hdsploader utility included in alsa-tools | ||
656 | package. | ||
657 | The firmware data is found in alsa-firmware package. | ||
658 | |||
659 | Note: snd-page-alloc module does the job which snd-hammerfall-mem | ||
660 | module did formerly. It will allocate the buffers in advance | ||
661 | when any HDSP cards are found. To make the buffer | ||
662 | allocation sure, load snd-page-alloc module in the early | ||
663 | stage of boot sequence. | ||
664 | |||
665 | Module snd-ice1712 | ||
666 | ------------------ | ||
667 | |||
668 | Module for Envy24 (ICE1712) based PCI sound cards. | ||
669 | * MidiMan M Audio Delta 1010 | ||
670 | * MidiMan M Audio Delta 1010LT | ||
671 | * MidiMan M Audio Delta DiO 2496 | ||
672 | * MidiMan M Audio Delta 66 | ||
673 | * MidiMan M Audio Delta 44 | ||
674 | * MidiMan M Audio Delta 410 | ||
675 | * MidiMan M Audio Audiophile 2496 | ||
676 | * TerraTec EWS 88MT | ||
677 | * TerraTec EWS 88D | ||
678 | * TerraTec EWX 24/96 | ||
679 | * TerraTec DMX 6Fire | ||
680 | * Hoontech SoundTrack DSP 24 | ||
681 | * Hoontech SoundTrack DSP 24 Value | ||
682 | * Hoontech SoundTrack DSP 24 Media 7.1 | ||
683 | * Digigram VX442 | ||
684 | |||
685 | model - Use the given board model, one of the following: | ||
686 | delta1010, dio2496, delta66, delta44, audiophile, delta410, | ||
687 | delta1010lt, vx442, ewx2496, ews88mt, ews88mt_new, ews88d, | ||
688 | dmx6fire, dsp24, dsp24_value, dsp24_71, ez8 | ||
689 | omni - Omni I/O support for MidiMan M-Audio Delta44/66 | ||
690 | cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever) | ||
691 | in msec resolution, default value is 500 (0.5 sec) | ||
692 | |||
693 | Module supports up to 8 cards and autoprobe. Note: The consumer part | ||
694 | is not used with all Envy24 based cards (for example in the MidiMan Delta | ||
695 | serie). | ||
696 | |||
697 | Module snd-ice1724 | ||
698 | ------------------ | ||
699 | |||
700 | Module for Envy24HT (VT/ICE1724) based PCI sound cards. | ||
701 | * MidiMan M Audio Revolution 7.1 | ||
702 | * AMP Ltd AUDIO2000 | ||
703 | * TerraTec Aureon Sky-5.1, Space-7.1 | ||
704 | |||
705 | model - Use the given board model, one of the following: | ||
706 | revo71, amp2000, prodigy71, aureon51, aureon71, | ||
707 | k8x800 | ||
708 | |||
709 | Module supports up to 8 cards and autoprobe. | ||
710 | |||
711 | Module snd-intel8x0 | ||
712 | ------------------- | ||
713 | |||
714 | Module for AC'97 motherboards from Intel and compatibles. | ||
715 | * Intel i810/810E, i815, i820, i830, i84x, MX440 | ||
716 | * SiS 7012 (SiS 735) | ||
717 | * NVidia NForce, NForce2 | ||
718 | * AMD AMD768, AMD8111 | ||
719 | * ALi m5455 | ||
720 | |||
721 | ac97_clock - AC'97 codec clock base (0 = auto-detect) | ||
722 | ac97_quirk - AC'97 workaround for strange hardware | ||
723 | The following strings are accepted: | ||
724 | default = don't override the default setting | ||
725 | disable = disable the quirk | ||
726 | hp_only = use headphone control as master | ||
727 | swap_hp = swap headphone and master controls | ||
728 | swap_surround = swap master and surround controls | ||
729 | ad_sharing = for AD1985, turn on OMS bit and use headphone | ||
730 | alc_jack = for ALC65x, turn on the jack sense mode | ||
731 | inv_eapd = inverted EAPD implementation | ||
732 | mute_led = bind EAPD bit for turning on/off mute LED | ||
733 | For backward compatibility, the corresponding integer | ||
734 | value -1, 0, ... are accepted, too. | ||
735 | buggy_irq - Enable workaround for buggy interrupts on some | ||
736 | motherboards (default off) | ||
737 | |||
738 | Module supports autoprobe and multiple bus-master chips (max 8). | ||
739 | |||
740 | Note: the latest driver supports auto-detection of chip clock. | ||
741 | if you still encounter too fast playback, specify the clock | ||
742 | explicitly via the module option "ac97_clock=41194". | ||
743 | |||
744 | Joystick/MIDI ports are not supported by this driver. If your | ||
745 | motherboard has these devices, use the ns558 or snd-mpu401 | ||
746 | modules, respectively. | ||
747 | |||
748 | The ac97_quirk option is used to enable/override the workaround | ||
749 | for specific devices. Some hardware have swapped output pins | ||
750 | between Master and Headphone, or Surround. The driver provides | ||
751 | the auto-detection of known problematic devices, but some might | ||
752 | be unknown or wrongly detected. In such a case, pass the proper | ||
753 | value with this option. | ||
754 | |||
755 | The power-management is supported. | ||
756 | |||
757 | Module snd-intel8x0m | ||
758 | -------------------- | ||
759 | |||
760 | Module for Intel ICH (i8x0) chipset MC97 modems. | ||
761 | |||
762 | ac97_clock - AC'97 codec clock base (0 = auto-detect) | ||
763 | |||
764 | This module supports up to 8 cards and autoprobe. | ||
765 | |||
766 | Note: The default index value of this module is -2, i.e. the first | ||
767 | slot is excluded. | ||
768 | |||
769 | Module snd-interwave | ||
770 | -------------------- | ||
771 | |||
772 | Module for Gravis UltraSound PnP, Dynasonic 3-D/Pro, STB Sound Rage 32 | ||
773 | and other sound cards based on AMD InterWave (tm) chip. | ||
774 | |||
775 | port - port # for InterWave chip (0x210,0x220,0x230,0x240,0x250,0x260) | ||
776 | irq - IRQ # for InterWave chip (3,5,9,11,12,15) | ||
777 | dma1 - DMA # for InterWave chip (0,1,3,5,6,7) | ||
778 | dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable) | ||
779 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | ||
780 | midi - 1 = MIDI UART enable, 0 = MIDI UART disable (default) | ||
781 | pcm_voices - reserved PCM voices for the synthesizer (default 2) | ||
782 | effect - 1 = InterWave effects enable (default 0); | ||
783 | requires 8 voices | ||
784 | |||
785 | Module supports up to 8 cards, autoprobe and ISA PnP. | ||
786 | |||
787 | Module snd-interwave-stb | ||
788 | ------------------------ | ||
789 | |||
790 | Module for UltraSound 32-Pro (sound card from STB used by Compaq) | ||
791 | and other sound cards based on AMD InterWave (tm) chip with TEA6330T | ||
792 | circuit for extended control of bass, treble and master volume. | ||
793 | |||
794 | port - port # for InterWave chip (0x210,0x220,0x230,0x240,0x250,0x260) | ||
795 | port_tc - tone control (i2c bus) port # for TEA6330T chip (0x350,0x360,0x370,0x380) | ||
796 | irq - IRQ # for InterWave chip (3,5,9,11,12,15) | ||
797 | dma1 - DMA # for InterWave chip (0,1,3,5,6,7) | ||
798 | dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable) | ||
799 | joystick_dac - 0 to 31, (0.59V-4.52V or 0.389V-2.98V) | ||
800 | midi - 1 = MIDI UART enable, 0 = MIDI UART disable (default) | ||
801 | pcm_voices - reserved PCM voices for the synthesizer (default 2) | ||
802 | effect - 1 = InterWave effects enable (default 0); | ||
803 | requires 8 voices | ||
804 | |||
805 | Module supports up to 8 cards, autoprobe and ISA PnP. | ||
806 | |||
807 | Module snd-korg1212 | ||
808 | ------------------- | ||
809 | |||
810 | Module for Korg 1212 IO PCI card | ||
811 | |||
812 | Module supports up to 8 cards. | ||
813 | |||
814 | Module snd-maestro3 | ||
815 | ------------------- | ||
816 | |||
817 | Module for Allegro/Maestro3 chips | ||
818 | |||
819 | external_amp - enable external amp (enabled by default) | ||
820 | amp_gpio - GPIO pin number for external amp (0-15) or | ||
821 | -1 for default pin (8 for allegro, 1 for | ||
822 | others) | ||
823 | |||
824 | Module supports autoprobe and multiple chips (max 8). | ||
825 | |||
826 | Note: the binding of amplifier is dependent on hardware. | ||
827 | If there is no sound even though all channels are unmuted, try to | ||
828 | specify other gpio connection via amp_gpio option. | ||
829 | For example, a Panasonic notebook might need "amp_gpio=0x0d" | ||
830 | option. | ||
831 | |||
832 | The power-management is supported. | ||
833 | |||
834 | Module snd-mixart | ||
835 | ----------------- | ||
836 | |||
837 | Module for Digigram miXart8 sound cards. | ||
838 | |||
839 | Module supports multiple cards. | ||
840 | Note: One miXart8 board will be represented as 4 alsa cards. | ||
841 | See MIXART.txt for details. | ||
842 | |||
843 | When the driver is compiled as a module and the hotplug firmware | ||
844 | is supported, the firmware data is loaded via hotplug automatically. | ||
845 | Install the necessary firmware files in alsa-firmware package. | ||
846 | When no hotplug fw loader is available, you need to load the | ||
847 | firmware via mixartloader utility in alsa-tools package. | ||
848 | |||
849 | Module snd-mpu401 | ||
850 | ----------------- | ||
851 | |||
852 | Module for MPU-401 UART devices. | ||
853 | |||
854 | port - port number or -1 (disable) | ||
855 | irq - IRQ number or -1 (disable) | ||
856 | pnp - PnP detection - 0 = disable, 1 = enable (default) | ||
857 | |||
858 | Module supports multiple devices (max 8) and PnP. | ||
859 | |||
860 | Module snd-mtpav | ||
861 | ---------------- | ||
862 | |||
863 | Module for MOTU MidiTimePiece AV multiport MIDI (on the parallel | ||
864 | port). | ||
865 | |||
866 | port - I/O port # for MTPAV (0x378,0x278, default=0x378) | ||
867 | irq - IRQ # for MTPAV (7,5, default=7) | ||
868 | hwports - number of supported hardware ports, default=8. | ||
869 | |||
870 | Module supports only 1 card. This module has no enable option. | ||
871 | |||
872 | Module snd-nm256 | ||
873 | ---------------- | ||
874 | |||
875 | Module for NeoMagic NM256AV/ZX chips | ||
876 | |||
877 | playback_bufsize - max playback frame size in kB (4-128kB) | ||
878 | capture_bufsize - max capture frame size in kB (4-128kB) | ||
879 | force_ac97 - 0 or 1 (disabled by default) | ||
880 | buffer_top - specify buffer top address | ||
881 | use_cache - 0 or 1 (disabled by default) | ||
882 | vaio_hack - alias buffer_top=0x25a800 | ||
883 | reset_workaround - enable AC97 RESET workaround for some laptops | ||
884 | |||
885 | Module supports autoprobe and multiple chips (max 8). | ||
886 | |||
887 | The power-management is supported. | ||
888 | |||
889 | Note: on some notebooks the buffer address cannot be detected | ||
890 | automatically, or causes hang-up during initialization. | ||
891 | In such a case, specify the buffer top address explicity via | ||
892 | buffer_top option. | ||
893 | For example, | ||
894 | Sony F250: buffer_top=0x25a800 | ||
895 | Sony F270: buffer_top=0x272800 | ||
896 | The driver supports only ac97 codec. It's possible to force | ||
897 | to initialize/use ac97 although it's not detected. In such a | ||
898 | case, use force_ac97=1 option - but *NO* guarantee whether it | ||
899 | works! | ||
900 | |||
901 | Note: The NM256 chip can be linked internally with non-AC97 | ||
902 | codecs. This driver supports only the AC97 codec, and won't work | ||
903 | with machines with other (most likely CS423x or OPL3SAx) chips, | ||
904 | even though the device is detected in lspci. In such a case, try | ||
905 | other drivers, e.g. snd-cs4232 or snd-opl3sa2. Some has ISA-PnP | ||
906 | but some doesn't have ISA PnP. You'll need to speicfy isapnp=0 | ||
907 | and proper hardware parameters in the case without ISA PnP. | ||
908 | |||
909 | Note: some laptops need a workaround for AC97 RESET. For the | ||
910 | known hardware like Dell Latitude LS and Sony PCG-F305, this | ||
911 | workaround is enabled automatically. For other laptops with a | ||
912 | hard freeze, you can try reset_workaround=1 option. | ||
913 | |||
914 | Note: This driver is really crappy. It's a porting from the | ||
915 | OSS driver, which is a result of black-magic reverse engineering. | ||
916 | The detection of codec will fail if the driver is loaded *after* | ||
917 | X-server as described above. You might be able to force to load | ||
918 | the module, but it may result in hang-up. Hence, make sure that | ||
919 | you load this module *before* X if you encounter this kind of | ||
920 | problem. | ||
921 | |||
922 | Module snd-opl3sa2 | ||
923 | ------------------ | ||
924 | |||
925 | Module for Yamaha OPL3-SA2/SA3 sound cards. | ||
926 | |||
927 | port - control port # for OPL3-SA chip (0x370) | ||
928 | sb_port - SB port # for OPL3-SA chip (0x220,0x240) | ||
929 | wss_port - WSS port # for OPL3-SA chip (0x530,0xe80,0xf40,0x604) | ||
930 | midi_port - port # for MPU-401 UART (0x300,0x330), -1 = disable | ||
931 | fm_port - FM port # for OPL3-SA chip (0x388), -1 = disable | ||
932 | irq - IRQ # for OPL3-SA chip (5,7,9,10) | ||
933 | dma1 - first DMA # for Yamaha OPL3-SA chip (0,1,3) | ||
934 | dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable | ||
935 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
936 | |||
937 | Module supports up to 8 cards and ISA PnP. This module does not support | ||
938 | autoprobe (if ISA PnP is not used) thus all ports must be specified!!! | ||
939 | |||
940 | The power-management is supported. | ||
941 | |||
942 | Module snd-opti92x-ad1848 | ||
943 | ------------------------- | ||
944 | |||
945 | Module for sound cards based on OPTi 82c92x and Analog Devices AD1848 chips. | ||
946 | Module works with OAK Mozart cards as well. | ||
947 | |||
948 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) | ||
949 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) | ||
950 | fm_port - port # for OPL3 device (0x388) | ||
951 | irq - IRQ # for WSS chip (5,7,9,10,11) | ||
952 | mpu_irq - IRQ # for MPU-401 UART (5,7,9,10) | ||
953 | dma1 - first DMA # for WSS chip (0,1,3) | ||
954 | |||
955 | This module supports only one card, autoprobe and PnP. | ||
956 | |||
957 | Module snd-opti92x-cs4231 | ||
958 | ------------------------- | ||
959 | |||
960 | Module for sound cards based on OPTi 82c92x and Crystal CS4231 chips. | ||
961 | |||
962 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) | ||
963 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) | ||
964 | fm_port - port # for OPL3 device (0x388) | ||
965 | irq - IRQ # for WSS chip (5,7,9,10,11) | ||
966 | mpu_irq - IRQ # for MPU-401 UART (5,7,9,10) | ||
967 | dma1 - first DMA # for WSS chip (0,1,3) | ||
968 | dma2 - second DMA # for WSS chip (0,1,3) | ||
969 | |||
970 | This module supports only one card, autoprobe and PnP. | ||
971 | |||
972 | Module snd-opti93x | ||
973 | ------------------ | ||
974 | |||
975 | Module for sound cards based on OPTi 82c93x chips. | ||
976 | |||
977 | port - port # for WSS chip (0x530,0xe80,0xf40,0x604) | ||
978 | mpu_port - port # for MPU-401 UART (0x300,0x310,0x320,0x330) | ||
979 | fm_port - port # for OPL3 device (0x388) | ||
980 | irq - IRQ # for WSS chip (5,7,9,10,11) | ||
981 | mpu_irq - IRQ # for MPU-401 UART (5,7,9,10) | ||
982 | dma1 - first DMA # for WSS chip (0,1,3) | ||
983 | dma2 - second DMA # for WSS chip (0,1,3) | ||
984 | |||
985 | This module supports only one card, autoprobe and PnP. | ||
986 | |||
987 | Module snd-powermac (on ppc only) | ||
988 | --------------------------------- | ||
989 | |||
990 | Module for PowerMac, iMac and iBook on-board soundchips | ||
991 | |||
992 | enable_beep - enable beep using PCM (enabled as default) | ||
993 | |||
994 | Module supports autoprobe a chip. | ||
995 | |||
996 | Note: the driver may have problems regarding endianess. | ||
997 | |||
998 | The power-management is supported. | ||
999 | |||
1000 | Module snd-rme32 | ||
1001 | ---------------- | ||
1002 | |||
1003 | Module for RME Digi32, Digi32 Pro and Digi32/8 (Sek'd Prodif32, | ||
1004 | Prodif96 and Prodif Gold) sound cards. | ||
1005 | |||
1006 | Module supports up to 8 cards. | ||
1007 | |||
1008 | Module snd-rme96 | ||
1009 | ---------------- | ||
1010 | |||
1011 | Module for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST sound cards. | ||
1012 | |||
1013 | Module supports up to 8 cards. | ||
1014 | |||
1015 | Module snd-rme9652 | ||
1016 | ------------------ | ||
1017 | |||
1018 | Module for RME Digi9652 (Hammerfall, Hammerfall-Light) sound cards. | ||
1019 | |||
1020 | precise_ptr - Enable precise pointer (doesn't work reliably). | ||
1021 | (default = 0) | ||
1022 | |||
1023 | Module supports up to 8 cards. | ||
1024 | |||
1025 | Note: snd-page-alloc module does the job which snd-hammerfall-mem | ||
1026 | module did formerly. It will allocate the buffers in advance | ||
1027 | when any RME9652 cards are found. To make the buffer | ||
1028 | allocation sure, load snd-page-alloc module in the early | ||
1029 | stage of boot sequence. | ||
1030 | |||
1031 | Module snd-sa11xx-uda1341 (on arm only) | ||
1032 | --------------------------------------- | ||
1033 | |||
1034 | Module for Philips UDA1341TS on Compaq iPAQ H3600 sound card. | ||
1035 | |||
1036 | Module supports only one card. | ||
1037 | Module has no enable and index options. | ||
1038 | |||
1039 | Module snd-sb8 | ||
1040 | -------------- | ||
1041 | |||
1042 | Module for 8-bit SoundBlaster cards: SoundBlaster 1.0, | ||
1043 | SoundBlaster 2.0, | ||
1044 | SoundBlaster Pro | ||
1045 | |||
1046 | port - port # for SB DSP chip (0x220,0x240,0x260) | ||
1047 | irq - IRQ # for SB DSP chip (5,7,9,10) | ||
1048 | dma8 - DMA # for SB DSP chip (1,3) | ||
1049 | |||
1050 | Module supports up to 8 cards and autoprobe. | ||
1051 | |||
1052 | Module snd-sb16 and snd-sbawe | ||
1053 | ----------------------------- | ||
1054 | |||
1055 | Module for 16-bit SoundBlaster cards: SoundBlaster 16 (PnP), | ||
1056 | SoundBlaster AWE 32 (PnP), | ||
1057 | SoundBlaster AWE 64 PnP | ||
1058 | |||
1059 | port - port # for SB DSP 4.x chip (0x220,0x240,0x260) | ||
1060 | mpu_port - port # for MPU-401 UART (0x300,0x330), -1 = disable | ||
1061 | awe_port - base port # for EMU8000 synthesizer (0x620,0x640,0x660) | ||
1062 | (snd-sbawe module only) | ||
1063 | irq - IRQ # for SB DSP 4.x chip (5,7,9,10) | ||
1064 | dma8 - 8-bit DMA # for SB DSP 4.x chip (0,1,3) | ||
1065 | dma16 - 16-bit DMA # for SB DSP 4.x chip (5,6,7) | ||
1066 | mic_agc - Mic Auto-Gain-Control - 0 = disable, 1 = enable (default) | ||
1067 | csp - ASP/CSP chip support - 0 = disable (default), 1 = enable | ||
1068 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1069 | |||
1070 | Module supports up to 8 cards, autoprobe and ISA PnP. | ||
1071 | |||
1072 | Note: To use Vibra16X cards in 16-bit half duplex mode, you must | ||
1073 | disable 16bit DMA with dma16 = -1 module parameter. | ||
1074 | Also, all Sound Blaster 16 type cards can operate in 16-bit | ||
1075 | half duplex mode through 8-bit DMA channel by disabling their | ||
1076 | 16-bit DMA channel. | ||
1077 | |||
1078 | Module snd-sgalaxy | ||
1079 | ------------------ | ||
1080 | |||
1081 | Module for Aztech Sound Galaxy sound card. | ||
1082 | |||
1083 | sbport - Port # for SB16 interface (0x220,0x240) | ||
1084 | wssport - Port # for WSS interface (0x530,0xe80,0xf40,0x604) | ||
1085 | irq - IRQ # (7,9,10,11) | ||
1086 | dma1 - DMA # | ||
1087 | |||
1088 | Module supports up to 8 cards. | ||
1089 | |||
1090 | Module snd-sscape | ||
1091 | ----------------- | ||
1092 | |||
1093 | Module for ENSONIQ SoundScape PnP cards. | ||
1094 | |||
1095 | port - Port # (PnP setup) | ||
1096 | irq - IRQ # (PnP setup) | ||
1097 | mpu_irq - MPU-401 IRQ # (PnP setup) | ||
1098 | dma - DMA # (PnP setup) | ||
1099 | |||
1100 | Module supports up to 8 cards. ISA PnP must be enabled. | ||
1101 | You need sscape_ctl tool in alsa-tools package for loading | ||
1102 | the microcode. | ||
1103 | |||
1104 | Module snd-sun-amd7930 (on sparc only) | ||
1105 | -------------------------------------- | ||
1106 | |||
1107 | Module for AMD7930 sound chips found on Sparcs. | ||
1108 | |||
1109 | Module supports up to 8 cards. | ||
1110 | |||
1111 | Module snd-sun-cs4231 (on sparc only) | ||
1112 | ------------------------------------- | ||
1113 | |||
1114 | Module for CS4231 sound chips found on Sparcs. | ||
1115 | |||
1116 | Module supports up to 8 cards. | ||
1117 | |||
1118 | Module snd-wavefront | ||
1119 | -------------------- | ||
1120 | |||
1121 | Module for Turtle Beach Maui, Tropez and Tropez+ sound cards. | ||
1122 | |||
1123 | cs4232_pcm_port - Port # for CS4232 PCM interface. | ||
1124 | cs4232_pcm_irq - IRQ # for CS4232 PCM interface (5,7,9,11,12,15). | ||
1125 | cs4232_mpu_port - Port # for CS4232 MPU-401 interface. | ||
1126 | cs4232_mpu_irq - IRQ # for CS4232 MPU-401 interface (9,11,12,15). | ||
1127 | use_cs4232_midi - Use CS4232 MPU-401 interface | ||
1128 | (inaccessibly located inside your computer) | ||
1129 | ics2115_port - Port # for ICS2115 | ||
1130 | ics2115_irq - IRQ # for ICS2115 | ||
1131 | fm_port - FM OPL-3 Port # | ||
1132 | dma1 - DMA1 # for CS4232 PCM interface. | ||
1133 | dma2 - DMA2 # for CS4232 PCM interface. | ||
1134 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) | ||
1135 | |||
1136 | Module supports up to 8 cards and ISA PnP. | ||
1137 | |||
1138 | Module snd-sonicvibes | ||
1139 | --------------------- | ||
1140 | |||
1141 | Module for S3 SonicVibes PCI sound cards. | ||
1142 | * PINE Schubert 32 PCI | ||
1143 | |||
1144 | reverb - Reverb Enable - 1 = enable, 0 = disable (default) | ||
1145 | - SoundCard must have onboard SRAM for this. | ||
1146 | mge - Mic Gain Enable - 1 = enable, 0 = disable (default) | ||
1147 | |||
1148 | Module supports up to 8 cards and autoprobe. | ||
1149 | |||
1150 | Module snd-serial-u16550 | ||
1151 | ------------------------ | ||
1152 | |||
1153 | Module for UART16550A serial MIDI ports. | ||
1154 | |||
1155 | port - port # for UART16550A chip | ||
1156 | irq - IRQ # for UART16550A chip, -1 = poll mode | ||
1157 | speed - speed in bauds (9600,19200,38400,57600,115200) | ||
1158 | 38400 = default | ||
1159 | base - base for divisor in bauds (57600,115200,230400,460800) | ||
1160 | 115200 = default | ||
1161 | outs - number of MIDI ports in a serial port (1-4) | ||
1162 | 1 = default | ||
1163 | adaptor - Type of adaptor. | ||
1164 | 0 = Soundcanvas, 1 = MS-124T, 2 = MS-124W S/A, | ||
1165 | 3 = MS-124W M/B, 4 = Generic | ||
1166 | |||
1167 | Module supports up to 8 cards. This module does not support autoprobe | ||
1168 | thus the main port must be specified!!! Other options are optional. | ||
1169 | |||
1170 | Module snd-trident | ||
1171 | ------------------ | ||
1172 | |||
1173 | Module for Trident 4DWave DX/NX sound cards. | ||
1174 | * Best Union Miss Melody 4DWave PCI | ||
1175 | * HIS 4DWave PCI | ||
1176 | * Warpspeed ONSpeed 4DWave PCI | ||
1177 | * AzTech PCI 64-Q3D | ||
1178 | * Addonics SV 750 | ||
1179 | * CHIC True Sound 4Dwave | ||
1180 | * Shark Predator4D-PCI | ||
1181 | * Jaton SonicWave 4D | ||
1182 | |||
1183 | pcm_channels - max channels (voices) reserved for PCM | ||
1184 | wavetable_size - max wavetable size in kB (4-?kb) | ||
1185 | |||
1186 | Module supports up to 8 cards and autoprobe. | ||
1187 | |||
1188 | The power-management is supported. | ||
1189 | |||
1190 | Module snd-usb-audio | ||
1191 | -------------------- | ||
1192 | |||
1193 | Module for USB audio and USB MIDI devices. | ||
1194 | |||
1195 | vid - Vendor ID for the device (optional) | ||
1196 | pid - Product ID for the device (optional) | ||
1197 | |||
1198 | This module supports up to 8 cards, autoprobe and hotplugging. | ||
1199 | |||
1200 | Module snd-usb-usx2y | ||
1201 | -------------------- | ||
1202 | |||
1203 | Module for Tascam USB US-122, US-224 and US-428 devices. | ||
1204 | |||
1205 | This module supports up to 8 cards, autoprobe and hotplugging. | ||
1206 | |||
1207 | Note: you need to load the firmware via usx2yloader utility included | ||
1208 | in alsa-tools and alsa-firmware packages. | ||
1209 | |||
1210 | Module snd-via82xx | ||
1211 | ------------------ | ||
1212 | |||
1213 | Module for AC'97 motherboards based on VIA 82C686A/686B, 8233, | ||
1214 | 8233A, 8233C, 8235 (south) bridge. | ||
1215 | |||
1216 | mpu_port - 0x300,0x310,0x320,0x330, otherwise obtain BIOS setup | ||
1217 | [VIA686A/686B only] | ||
1218 | joystick - Enable joystick (default off) [VIA686A/686B only] | ||
1219 | ac97_clock - AC'97 codec clock base (default 48000Hz) | ||
1220 | dxs_support - support DXS channels, | ||
1221 | 0 = auto (defalut), 1 = enable, 2 = disable, | ||
1222 | 3 = 48k only, 4 = no VRA | ||
1223 | [VIA8233/C,8235 only] | ||
1224 | ac97_quirk - AC'97 workaround for strange hardware | ||
1225 | See the description of intel8x0 module for details. | ||
1226 | |||
1227 | Module supports autoprobe and multiple bus-master chips (max 8). | ||
1228 | |||
1229 | Note: on some SMP motherboards like MSI 694D the interrupts might | ||
1230 | not be generated properly. In such a case, please try to | ||
1231 | set the SMP (or MPS) version on BIOS to 1.1 instead of | ||
1232 | default value 1.4. Then the interrupt number will be | ||
1233 | assigned under 15. You might also upgrade your BIOS. | ||
1234 | |||
1235 | Note: VIA8233/5 (not VIA8233A) can support DXS (direct sound) | ||
1236 | channels as the first PCM. On these channels, up to 4 | ||
1237 | streams can be played at the same time. | ||
1238 | As default (dxs_support = 0), 48k fixed rate is chosen | ||
1239 | except for the known devices since the output is often | ||
1240 | noisy except for 48k on some mother boards due to the | ||
1241 | bug of BIOS. | ||
1242 | Please try once dxs_support=1 and if it works on other | ||
1243 | sample rates (e.g. 44.1kHz of mp3 playback), please let us | ||
1244 | know the PCI subsystem vendor/device id's (output of | ||
1245 | "lspci -nv"). | ||
1246 | If it doesn't work, try dxs_support=4. If it still doesn't | ||
1247 | work and the default setting is ok, dxs_support=3 is the | ||
1248 | right choice. If the default setting doesn't work at all, | ||
1249 | try dxs_support=2 to disable the DXS channels. | ||
1250 | In any cases, please let us know the result and the | ||
1251 | subsystem vendor/device ids. | ||
1252 | |||
1253 | Note: for the MPU401 on VIA823x, use snd-mpu401 driver | ||
1254 | additonally. The mpu_port option is for VIA686 chips only. | ||
1255 | |||
1256 | Module snd-via82xx-modem | ||
1257 | ------------------------ | ||
1258 | |||
1259 | Module for VIA82xx AC97 modem | ||
1260 | |||
1261 | ac97_clock - AC'97 codec clock base (default 48000Hz) | ||
1262 | |||
1263 | Module supports up to 8 cards. | ||
1264 | |||
1265 | Note: The default index value of this module is -2, i.e. the first | ||
1266 | slot is excluded. | ||
1267 | |||
1268 | Module snd-virmidi | ||
1269 | ------------------ | ||
1270 | |||
1271 | Module for virtual rawmidi devices. | ||
1272 | This module creates virtual rawmidi devices which communicate | ||
1273 | to the corresponding ALSA sequencer ports. | ||
1274 | |||
1275 | midi_devs - MIDI devices # (1-8, default=4) | ||
1276 | |||
1277 | Module supports up to 8 cards. | ||
1278 | |||
1279 | Module snd-vx222 | ||
1280 | ---------------- | ||
1281 | |||
1282 | Module for Digigram VX-Pocket VX222, V222 v2 and Mic cards. | ||
1283 | |||
1284 | mic - Enable Microphone on V222 Mic (NYI) | ||
1285 | ibl - Capture IBL size. (default = 0, minimum size) | ||
1286 | |||
1287 | Module supports up to 8 cards. | ||
1288 | |||
1289 | When the driver is compiled as a module and the hotplug firmware | ||
1290 | is supported, the firmware data is loaded via hotplug automatically. | ||
1291 | Install the necessary firmware files in alsa-firmware package. | ||
1292 | When no hotplug fw loader is available, you need to load the | ||
1293 | firmware via vxloader utility in alsa-tools package. To invoke | ||
1294 | vxloader automatically, add the following to /etc/modprobe.conf | ||
1295 | |||
1296 | install snd-vx222 /sbin/modprobe --first-time -i snd-vx222 && /usr/bin/vxloader | ||
1297 | |||
1298 | (for 2.2/2.4 kernels, add "post-install /usr/bin/vxloader" to | ||
1299 | /etc/modules.conf, instead.) | ||
1300 | IBL size defines the interrupts period for PCM. The smaller size | ||
1301 | gives smaller latency but leads to more CPU consumption, too. | ||
1302 | The size is usually aligned to 126. As default (=0), the smallest | ||
1303 | size is chosen. The possible IBL values can be found in | ||
1304 | /proc/asound/cardX/vx-status proc file. | ||
1305 | |||
1306 | Module snd-vxpocket | ||
1307 | ------------------- | ||
1308 | |||
1309 | Module for Digigram VX-Pocket VX2 PCMCIA card. | ||
1310 | |||
1311 | ibl - Capture IBL size. (default = 0, minimum size) | ||
1312 | |||
1313 | Module supports up to 8 cards. The module is compiled only when | ||
1314 | PCMCIA is supported on kernel. | ||
1315 | |||
1316 | To activate the driver via the card manager, you'll need to set | ||
1317 | up /etc/pcmcia/vxpocket.conf. See the sound/pcmcia/vx/vxpocket.c. | ||
1318 | |||
1319 | When the driver is compiled as a module and the hotplug firmware | ||
1320 | is supported, the firmware data is loaded via hotplug automatically. | ||
1321 | Install the necessary firmware files in alsa-firmware package. | ||
1322 | When no hotplug fw loader is available, you need to load the | ||
1323 | firmware via vxloader utility in alsa-tools package. | ||
1324 | |||
1325 | About capture IBL, see the description of snd-vx222 module. | ||
1326 | |||
1327 | Note: the driver is build only when CONFIG_ISA is set. | ||
1328 | |||
1329 | Module snd-vxp440 | ||
1330 | ----------------- | ||
1331 | |||
1332 | Module for Digigram VX-Pocket 440 PCMCIA card. | ||
1333 | |||
1334 | ibl - Capture IBL size. (default = 0, minimum size) | ||
1335 | |||
1336 | Module supports up to 8 cards. The module is compiled only when | ||
1337 | PCMCIA is supported on kernel. | ||
1338 | |||
1339 | To activate the driver via the card manager, you'll need to set | ||
1340 | up /etc/pcmcia/vxp440.conf. See the sound/pcmcia/vx/vxp440.c. | ||
1341 | |||
1342 | When the driver is compiled as a module and the hotplug firmware | ||
1343 | is supported, the firmware data is loaded via hotplug automatically. | ||
1344 | Install the necessary firmware files in alsa-firmware package. | ||
1345 | When no hotplug fw loader is available, you need to load the | ||
1346 | firmware via vxloader utility in alsa-tools package. | ||
1347 | |||
1348 | About capture IBL, see the description of snd-vx222 module. | ||
1349 | |||
1350 | Note: the driver is build only when CONFIG_ISA is set. | ||
1351 | |||
1352 | Module snd-ymfpci | ||
1353 | ----------------- | ||
1354 | |||
1355 | Module for Yamaha PCI chips (YMF72x, YMF74x & YMF75x). | ||
1356 | |||
1357 | mpu_port - 0x300,0x330,0x332,0x334, 0 (disable) by default, | ||
1358 | 1 (auto-detect for YMF744/754 only) | ||
1359 | fm_port - 0x388,0x398,0x3a0,0x3a8, 0 (disable) by default | ||
1360 | 1 (auto-detect for YMF744/754 only) | ||
1361 | joystick_port - 0x201,0x202,0x204,0x205, 0 (disable) by default, | ||
1362 | 1 (auto-detect) | ||
1363 | rear_switch - enable shared rear/line-in switch (bool) | ||
1364 | |||
1365 | Module supports autoprobe and multiple chips (max 8). | ||
1366 | |||
1367 | The power-management is supported. | ||
1368 | |||
1369 | Module snd-pdaudiocf | ||
1370 | -------------------- | ||
1371 | |||
1372 | Module for Sound Core PDAudioCF sound card. | ||
1373 | |||
1374 | Note: the driver is build only when CONFIG_ISA is set. | ||
1375 | |||
1376 | |||
1377 | Configuring Non-ISAPNP Cards | ||
1378 | ============================ | ||
1379 | |||
1380 | When the kernel is configured with ISA-PnP support, the modules | ||
1381 | supporting the isapnp cards will have module options "isapnp". | ||
1382 | If this option is set, *only* the ISA-PnP devices will be probed. | ||
1383 | For probing the non ISA-PnP cards, you have to pass "isapnp=0" option | ||
1384 | together with the proper i/o and irq configuration. | ||
1385 | |||
1386 | When the kernel is configured without ISA-PnP support, isapnp option | ||
1387 | will be not built in. | ||
1388 | |||
1389 | |||
1390 | Module Autoloading Support | ||
1391 | ========================== | ||
1392 | |||
1393 | The ALSA drivers can be loaded automatically on demand by defining | ||
1394 | module aliases. The string 'snd-card-%1' is requested for ALSA native | ||
1395 | devices where %i is sound card number from zero to seven. | ||
1396 | |||
1397 | To auto-load an ALSA driver for OSS services, define the string | ||
1398 | 'sound-slot-%i' where %i means the slot number for OSS, which | ||
1399 | corresponds to the card index of ALSA. Usually, define this | ||
1400 | as the the same card module. | ||
1401 | |||
1402 | An example configuration for a single emu10k1 card is like below: | ||
1403 | ----- /etc/modprobe.conf | ||
1404 | alias snd-card-0 snd-emu10k1 | ||
1405 | alias sound-slot-0 snd-emu10k1 | ||
1406 | ----- /etc/modprobe.conf | ||
1407 | |||
1408 | The available number of auto-loaded sound cards depends on the module | ||
1409 | option "cards_limit" of snd module. As default it's set to 1. | ||
1410 | To enable the auto-loading of multiple cards, specify the number of | ||
1411 | sound cards in that option. | ||
1412 | |||
1413 | When multiple cards are available, it'd better to specify the index | ||
1414 | number for each card via module option, too, so that the order of | ||
1415 | cards is kept consistent. | ||
1416 | |||
1417 | An example configuration for two sound cards is like below: | ||
1418 | |||
1419 | ----- /etc/modprobe.conf | ||
1420 | # ALSA portion | ||
1421 | options snd cards_limit=2 | ||
1422 | alias snd-card-0 snd-interwave | ||
1423 | alias snd-card-1 snd-ens1371 | ||
1424 | options snd-interwave index=0 | ||
1425 | options snd-ens1371 index=1 | ||
1426 | # OSS/Free portion | ||
1427 | alias sound-slot-0 snd-interwave | ||
1428 | alias sound-slot-1 snd-ens1371 | ||
1429 | ----- /etc/moprobe.conf | ||
1430 | |||
1431 | In this example, the interwave card is always loaded as the first card | ||
1432 | (index 0) and ens1371 as the second (index 1). | ||
1433 | |||
1434 | |||
1435 | ALSA PCM devices to OSS devices mapping | ||
1436 | ======================================= | ||
1437 | |||
1438 | /dev/snd/pcmC0D0[c|p] -> /dev/audio0 (/dev/audio) -> minor 4 | ||
1439 | /dev/snd/pcmC0D0[c|p] -> /dev/dsp0 (/dev/dsp) -> minor 3 | ||
1440 | /dev/snd/pcmC0D1[c|p] -> /dev/adsp0 (/dev/adsp) -> minor 12 | ||
1441 | /dev/snd/pcmC1D0[c|p] -> /dev/audio1 -> minor 4+16 = 20 | ||
1442 | /dev/snd/pcmC1D0[c|p] -> /dev/dsp1 -> minor 3+16 = 19 | ||
1443 | /dev/snd/pcmC1D1[c|p] -> /dev/adsp1 -> minor 12+16 = 28 | ||
1444 | /dev/snd/pcmC2D0[c|p] -> /dev/audio2 -> minor 4+32 = 36 | ||
1445 | /dev/snd/pcmC2D0[c|p] -> /dev/dsp2 -> minor 3+32 = 39 | ||
1446 | /dev/snd/pcmC2D1[c|p] -> /dev/adsp2 -> minor 12+32 = 44 | ||
1447 | |||
1448 | The first number from /dev/snd/pcmC{X}D{Y}[c|p] expression means | ||
1449 | sound card number and second means device number. The ALSA devices | ||
1450 | have either 'c' or 'p' suffix indicating the direction, capture and | ||
1451 | playback, respectively. | ||
1452 | |||
1453 | Please note that the device mapping above may be varied via the module | ||
1454 | options of snd-pcm-oss module. | ||
1455 | |||
1456 | |||
1457 | DEVFS support | ||
1458 | ============= | ||
1459 | |||
1460 | The ALSA driver fully supports the devfs extension. | ||
1461 | You should add lines below to your devfsd.conf file: | ||
1462 | |||
1463 | LOOKUP snd MODLOAD ACTION snd | ||
1464 | REGISTER ^sound/.* PERMISSIONS root.audio 660 | ||
1465 | REGISTER ^snd/.* PERMISSIONS root.audio 660 | ||
1466 | |||
1467 | Warning: These lines assume that you have the audio group in your system. | ||
1468 | Otherwise replace audio word with another group name (root for | ||
1469 | example). | ||
1470 | |||
1471 | |||
1472 | Proc interfaces (/proc/asound) | ||
1473 | ============================== | ||
1474 | |||
1475 | /proc/asound/card#/pcm#[cp]/oss | ||
1476 | ------------------------------- | ||
1477 | String "erase" - erase all additional informations about OSS applications | ||
1478 | String "<app_name> <fragments> <fragment_size> [<options>]" | ||
1479 | |||
1480 | <app_name> - name of application with (higher priority) or without path | ||
1481 | <fragments> - number of fragments or zero if auto | ||
1482 | <fragment_size> - size of fragment in bytes or zero if auto | ||
1483 | <options> - optional parameters | ||
1484 | - disable the application tries to open a pcm device for | ||
1485 | this channel but does not want to use it. | ||
1486 | (Cause a bug or mmap needs) | ||
1487 | It's good for Quake etc... | ||
1488 | - direct don't use plugins | ||
1489 | - block force block mode (rvplayer) | ||
1490 | - non-block force non-block mode | ||
1491 | - whole-frag write only whole fragments (optimization affecting | ||
1492 | playback only) | ||
1493 | - no-silence do not fill silence ahead to avoid clicks | ||
1494 | |||
1495 | Example: echo "x11amp 128 16384" > /proc/asound/card0/pcm0p/oss | ||
1496 | echo "squake 0 0 disable" > /proc/asound/card0/pcm0c/oss | ||
1497 | echo "rvplayer 0 0 block" > /proc/asound/card0/pcm0p/oss | ||
1498 | |||
1499 | |||
1500 | Links | ||
1501 | ===== | ||
1502 | |||
1503 | ALSA project homepage | ||
1504 | http://www.alsa-project.org | ||
1505 | |||
diff --git a/Documentation/sound/alsa/Audigy-mixer.txt b/Documentation/sound/alsa/Audigy-mixer.txt new file mode 100644 index 000000000000..5132fd95e074 --- /dev/null +++ b/Documentation/sound/alsa/Audigy-mixer.txt | |||
@@ -0,0 +1,345 @@ | |||
1 | |||
2 | Sound Blaster Audigy mixer / default DSP code | ||
3 | =========================================== | ||
4 | |||
5 | This is based on SB-Live-mixer.txt. | ||
6 | |||
7 | The EMU10K2 chips have a DSP part which can be programmed to support | ||
8 | various ways of sample processing, which is described here. | ||
9 | (This acticle does not deal with the overall functionality of the | ||
10 | EMU10K2 chips. See the manuals section for further details.) | ||
11 | |||
12 | The ALSA driver programs this portion of chip by default code | ||
13 | (can be altered later) which offers the following functionality: | ||
14 | |||
15 | |||
16 | 1) Digital mixer controls | ||
17 | ------------------------- | ||
18 | |||
19 | These controls are built using the DSP instructions. They offer extended | ||
20 | functionality. Only the default build-in code in the ALSA driver is described | ||
21 | here. Note that the controls work as attenuators: the maximum value is the | ||
22 | neutral position leaving the signal unchanged. Note that if the same destination | ||
23 | is mentioned in multiple controls, the signal is accumulated and can be wrapped | ||
24 | (set to maximal or minimal value without checking of overflow). | ||
25 | |||
26 | |||
27 | Explanation of used abbreviations: | ||
28 | |||
29 | DAC - digital to analog converter | ||
30 | ADC - analog to digital converter | ||
31 | I2S - one-way three wire serial bus for digital sound by Philips Semiconductors | ||
32 | (this standard is used for connecting standalone DAC and ADC converters) | ||
33 | LFE - low frequency effects (subwoofer signal) | ||
34 | AC97 - a chip containing an analog mixer, DAC and ADC converters | ||
35 | IEC958 - S/PDIF | ||
36 | FX-bus - the EMU10K2 chip has an effect bus containing 64 accumulators. | ||
37 | Each of the synthesizer voices can feed its output to these accumulators | ||
38 | and the DSP microcontroller can operate with the resulting sum. | ||
39 | |||
40 | name='PCM Front Playback Volume',index=0 | ||
41 | |||
42 | This control is used to attenuate samples for left and right front PCM FX-bus | ||
43 | accumulators. ALSA uses accumulators 8 and 9 for left and right front PCM | ||
44 | samples for 5.1 playback. The result samples are forwarded to the front DAC PCM | ||
45 | slots of the Philips DAC. | ||
46 | |||
47 | name='PCM Surround Playback Volume',index=0 | ||
48 | |||
49 | This control is used to attenuate samples for left and right surround PCM FX-bus | ||
50 | accumulators. ALSA uses accumulators 2 and 3 for left and right surround PCM | ||
51 | samples for 5.1 playback. The result samples are forwarded to the surround DAC PCM | ||
52 | slots of the Philips DAC. | ||
53 | |||
54 | name='PCM Center Playback Volume',index=0 | ||
55 | |||
56 | This control is used to attenuate samples for center PCM FX-bus accumulator. | ||
57 | ALSA uses accumulator 6 for center PCM sample for 5.1 playback. The result sample | ||
58 | is forwarded to the center DAC PCM slot of the Philips DAC. | ||
59 | |||
60 | name='PCM LFE Playback Volume',index=0 | ||
61 | |||
62 | This control is used to attenuate sample for LFE PCM FX-bus accumulator. | ||
63 | ALSA uses accumulator 7 for LFE PCM sample for 5.1 playback. The result sample | ||
64 | is forwarded to the LFE DAC PCM slot of the Philips DAC. | ||
65 | |||
66 | name='PCM Playback Volume',index=0 | ||
67 | |||
68 | This control is used to attenuate samples for left and right PCM FX-bus | ||
69 | accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples for | ||
70 | stereo playback. The result samples are forwarded to the front DAC PCM slots | ||
71 | of the Philips DAC. | ||
72 | |||
73 | name='PCM Capture Volume',index=0 | ||
74 | |||
75 | This control is used to attenuate samples for left and right PCM FX-bus | ||
76 | accumulator. ALSA uses accumulators 0 and 1 for left and right PCM. | ||
77 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | ||
78 | PCM device). | ||
79 | |||
80 | name='Music Playback Volume',index=0 | ||
81 | |||
82 | This control is used to attenuate samples for left and right MIDI FX-bus | ||
83 | accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. | ||
84 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. | ||
85 | |||
86 | name='Music Capture Volume',index=0 | ||
87 | |||
88 | These controls are used to attenuate samples for left and right MIDI FX-bus | ||
89 | accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. | ||
90 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | ||
91 | PCM device). | ||
92 | |||
93 | name='Mic Playback Volume',index=0 | ||
94 | |||
95 | This control is used to attenuate samples for left and right Mic input. | ||
96 | For Mic input is used AC97 codec. The result samples are forwarded to | ||
97 | the front DAC PCM slots of the Philips DAC. Samples are forwarded to Mic | ||
98 | capture FIFO (device 1 - 16bit/8KHz mono) too without volume control. | ||
99 | |||
100 | name='Mic Capture Volume',index=0 | ||
101 | |||
102 | This control is used to attenuate samples for left and right Mic input. | ||
103 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | ||
104 | PCM device). | ||
105 | |||
106 | name='Audigy CD Playback Volume',index=0 | ||
107 | |||
108 | This control is used to attenuate samples from left and right IEC958 TTL | ||
109 | digital inputs (usually used by a CDROM drive). The result samples are | ||
110 | forwarded to the front DAC PCM slots of the Philips DAC. | ||
111 | |||
112 | name='Audigy CD Capture Volume',index=0 | ||
113 | |||
114 | This control is used to attenuate samples from left and right IEC958 TTL | ||
115 | digital inputs (usually used by a CDROM drive). The result samples are | ||
116 | forwarded to the ADC capture FIFO (thus to the standard capture PCM device). | ||
117 | |||
118 | name='IEC958 Optical Playback Volume',index=0 | ||
119 | |||
120 | This control is used to attenuate samples from left and right IEC958 optical | ||
121 | digital input. The result samples are forwarded to the front DAC PCM slots | ||
122 | of the Philips DAC. | ||
123 | |||
124 | name='IEC958 Optical Capture Volume',index=0 | ||
125 | |||
126 | This control is used to attenuate samples from left and right IEC958 optical | ||
127 | digital inputs. The result samples are forwarded to the ADC capture FIFO | ||
128 | (thus to the standard capture PCM device). | ||
129 | |||
130 | name='Line2 Playback Volume',index=0 | ||
131 | |||
132 | This control is used to attenuate samples from left and right I2S ADC | ||
133 | inputs (on the AudigyDrive). The result samples are forwarded to the front | ||
134 | DAC PCM slots of the Philips DAC. | ||
135 | |||
136 | name='Line2 Capture Volume',index=1 | ||
137 | |||
138 | This control is used to attenuate samples from left and right I2S ADC | ||
139 | inputs (on the AudigyDrive). The result samples are forwarded to the ADC | ||
140 | capture FIFO (thus to the standard capture PCM device). | ||
141 | |||
142 | name='Analog Mix Playback Volume',index=0 | ||
143 | |||
144 | This control is used to attenuate samples from left and right I2S ADC | ||
145 | inputs from Philips ADC. The result samples are forwarded to the front | ||
146 | DAC PCM slots of the Philips DAC. This contains mix from analog sources | ||
147 | like CD, Line In, Aux, .... | ||
148 | |||
149 | name='Analog Mix Capture Volume',index=1 | ||
150 | |||
151 | This control is used to attenuate samples from left and right I2S ADC | ||
152 | inputs Philips ADC. The result samples are forwarded to the ADC | ||
153 | capture FIFO (thus to the standard capture PCM device). | ||
154 | |||
155 | name='Aux2 Playback Volume',index=0 | ||
156 | |||
157 | This control is used to attenuate samples from left and right I2S ADC | ||
158 | inputs (on the AudigyDrive). The result samples are forwarded to the front | ||
159 | DAC PCM slots of the Philips DAC. | ||
160 | |||
161 | name='Aux2 Capture Volume',index=1 | ||
162 | |||
163 | This control is used to attenuate samples from left and right I2S ADC | ||
164 | inputs (on the AudigyDrive). The result samples are forwarded to the ADC | ||
165 | capture FIFO (thus to the standard capture PCM device). | ||
166 | |||
167 | name='Front Playback Volume',index=0 | ||
168 | |||
169 | All stereo signals are mixed together and mirrored to surround, center and LFE. | ||
170 | This control is used to attenuate samples for left and right front speakers of | ||
171 | this mix. | ||
172 | |||
173 | name='Surround Playback Volume',index=0 | ||
174 | |||
175 | All stereo signals are mixed together and mirrored to surround, center and LFE. | ||
176 | This control is used to attenuate samples for left and right surround speakers of | ||
177 | this mix. | ||
178 | |||
179 | name='Center Playback Volume',index=0 | ||
180 | |||
181 | All stereo signals are mixed together and mirrored to surround, center and LFE. | ||
182 | This control is used to attenuate sample for center speaker of this mix. | ||
183 | |||
184 | name='LFE Playback Volume',index=0 | ||
185 | |||
186 | All stereo signals are mixed together and mirrored to surround, center and LFE. | ||
187 | This control is used to attenuate sample for LFE speaker of this mix. | ||
188 | |||
189 | name='Tone Control - Switch',index=0 | ||
190 | |||
191 | This control turns the tone control on or off. The samples for front, rear | ||
192 | and center / LFE outputs are affected. | ||
193 | |||
194 | name='Tone Control - Bass',index=0 | ||
195 | |||
196 | This control sets the bass intensity. There is no neutral value!! | ||
197 | When the tone control code is activated, the samples are always modified. | ||
198 | The closest value to pure signal is 20. | ||
199 | |||
200 | name='Tone Control - Treble',index=0 | ||
201 | |||
202 | This control sets the treble intensity. There is no neutral value!! | ||
203 | When the tone control code is activated, the samples are always modified. | ||
204 | The closest value to pure signal is 20. | ||
205 | |||
206 | name='Master Playback Volume',index=0 | ||
207 | |||
208 | This control is used to attenuate samples for front, surround, center and | ||
209 | LFE outputs. | ||
210 | |||
211 | name='IEC958 Optical Raw Playback Switch',index=0 | ||
212 | |||
213 | If this switch is on, then the samples for the IEC958 (S/PDIF) digital | ||
214 | output are taken only from the raw FX8010 PCM, otherwise standard front | ||
215 | PCM samples are taken. | ||
216 | |||
217 | |||
218 | 2) PCM stream related controls | ||
219 | ------------------------------ | ||
220 | |||
221 | name='EMU10K1 PCM Volume',index 0-31 | ||
222 | |||
223 | Channel volume attenuation in range 0-0xffff. The maximum value (no | ||
224 | attenuation) is default. The channel mapping for three values is | ||
225 | as follows: | ||
226 | |||
227 | 0 - mono, default 0xffff (no attenuation) | ||
228 | 1 - left, default 0xffff (no attenuation) | ||
229 | 2 - right, default 0xffff (no attenuation) | ||
230 | |||
231 | name='EMU10K1 PCM Send Routing',index 0-31 | ||
232 | |||
233 | This control specifies the destination - FX-bus accumulators. There 24 | ||
234 | values with this mapping: | ||
235 | |||
236 | 0 - mono, A destination (FX-bus 0-63), default 0 | ||
237 | 1 - mono, B destination (FX-bus 0-63), default 1 | ||
238 | 2 - mono, C destination (FX-bus 0-63), default 2 | ||
239 | 3 - mono, D destination (FX-bus 0-63), default 3 | ||
240 | 4 - mono, E destination (FX-bus 0-63), default 0 | ||
241 | 5 - mono, F destination (FX-bus 0-63), default 0 | ||
242 | 6 - mono, G destination (FX-bus 0-63), default 0 | ||
243 | 7 - mono, H destination (FX-bus 0-63), default 0 | ||
244 | 8 - left, A destination (FX-bus 0-63), default 0 | ||
245 | 9 - left, B destination (FX-bus 0-63), default 1 | ||
246 | 10 - left, C destination (FX-bus 0-63), default 2 | ||
247 | 11 - left, D destination (FX-bus 0-63), default 3 | ||
248 | 12 - left, E destination (FX-bus 0-63), default 0 | ||
249 | 13 - left, F destination (FX-bus 0-63), default 0 | ||
250 | 14 - left, G destination (FX-bus 0-63), default 0 | ||
251 | 15 - left, H destination (FX-bus 0-63), default 0 | ||
252 | 16 - right, A destination (FX-bus 0-63), default 0 | ||
253 | 17 - right, B destination (FX-bus 0-63), default 1 | ||
254 | 18 - right, C destination (FX-bus 0-63), default 2 | ||
255 | 19 - right, D destination (FX-bus 0-63), default 3 | ||
256 | 20 - right, E destination (FX-bus 0-63), default 0 | ||
257 | 21 - right, F destination (FX-bus 0-63), default 0 | ||
258 | 22 - right, G destination (FX-bus 0-63), default 0 | ||
259 | 23 - right, H destination (FX-bus 0-63), default 0 | ||
260 | |||
261 | Don't forget that it's illegal to assign a channel to the same FX-bus accumulator | ||
262 | more than once (it means 0=0 && 1=0 is an invalid combination). | ||
263 | |||
264 | name='EMU10K1 PCM Send Volume',index 0-31 | ||
265 | |||
266 | It specifies the attenuation (amount) for given destination in range 0-255. | ||
267 | The channel mapping is following: | ||
268 | |||
269 | 0 - mono, A destination attn, default 255 (no attenuation) | ||
270 | 1 - mono, B destination attn, default 255 (no attenuation) | ||
271 | 2 - mono, C destination attn, default 0 (mute) | ||
272 | 3 - mono, D destination attn, default 0 (mute) | ||
273 | 4 - mono, E destination attn, default 0 (mute) | ||
274 | 5 - mono, F destination attn, default 0 (mute) | ||
275 | 6 - mono, G destination attn, default 0 (mute) | ||
276 | 7 - mono, H destination attn, default 0 (mute) | ||
277 | 8 - left, A destination attn, default 255 (no attenuation) | ||
278 | 9 - left, B destination attn, default 0 (mute) | ||
279 | 10 - left, C destination attn, default 0 (mute) | ||
280 | 11 - left, D destination attn, default 0 (mute) | ||
281 | 12 - left, E destination attn, default 0 (mute) | ||
282 | 13 - left, F destination attn, default 0 (mute) | ||
283 | 14 - left, G destination attn, default 0 (mute) | ||
284 | 15 - left, H destination attn, default 0 (mute) | ||
285 | 16 - right, A destination attn, default 0 (mute) | ||
286 | 17 - right, B destination attn, default 255 (no attenuation) | ||
287 | 18 - right, C destination attn, default 0 (mute) | ||
288 | 19 - right, D destination attn, default 0 (mute) | ||
289 | 20 - right, E destination attn, default 0 (mute) | ||
290 | 21 - right, F destination attn, default 0 (mute) | ||
291 | 22 - right, G destination attn, default 0 (mute) | ||
292 | 23 - right, H destination attn, default 0 (mute) | ||
293 | |||
294 | |||
295 | |||
296 | 4) MANUALS/PATENTS: | ||
297 | ------------------- | ||
298 | |||
299 | ftp://opensource.creative.com/pub/doc | ||
300 | ------------------------------------- | ||
301 | |||
302 | Files: | ||
303 | LM4545.pdf AC97 Codec | ||
304 | |||
305 | m2049.pdf The EMU10K1 Digital Audio Processor | ||
306 | |||
307 | hog63.ps FX8010 - A DSP Chip Architecture for Audio Effects | ||
308 | |||
309 | |||
310 | WIPO Patents | ||
311 | ------------ | ||
312 | Patent numbers: | ||
313 | WO 9901813 (A1) Audio Effects Processor with multiple asynchronous (Jan. 14, 1999) | ||
314 | streams | ||
315 | |||
316 | WO 9901814 (A1) Processor with Instruction Set for Audio Effects (Jan. 14, 1999) | ||
317 | |||
318 | WO 9901953 (A1) Audio Effects Processor having Decoupled Instruction | ||
319 | Execution and Audio Data Sequencing (Jan. 14, 1999) | ||
320 | |||
321 | |||
322 | US Patents (http://www.uspto.gov/) | ||
323 | ---------------------------------- | ||
324 | |||
325 | US 5925841 Digital Sampling Instrument employing cache memory (Jul. 20, 1999) | ||
326 | |||
327 | US 5928342 Audio Effects Processor integrated on a single chip (Jul. 27, 1999) | ||
328 | with a multiport memory onto which multiple asynchronous | ||
329 | digital sound samples can be concurrently loaded | ||
330 | |||
331 | US 5930158 Processor with Instruction Set for Audio Effects (Jul. 27, 1999) | ||
332 | |||
333 | US 6032235 Memory initialization circuit (Tram) (Feb. 29, 2000) | ||
334 | |||
335 | US 6138207 Interpolation looping of audio samples in cache connected to (Oct. 24, 2000) | ||
336 | system bus with prioritization and modification of bus transfers | ||
337 | in accordance with loop ends and minimum block sizes | ||
338 | |||
339 | US 6151670 Method for conserving memory storage using a (Nov. 21, 2000) | ||
340 | pool of short term memory registers | ||
341 | |||
342 | US 6195715 Interrupt control for multiple programs communicating with (Feb. 27, 2001) | ||
343 | a common interrupt by associating programs to GP registers, | ||
344 | defining interrupt register, polling GP registers, and invoking | ||
345 | callback routine associated with defined interrupt register | ||
diff --git a/Documentation/sound/alsa/Bt87x.txt b/Documentation/sound/alsa/Bt87x.txt new file mode 100644 index 000000000000..11edb2fd2a5a --- /dev/null +++ b/Documentation/sound/alsa/Bt87x.txt | |||
@@ -0,0 +1,78 @@ | |||
1 | Intro | ||
2 | ===== | ||
3 | |||
4 | You might have noticed that the bt878 grabber cards have actually | ||
5 | _two_ PCI functions: | ||
6 | |||
7 | $ lspci | ||
8 | [ ... ] | ||
9 | 00:0a.0 Multimedia video controller: Brooktree Corporation Bt878 (rev 02) | ||
10 | 00:0a.1 Multimedia controller: Brooktree Corporation Bt878 (rev 02) | ||
11 | [ ... ] | ||
12 | |||
13 | The first does video, it is backward compatible to the bt848. The second | ||
14 | does audio. snd-bt87x is a driver for the second function. It's a sound | ||
15 | driver which can be used for recording sound (and _only_ recording, no | ||
16 | playback). As most TV cards come with a short cable which can be plugged | ||
17 | into your sound card's line-in you probably don't need this driver if all | ||
18 | you want to do is just watching TV... | ||
19 | |||
20 | Some cards do not bother to connect anything to the audio input pins of | ||
21 | the chip, and some other cards use the audio function to transport MPEG | ||
22 | video data, so it's quite possible that audio recording may not work | ||
23 | with your card. | ||
24 | |||
25 | |||
26 | Driver Status | ||
27 | ============= | ||
28 | |||
29 | The driver is now stable. However, it doesn't know about many TV cards, | ||
30 | and it refuses to load for cards it doesn't know. | ||
31 | |||
32 | If the driver complains ("Unknown TV card found, the audio driver will | ||
33 | not load"), you can specify the load_all=1 option to force the driver to | ||
34 | try to use the audio capture function of your card. If the frequency of | ||
35 | recorded data is not right, try to specify the digital_rate option with | ||
36 | other values than the default 32000 (often it's 44100 or 64000). | ||
37 | |||
38 | If you have an unknown card, please mail the ID and board name to | ||
39 | <alsa-devel@lists.sf.net>, regardless of whether audio capture works or | ||
40 | not, so that future versions of this driver know about your card. | ||
41 | |||
42 | |||
43 | Audio modes | ||
44 | =========== | ||
45 | |||
46 | The chip knows two different modes (digital/analog). snd-bt87x | ||
47 | registers two PCM devices, one for each mode. They cannot be used at | ||
48 | the same time. | ||
49 | |||
50 | |||
51 | Digital audio mode | ||
52 | ================== | ||
53 | |||
54 | The first device (hw:X,0) gives you 16 bit stereo sound. The sample | ||
55 | rate depends on the external source which feeds the Bt87x with digital | ||
56 | sound via I2S interface. | ||
57 | |||
58 | |||
59 | Analog audio mode (A/D) | ||
60 | ======================= | ||
61 | |||
62 | The second device (hw:X,1) gives you 8 or 16 bit mono sound. Supported | ||
63 | sample rates are between 119466 and 448000 Hz (yes, these numbers are | ||
64 | that high). If you've set the CONFIG_SND_BT87X_OVERCLOCK option, the | ||
65 | maximum sample rate is 1792000 Hz, but audio data becomes unusable | ||
66 | beyond 896000 Hz on my card. | ||
67 | |||
68 | The chip has three analog inputs. Consequently you'll get a mixer | ||
69 | device to control these. | ||
70 | |||
71 | |||
72 | Have fun, | ||
73 | |||
74 | Clemens | ||
75 | |||
76 | |||
77 | Written by Clemens Ladisch <clemens@ladisch.de> | ||
78 | big parts copied from btaudio.txt by Gerd Knorr <kraxel@bytesex.org> | ||
diff --git a/Documentation/sound/alsa/CMIPCI.txt b/Documentation/sound/alsa/CMIPCI.txt new file mode 100644 index 000000000000..4a7df771b806 --- /dev/null +++ b/Documentation/sound/alsa/CMIPCI.txt | |||
@@ -0,0 +1,242 @@ | |||
1 | Brief Notes on C-Media 8738/8338 Driver | ||
2 | ======================================= | ||
3 | |||
4 | Takashi Iwai <tiwai@suse.de> | ||
5 | |||
6 | |||
7 | Front/Rear Multi-channel Playback | ||
8 | --------------------------------- | ||
9 | |||
10 | CM8x38 chip can use ADC as the second DAC so that two different stereo | ||
11 | channels can be used for front/rear playbacks. Since there are two | ||
12 | DACs, both streams are handled independently unlike the 4/6ch multi- | ||
13 | channel playbacks in the section below. | ||
14 | |||
15 | As default, ALSA driver assigns the first PCM device (i.e. hw:0,0 for | ||
16 | card#0) for front and 4/6ch playbacks, while the second PCM device | ||
17 | (hw:0,1) is assigned to the second DAC for rear playback. | ||
18 | |||
19 | There are slight difference between two DACs. | ||
20 | |||
21 | - The first DAC supports U8 and S16LE formats, while the second DAC | ||
22 | supports only S16LE. | ||
23 | - The seconde DAC supports only two channel stereo. | ||
24 | |||
25 | Please note that the CM8x38 DAC doesn't support continuous playback | ||
26 | rate but only fixed rates: 5512, 8000, 11025, 16000, 22050, 32000, | ||
27 | 44100 and 48000 Hz. | ||
28 | |||
29 | The rear output can be heard only when "Four Channel Mode" switch is | ||
30 | disabled. Otherwise no signal will be routed to the rear speakers. | ||
31 | As default it's turned on. | ||
32 | |||
33 | *** WARNING *** | ||
34 | When "Four Channel Mode" switch is off, the output from rear speakers | ||
35 | will be FULL VOLUME regardless of Master and PCM volumes. | ||
36 | This might damage your audio equipment. Please disconnect speakers | ||
37 | before your turn off this switch. | ||
38 | *** WARNING *** | ||
39 | |||
40 | [ Well.. I once got the output with correct volume (i.e. same with the | ||
41 | front one) and was so excited. It was even with "Four Channel" bit | ||
42 | on and "double DAC" mode. Actually I could hear separate 4 channels | ||
43 | from front and rear speakers! But.. after reboot, all was gone. | ||
44 | It's a very pity that I didn't save the register dump at that | ||
45 | time.. Maybe there is an unknown register to achieve this... ] | ||
46 | |||
47 | If your card has an extra output jack for the rear output, the rear | ||
48 | playback should be routed there as default. If not, there is a | ||
49 | control switch in the driver "Line-In As Rear", which you can change | ||
50 | via alsamixer or somewhat else. When this switch is on, line-in jack | ||
51 | is used as rear output. | ||
52 | |||
53 | There are two more controls regarding to the rear output. | ||
54 | The "Exchange DAC" switch is used to exchange front and rear playback | ||
55 | routes, i.e. the 2nd DAC is output from front output. | ||
56 | |||
57 | |||
58 | 4/6 Multi-Channel Playback | ||
59 | -------------------------- | ||
60 | |||
61 | The recent CM8738 chips support for the 4/6 multi-channel playback | ||
62 | function. This is useful especially for AC3 decoding. | ||
63 | |||
64 | When the multi-channel is supported, the driver name has a suffix | ||
65 | "-MC" such like "CMI8738-MC6". You can check this name from | ||
66 | /proc/asound/cards. | ||
67 | |||
68 | When the 4/6-ch output is enabled, the second DAC accepts up to 6 (or | ||
69 | 4) channels. While the dual DAC supports two different rates or | ||
70 | formats, the 4/6-ch playback supports only the same condition for all | ||
71 | channels. Since the multi-channel playback mode uses both DACs, you | ||
72 | cannot operate with full-duplex. | ||
73 | |||
74 | The 4.0 and 5.1 modes are defined as the pcm "surround40" and "surround51" | ||
75 | in alsa-lib. For example, you can play a WAV file with 6 channels like | ||
76 | |||
77 | % aplay -Dsurround51 sixchannels.wav | ||
78 | |||
79 | For programmin the 4/6 channel playback, you need to specify the PCM | ||
80 | channels as you like and set the format S16LE. For example, for playback | ||
81 | with 4 channels, | ||
82 | |||
83 | snd_pcm_hw_params_set_access(pcm, hw, SND_PCM_ACCESS_RW_INTERLEAVED); | ||
84 | // or mmap if you like | ||
85 | snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_S16_LE); | ||
86 | snd_pcm_hw_params_set_channels(pcm, hw, 4); | ||
87 | |||
88 | and use the interleaved 4 channel data. | ||
89 | |||
90 | There are some control switchs affecting to the speaker connections: | ||
91 | |||
92 | "Line-In As Rear" - As mentioned above, the line-in jack is used | ||
93 | for the rear (3th and 4th channels) output. | ||
94 | "Line-In As Bass" - The line-in jack is used for the bass (5th | ||
95 | and 6th channels) output. | ||
96 | "Mic As Center/LFE" - The mic jack is used for the bass output. | ||
97 | If this switch is on, you cannot use a microphone as a capture | ||
98 | source, of course. | ||
99 | |||
100 | |||
101 | Digital I/O | ||
102 | ----------- | ||
103 | |||
104 | The CM8x38 provides the excellent SPDIF capability with very chip | ||
105 | price (yes, that's the reason I bought the card :) | ||
106 | |||
107 | The SPDIF playback and capture are done via the third PCM device | ||
108 | (hw:0,2). Usually this is assigned to the PCM device "spdif". | ||
109 | The available rates are 44100 and 48000 Hz. | ||
110 | For playback with aplay, you can run like below: | ||
111 | |||
112 | % aplay -Dhw:0,2 foo.wav | ||
113 | |||
114 | or | ||
115 | |||
116 | % aplay -Dspdif foo.wav | ||
117 | |||
118 | 24bit format is also supported experimentally. | ||
119 | |||
120 | The playback and capture over SPDIF use normal DAC and ADC, | ||
121 | respectively, so you cannot playback both analog and digital streams | ||
122 | simultaneously. | ||
123 | |||
124 | To enable SPDIF output, you need to turn on "IEC958 Output Switch" | ||
125 | control via mixer or alsactl. Then you'll see the red light on from | ||
126 | the card so you know that's working obviously :) | ||
127 | The SPDIF input is always enabled, so you can hear SPDIF input data | ||
128 | from line-out with "IEC958 In Monitor" switch at any time (see | ||
129 | below). | ||
130 | |||
131 | You can play via SPDIF even with the first device (hw:0,0), | ||
132 | but SPDIF is enabled only when the proper format (S16LE), sample rate | ||
133 | (441100 or 48000) and channels (2) are used. Otherwise it's turned | ||
134 | off. (Also don't forget to turn on "IEC958 Output Switch", too.) | ||
135 | |||
136 | |||
137 | Additionally there are relevant control switches: | ||
138 | |||
139 | "IEC958 Mix Analog" - Mix analog PCM playback and FM-OPL/3 streams and | ||
140 | output through SPDIF. This switch appears only on old chip | ||
141 | models (CM8738 033 and 037). | ||
142 | Note: without this control you can output PCM to SPDIF. | ||
143 | This is "mixing" of streams, so e.g. it's not for AC3 output | ||
144 | (see the next section). | ||
145 | |||
146 | "IEC958 In Select" - Select SPDIF input, the internal CD-in (false) | ||
147 | and the external input (true). | ||
148 | |||
149 | "IEC958 Loop" - SPDIF input data is loop back into SPDIF | ||
150 | output (aka bypass) | ||
151 | |||
152 | "IEC958 Copyright" - Set the copyright bit. | ||
153 | |||
154 | "IEC958 5V" - Select 0.5V (coax) or 5V (optical) interface. | ||
155 | On some cards this doesn't work and you need to change the | ||
156 | configuration with hardware dip-switch. | ||
157 | |||
158 | "IEC958 In Monitor" - SPDIF input is routed to DAC. | ||
159 | |||
160 | "IEC958 In Phase Inverse" - Set SPDIF input format as inverse. | ||
161 | [FIXME: this doesn't work on all chips..] | ||
162 | |||
163 | "IEC958 In Valid" - Set input validity flag detection. | ||
164 | |||
165 | Note: When "PCM Playback Switch" is on, you'll hear the digital output | ||
166 | stream through analog line-out. | ||
167 | |||
168 | |||
169 | The AC3 (RAW DIGITAL) OUTPUT | ||
170 | ---------------------------- | ||
171 | |||
172 | The driver supports raw digital (typically AC3) i/o over SPDIF. This | ||
173 | can be toggled via IEC958 playback control, but usually you need to | ||
174 | access it via alsa-lib. See alsa-lib documents for more details. | ||
175 | |||
176 | On the raw digital mode, the "PCM Playback Switch" is automatically | ||
177 | turned off so that non-audio data is heard from the analog line-out. | ||
178 | Similarly the following switches are off: "IEC958 Mix Analog" and | ||
179 | "IEC958 Loop". The switches are resumed after closing the SPDIF PCM | ||
180 | device automatically to the previous state. | ||
181 | |||
182 | On the model 033, AC3 is implemented by the software conversion in | ||
183 | the alsa-lib. If you need to bypass the software conversion of IEC958 | ||
184 | subframes, pass the "soft_ac3=0" module option. This doesn't matter | ||
185 | on the newer models. | ||
186 | |||
187 | |||
188 | ANALOG MIXER INTERFACE | ||
189 | ---------------------- | ||
190 | |||
191 | The mixer interface on CM8x38 is similar to SB16. | ||
192 | There are Master, PCM, Synth, CD, Line, Mic and PC Speaker playback | ||
193 | volumes. Synth, CD, Line and Mic have playback and capture switches, | ||
194 | too, as well as SB16. | ||
195 | |||
196 | In addition to the standard SB mixer, CM8x38 provides more functions. | ||
197 | - PCM playback switch | ||
198 | - PCM capture switch (to capture the data sent to DAC) | ||
199 | - Mic Boost switch | ||
200 | - Mic capture volume | ||
201 | - Aux playback volume/switch and capture switch | ||
202 | - 3D control switch | ||
203 | |||
204 | |||
205 | MIDI CONTROLLER | ||
206 | --------------- | ||
207 | |||
208 | The MPU401-UART interface is enabled as default only for the first | ||
209 | (CMIPCI) card. You need to set module option "midi_port" properly | ||
210 | for the 2nd (CMIPCI) card. | ||
211 | |||
212 | There is _no_ hardware wavetable function on this chip (except for | ||
213 | OPL3 synth below). | ||
214 | What's said as MIDI synth on Windows is a software synthesizer | ||
215 | emulation. On Linux use TiMidity or other softsynth program for | ||
216 | playing MIDI music. | ||
217 | |||
218 | |||
219 | FM OPL/3 Synth | ||
220 | -------------- | ||
221 | |||
222 | The FM OPL/3 is also enabled as default only for the first card. | ||
223 | Set "fm_port" module option for more cards. | ||
224 | |||
225 | The output quality of FM OPL/3 is, however, very weird. | ||
226 | I don't know why.. | ||
227 | |||
228 | |||
229 | Joystick and Modem | ||
230 | ------------------ | ||
231 | |||
232 | The joystick and modem should be available by enabling the control | ||
233 | switch "Joystick" and "Modem" respectively. But I myself have never | ||
234 | tested them yet. | ||
235 | |||
236 | |||
237 | Debugging Information | ||
238 | --------------------- | ||
239 | |||
240 | The registers are shown in /proc/asound/cardX/cmipci. If you have any | ||
241 | problem (especially unexpected behavior of mixer), please attach the | ||
242 | output of this proc file together with the bug report. | ||
diff --git a/Documentation/sound/alsa/ControlNames.txt b/Documentation/sound/alsa/ControlNames.txt new file mode 100644 index 000000000000..5b18298e9495 --- /dev/null +++ b/Documentation/sound/alsa/ControlNames.txt | |||
@@ -0,0 +1,84 @@ | |||
1 | This document describes standard names of mixer controls. | ||
2 | |||
3 | Syntax: SOURCE [DIRECTION] FUNCTION | ||
4 | |||
5 | DIRECTION: | ||
6 | <nothing> (both directions) | ||
7 | Playback | ||
8 | Capture | ||
9 | Bypass Playback | ||
10 | Bypass Capture | ||
11 | |||
12 | FUNCTION: | ||
13 | Switch (on/off switch) | ||
14 | Volume | ||
15 | Route (route control, hardware specific) | ||
16 | |||
17 | SOURCE: | ||
18 | Master | ||
19 | Master Mono | ||
20 | Hardware Master | ||
21 | Headphone | ||
22 | PC Speaker | ||
23 | Phone | ||
24 | Phone Input | ||
25 | Phone Output | ||
26 | Synth | ||
27 | FM | ||
28 | Mic | ||
29 | Line | ||
30 | CD | ||
31 | Video | ||
32 | Zoom Video | ||
33 | Aux | ||
34 | PCM | ||
35 | PCM Front | ||
36 | PCM Rear | ||
37 | PCM Pan | ||
38 | Loopback | ||
39 | Analog Loopback (D/A -> A/D loopback) | ||
40 | Digital Loopback (playback -> capture loopback - without analog path) | ||
41 | Mono | ||
42 | Mono Output | ||
43 | Multi | ||
44 | ADC | ||
45 | Wave | ||
46 | Music | ||
47 | I2S | ||
48 | IEC958 | ||
49 | |||
50 | Exceptions: | ||
51 | [Digital] Capture Source | ||
52 | [Digital] Capture Switch (aka input gain switch) | ||
53 | [Digital] Capture Volume (aka input gain volume) | ||
54 | [Digital] Playback Switch (aka output gain switch) | ||
55 | [Digital] Playback Volume (aka output gain volume) | ||
56 | Tone Control - Switch | ||
57 | Tone Control - Bass | ||
58 | Tone Control - Treble | ||
59 | 3D Control - Switch | ||
60 | 3D Control - Center | ||
61 | 3D Control - Depth | ||
62 | 3D Control - Wide | ||
63 | 3D Control - Space | ||
64 | 3D Control - Level | ||
65 | Mic Boost [(?dB)] | ||
66 | |||
67 | PCM interface: | ||
68 | |||
69 | Sample Clock Source { "Word", "Internal", "AutoSync" } | ||
70 | Clock Sync Status { "Lock", "Sync", "No Lock" } | ||
71 | External Rate /* external capture rate */ | ||
72 | Capture Rate /* capture rate taken from external source */ | ||
73 | |||
74 | IEC958 (S/PDIF) interface: | ||
75 | |||
76 | IEC958 [...] [Playback|Capture] Switch /* turn on/off the IEC958 interface */ | ||
77 | IEC958 [...] [Playback|Capture] Volume /* digital volume control */ | ||
78 | IEC958 [...] [Playback|Capture] Default /* default or global value - read/write */ | ||
79 | IEC958 [...] [Playback|Capture] Mask /* consumer and professional mask */ | ||
80 | IEC958 [...] [Playback|Capture] Con Mask /* consumer mask */ | ||
81 | IEC958 [...] [Playback|Capture] Pro Mask /* professional mask */ | ||
82 | IEC958 [...] [Playback|Capture] PCM Stream /* the settings assigned to a PCM stream */ | ||
83 | IEC958 Q-subcode [Playback|Capture] Default /* Q-subcode bits */ | ||
84 | IEC958 Preamble [Playback|Capture] Default /* burst preamble words (4*16bits) */ | ||
diff --git a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl new file mode 100644 index 000000000000..1f3ae3e32d69 --- /dev/null +++ b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl | |||
@@ -0,0 +1,100 @@ | |||
1 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> | ||
2 | |||
3 | <book> | ||
4 | <?dbhtml filename="index.html"> | ||
5 | |||
6 | <!-- ****************************************************** --> | ||
7 | <!-- Header --> | ||
8 | <!-- ****************************************************** --> | ||
9 | <bookinfo> | ||
10 | <title>The ALSA Driver API</title> | ||
11 | |||
12 | <legalnotice> | ||
13 | <para> | ||
14 | This document is free; you can redistribute it and/or modify it | ||
15 | under the terms of the GNU General Public License as published by | ||
16 | the Free Software Foundation; either version 2 of the License, or | ||
17 | (at your option) any later version. | ||
18 | </para> | ||
19 | |||
20 | <para> | ||
21 | This document is distributed in the hope that it will be useful, | ||
22 | but <emphasis>WITHOUT ANY WARRANTY</emphasis>; without even the | ||
23 | implied warranty of <emphasis>MERCHANTABILITY or FITNESS FOR A | ||
24 | PARTICULAR PURPOSE</emphasis>. See the GNU General Public License | ||
25 | for more details. | ||
26 | </para> | ||
27 | |||
28 | <para> | ||
29 | You should have received a copy of the GNU General Public | ||
30 | License along with this program; if not, write to the Free | ||
31 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
32 | MA 02111-1307 USA | ||
33 | </para> | ||
34 | </legalnotice> | ||
35 | |||
36 | </bookinfo> | ||
37 | |||
38 | <chapter><title>Management of Cards and Devices</title> | ||
39 | <sect1><title>Card Managment</title> | ||
40 | !Esound/core/init.c | ||
41 | </sect1> | ||
42 | <sect1><title>Device Components</title> | ||
43 | !Esound/core/device.c | ||
44 | </sect1> | ||
45 | <sect1><title>KMOD and Device File Entries</title> | ||
46 | !Esound/core/sound.c | ||
47 | </sect1> | ||
48 | <sect1><title>Memory Management Helpers</title> | ||
49 | !Esound/core/memory.c | ||
50 | !Esound/core/memalloc.c | ||
51 | </sect1> | ||
52 | </chapter> | ||
53 | <chapter><title>PCM API</title> | ||
54 | <sect1><title>PCM Core</title> | ||
55 | !Esound/core/pcm.c | ||
56 | !Esound/core/pcm_lib.c | ||
57 | !Esound/core/pcm_native.c | ||
58 | </sect1> | ||
59 | <sect1><title>PCM Format Helpers</title> | ||
60 | !Esound/core/pcm_misc.c | ||
61 | </sect1> | ||
62 | <sect1><title>PCM Memory Managment</title> | ||
63 | !Esound/core/pcm_memory.c | ||
64 | </sect1> | ||
65 | </chapter> | ||
66 | <chapter><title>Control/Mixer API</title> | ||
67 | <sect1><title>General Control Interface</title> | ||
68 | !Esound/core/control.c | ||
69 | </sect1> | ||
70 | <sect1><title>AC97 Codec API</title> | ||
71 | !Esound/pci/ac97/ac97_codec.c | ||
72 | !Esound/pci/ac97/ac97_pcm.c | ||
73 | </sect1> | ||
74 | </chapter> | ||
75 | <chapter><title>MIDI API</title> | ||
76 | <sect1><title>Raw MIDI API</title> | ||
77 | !Esound/core/rawmidi.c | ||
78 | </sect1> | ||
79 | <sect1><title>MPU401-UART API</title> | ||
80 | !Esound/drivers/mpu401/mpu401_uart.c | ||
81 | </sect1> | ||
82 | </chapter> | ||
83 | <chapter><title>Proc Info API</title> | ||
84 | <sect1><title>Proc Info Interface</title> | ||
85 | !Esound/core/info.c | ||
86 | </sect1> | ||
87 | </chapter> | ||
88 | <chapter><title>Miscellaneous Functions</title> | ||
89 | <sect1><title>Hardware-Dependent Devices API</title> | ||
90 | !Esound/core/hwdep.c | ||
91 | </sect1> | ||
92 | <sect1><title>ISA DMA Helpers</title> | ||
93 | !Esound/core/isadma.c | ||
94 | </sect1> | ||
95 | <sect1><title>Other Helper Macros</title> | ||
96 | !Iinclude/sound/core.h | ||
97 | </sect1> | ||
98 | </chapter> | ||
99 | |||
100 | </book> | ||
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl new file mode 100644 index 000000000000..e789475304b6 --- /dev/null +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -0,0 +1,6045 @@ | |||
1 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> | ||
2 | |||
3 | <book> | ||
4 | <?dbhtml filename="index.html"> | ||
5 | |||
6 | <!-- ****************************************************** --> | ||
7 | <!-- Header --> | ||
8 | <!-- ****************************************************** --> | ||
9 | <bookinfo> | ||
10 | <title>Writing an ALSA Driver</title> | ||
11 | <author> | ||
12 | <firstname>Takashi</firstname> | ||
13 | <surname>Iwai</surname> | ||
14 | <affiliation> | ||
15 | <address> | ||
16 | <email>tiwai@suse.de</email> | ||
17 | </address> | ||
18 | </affiliation> | ||
19 | </author> | ||
20 | |||
21 | <date>March 6, 2005</date> | ||
22 | <edition>0.3.4</edition> | ||
23 | |||
24 | <abstract> | ||
25 | <para> | ||
26 | This document describes how to write an ALSA (Advanced Linux | ||
27 | Sound Architecture) driver. | ||
28 | </para> | ||
29 | </abstract> | ||
30 | |||
31 | <legalnotice> | ||
32 | <para> | ||
33 | Copyright (c) 2002-2004 Takashi Iwai <email>tiwai@suse.de</email> | ||
34 | </para> | ||
35 | |||
36 | <para> | ||
37 | This document is free; you can redistribute it and/or modify it | ||
38 | under the terms of the GNU General Public License as published by | ||
39 | the Free Software Foundation; either version 2 of the License, or | ||
40 | (at your option) any later version. | ||
41 | </para> | ||
42 | |||
43 | <para> | ||
44 | This document is distributed in the hope that it will be useful, | ||
45 | but <emphasis>WITHOUT ANY WARRANTY</emphasis>; without even the | ||
46 | implied warranty of <emphasis>MERCHANTABILITY or FITNESS FOR A | ||
47 | PARTICULAR PURPOSE</emphasis>. See the GNU General Public License | ||
48 | for more details. | ||
49 | </para> | ||
50 | |||
51 | <para> | ||
52 | You should have received a copy of the GNU General Public | ||
53 | License along with this program; if not, write to the Free | ||
54 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
55 | MA 02111-1307 USA | ||
56 | </para> | ||
57 | </legalnotice> | ||
58 | |||
59 | </bookinfo> | ||
60 | |||
61 | <!-- ****************************************************** --> | ||
62 | <!-- Preface --> | ||
63 | <!-- ****************************************************** --> | ||
64 | <preface id="preface"> | ||
65 | <title>Preface</title> | ||
66 | <para> | ||
67 | This document describes how to write an | ||
68 | <ulink url="http://www.alsa-project.org/"><citetitle> | ||
69 | ALSA (Advanced Linux Sound Architecture)</citetitle></ulink> | ||
70 | driver. The document focuses mainly on the PCI soundcard. | ||
71 | In the case of other device types, the API might | ||
72 | be different, too. However, at least the ALSA kernel API is | ||
73 | consistent, and therefore it would be still a bit help for | ||
74 | writing them. | ||
75 | </para> | ||
76 | |||
77 | <para> | ||
78 | The target of this document is ones who already have enough | ||
79 | skill of C language and have the basic knowledge of linux | ||
80 | kernel programming. This document doesn't explain the general | ||
81 | topics of linux kernel codes and doesn't cover the detail of | ||
82 | implementation of each low-level driver. It describes only how is | ||
83 | the standard way to write a PCI sound driver on ALSA. | ||
84 | </para> | ||
85 | |||
86 | <para> | ||
87 | If you are already familiar with the older ALSA ver.0.5.x, you | ||
88 | can check the drivers such as <filename>es1938.c</filename> or | ||
89 | <filename>maestro3.c</filename> which have also almost the same | ||
90 | code-base in the ALSA 0.5.x tree, so you can compare the differences. | ||
91 | </para> | ||
92 | |||
93 | <para> | ||
94 | This document is still a draft version. Any feedbacks and | ||
95 | corrections, please!! | ||
96 | </para> | ||
97 | </preface> | ||
98 | |||
99 | |||
100 | <!-- ****************************************************** --> | ||
101 | <!-- File Tree Structure --> | ||
102 | <!-- ****************************************************** --> | ||
103 | <chapter id="file-tree"> | ||
104 | <title>File Tree Structure</title> | ||
105 | |||
106 | <section id="file-tree-general"> | ||
107 | <title>General</title> | ||
108 | <para> | ||
109 | The ALSA drivers are provided in the two ways. | ||
110 | </para> | ||
111 | |||
112 | <para> | ||
113 | One is the trees provided as a tarball or via cvs from the | ||
114 | ALSA's ftp site, and another is the 2.6 (or later) Linux kernel | ||
115 | tree. To synchronize both, the ALSA driver tree is split into | ||
116 | two different trees: alsa-kernel and alsa-driver. The former | ||
117 | contains purely the source codes for the Linux 2.6 (or later) | ||
118 | tree. This tree is designed only for compilation on 2.6 or | ||
119 | later environment. The latter, alsa-driver, contains many subtle | ||
120 | files for compiling the ALSA driver on the outside of Linux | ||
121 | kernel like configure script, the wrapper functions for older, | ||
122 | 2.2 and 2.4 kernels, to adapt the latest kernel API, | ||
123 | and additional drivers which are still in development or in | ||
124 | tests. The drivers in alsa-driver tree will be moved to | ||
125 | alsa-kernel (eventually 2.6 kernel tree) once when they are | ||
126 | finished and confirmed to work fine. | ||
127 | </para> | ||
128 | |||
129 | <para> | ||
130 | The file tree structure of ALSA driver is depicted below. Both | ||
131 | alsa-kernel and alsa-driver have almost the same file | ||
132 | structure, except for <quote>core</quote> directory. It's | ||
133 | named as <quote>acore</quote> in alsa-driver tree. | ||
134 | |||
135 | <example> | ||
136 | <title>ALSA File Tree Structure</title> | ||
137 | <literallayout> | ||
138 | sound | ||
139 | /core | ||
140 | /oss | ||
141 | /seq | ||
142 | /oss | ||
143 | /instr | ||
144 | /ioctl32 | ||
145 | /include | ||
146 | /drivers | ||
147 | /mpu401 | ||
148 | /opl3 | ||
149 | /i2c | ||
150 | /l3 | ||
151 | /synth | ||
152 | /emux | ||
153 | /pci | ||
154 | /(cards) | ||
155 | /isa | ||
156 | /(cards) | ||
157 | /arm | ||
158 | /ppc | ||
159 | /sparc | ||
160 | /usb | ||
161 | /pcmcia /(cards) | ||
162 | /oss | ||
163 | </literallayout> | ||
164 | </example> | ||
165 | </para> | ||
166 | </section> | ||
167 | |||
168 | <section id="file-tree-core-directory"> | ||
169 | <title>core directory</title> | ||
170 | <para> | ||
171 | This directory contains the middle layer, that is, the heart | ||
172 | of ALSA drivers. In this directory, the native ALSA modules are | ||
173 | stored. The sub-directories contain different modules and are | ||
174 | dependent upon the kernel config. | ||
175 | </para> | ||
176 | |||
177 | <section id="file-tree-core-directory-oss"> | ||
178 | <title>core/oss</title> | ||
179 | |||
180 | <para> | ||
181 | The codes for PCM and mixer OSS emulation modules are stored | ||
182 | in this directory. The rawmidi OSS emulation is included in | ||
183 | the ALSA rawmidi code since it's quite small. The sequencer | ||
184 | code is stored in core/seq/oss directory (see | ||
185 | <link linkend="file-tree-core-directory-seq-oss"><citetitle> | ||
186 | below</citetitle></link>). | ||
187 | </para> | ||
188 | </section> | ||
189 | |||
190 | <section id="file-tree-core-directory-ioctl32"> | ||
191 | <title>core/ioctl32</title> | ||
192 | |||
193 | <para> | ||
194 | This directory contains the 32bit-ioctl wrappers for 64bit | ||
195 | architectures such like x86-64, ppc64 and sparc64. For 32bit | ||
196 | and alpha architectures, these are not compiled. | ||
197 | </para> | ||
198 | </section> | ||
199 | |||
200 | <section id="file-tree-core-directory-seq"> | ||
201 | <title>core/seq</title> | ||
202 | <para> | ||
203 | This and its sub-directories are for the ALSA | ||
204 | sequencer. This directory contains the sequencer core and | ||
205 | primary sequencer modules such like snd-seq-midi, | ||
206 | snd-seq-virmidi, etc. They are compiled only when | ||
207 | <constant>CONFIG_SND_SEQUENCER</constant> is set in the kernel | ||
208 | config. | ||
209 | </para> | ||
210 | </section> | ||
211 | |||
212 | <section id="file-tree-core-directory-seq-oss"> | ||
213 | <title>core/seq/oss</title> | ||
214 | <para> | ||
215 | This contains the OSS sequencer emulation codes. | ||
216 | </para> | ||
217 | </section> | ||
218 | |||
219 | <section id="file-tree-core-directory-deq-instr"> | ||
220 | <title>core/seq/instr</title> | ||
221 | <para> | ||
222 | This directory contains the modules for the sequencer | ||
223 | instrument layer. | ||
224 | </para> | ||
225 | </section> | ||
226 | </section> | ||
227 | |||
228 | <section id="file-tree-include-directory"> | ||
229 | <title>include directory</title> | ||
230 | <para> | ||
231 | This is the place for the public header files of ALSA drivers, | ||
232 | which are to be exported to the user-space, or included by | ||
233 | several files at different directories. Basically, the private | ||
234 | header files should not be placed in this directory, but you may | ||
235 | still find files there, due to historical reason :) | ||
236 | </para> | ||
237 | </section> | ||
238 | |||
239 | <section id="file-tree-drivers-directory"> | ||
240 | <title>drivers directory</title> | ||
241 | <para> | ||
242 | This directory contains the codes shared among different drivers | ||
243 | on the different architectures. They are hence supposed not to be | ||
244 | architecture-specific. | ||
245 | For example, the dummy pcm driver and the serial MIDI | ||
246 | driver are found in this directory. In the sub-directories, | ||
247 | there are the codes for components which are independent from | ||
248 | bus and cpu architectures. | ||
249 | </para> | ||
250 | |||
251 | <section id="file-tree-drivers-directory-mpu401"> | ||
252 | <title>drivers/mpu401</title> | ||
253 | <para> | ||
254 | The MPU401 and MPU401-UART modules are stored here. | ||
255 | </para> | ||
256 | </section> | ||
257 | |||
258 | <section id="file-tree-drivers-directory-opl3"> | ||
259 | <title>drivers/opl3 and opl4</title> | ||
260 | <para> | ||
261 | The OPL3 and OPL4 FM-synth stuff is found here. | ||
262 | </para> | ||
263 | </section> | ||
264 | </section> | ||
265 | |||
266 | <section id="file-tree-i2c-directory"> | ||
267 | <title>i2c directory</title> | ||
268 | <para> | ||
269 | This contains the ALSA i2c components. | ||
270 | </para> | ||
271 | |||
272 | <para> | ||
273 | Although there is a standard i2c layer on Linux, ALSA has its | ||
274 | own i2c codes for some cards, because the soundcard needs only a | ||
275 | simple operation and the standard i2c API is too complicated for | ||
276 | such a purpose. | ||
277 | </para> | ||
278 | |||
279 | <section id="file-tree-i2c-directory-l3"> | ||
280 | <title>i2c/l3</title> | ||
281 | <para> | ||
282 | This is a sub-directory for ARM L3 i2c. | ||
283 | </para> | ||
284 | </section> | ||
285 | </section> | ||
286 | |||
287 | <section id="file-tree-synth-directory"> | ||
288 | <title>synth directory</title> | ||
289 | <para> | ||
290 | This contains the synth middle-level modules. | ||
291 | </para> | ||
292 | |||
293 | <para> | ||
294 | So far, there is only Emu8000/Emu10k1 synth driver under | ||
295 | synth/emux sub-directory. | ||
296 | </para> | ||
297 | </section> | ||
298 | |||
299 | <section id="file-tree-pci-directory"> | ||
300 | <title>pci directory</title> | ||
301 | <para> | ||
302 | This and its sub-directories hold the top-level card modules | ||
303 | for PCI soundcards and the codes specific to the PCI BUS. | ||
304 | </para> | ||
305 | |||
306 | <para> | ||
307 | The drivers compiled from a single file is stored directly on | ||
308 | pci directory, while the drivers with several source files are | ||
309 | stored on its own sub-directory (e.g. emu10k1, ice1712). | ||
310 | </para> | ||
311 | </section> | ||
312 | |||
313 | <section id="file-tree-isa-directory"> | ||
314 | <title>isa directory</title> | ||
315 | <para> | ||
316 | This and its sub-directories hold the top-level card modules | ||
317 | for ISA soundcards. | ||
318 | </para> | ||
319 | </section> | ||
320 | |||
321 | <section id="file-tree-arm-ppc-sparc-directories"> | ||
322 | <title>arm, ppc, and sparc directories</title> | ||
323 | <para> | ||
324 | These are for the top-level card modules which are | ||
325 | specific to each given architecture. | ||
326 | </para> | ||
327 | </section> | ||
328 | |||
329 | <section id="file-tree-usb-directory"> | ||
330 | <title>usb directory</title> | ||
331 | <para> | ||
332 | This contains the USB-audio driver. On the latest version, the | ||
333 | USB MIDI driver is integrated together with usb-audio driver. | ||
334 | </para> | ||
335 | </section> | ||
336 | |||
337 | <section id="file-tree-pcmcia-directory"> | ||
338 | <title>pcmcia directory</title> | ||
339 | <para> | ||
340 | The PCMCIA, especially PCCard drivers will go here. CardBus | ||
341 | drivers will be on pci directory, because its API is identical | ||
342 | with the standard PCI cards. | ||
343 | </para> | ||
344 | </section> | ||
345 | |||
346 | <section id="file-tree-oss-directory"> | ||
347 | <title>oss directory</title> | ||
348 | <para> | ||
349 | The OSS/Lite source files are stored here on Linux 2.6 (or | ||
350 | later) tree. (In the ALSA driver tarball, it's empty, of course :) | ||
351 | </para> | ||
352 | </section> | ||
353 | </chapter> | ||
354 | |||
355 | |||
356 | <!-- ****************************************************** --> | ||
357 | <!-- Basic Flow for PCI Drivers --> | ||
358 | <!-- ****************************************************** --> | ||
359 | <chapter id="basic-flow"> | ||
360 | <title>Basic Flow for PCI Drivers</title> | ||
361 | |||
362 | <section id="basic-flow-outline"> | ||
363 | <title>Outline</title> | ||
364 | <para> | ||
365 | The minimum flow of PCI soundcard is like the following: | ||
366 | |||
367 | <itemizedlist> | ||
368 | <listitem><para>define the PCI ID table (see the section | ||
369 | <link linkend="pci-resource-entries"><citetitle>PCI Entries | ||
370 | </citetitle></link>).</para></listitem> | ||
371 | <listitem><para>create <function>probe()</function> callback.</para></listitem> | ||
372 | <listitem><para>create <function>remove()</function> callback.</para></listitem> | ||
373 | <listitem><para>create pci_driver table which contains the three pointers above.</para></listitem> | ||
374 | <listitem><para>create <function>init()</function> function just calling <function>pci_module_init()</function> to register the pci_driver table defined above.</para></listitem> | ||
375 | <listitem><para>create <function>exit()</function> function to call <function>pci_unregister_driver()</function> function.</para></listitem> | ||
376 | </itemizedlist> | ||
377 | </para> | ||
378 | </section> | ||
379 | |||
380 | <section id="basic-flow-example"> | ||
381 | <title>Full Code Example</title> | ||
382 | <para> | ||
383 | The code example is shown below. Some parts are kept | ||
384 | unimplemented at this moment but will be filled in the | ||
385 | succeeding sections. The numbers in comment lines of | ||
386 | <function>snd_mychip_probe()</function> function are the | ||
387 | markers. | ||
388 | |||
389 | <example> | ||
390 | <title>Basic Flow for PCI Drivers Example</title> | ||
391 | <programlisting> | ||
392 | <![CDATA[ | ||
393 | #include <sound/driver.h> | ||
394 | #include <linux/init.h> | ||
395 | #include <linux/pci.h> | ||
396 | #include <linux/slab.h> | ||
397 | #include <sound/core.h> | ||
398 | #include <sound/initval.h> | ||
399 | |||
400 | /* module parameters (see "Module Parameters") */ | ||
401 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | ||
402 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | ||
403 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | ||
404 | |||
405 | /* definition of the chip-specific record */ | ||
406 | typedef struct snd_mychip mychip_t; | ||
407 | struct snd_mychip { | ||
408 | snd_card_t *card; | ||
409 | // rest of implementation will be in the section | ||
410 | // "PCI Resource Managements" | ||
411 | }; | ||
412 | |||
413 | /* chip-specific destructor | ||
414 | * (see "PCI Resource Managements") | ||
415 | */ | ||
416 | static int snd_mychip_free(mychip_t *chip) | ||
417 | { | ||
418 | .... // will be implemented later... | ||
419 | } | ||
420 | |||
421 | /* component-destructor | ||
422 | * (see "Management of Cards and Components") | ||
423 | */ | ||
424 | static int snd_mychip_dev_free(snd_device_t *device) | ||
425 | { | ||
426 | mychip_t *chip = device->device_data; | ||
427 | return snd_mychip_free(chip); | ||
428 | } | ||
429 | |||
430 | /* chip-specific constructor | ||
431 | * (see "Management of Cards and Components") | ||
432 | */ | ||
433 | static int __devinit snd_mychip_create(snd_card_t *card, | ||
434 | struct pci_dev *pci, | ||
435 | mychip_t **rchip) | ||
436 | { | ||
437 | mychip_t *chip; | ||
438 | int err; | ||
439 | static snd_device_ops_t ops = { | ||
440 | .dev_free = snd_mychip_dev_free, | ||
441 | }; | ||
442 | |||
443 | *rchip = NULL; | ||
444 | |||
445 | // check PCI availability here | ||
446 | // (see "PCI Resource Managements") | ||
447 | .... | ||
448 | |||
449 | /* allocate a chip-specific data with zero filled */ | ||
450 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | ||
451 | if (chip == NULL) | ||
452 | return -ENOMEM; | ||
453 | |||
454 | chip->card = card; | ||
455 | |||
456 | // rest of initialization here; will be implemented | ||
457 | // later, see "PCI Resource Managements" | ||
458 | .... | ||
459 | |||
460 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, | ||
461 | chip, &ops)) < 0) { | ||
462 | snd_mychip_free(chip); | ||
463 | return err; | ||
464 | } | ||
465 | |||
466 | snd_card_set_dev(card, &pci->dev); | ||
467 | |||
468 | *rchip = chip; | ||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | /* constructor -- see "Constructor" sub-section */ | ||
473 | static int __devinit snd_mychip_probe(struct pci_dev *pci, | ||
474 | const struct pci_device_id *pci_id) | ||
475 | { | ||
476 | static int dev; | ||
477 | snd_card_t *card; | ||
478 | mychip_t *chip; | ||
479 | int err; | ||
480 | |||
481 | /* (1) */ | ||
482 | if (dev >= SNDRV_CARDS) | ||
483 | return -ENODEV; | ||
484 | if (!enable[dev]) { | ||
485 | dev++; | ||
486 | return -ENOENT; | ||
487 | } | ||
488 | |||
489 | /* (2) */ | ||
490 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
491 | if (card == NULL) | ||
492 | return -ENOMEM; | ||
493 | |||
494 | /* (3) */ | ||
495 | if ((err = snd_mychip_create(card, pci, &chip)) < 0) { | ||
496 | snd_card_free(card); | ||
497 | return err; | ||
498 | } | ||
499 | |||
500 | /* (4) */ | ||
501 | strcpy(card->driver, "My Chip"); | ||
502 | strcpy(card->shortname, "My Own Chip 123"); | ||
503 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
504 | card->shortname, chip->ioport, chip->irq); | ||
505 | |||
506 | /* (5) */ | ||
507 | .... // implemented later | ||
508 | |||
509 | /* (6) */ | ||
510 | if ((err = snd_card_register(card)) < 0) { | ||
511 | snd_card_free(card); | ||
512 | return err; | ||
513 | } | ||
514 | |||
515 | /* (7) */ | ||
516 | pci_set_drvdata(pci, card); | ||
517 | dev++; | ||
518 | return 0; | ||
519 | } | ||
520 | |||
521 | /* destructor -- see "Destructor" sub-section */ | ||
522 | static void __devexit snd_mychip_remove(struct pci_dev *pci) | ||
523 | { | ||
524 | snd_card_free(pci_get_drvdata(pci)); | ||
525 | pci_set_drvdata(pci, NULL); | ||
526 | } | ||
527 | ]]> | ||
528 | </programlisting> | ||
529 | </example> | ||
530 | </para> | ||
531 | </section> | ||
532 | |||
533 | <section id="basic-flow-constructor"> | ||
534 | <title>Constructor</title> | ||
535 | <para> | ||
536 | The real constructor of PCI drivers is probe callback. The | ||
537 | probe callback and other component-constructors which are called | ||
538 | from probe callback should be defined with | ||
539 | <parameter>__devinit</parameter> prefix. You | ||
540 | cannot use <parameter>__init</parameter> prefix for them, | ||
541 | because any PCI device could be a hotplug device. | ||
542 | </para> | ||
543 | |||
544 | <para> | ||
545 | In the probe callback, the following scheme is often used. | ||
546 | </para> | ||
547 | |||
548 | <section id="basic-flow-constructor-device-index"> | ||
549 | <title>1) Check and increment the device index.</title> | ||
550 | <para> | ||
551 | <informalexample> | ||
552 | <programlisting> | ||
553 | <![CDATA[ | ||
554 | static int dev; | ||
555 | .... | ||
556 | if (dev >= SNDRV_CARDS) | ||
557 | return -ENODEV; | ||
558 | if (!enable[dev]) { | ||
559 | dev++; | ||
560 | return -ENOENT; | ||
561 | } | ||
562 | ]]> | ||
563 | </programlisting> | ||
564 | </informalexample> | ||
565 | |||
566 | where enable[dev] is the module option. | ||
567 | </para> | ||
568 | |||
569 | <para> | ||
570 | At each time probe callback is called, check the | ||
571 | availability of the device. If not available, simply increment | ||
572 | the device index and returns. dev will be incremented also | ||
573 | later (<link | ||
574 | linkend="basic-flow-constructor-set-pci"><citetitle>step | ||
575 | 7</citetitle></link>). | ||
576 | </para> | ||
577 | </section> | ||
578 | |||
579 | <section id="basic-flow-constructor-create-card"> | ||
580 | <title>2) Create a card instance</title> | ||
581 | <para> | ||
582 | <informalexample> | ||
583 | <programlisting> | ||
584 | <![CDATA[ | ||
585 | snd_card_t *card; | ||
586 | .... | ||
587 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
588 | ]]> | ||
589 | </programlisting> | ||
590 | </informalexample> | ||
591 | </para> | ||
592 | |||
593 | <para> | ||
594 | The detail will be explained in the section | ||
595 | <link linkend="card-management-card-instance"><citetitle> | ||
596 | Management of Cards and Components</citetitle></link>. | ||
597 | </para> | ||
598 | </section> | ||
599 | |||
600 | <section id="basic-flow-constructor-create-main"> | ||
601 | <title>3) Create a main component</title> | ||
602 | <para> | ||
603 | In this part, the PCI resources are allocated. | ||
604 | |||
605 | <informalexample> | ||
606 | <programlisting> | ||
607 | <![CDATA[ | ||
608 | mychip_t *chip; | ||
609 | .... | ||
610 | if ((err = snd_mychip_create(card, pci, &chip)) < 0) { | ||
611 | snd_card_free(card); | ||
612 | return err; | ||
613 | } | ||
614 | ]]> | ||
615 | </programlisting> | ||
616 | </informalexample> | ||
617 | |||
618 | The detail will be explained in the section <link | ||
619 | linkend="pci-resource"><citetitle>PCI Resource | ||
620 | Managements</citetitle></link>. | ||
621 | </para> | ||
622 | </section> | ||
623 | |||
624 | <section id="basic-flow-constructor-main-component"> | ||
625 | <title>4) Set the driver ID and name strings.</title> | ||
626 | <para> | ||
627 | <informalexample> | ||
628 | <programlisting> | ||
629 | <![CDATA[ | ||
630 | strcpy(card->driver, "My Chip"); | ||
631 | strcpy(card->shortname, "My Own Chip 123"); | ||
632 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
633 | card->shortname, chip->ioport, chip->irq); | ||
634 | ]]> | ||
635 | </programlisting> | ||
636 | </informalexample> | ||
637 | |||
638 | The driver field holds the minimal ID string of the | ||
639 | chip. This is referred by alsa-lib's configurator, so keep it | ||
640 | simple but unique. | ||
641 | Even the same driver can have different driver IDs to | ||
642 | distinguish the functionality of each chip type. | ||
643 | </para> | ||
644 | |||
645 | <para> | ||
646 | The shortname field is a string shown as more verbose | ||
647 | name. The longname field contains the information which is | ||
648 | shown in <filename>/proc/asound/cards</filename>. | ||
649 | </para> | ||
650 | </section> | ||
651 | |||
652 | <section id="basic-flow-constructor-create-other"> | ||
653 | <title>5) Create other components, such as mixer, MIDI, etc.</title> | ||
654 | <para> | ||
655 | Here you define the basic components such as | ||
656 | <link linkend="pcm-interface"><citetitle>PCM</citetitle></link>, | ||
657 | mixer (e.g. <link linkend="api-ac97"><citetitle>AC97</citetitle></link>), | ||
658 | MIDI (e.g. <link linkend="midi-interface"><citetitle>MPU-401</citetitle></link>), | ||
659 | and other interfaces. | ||
660 | Also, if you want a <link linkend="proc-interface"><citetitle>proc | ||
661 | file</citetitle></link>, define it here, too. | ||
662 | </para> | ||
663 | </section> | ||
664 | |||
665 | <section id="basic-flow-constructor-register-card"> | ||
666 | <title>6) Register the card instance.</title> | ||
667 | <para> | ||
668 | <informalexample> | ||
669 | <programlisting> | ||
670 | <![CDATA[ | ||
671 | if ((err = snd_card_register(card)) < 0) { | ||
672 | snd_card_free(card); | ||
673 | return err; | ||
674 | } | ||
675 | ]]> | ||
676 | </programlisting> | ||
677 | </informalexample> | ||
678 | </para> | ||
679 | |||
680 | <para> | ||
681 | Will be explained in the section <link | ||
682 | linkend="card-management-registration"><citetitle>Management | ||
683 | of Cards and Components</citetitle></link>, too. | ||
684 | </para> | ||
685 | </section> | ||
686 | |||
687 | <section id="basic-flow-constructor-set-pci"> | ||
688 | <title>7) Set the PCI driver data and return zero.</title> | ||
689 | <para> | ||
690 | <informalexample> | ||
691 | <programlisting> | ||
692 | <![CDATA[ | ||
693 | pci_set_drvdata(pci, card); | ||
694 | dev++; | ||
695 | return 0; | ||
696 | ]]> | ||
697 | </programlisting> | ||
698 | </informalexample> | ||
699 | |||
700 | In the above, the card record is stored. This pointer is | ||
701 | referred in the remove callback and power-management | ||
702 | callbacks, too. | ||
703 | </para> | ||
704 | </section> | ||
705 | </section> | ||
706 | |||
707 | <section id="basic-flow-destructor"> | ||
708 | <title>Destructor</title> | ||
709 | <para> | ||
710 | The destructor, remove callback, simply releases the card | ||
711 | instance. Then the ALSA middle layer will release all the | ||
712 | attached components automatically. | ||
713 | </para> | ||
714 | |||
715 | <para> | ||
716 | It would be typically like the following: | ||
717 | |||
718 | <informalexample> | ||
719 | <programlisting> | ||
720 | <![CDATA[ | ||
721 | static void __devexit snd_mychip_remove(struct pci_dev *pci) | ||
722 | { | ||
723 | snd_card_free(pci_get_drvdata(pci)); | ||
724 | pci_set_drvdata(pci, NULL); | ||
725 | } | ||
726 | ]]> | ||
727 | </programlisting> | ||
728 | </informalexample> | ||
729 | |||
730 | The above code assumes that the card pointer is set to the PCI | ||
731 | driver data. | ||
732 | </para> | ||
733 | </section> | ||
734 | |||
735 | <section id="basic-flow-header-files"> | ||
736 | <title>Header Files</title> | ||
737 | <para> | ||
738 | For the above example, at least the following include files | ||
739 | are necessary. | ||
740 | |||
741 | <informalexample> | ||
742 | <programlisting> | ||
743 | <![CDATA[ | ||
744 | #include <sound/driver.h> | ||
745 | #include <linux/init.h> | ||
746 | #include <linux/pci.h> | ||
747 | #include <linux/slab.h> | ||
748 | #include <sound/core.h> | ||
749 | #include <sound/initval.h> | ||
750 | ]]> | ||
751 | </programlisting> | ||
752 | </informalexample> | ||
753 | |||
754 | where the last one is necessary only when module options are | ||
755 | defined in the source file. If the codes are split to several | ||
756 | files, the file without module options don't need them. | ||
757 | </para> | ||
758 | |||
759 | <para> | ||
760 | In addition to them, you'll need | ||
761 | <filename><linux/interrupt.h></filename> for the interrupt | ||
762 | handling, and <filename><asm/io.h></filename> for the i/o | ||
763 | access. If you use <function>mdelay()</function> or | ||
764 | <function>udelay()</function> functions, you'll need to include | ||
765 | <filename><linux/delay.h></filename>, too. | ||
766 | </para> | ||
767 | |||
768 | <para> | ||
769 | The ALSA interfaces like PCM or control API are defined in other | ||
770 | header files as <filename><sound/xxx.h></filename>. | ||
771 | They have to be included after | ||
772 | <filename><sound/core.h></filename>. | ||
773 | </para> | ||
774 | |||
775 | </section> | ||
776 | </chapter> | ||
777 | |||
778 | |||
779 | <!-- ****************************************************** --> | ||
780 | <!-- Management of Cards and Components --> | ||
781 | <!-- ****************************************************** --> | ||
782 | <chapter id="card-management"> | ||
783 | <title>Management of Cards and Components</title> | ||
784 | |||
785 | <section id="card-management-card-instance"> | ||
786 | <title>Card Instance</title> | ||
787 | <para> | ||
788 | For each soundcard, a <quote>card</quote> record must be allocated. | ||
789 | </para> | ||
790 | |||
791 | <para> | ||
792 | A card record is the headquarters of the soundcard. It manages | ||
793 | the list of whole devices (components) on the soundcard, such as | ||
794 | PCM, mixers, MIDI, synthesizer, and so on. Also, the card | ||
795 | record holds the ID and the name strings of the card, manages | ||
796 | the root of proc files, and controls the power-management states | ||
797 | and hotplug disconnections. The component list on the card | ||
798 | record is used to manage the proper releases of resources at | ||
799 | destruction. | ||
800 | </para> | ||
801 | |||
802 | <para> | ||
803 | As mentioned above, to create a card instance, call | ||
804 | <function>snd_card_new()</function>. | ||
805 | |||
806 | <informalexample> | ||
807 | <programlisting> | ||
808 | <![CDATA[ | ||
809 | snd_card_t *card; | ||
810 | card = snd_card_new(index, id, module, extra_size); | ||
811 | ]]> | ||
812 | </programlisting> | ||
813 | </informalexample> | ||
814 | </para> | ||
815 | |||
816 | <para> | ||
817 | The function takes four arguments, the card-index number, the | ||
818 | id string, the module pointer (usually | ||
819 | <constant>THIS_MODULE</constant>), | ||
820 | and the size of extra-data space. The last argument is used to | ||
821 | allocate card->private_data for the | ||
822 | chip-specific data. Note that this data | ||
823 | <emphasis>is</emphasis> allocated by | ||
824 | <function>snd_card_new()</function>. | ||
825 | </para> | ||
826 | </section> | ||
827 | |||
828 | <section id="card-management-component"> | ||
829 | <title>Components</title> | ||
830 | <para> | ||
831 | After the card is created, you can attach the components | ||
832 | (devices) to the card instance. On ALSA driver, a component is | ||
833 | represented as a <type>snd_device_t</type> object. | ||
834 | A component can be a PCM instance, a control interface, a raw | ||
835 | MIDI interface, etc. Each of such instances has one component | ||
836 | entry. | ||
837 | </para> | ||
838 | |||
839 | <para> | ||
840 | A component can be created via | ||
841 | <function>snd_device_new()</function> function. | ||
842 | |||
843 | <informalexample> | ||
844 | <programlisting> | ||
845 | <![CDATA[ | ||
846 | snd_device_new(card, SNDRV_DEV_XXX, chip, &ops); | ||
847 | ]]> | ||
848 | </programlisting> | ||
849 | </informalexample> | ||
850 | </para> | ||
851 | |||
852 | <para> | ||
853 | This takes the card pointer, the device-level | ||
854 | (<constant>SNDRV_DEV_XXX</constant>), the data pointer, and the | ||
855 | callback pointers (<parameter>&ops</parameter>). The | ||
856 | device-level defines the type of components and the order of | ||
857 | registration and de-registration. For most of components, the | ||
858 | device-level is already defined. For a user-defined component, | ||
859 | you can use <constant>SNDRV_DEV_LOWLEVEL</constant>. | ||
860 | </para> | ||
861 | |||
862 | <para> | ||
863 | This function itself doesn't allocate the data space. The data | ||
864 | must be allocated manually beforehand, and its pointer is passed | ||
865 | as the argument. This pointer is used as the identifier | ||
866 | (<parameter>chip</parameter> in the above example) for the | ||
867 | instance. | ||
868 | </para> | ||
869 | |||
870 | <para> | ||
871 | Each ALSA pre-defined component such as ac97 or pcm calls | ||
872 | <function>snd_device_new()</function> inside its | ||
873 | constructor. The destructor for each component is defined in the | ||
874 | callback pointers. Hence, you don't need to take care of | ||
875 | calling a destructor for such a component. | ||
876 | </para> | ||
877 | |||
878 | <para> | ||
879 | If you would like to create your own component, you need to | ||
880 | set the destructor function to dev_free callback in | ||
881 | <parameter>ops</parameter>, so that it can be released | ||
882 | automatically via <function>snd_card_free()</function>. The | ||
883 | example will be shown later as an implementation of a | ||
884 | chip-specific data. | ||
885 | </para> | ||
886 | </section> | ||
887 | |||
888 | <section id="card-management-chip-specific"> | ||
889 | <title>Chip-Specific Data</title> | ||
890 | <para> | ||
891 | The chip-specific information, e.g. the i/o port address, its | ||
892 | resource pointer, or the irq number, is stored in the | ||
893 | chip-specific record. | ||
894 | Usually, the chip-specific record is typedef'ed as | ||
895 | <type>xxx_t</type> like the following: | ||
896 | |||
897 | <informalexample> | ||
898 | <programlisting> | ||
899 | <![CDATA[ | ||
900 | typedef struct snd_mychip mychip_t; | ||
901 | struct snd_mychip { | ||
902 | .... | ||
903 | }; | ||
904 | ]]> | ||
905 | </programlisting> | ||
906 | </informalexample> | ||
907 | </para> | ||
908 | |||
909 | <para> | ||
910 | In general, there are two ways to allocate the chip record. | ||
911 | </para> | ||
912 | |||
913 | <section id="card-management-chip-specific-snd-card-new"> | ||
914 | <title>1. Allocating via <function>snd_card_new()</function>.</title> | ||
915 | <para> | ||
916 | As mentioned above, you can pass the extra-data-length to the 4th argument of <function>snd_card_new()</function>, i.e. | ||
917 | |||
918 | <informalexample> | ||
919 | <programlisting> | ||
920 | <![CDATA[ | ||
921 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(mychip_t)); | ||
922 | ]]> | ||
923 | </programlisting> | ||
924 | </informalexample> | ||
925 | |||
926 | whether <type>mychip_t</type> is the type of the chip record. | ||
927 | </para> | ||
928 | |||
929 | <para> | ||
930 | In return, the allocated record can be accessed as | ||
931 | |||
932 | <informalexample> | ||
933 | <programlisting> | ||
934 | <![CDATA[ | ||
935 | mychip_t *chip = (mychip_t *)card->private_data; | ||
936 | ]]> | ||
937 | </programlisting> | ||
938 | </informalexample> | ||
939 | |||
940 | With this method, you don't have to allocate twice. | ||
941 | The record is released together with the card instance. | ||
942 | </para> | ||
943 | </section> | ||
944 | |||
945 | <section id="card-management-chip-specific-allocate-extra"> | ||
946 | <title>2. Allocating an extra device.</title> | ||
947 | |||
948 | <para> | ||
949 | After allocating a card instance via | ||
950 | <function>snd_card_new()</function> (with | ||
951 | <constant>NULL</constant> on the 4th arg), call | ||
952 | <function>kcalloc()</function>. | ||
953 | |||
954 | <informalexample> | ||
955 | <programlisting> | ||
956 | <![CDATA[ | ||
957 | snd_card_t *card; | ||
958 | mychip_t *chip; | ||
959 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); | ||
960 | ..... | ||
961 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | ||
962 | ]]> | ||
963 | </programlisting> | ||
964 | </informalexample> | ||
965 | </para> | ||
966 | |||
967 | <para> | ||
968 | The chip record should have the field to hold the card | ||
969 | pointer at least, | ||
970 | |||
971 | <informalexample> | ||
972 | <programlisting> | ||
973 | <![CDATA[ | ||
974 | struct snd_mychip { | ||
975 | snd_card_t *card; | ||
976 | .... | ||
977 | }; | ||
978 | ]]> | ||
979 | </programlisting> | ||
980 | </informalexample> | ||
981 | </para> | ||
982 | |||
983 | <para> | ||
984 | Then, set the card pointer in the returned chip instance. | ||
985 | |||
986 | <informalexample> | ||
987 | <programlisting> | ||
988 | <![CDATA[ | ||
989 | chip->card = card; | ||
990 | ]]> | ||
991 | </programlisting> | ||
992 | </informalexample> | ||
993 | </para> | ||
994 | |||
995 | <para> | ||
996 | Next, initialize the fields, and register this chip | ||
997 | record as a low-level device with a specified | ||
998 | <parameter>ops</parameter>, | ||
999 | |||
1000 | <informalexample> | ||
1001 | <programlisting> | ||
1002 | <![CDATA[ | ||
1003 | static snd_device_ops_t ops = { | ||
1004 | .dev_free = snd_mychip_dev_free, | ||
1005 | }; | ||
1006 | .... | ||
1007 | snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); | ||
1008 | ]]> | ||
1009 | </programlisting> | ||
1010 | </informalexample> | ||
1011 | |||
1012 | <function>snd_mychip_dev_free()</function> is the | ||
1013 | device-destructor function, which will call the real | ||
1014 | destructor. | ||
1015 | </para> | ||
1016 | |||
1017 | <para> | ||
1018 | <informalexample> | ||
1019 | <programlisting> | ||
1020 | <![CDATA[ | ||
1021 | static int snd_mychip_dev_free(snd_device_t *device) | ||
1022 | { | ||
1023 | mychip_t *chip = device->device_data; | ||
1024 | return snd_mychip_free(chip); | ||
1025 | } | ||
1026 | ]]> | ||
1027 | </programlisting> | ||
1028 | </informalexample> | ||
1029 | |||
1030 | where <function>snd_mychip_free()</function> is the real destructor. | ||
1031 | </para> | ||
1032 | </section> | ||
1033 | </section> | ||
1034 | |||
1035 | <section id="card-management-registration"> | ||
1036 | <title>Registration and Release</title> | ||
1037 | <para> | ||
1038 | After all components are assigned, register the card instance | ||
1039 | by calling <function>snd_card_register()</function>. The access | ||
1040 | to the device files are enabled at this point. That is, before | ||
1041 | <function>snd_card_register()</function> is called, the | ||
1042 | components are safely inaccessible from external side. If this | ||
1043 | call fails, exit the probe function after releasing the card via | ||
1044 | <function>snd_card_free()</function>. | ||
1045 | </para> | ||
1046 | |||
1047 | <para> | ||
1048 | For releasing the card instance, you can call simply | ||
1049 | <function>snd_card_free()</function>. As already mentioned, all | ||
1050 | components are released automatically by this call. | ||
1051 | </para> | ||
1052 | |||
1053 | <para> | ||
1054 | As further notes, the destructors (both | ||
1055 | <function>snd_mychip_dev_free</function> and | ||
1056 | <function>snd_mychip_free</function>) cannot be defined with | ||
1057 | <parameter>__devexit</parameter> prefix, because they may be | ||
1058 | called from the constructor, too, at the false path. | ||
1059 | </para> | ||
1060 | |||
1061 | <para> | ||
1062 | For a device which allows hotplugging, you can use | ||
1063 | <function>snd_card_free_in_thread</function>. This one will | ||
1064 | postpone the destruction and wait in a kernel-thread until all | ||
1065 | devices are closed. | ||
1066 | </para> | ||
1067 | |||
1068 | </section> | ||
1069 | |||
1070 | </chapter> | ||
1071 | |||
1072 | |||
1073 | <!-- ****************************************************** --> | ||
1074 | <!-- PCI Resource Managements --> | ||
1075 | <!-- ****************************************************** --> | ||
1076 | <chapter id="pci-resource"> | ||
1077 | <title>PCI Resource Managements</title> | ||
1078 | |||
1079 | <section id="pci-resource-example"> | ||
1080 | <title>Full Code Example</title> | ||
1081 | <para> | ||
1082 | In this section, we'll finish the chip-specific constructor, | ||
1083 | destructor and PCI entries. The example code is shown first, | ||
1084 | below. | ||
1085 | |||
1086 | <example> | ||
1087 | <title>PCI Resource Managements Example</title> | ||
1088 | <programlisting> | ||
1089 | <![CDATA[ | ||
1090 | struct snd_mychip { | ||
1091 | snd_card_t *card; | ||
1092 | struct pci_dev *pci; | ||
1093 | |||
1094 | unsigned long port; | ||
1095 | int irq; | ||
1096 | }; | ||
1097 | |||
1098 | static int snd_mychip_free(mychip_t *chip) | ||
1099 | { | ||
1100 | /* disable hardware here if any */ | ||
1101 | .... // (not implemented in this document) | ||
1102 | |||
1103 | /* release the irq */ | ||
1104 | if (chip->irq >= 0) | ||
1105 | free_irq(chip->irq, (void *)chip); | ||
1106 | /* release the i/o ports & memory */ | ||
1107 | pci_release_regions(chip->pci); | ||
1108 | /* disable the PCI entry */ | ||
1109 | pci_disable_device(chip->pci); | ||
1110 | /* release the data */ | ||
1111 | kfree(chip); | ||
1112 | return 0; | ||
1113 | } | ||
1114 | |||
1115 | /* chip-specific constructor */ | ||
1116 | static int __devinit snd_mychip_create(snd_card_t *card, | ||
1117 | struct pci_dev *pci, | ||
1118 | mychip_t **rchip) | ||
1119 | { | ||
1120 | mychip_t *chip; | ||
1121 | int err; | ||
1122 | static snd_device_ops_t ops = { | ||
1123 | .dev_free = snd_mychip_dev_free, | ||
1124 | }; | ||
1125 | |||
1126 | *rchip = NULL; | ||
1127 | |||
1128 | /* initialize the PCI entry */ | ||
1129 | if ((err = pci_enable_device(pci)) < 0) | ||
1130 | return err; | ||
1131 | /* check PCI availability (28bit DMA) */ | ||
1132 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | ||
1133 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | ||
1134 | printk(KERN_ERR "error to set 28bit mask DMA\n"); | ||
1135 | pci_disable_device(pci); | ||
1136 | return -ENXIO; | ||
1137 | } | ||
1138 | |||
1139 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | ||
1140 | if (chip == NULL) { | ||
1141 | pci_disable_device(pci); | ||
1142 | return -ENOMEM; | ||
1143 | } | ||
1144 | |||
1145 | /* initialize the stuff */ | ||
1146 | chip->card = card; | ||
1147 | chip->pci = pci; | ||
1148 | chip->irq = -1; | ||
1149 | |||
1150 | /* (1) PCI resource allocation */ | ||
1151 | if ((err = pci_request_regions(pci, "My Chip")) < 0) { | ||
1152 | kfree(chip); | ||
1153 | pci_disable_device(pci); | ||
1154 | return err; | ||
1155 | } | ||
1156 | chip->port = pci_resource_start(pci, 0); | ||
1157 | if (request_irq(pci->irq, snd_mychip_interrupt, | ||
1158 | SA_INTERRUPT|SA_SHIRQ, "My Chip", | ||
1159 | (void *)chip)) { | ||
1160 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | ||
1161 | snd_mychip_free(chip); | ||
1162 | return -EBUSY; | ||
1163 | } | ||
1164 | chip->irq = pci->irq; | ||
1165 | |||
1166 | /* (2) initialization of the chip hardware */ | ||
1167 | .... // (not implemented in this document) | ||
1168 | |||
1169 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, | ||
1170 | chip, &ops)) < 0) { | ||
1171 | snd_mychip_free(chip); | ||
1172 | return err; | ||
1173 | } | ||
1174 | |||
1175 | snd_card_set_dev(card, &pci->dev); | ||
1176 | |||
1177 | *rchip = chip; | ||
1178 | return 0; | ||
1179 | } | ||
1180 | |||
1181 | /* PCI IDs */ | ||
1182 | static struct pci_device_id snd_mychip_ids[] = { | ||
1183 | { PCI_VENDOR_ID_FOO, PCI_DEVICE_ID_BAR, | ||
1184 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
1185 | .... | ||
1186 | { 0, } | ||
1187 | }; | ||
1188 | MODULE_DEVICE_TABLE(pci, snd_mychip_ids); | ||
1189 | |||
1190 | /* pci_driver definition */ | ||
1191 | static struct pci_driver driver = { | ||
1192 | .name = "My Own Chip", | ||
1193 | .id_table = snd_mychip_ids, | ||
1194 | .probe = snd_mychip_probe, | ||
1195 | .remove = __devexit_p(snd_mychip_remove), | ||
1196 | }; | ||
1197 | |||
1198 | /* initialization of the module */ | ||
1199 | static int __init alsa_card_mychip_init(void) | ||
1200 | { | ||
1201 | return pci_module_init(&driver); | ||
1202 | } | ||
1203 | |||
1204 | /* clean up the module */ | ||
1205 | static void __exit alsa_card_mychip_exit(void) | ||
1206 | { | ||
1207 | pci_unregister_driver(&driver); | ||
1208 | } | ||
1209 | |||
1210 | module_init(alsa_card_mychip_init) | ||
1211 | module_exit(alsa_card_mychip_exit) | ||
1212 | |||
1213 | EXPORT_NO_SYMBOLS; /* for old kernels only */ | ||
1214 | ]]> | ||
1215 | </programlisting> | ||
1216 | </example> | ||
1217 | </para> | ||
1218 | </section> | ||
1219 | |||
1220 | <section id="pci-resource-some-haftas"> | ||
1221 | <title>Some Hafta's</title> | ||
1222 | <para> | ||
1223 | The allocation of PCI resources is done in the | ||
1224 | <function>probe()</function> function, and usually an extra | ||
1225 | <function>xxx_create()</function> function is written for this | ||
1226 | purpose. | ||
1227 | </para> | ||
1228 | |||
1229 | <para> | ||
1230 | In the case of PCI devices, you have to call at first | ||
1231 | <function>pci_enable_device()</function> function before | ||
1232 | allocating resources. Also, you need to set the proper PCI DMA | ||
1233 | mask to limit the accessed i/o range. In some cases, you might | ||
1234 | need to call <function>pci_set_master()</function> function, | ||
1235 | too. | ||
1236 | </para> | ||
1237 | |||
1238 | <para> | ||
1239 | Suppose the 28bit mask, and the code to be added would be like: | ||
1240 | |||
1241 | <informalexample> | ||
1242 | <programlisting> | ||
1243 | <![CDATA[ | ||
1244 | if ((err = pci_enable_device(pci)) < 0) | ||
1245 | return err; | ||
1246 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | ||
1247 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | ||
1248 | printk(KERN_ERR "error to set 28bit mask DMA\n"); | ||
1249 | pci_disable_device(pci); | ||
1250 | return -ENXIO; | ||
1251 | } | ||
1252 | |||
1253 | ]]> | ||
1254 | </programlisting> | ||
1255 | </informalexample> | ||
1256 | </para> | ||
1257 | </section> | ||
1258 | |||
1259 | <section id="pci-resource-resource-allocation"> | ||
1260 | <title>Resource Allocation</title> | ||
1261 | <para> | ||
1262 | The allocation of I/O ports and irqs are done via standard kernel | ||
1263 | functions. Unlike ALSA ver.0.5.x., there are no helpers for | ||
1264 | that. And these resources must be released in the destructor | ||
1265 | function (see below). Also, on ALSA 0.9.x, you don't need to | ||
1266 | allocate (pseudo-)DMA for PCI like ALSA 0.5.x. | ||
1267 | </para> | ||
1268 | |||
1269 | <para> | ||
1270 | Now assume that this PCI device has an I/O port with 8 bytes | ||
1271 | and an interrupt. Then <type>mychip_t</type> will have the | ||
1272 | following fields: | ||
1273 | |||
1274 | <informalexample> | ||
1275 | <programlisting> | ||
1276 | <![CDATA[ | ||
1277 | struct snd_mychip { | ||
1278 | snd_card_t *card; | ||
1279 | |||
1280 | unsigned long port; | ||
1281 | int irq; | ||
1282 | }; | ||
1283 | ]]> | ||
1284 | </programlisting> | ||
1285 | </informalexample> | ||
1286 | </para> | ||
1287 | |||
1288 | <para> | ||
1289 | For an i/o port (and also a memory region), you need to have | ||
1290 | the resource pointer for the standard resource management. For | ||
1291 | an irq, you have to keep only the irq number (integer). But you | ||
1292 | need to initialize this number as -1 before actual allocation, | ||
1293 | since irq 0 is valid. The port address and its resource pointer | ||
1294 | can be initialized as null by | ||
1295 | <function>kcalloc()</function> automatically, so you | ||
1296 | don't have to take care of resetting them. | ||
1297 | </para> | ||
1298 | |||
1299 | <para> | ||
1300 | The allocation of an i/o port is done like this: | ||
1301 | |||
1302 | <informalexample> | ||
1303 | <programlisting> | ||
1304 | <![CDATA[ | ||
1305 | if ((err = pci_request_regions(pci, "My Chip")) < 0) { | ||
1306 | kfree(chip); | ||
1307 | pci_disable_device(pci); | ||
1308 | return err; | ||
1309 | } | ||
1310 | chip->port = pci_resource_start(pci, 0); | ||
1311 | ]]> | ||
1312 | </programlisting> | ||
1313 | </informalexample> | ||
1314 | </para> | ||
1315 | |||
1316 | <para> | ||
1317 | <!-- obsolete --> | ||
1318 | It will reserve the i/o port region of 8 bytes of the given | ||
1319 | PCI device. The returned value, chip->res_port, is allocated | ||
1320 | via <function>kmalloc()</function> by | ||
1321 | <function>request_region()</function>. The pointer must be | ||
1322 | released via <function>kfree()</function>, but there is some | ||
1323 | problem regarding this. This issue will be explained more below. | ||
1324 | </para> | ||
1325 | |||
1326 | <para> | ||
1327 | The allocation of an interrupt source is done like this: | ||
1328 | |||
1329 | <informalexample> | ||
1330 | <programlisting> | ||
1331 | <![CDATA[ | ||
1332 | if (request_irq(pci->irq, snd_mychip_interrupt, | ||
1333 | SA_INTERRUPT|SA_SHIRQ, "My Chip", | ||
1334 | (void *)chip)) { | ||
1335 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | ||
1336 | snd_mychip_free(chip); | ||
1337 | return -EBUSY; | ||
1338 | } | ||
1339 | chip->irq = pci->irq; | ||
1340 | ]]> | ||
1341 | </programlisting> | ||
1342 | </informalexample> | ||
1343 | |||
1344 | where <function>snd_mychip_interrupt()</function> is the | ||
1345 | interrupt handler defined <link | ||
1346 | linkend="pcm-interface-interrupt-handler"><citetitle>later</citetitle></link>. | ||
1347 | Note that chip->irq should be defined | ||
1348 | only when <function>request_irq()</function> succeeded. | ||
1349 | </para> | ||
1350 | |||
1351 | <para> | ||
1352 | On the PCI bus, the interrupts can be shared. Thus, | ||
1353 | <constant>SA_SHIRQ</constant> is given as the interrupt flag of | ||
1354 | <function>request_irq()</function>. | ||
1355 | </para> | ||
1356 | |||
1357 | <para> | ||
1358 | The last argument of <function>request_irq()</function> is the | ||
1359 | data pointer passed to the interrupt handler. Usually, the | ||
1360 | chip-specific record is used for that, but you can use what you | ||
1361 | like, too. | ||
1362 | </para> | ||
1363 | |||
1364 | <para> | ||
1365 | I won't define the detail of the interrupt handler at this | ||
1366 | point, but at least its appearance can be explained now. The | ||
1367 | interrupt handler looks usually like the following: | ||
1368 | |||
1369 | <informalexample> | ||
1370 | <programlisting> | ||
1371 | <![CDATA[ | ||
1372 | static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, | ||
1373 | struct pt_regs *regs) | ||
1374 | { | ||
1375 | mychip_t *chip = dev_id; | ||
1376 | .... | ||
1377 | return IRQ_HANDLED; | ||
1378 | } | ||
1379 | ]]> | ||
1380 | </programlisting> | ||
1381 | </informalexample> | ||
1382 | </para> | ||
1383 | |||
1384 | <para> | ||
1385 | Now let's write the corresponding destructor for the resources | ||
1386 | above. The role of destructor is simple: disable the hardware | ||
1387 | (if already activated) and release the resources. So far, we | ||
1388 | have no hardware part, so the disabling is not written here. | ||
1389 | </para> | ||
1390 | |||
1391 | <para> | ||
1392 | For releasing the resources, <quote>check-and-release</quote> | ||
1393 | method is a safer way. For the interrupt, do like this: | ||
1394 | |||
1395 | <informalexample> | ||
1396 | <programlisting> | ||
1397 | <![CDATA[ | ||
1398 | if (chip->irq >= 0) | ||
1399 | free_irq(chip->irq, (void *)chip); | ||
1400 | ]]> | ||
1401 | </programlisting> | ||
1402 | </informalexample> | ||
1403 | |||
1404 | Since the irq number can start from 0, you should initialize | ||
1405 | chip->irq with a negative value (e.g. -1), so that you can | ||
1406 | check the validity of the irq number as above. | ||
1407 | </para> | ||
1408 | |||
1409 | <para> | ||
1410 | When you requested I/O ports or memory regions via | ||
1411 | <function>pci_request_region()</function> or | ||
1412 | <function>pci_request_regions()</function> like this example, | ||
1413 | release the resource(s) using the corresponding function, | ||
1414 | <function>pci_release_region()</function> or | ||
1415 | <function>pci_release_regions()</function>. | ||
1416 | |||
1417 | <informalexample> | ||
1418 | <programlisting> | ||
1419 | <![CDATA[ | ||
1420 | pci_release_regions(chip->pci); | ||
1421 | ]]> | ||
1422 | </programlisting> | ||
1423 | </informalexample> | ||
1424 | </para> | ||
1425 | |||
1426 | <para> | ||
1427 | When you requested manually via <function>request_region()</function> | ||
1428 | or <function>request_mem_region</function>, you can release it via | ||
1429 | <function>release_resource()</function>. Suppose that you keep | ||
1430 | the resource pointer returned from <function>request_region()</function> | ||
1431 | in chip->res_port, the release procedure looks like below: | ||
1432 | |||
1433 | <informalexample> | ||
1434 | <programlisting> | ||
1435 | <![CDATA[ | ||
1436 | if (chip->res_port) { | ||
1437 | release_resource(chip->res_port); | ||
1438 | kfree_nocheck(chip->res_port); | ||
1439 | } | ||
1440 | ]]> | ||
1441 | </programlisting> | ||
1442 | </informalexample> | ||
1443 | |||
1444 | As you can see, the resource pointer is also to be freed | ||
1445 | via <function>kfree_nocheck()</function> after | ||
1446 | <function>release_resource()</function> is called. You | ||
1447 | cannot use <function>kfree()</function> here, because on ALSA, | ||
1448 | <function>kfree()</function> may be a wrapper to its own | ||
1449 | allocator with the memory debugging. Since the resource pointer | ||
1450 | is allocated externally outside the ALSA, it must be released | ||
1451 | via the native | ||
1452 | <function>kfree()</function>. | ||
1453 | <function>kfree_nocheck()</function> is used for that; it calls | ||
1454 | the native <function>kfree()</function> without wrapper. | ||
1455 | </para> | ||
1456 | |||
1457 | <para> | ||
1458 | Don't forget to call <function>pci_disable_device()</function> | ||
1459 | before all finished. | ||
1460 | </para> | ||
1461 | |||
1462 | <para> | ||
1463 | And finally, release the chip-specific record. | ||
1464 | |||
1465 | <informalexample> | ||
1466 | <programlisting> | ||
1467 | <![CDATA[ | ||
1468 | kfree(chip); | ||
1469 | ]]> | ||
1470 | </programlisting> | ||
1471 | </informalexample> | ||
1472 | </para> | ||
1473 | |||
1474 | <para> | ||
1475 | Again, remember that you cannot | ||
1476 | set <parameter>__devexit</parameter> prefix for this destructor. | ||
1477 | </para> | ||
1478 | |||
1479 | <para> | ||
1480 | We didn't implement the hardware-disabling part in the above. | ||
1481 | If you need to do this, please note that the destructor may be | ||
1482 | called even before the initialization of the chip is completed. | ||
1483 | It would be better to have a flag to skip the hardware-disabling | ||
1484 | if the hardware was not initialized yet. | ||
1485 | </para> | ||
1486 | |||
1487 | <para> | ||
1488 | When the chip-data is assigned to the card using | ||
1489 | <function>snd_device_new()</function> with | ||
1490 | <constant>SNDRV_DEV_LOWLELVEL</constant> , its destructor is | ||
1491 | called at the last. That is, it is assured that all other | ||
1492 | components like PCMs and controls have been already released. | ||
1493 | You don't have to call stopping PCMs, etc. explicitly, but just | ||
1494 | stop the hardware in the low-level. | ||
1495 | </para> | ||
1496 | |||
1497 | <para> | ||
1498 | The management of a memory-mapped region is almost as same as | ||
1499 | the management of an i/o port. You'll need three fields like | ||
1500 | the following: | ||
1501 | |||
1502 | <informalexample> | ||
1503 | <programlisting> | ||
1504 | <![CDATA[ | ||
1505 | struct snd_mychip { | ||
1506 | .... | ||
1507 | unsigned long iobase_phys; | ||
1508 | void __iomem *iobase_virt; | ||
1509 | }; | ||
1510 | ]]> | ||
1511 | </programlisting> | ||
1512 | </informalexample> | ||
1513 | |||
1514 | and the allocation would be like below: | ||
1515 | |||
1516 | <informalexample> | ||
1517 | <programlisting> | ||
1518 | <![CDATA[ | ||
1519 | if ((err = pci_request_regions(pci, "My Chip")) < 0) { | ||
1520 | kfree(chip); | ||
1521 | return err; | ||
1522 | } | ||
1523 | chip->iobase_phys = pci_resource_start(pci, 0); | ||
1524 | chip->iobase_virt = ioremap_nocache(chip->iobase_phys, | ||
1525 | pci_resource_len(pci, 0)); | ||
1526 | ]]> | ||
1527 | </programlisting> | ||
1528 | </informalexample> | ||
1529 | |||
1530 | and the corresponding destructor would be: | ||
1531 | |||
1532 | <informalexample> | ||
1533 | <programlisting> | ||
1534 | <![CDATA[ | ||
1535 | static int snd_mychip_free(mychip_t *chip) | ||
1536 | { | ||
1537 | .... | ||
1538 | if (chip->iobase_virt) | ||
1539 | iounmap(chip->iobase_virt); | ||
1540 | .... | ||
1541 | pci_release_regions(chip->pci); | ||
1542 | .... | ||
1543 | } | ||
1544 | ]]> | ||
1545 | </programlisting> | ||
1546 | </informalexample> | ||
1547 | </para> | ||
1548 | |||
1549 | </section> | ||
1550 | |||
1551 | <section id="pci-resource-device-struct"> | ||
1552 | <title>Registration of Device Struct</title> | ||
1553 | <para> | ||
1554 | At some point, typically after calling <function>snd_device_new()</function>, | ||
1555 | you need to register the <structname>struct device</structname> of the chip | ||
1556 | you're handling for udev and co. ALSA provides a macro for compatibility with | ||
1557 | older kernels. Simply call like the following: | ||
1558 | <informalexample> | ||
1559 | <programlisting> | ||
1560 | <![CDATA[ | ||
1561 | snd_card_set_dev(card, &pci->dev); | ||
1562 | ]]> | ||
1563 | </programlisting> | ||
1564 | </informalexample> | ||
1565 | so that it stores the PCI's device pointer to the card. This will be | ||
1566 | referred by ALSA core functions later when the devices are registered. | ||
1567 | </para> | ||
1568 | <para> | ||
1569 | In the case of non-PCI, pass the proper device struct pointer of the BUS | ||
1570 | instead. (In the case of legacy ISA without PnP, you don't have to do | ||
1571 | anything.) | ||
1572 | </para> | ||
1573 | </section> | ||
1574 | |||
1575 | <section id="pci-resource-entries"> | ||
1576 | <title>PCI Entries</title> | ||
1577 | <para> | ||
1578 | So far, so good. Let's finish the rest of missing PCI | ||
1579 | stuffs. At first, we need a | ||
1580 | <structname>pci_device_id</structname> table for this | ||
1581 | chipset. It's a table of PCI vendor/device ID number, and some | ||
1582 | masks. | ||
1583 | </para> | ||
1584 | |||
1585 | <para> | ||
1586 | For example, | ||
1587 | |||
1588 | <informalexample> | ||
1589 | <programlisting> | ||
1590 | <![CDATA[ | ||
1591 | static struct pci_device_id snd_mychip_ids[] = { | ||
1592 | { PCI_VENDOR_ID_FOO, PCI_DEVICE_ID_BAR, | ||
1593 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
1594 | .... | ||
1595 | { 0, } | ||
1596 | }; | ||
1597 | MODULE_DEVICE_TABLE(pci, snd_mychip_ids); | ||
1598 | ]]> | ||
1599 | </programlisting> | ||
1600 | </informalexample> | ||
1601 | </para> | ||
1602 | |||
1603 | <para> | ||
1604 | The first and second fields of | ||
1605 | <structname>pci_device_id</structname> struct are the vendor and | ||
1606 | device IDs. If you have nothing special to filter the matching | ||
1607 | devices, you can use the rest of fields like above. The last | ||
1608 | field of <structname>pci_device_id</structname> struct is a | ||
1609 | private data for this entry. You can specify any value here, for | ||
1610 | example, to tell the type of different operations per each | ||
1611 | device IDs. Such an example is found in intel8x0 driver. | ||
1612 | </para> | ||
1613 | |||
1614 | <para> | ||
1615 | The last entry of this list is the terminator. You must | ||
1616 | specify this all-zero entry. | ||
1617 | </para> | ||
1618 | |||
1619 | <para> | ||
1620 | Then, prepare the <structname>pci_driver</structname> record: | ||
1621 | |||
1622 | <informalexample> | ||
1623 | <programlisting> | ||
1624 | <![CDATA[ | ||
1625 | static struct pci_driver driver = { | ||
1626 | .name = "My Own Chip", | ||
1627 | .id_table = snd_mychip_ids, | ||
1628 | .probe = snd_mychip_probe, | ||
1629 | .remove = __devexit_p(snd_mychip_remove), | ||
1630 | }; | ||
1631 | ]]> | ||
1632 | </programlisting> | ||
1633 | </informalexample> | ||
1634 | </para> | ||
1635 | |||
1636 | <para> | ||
1637 | The <structfield>probe</structfield> and | ||
1638 | <structfield>remove</structfield> functions are what we already | ||
1639 | defined in | ||
1640 | the previous sections. The <structfield>remove</structfield> should | ||
1641 | be defined with | ||
1642 | <function>__devexit_p()</function> macro, so that it's not | ||
1643 | defined for built-in (and non-hot-pluggable) case. The | ||
1644 | <structfield>name</structfield> | ||
1645 | field is the name string of this device. Note that you must not | ||
1646 | use a slash <quote>/</quote> in this string. | ||
1647 | </para> | ||
1648 | |||
1649 | <para> | ||
1650 | And at last, the module entries: | ||
1651 | |||
1652 | <informalexample> | ||
1653 | <programlisting> | ||
1654 | <![CDATA[ | ||
1655 | static int __init alsa_card_mychip_init(void) | ||
1656 | { | ||
1657 | return pci_module_init(&driver); | ||
1658 | } | ||
1659 | |||
1660 | static void __exit alsa_card_mychip_exit(void) | ||
1661 | { | ||
1662 | pci_unregister_driver(&driver); | ||
1663 | } | ||
1664 | |||
1665 | module_init(alsa_card_mychip_init) | ||
1666 | module_exit(alsa_card_mychip_exit) | ||
1667 | ]]> | ||
1668 | </programlisting> | ||
1669 | </informalexample> | ||
1670 | </para> | ||
1671 | |||
1672 | <para> | ||
1673 | Note that these module entries are tagged with | ||
1674 | <parameter>__init</parameter> and | ||
1675 | <parameter>__exit</parameter> prefixes, not | ||
1676 | <parameter>__devinit</parameter> nor | ||
1677 | <parameter>__devexit</parameter>. | ||
1678 | </para> | ||
1679 | |||
1680 | <para> | ||
1681 | Oh, one thing was forgotten. If you have no exported symbols, | ||
1682 | you need to declare it on 2.2 or 2.4 kernels (on 2.6 kernels | ||
1683 | it's not necessary, though). | ||
1684 | |||
1685 | <informalexample> | ||
1686 | <programlisting> | ||
1687 | <![CDATA[ | ||
1688 | EXPORT_NO_SYMBOLS; | ||
1689 | ]]> | ||
1690 | </programlisting> | ||
1691 | </informalexample> | ||
1692 | |||
1693 | That's all! | ||
1694 | </para> | ||
1695 | </section> | ||
1696 | </chapter> | ||
1697 | |||
1698 | |||
1699 | <!-- ****************************************************** --> | ||
1700 | <!-- PCM Interface --> | ||
1701 | <!-- ****************************************************** --> | ||
1702 | <chapter id="pcm-interface"> | ||
1703 | <title>PCM Interface</title> | ||
1704 | |||
1705 | <section id="pcm-interface-general"> | ||
1706 | <title>General</title> | ||
1707 | <para> | ||
1708 | The PCM middle layer of ALSA is quite powerful and it is only | ||
1709 | necessary for each driver to implement the low-level functions | ||
1710 | to access its hardware. | ||
1711 | </para> | ||
1712 | |||
1713 | <para> | ||
1714 | For accessing to the PCM layer, you need to include | ||
1715 | <filename><sound/pcm.h></filename> above all. In addition, | ||
1716 | <filename><sound/pcm_params.h></filename> might be needed | ||
1717 | if you access to some functions related with hw_param. | ||
1718 | </para> | ||
1719 | |||
1720 | <para> | ||
1721 | Each card device can have up to four pcm instances. A pcm | ||
1722 | instance corresponds to a pcm device file. The limitation of | ||
1723 | number of instances comes only from the available bit size of | ||
1724 | the linux's device number. Once when 64bit device number is | ||
1725 | used, we'll have more available pcm instances. | ||
1726 | </para> | ||
1727 | |||
1728 | <para> | ||
1729 | A pcm instance consists of pcm playback and capture streams, | ||
1730 | and each pcm stream consists of one or more pcm substreams. Some | ||
1731 | soundcard supports the multiple-playback function. For example, | ||
1732 | emu10k1 has a PCM playback of 32 stereo substreams. In this case, at | ||
1733 | each open, a free substream is (usually) automatically chosen | ||
1734 | and opened. Meanwhile, when only one substream exists and it was | ||
1735 | already opened, the succeeding open will result in the blocking | ||
1736 | or the error with <constant>EAGAIN</constant> according to the | ||
1737 | file open mode. But you don't have to know the detail in your | ||
1738 | driver. The PCM middle layer will take all such jobs. | ||
1739 | </para> | ||
1740 | </section> | ||
1741 | |||
1742 | <section id="pcm-interface-example"> | ||
1743 | <title>Full Code Example</title> | ||
1744 | <para> | ||
1745 | The example code below does not include any hardware access | ||
1746 | routines but shows only the skeleton, how to build up the PCM | ||
1747 | interfaces. | ||
1748 | |||
1749 | <example> | ||
1750 | <title>PCM Example Code</title> | ||
1751 | <programlisting> | ||
1752 | <![CDATA[ | ||
1753 | #include <sound/pcm.h> | ||
1754 | .... | ||
1755 | |||
1756 | /* hardware definition */ | ||
1757 | static snd_pcm_hardware_t snd_mychip_playback_hw = { | ||
1758 | .info = (SNDRV_PCM_INFO_MMAP | | ||
1759 | SNDRV_PCM_INFO_INTERLEAVED | | ||
1760 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
1761 | SNDRV_PCM_INFO_MMAP_VALID), | ||
1762 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
1763 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
1764 | .rate_min = 8000, | ||
1765 | .rate_max = 48000, | ||
1766 | .channels_min = 2, | ||
1767 | .channels_max = 2, | ||
1768 | .buffer_bytes_max = 32768, | ||
1769 | .period_bytes_min = 4096, | ||
1770 | .period_bytes_max = 32768, | ||
1771 | .periods_min = 1, | ||
1772 | .periods_max = 1024, | ||
1773 | }; | ||
1774 | |||
1775 | /* hardware definition */ | ||
1776 | static snd_pcm_hardware_t snd_mychip_capture_hw = { | ||
1777 | .info = (SNDRV_PCM_INFO_MMAP | | ||
1778 | SNDRV_PCM_INFO_INTERLEAVED | | ||
1779 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
1780 | SNDRV_PCM_INFO_MMAP_VALID), | ||
1781 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
1782 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
1783 | .rate_min = 8000, | ||
1784 | .rate_max = 48000, | ||
1785 | .channels_min = 2, | ||
1786 | .channels_max = 2, | ||
1787 | .buffer_bytes_max = 32768, | ||
1788 | .period_bytes_min = 4096, | ||
1789 | .period_bytes_max = 32768, | ||
1790 | .periods_min = 1, | ||
1791 | .periods_max = 1024, | ||
1792 | }; | ||
1793 | |||
1794 | /* open callback */ | ||
1795 | static int snd_mychip_playback_open(snd_pcm_substream_t *substream) | ||
1796 | { | ||
1797 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
1798 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
1799 | |||
1800 | runtime->hw = snd_mychip_playback_hw; | ||
1801 | // more hardware-initialization will be done here | ||
1802 | return 0; | ||
1803 | } | ||
1804 | |||
1805 | /* close callback */ | ||
1806 | static int snd_mychip_playback_close(snd_pcm_substream_t *substream) | ||
1807 | { | ||
1808 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
1809 | // the hardware-specific codes will be here | ||
1810 | return 0; | ||
1811 | |||
1812 | } | ||
1813 | |||
1814 | /* open callback */ | ||
1815 | static int snd_mychip_capture_open(snd_pcm_substream_t *substream) | ||
1816 | { | ||
1817 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
1818 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
1819 | |||
1820 | runtime->hw = snd_mychip_capture_hw; | ||
1821 | // more hardware-initialization will be done here | ||
1822 | return 0; | ||
1823 | } | ||
1824 | |||
1825 | /* close callback */ | ||
1826 | static int snd_mychip_capture_close(snd_pcm_substream_t *substream) | ||
1827 | { | ||
1828 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
1829 | // the hardware-specific codes will be here | ||
1830 | return 0; | ||
1831 | |||
1832 | } | ||
1833 | |||
1834 | /* hw_params callback */ | ||
1835 | static int snd_mychip_pcm_hw_params(snd_pcm_substream_t *substream, | ||
1836 | snd_pcm_hw_params_t * hw_params) | ||
1837 | { | ||
1838 | return snd_pcm_lib_malloc_pages(substream, | ||
1839 | params_buffer_bytes(hw_params)); | ||
1840 | } | ||
1841 | |||
1842 | /* hw_free callback */ | ||
1843 | static int snd_mychip_pcm_hw_free(snd_pcm_substream_t *substream) | ||
1844 | { | ||
1845 | return snd_pcm_lib_free_pages(substream); | ||
1846 | } | ||
1847 | |||
1848 | /* prepare callback */ | ||
1849 | static int snd_mychip_pcm_prepare(snd_pcm_substream_t *substream) | ||
1850 | { | ||
1851 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
1852 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
1853 | |||
1854 | /* set up the hardware with the current configuration | ||
1855 | * for example... | ||
1856 | */ | ||
1857 | mychip_set_sample_format(chip, runtime->format); | ||
1858 | mychip_set_sample_rate(chip, runtime->rate); | ||
1859 | mychip_set_channels(chip, runtime->channels); | ||
1860 | mychip_set_dma_setup(chip, runtime->dma_area, | ||
1861 | chip->buffer_size, | ||
1862 | chip->period_size); | ||
1863 | return 0; | ||
1864 | } | ||
1865 | |||
1866 | /* trigger callback */ | ||
1867 | static int snd_mychip_pcm_trigger(snd_pcm_substream_t *substream, | ||
1868 | int cmd) | ||
1869 | { | ||
1870 | switch (cmd) { | ||
1871 | case SNDRV_PCM_TRIGGER_START: | ||
1872 | // do something to start the PCM engine | ||
1873 | break; | ||
1874 | case SNDRV_PCM_TRIGGER_STOP: | ||
1875 | // do something to stop the PCM engine | ||
1876 | break; | ||
1877 | default: | ||
1878 | return -EINVAL; | ||
1879 | } | ||
1880 | } | ||
1881 | |||
1882 | /* pointer callback */ | ||
1883 | static snd_pcm_uframes_t | ||
1884 | snd_mychip_pcm_pointer(snd_pcm_substream_t *substream) | ||
1885 | { | ||
1886 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
1887 | unsigned int current_ptr; | ||
1888 | |||
1889 | /* get the current hardware pointer */ | ||
1890 | current_ptr = mychip_get_hw_pointer(chip); | ||
1891 | return current_ptr; | ||
1892 | } | ||
1893 | |||
1894 | /* operators */ | ||
1895 | static snd_pcm_ops_t snd_mychip_playback_ops = { | ||
1896 | .open = snd_mychip_playback_open, | ||
1897 | .close = snd_mychip_playback_close, | ||
1898 | .ioctl = snd_pcm_lib_ioctl, | ||
1899 | .hw_params = snd_mychip_pcm_hw_params, | ||
1900 | .hw_free = snd_mychip_pcm_hw_free, | ||
1901 | .prepare = snd_mychip_pcm_prepare, | ||
1902 | .trigger = snd_mychip_pcm_trigger, | ||
1903 | .pointer = snd_mychip_pcm_pointer, | ||
1904 | }; | ||
1905 | |||
1906 | /* operators */ | ||
1907 | static snd_pcm_ops_t snd_mychip_capture_ops = { | ||
1908 | .open = snd_mychip_capture_open, | ||
1909 | .close = snd_mychip_capture_close, | ||
1910 | .ioctl = snd_pcm_lib_ioctl, | ||
1911 | .hw_params = snd_mychip_pcm_hw_params, | ||
1912 | .hw_free = snd_mychip_pcm_hw_free, | ||
1913 | .prepare = snd_mychip_pcm_prepare, | ||
1914 | .trigger = snd_mychip_pcm_trigger, | ||
1915 | .pointer = snd_mychip_pcm_pointer, | ||
1916 | }; | ||
1917 | |||
1918 | /* | ||
1919 | * definitions of capture are omitted here... | ||
1920 | */ | ||
1921 | |||
1922 | /* create a pcm device */ | ||
1923 | static int __devinit snd_mychip_new_pcm(mychip_t *chip) | ||
1924 | { | ||
1925 | snd_pcm_t *pcm; | ||
1926 | int err; | ||
1927 | |||
1928 | if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, | ||
1929 | &pcm)) < 0) | ||
1930 | return err; | ||
1931 | pcm->private_data = chip; | ||
1932 | strcpy(pcm->name, "My Chip"); | ||
1933 | chip->pcm = pcm; | ||
1934 | /* set operators */ | ||
1935 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1936 | &snd_mychip_playback_ops); | ||
1937 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | ||
1938 | &snd_mychip_capture_ops); | ||
1939 | /* pre-allocation of buffers */ | ||
1940 | /* NOTE: this may fail */ | ||
1941 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
1942 | snd_dma_pci_data(chip->pci), | ||
1943 | 64*1024, 64*1024); | ||
1944 | return 0; | ||
1945 | } | ||
1946 | ]]> | ||
1947 | </programlisting> | ||
1948 | </example> | ||
1949 | </para> | ||
1950 | </section> | ||
1951 | |||
1952 | <section id="pcm-interface-constructor"> | ||
1953 | <title>Constructor</title> | ||
1954 | <para> | ||
1955 | A pcm instance is allocated by <function>snd_pcm_new()</function> | ||
1956 | function. It would be better to create a constructor for pcm, | ||
1957 | namely, | ||
1958 | |||
1959 | <informalexample> | ||
1960 | <programlisting> | ||
1961 | <![CDATA[ | ||
1962 | static int __devinit snd_mychip_new_pcm(mychip_t *chip) | ||
1963 | { | ||
1964 | snd_pcm_t *pcm; | ||
1965 | int err; | ||
1966 | |||
1967 | if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, | ||
1968 | &pcm)) < 0) | ||
1969 | return err; | ||
1970 | pcm->private_data = chip; | ||
1971 | strcpy(pcm->name, "My Chip"); | ||
1972 | chip->pcm = pcm; | ||
1973 | .... | ||
1974 | return 0; | ||
1975 | } | ||
1976 | ]]> | ||
1977 | </programlisting> | ||
1978 | </informalexample> | ||
1979 | </para> | ||
1980 | |||
1981 | <para> | ||
1982 | The <function>snd_pcm_new()</function> function takes the four | ||
1983 | arguments. The first argument is the card pointer to which this | ||
1984 | pcm is assigned, and the second is the ID string. | ||
1985 | </para> | ||
1986 | |||
1987 | <para> | ||
1988 | The third argument (<parameter>index</parameter>, 0 in the | ||
1989 | above) is the index of this new pcm. It begins from zero. When | ||
1990 | you will create more than one pcm instances, specify the | ||
1991 | different numbers in this argument. For example, | ||
1992 | <parameter>index</parameter> = 1 for the second PCM device. | ||
1993 | </para> | ||
1994 | |||
1995 | <para> | ||
1996 | The fourth and fifth arguments are the number of substreams | ||
1997 | for playback and capture, respectively. Here both 1 are given in | ||
1998 | the above example. When no playback or no capture is available, | ||
1999 | pass 0 to the corresponding argument. | ||
2000 | </para> | ||
2001 | |||
2002 | <para> | ||
2003 | If a chip supports multiple playbacks or captures, you can | ||
2004 | specify more numbers, but they must be handled properly in | ||
2005 | open/close, etc. callbacks. When you need to know which | ||
2006 | substream you are referring to, then it can be obtained from | ||
2007 | <type>snd_pcm_substream_t</type> data passed to each callback | ||
2008 | as follows: | ||
2009 | |||
2010 | <informalexample> | ||
2011 | <programlisting> | ||
2012 | <![CDATA[ | ||
2013 | snd_pcm_substream_t *substream; | ||
2014 | int index = substream->number; | ||
2015 | ]]> | ||
2016 | </programlisting> | ||
2017 | </informalexample> | ||
2018 | </para> | ||
2019 | |||
2020 | <para> | ||
2021 | After the pcm is created, you need to set operators for each | ||
2022 | pcm stream. | ||
2023 | |||
2024 | <informalexample> | ||
2025 | <programlisting> | ||
2026 | <![CDATA[ | ||
2027 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
2028 | &snd_mychip_playback_ops); | ||
2029 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | ||
2030 | &snd_mychip_capture_ops); | ||
2031 | ]]> | ||
2032 | </programlisting> | ||
2033 | </informalexample> | ||
2034 | </para> | ||
2035 | |||
2036 | <para> | ||
2037 | The operators are defined typically like this: | ||
2038 | |||
2039 | <informalexample> | ||
2040 | <programlisting> | ||
2041 | <![CDATA[ | ||
2042 | static snd_pcm_ops_t snd_mychip_playback_ops = { | ||
2043 | .open = snd_mychip_pcm_open, | ||
2044 | .close = snd_mychip_pcm_close, | ||
2045 | .ioctl = snd_pcm_lib_ioctl, | ||
2046 | .hw_params = snd_mychip_pcm_hw_params, | ||
2047 | .hw_free = snd_mychip_pcm_hw_free, | ||
2048 | .prepare = snd_mychip_pcm_prepare, | ||
2049 | .trigger = snd_mychip_pcm_trigger, | ||
2050 | .pointer = snd_mychip_pcm_pointer, | ||
2051 | }; | ||
2052 | ]]> | ||
2053 | </programlisting> | ||
2054 | </informalexample> | ||
2055 | |||
2056 | Each of callbacks is explained in the subsection | ||
2057 | <link linkend="pcm-interface-operators"><citetitle> | ||
2058 | Operators</citetitle></link>. | ||
2059 | </para> | ||
2060 | |||
2061 | <para> | ||
2062 | After setting the operators, most likely you'd like to | ||
2063 | pre-allocate the buffer. For the pre-allocation, simply call | ||
2064 | the following: | ||
2065 | |||
2066 | <informalexample> | ||
2067 | <programlisting> | ||
2068 | <![CDATA[ | ||
2069 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
2070 | snd_dma_pci_data(chip->pci), | ||
2071 | 64*1024, 64*1024); | ||
2072 | ]]> | ||
2073 | </programlisting> | ||
2074 | </informalexample> | ||
2075 | |||
2076 | It will allocate up to 64kB buffer as default. The details of | ||
2077 | buffer management will be described in the later section <link | ||
2078 | linkend="buffer-and-memory"><citetitle>Buffer and Memory | ||
2079 | Management</citetitle></link>. | ||
2080 | </para> | ||
2081 | |||
2082 | <para> | ||
2083 | Additionally, you can set some extra information for this pcm | ||
2084 | in pcm->info_flags. | ||
2085 | The available values are defined as | ||
2086 | <constant>SNDRV_PCM_INFO_XXX</constant> in | ||
2087 | <filename><sound/asound.h></filename>, which is used for | ||
2088 | the hardware definition (described later). When your soundchip | ||
2089 | supports only half-duplex, specify like this: | ||
2090 | |||
2091 | <informalexample> | ||
2092 | <programlisting> | ||
2093 | <![CDATA[ | ||
2094 | pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; | ||
2095 | ]]> | ||
2096 | </programlisting> | ||
2097 | </informalexample> | ||
2098 | </para> | ||
2099 | </section> | ||
2100 | |||
2101 | <section id="pcm-interface-destructor"> | ||
2102 | <title>... And the Destructor?</title> | ||
2103 | <para> | ||
2104 | The destructor for a pcm instance is not always | ||
2105 | necessary. Since the pcm device will be released by the middle | ||
2106 | layer code automatically, you don't have to call destructor | ||
2107 | explicitly. | ||
2108 | </para> | ||
2109 | |||
2110 | <para> | ||
2111 | The destructor would be necessary when you created some | ||
2112 | special records internally and need to release them. In such a | ||
2113 | case, set the destructor function to | ||
2114 | pcm->private_free: | ||
2115 | |||
2116 | <example> | ||
2117 | <title>PCM Instance with a Destructor</title> | ||
2118 | <programlisting> | ||
2119 | <![CDATA[ | ||
2120 | static void mychip_pcm_free(snd_pcm_t *pcm) | ||
2121 | { | ||
2122 | mychip_t *chip = snd_pcm_chip(pcm); | ||
2123 | /* free your own data */ | ||
2124 | kfree(chip->my_private_pcm_data); | ||
2125 | // do what you like else | ||
2126 | .... | ||
2127 | } | ||
2128 | |||
2129 | static int __devinit snd_mychip_new_pcm(mychip_t *chip) | ||
2130 | { | ||
2131 | snd_pcm_t *pcm; | ||
2132 | .... | ||
2133 | /* allocate your own data */ | ||
2134 | chip->my_private_pcm_data = kmalloc(...); | ||
2135 | /* set the destructor */ | ||
2136 | pcm->private_data = chip; | ||
2137 | pcm->private_free = mychip_pcm_free; | ||
2138 | .... | ||
2139 | } | ||
2140 | ]]> | ||
2141 | </programlisting> | ||
2142 | </example> | ||
2143 | </para> | ||
2144 | </section> | ||
2145 | |||
2146 | <section id="pcm-interface-runtime"> | ||
2147 | <title>Runtime Pointer - The Chest of PCM Information</title> | ||
2148 | <para> | ||
2149 | When the PCM substream is opened, a PCM runtime instance is | ||
2150 | allocated and assigned to the substream. This pointer is | ||
2151 | accessible via <constant>substream->runtime</constant>. | ||
2152 | This runtime pointer holds the various information; it holds | ||
2153 | the copy of hw_params and sw_params configurations, the buffer | ||
2154 | pointers, mmap records, spinlocks, etc. Almost everyhing you | ||
2155 | need for controlling the PCM can be found there. | ||
2156 | </para> | ||
2157 | |||
2158 | <para> | ||
2159 | The definition of runtime instance is found in | ||
2160 | <filename><sound/pcm.h></filename>. Here is the | ||
2161 | copy from the file. | ||
2162 | <informalexample> | ||
2163 | <programlisting> | ||
2164 | <![CDATA[ | ||
2165 | struct _snd_pcm_runtime { | ||
2166 | /* -- Status -- */ | ||
2167 | snd_pcm_substream_t *trigger_master; | ||
2168 | snd_timestamp_t trigger_tstamp; /* trigger timestamp */ | ||
2169 | int overrange; | ||
2170 | snd_pcm_uframes_t avail_max; | ||
2171 | snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ | ||
2172 | snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/ | ||
2173 | |||
2174 | /* -- HW params -- */ | ||
2175 | snd_pcm_access_t access; /* access mode */ | ||
2176 | snd_pcm_format_t format; /* SNDRV_PCM_FORMAT_* */ | ||
2177 | snd_pcm_subformat_t subformat; /* subformat */ | ||
2178 | unsigned int rate; /* rate in Hz */ | ||
2179 | unsigned int channels; /* channels */ | ||
2180 | snd_pcm_uframes_t period_size; /* period size */ | ||
2181 | unsigned int periods; /* periods */ | ||
2182 | snd_pcm_uframes_t buffer_size; /* buffer size */ | ||
2183 | unsigned int tick_time; /* tick time */ | ||
2184 | snd_pcm_uframes_t min_align; /* Min alignment for the format */ | ||
2185 | size_t byte_align; | ||
2186 | unsigned int frame_bits; | ||
2187 | unsigned int sample_bits; | ||
2188 | unsigned int info; | ||
2189 | unsigned int rate_num; | ||
2190 | unsigned int rate_den; | ||
2191 | |||
2192 | /* -- SW params -- */ | ||
2193 | int tstamp_timespec; /* use timeval (0) or timespec (1) */ | ||
2194 | snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ | ||
2195 | unsigned int period_step; | ||
2196 | unsigned int sleep_min; /* min ticks to sleep */ | ||
2197 | snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ | ||
2198 | snd_pcm_uframes_t start_threshold; | ||
2199 | snd_pcm_uframes_t stop_threshold; | ||
2200 | snd_pcm_uframes_t silence_threshold; /* Silence filling happens when | ||
2201 | noise is nearest than this */ | ||
2202 | snd_pcm_uframes_t silence_size; /* Silence filling size */ | ||
2203 | snd_pcm_uframes_t boundary; /* pointers wrap point */ | ||
2204 | |||
2205 | snd_pcm_uframes_t silenced_start; | ||
2206 | snd_pcm_uframes_t silenced_size; | ||
2207 | |||
2208 | snd_pcm_sync_id_t sync; /* hardware synchronization ID */ | ||
2209 | |||
2210 | /* -- mmap -- */ | ||
2211 | volatile snd_pcm_mmap_status_t *status; | ||
2212 | volatile snd_pcm_mmap_control_t *control; | ||
2213 | atomic_t mmap_count; | ||
2214 | |||
2215 | /* -- locking / scheduling -- */ | ||
2216 | spinlock_t lock; | ||
2217 | wait_queue_head_t sleep; | ||
2218 | struct timer_list tick_timer; | ||
2219 | struct fasync_struct *fasync; | ||
2220 | |||
2221 | /* -- private section -- */ | ||
2222 | void *private_data; | ||
2223 | void (*private_free)(snd_pcm_runtime_t *runtime); | ||
2224 | |||
2225 | /* -- hardware description -- */ | ||
2226 | snd_pcm_hardware_t hw; | ||
2227 | snd_pcm_hw_constraints_t hw_constraints; | ||
2228 | |||
2229 | /* -- interrupt callbacks -- */ | ||
2230 | void (*transfer_ack_begin)(snd_pcm_substream_t *substream); | ||
2231 | void (*transfer_ack_end)(snd_pcm_substream_t *substream); | ||
2232 | |||
2233 | /* -- timer -- */ | ||
2234 | unsigned int timer_resolution; /* timer resolution */ | ||
2235 | |||
2236 | /* -- DMA -- */ | ||
2237 | unsigned char *dma_area; /* DMA area */ | ||
2238 | dma_addr_t dma_addr; /* physical bus address (not accessible from main CPU) */ | ||
2239 | size_t dma_bytes; /* size of DMA area */ | ||
2240 | |||
2241 | struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ | ||
2242 | |||
2243 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | ||
2244 | /* -- OSS things -- */ | ||
2245 | snd_pcm_oss_runtime_t oss; | ||
2246 | #endif | ||
2247 | }; | ||
2248 | ]]> | ||
2249 | </programlisting> | ||
2250 | </informalexample> | ||
2251 | </para> | ||
2252 | |||
2253 | <para> | ||
2254 | For the operators (callbacks) of each sound driver, most of | ||
2255 | these records are supposed to be read-only. Only the PCM | ||
2256 | middle-layer changes / updates these info. The exceptions are | ||
2257 | the hardware description (hw), interrupt callbacks | ||
2258 | (transfer_ack_xxx), DMA buffer information, and the private | ||
2259 | data. Besides, if you use the standard buffer allocation | ||
2260 | method via <function>snd_pcm_lib_malloc_pages()</function>, | ||
2261 | you don't need to set the DMA buffer information by yourself. | ||
2262 | </para> | ||
2263 | |||
2264 | <para> | ||
2265 | In the sections below, important records are explained. | ||
2266 | </para> | ||
2267 | |||
2268 | <section id="pcm-interface-runtime-hw"> | ||
2269 | <title>Hardware Description</title> | ||
2270 | <para> | ||
2271 | The hardware descriptor (<type>snd_pcm_hardware_t</type>) | ||
2272 | contains the definitions of the fundamental hardware | ||
2273 | configuration. Above all, you'll need to define this in | ||
2274 | <link linkend="pcm-interface-operators-open-callback"><citetitle> | ||
2275 | the open callback</citetitle></link>. | ||
2276 | Note that the runtime instance holds the copy of the | ||
2277 | descriptor, not the pointer to the existing descriptor. That | ||
2278 | is, in the open callback, you can modify the copied descriptor | ||
2279 | (<constant>runtime->hw</constant>) as you need. For example, if the maximum | ||
2280 | number of channels is 1 only on some chip models, you can | ||
2281 | still use the same hardware descriptor and change the | ||
2282 | channels_max later: | ||
2283 | <informalexample> | ||
2284 | <programlisting> | ||
2285 | <![CDATA[ | ||
2286 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
2287 | ... | ||
2288 | runtime->hw = snd_mychip_playback_hw; /* common definition */ | ||
2289 | if (chip->model == VERY_OLD_ONE) | ||
2290 | runtime->hw.channels_max = 1; | ||
2291 | ]]> | ||
2292 | </programlisting> | ||
2293 | </informalexample> | ||
2294 | </para> | ||
2295 | |||
2296 | <para> | ||
2297 | Typically, you'll have a hardware descriptor like below: | ||
2298 | <informalexample> | ||
2299 | <programlisting> | ||
2300 | <![CDATA[ | ||
2301 | static snd_pcm_hardware_t snd_mychip_playback_hw = { | ||
2302 | .info = (SNDRV_PCM_INFO_MMAP | | ||
2303 | SNDRV_PCM_INFO_INTERLEAVED | | ||
2304 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
2305 | SNDRV_PCM_INFO_MMAP_VALID), | ||
2306 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
2307 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
2308 | .rate_min = 8000, | ||
2309 | .rate_max = 48000, | ||
2310 | .channels_min = 2, | ||
2311 | .channels_max = 2, | ||
2312 | .buffer_bytes_max = 32768, | ||
2313 | .period_bytes_min = 4096, | ||
2314 | .period_bytes_max = 32768, | ||
2315 | .periods_min = 1, | ||
2316 | .periods_max = 1024, | ||
2317 | }; | ||
2318 | ]]> | ||
2319 | </programlisting> | ||
2320 | </informalexample> | ||
2321 | </para> | ||
2322 | |||
2323 | <para> | ||
2324 | <itemizedlist> | ||
2325 | <listitem><para> | ||
2326 | The <structfield>info</structfield> field contains the type and | ||
2327 | capabilities of this pcm. The bit flags are defined in | ||
2328 | <filename><sound/asound.h></filename> as | ||
2329 | <constant>SNDRV_PCM_INFO_XXX</constant>. Here, at least, you | ||
2330 | have to specify whether the mmap is supported and which | ||
2331 | interleaved format is supported. | ||
2332 | When the mmap is supported, add | ||
2333 | <constant>SNDRV_PCM_INFO_MMAP</constant> flag here. When the | ||
2334 | hardware supports the interleaved or the non-interleaved | ||
2335 | format, <constant>SNDRV_PCM_INFO_INTERLEAVED</constant> or | ||
2336 | <constant>SNDRV_PCM_INFO_NONINTERLEAVED</constant> flag must | ||
2337 | be set, respectively. If both are supported, you can set both, | ||
2338 | too. | ||
2339 | </para> | ||
2340 | |||
2341 | <para> | ||
2342 | In the above example, <constant>MMAP_VALID</constant> and | ||
2343 | <constant>BLOCK_TRANSFER</constant> are specified for OSS mmap | ||
2344 | mode. Usually both are set. Of course, | ||
2345 | <constant>MMAP_VALID</constant> is set only if the mmap is | ||
2346 | really supported. | ||
2347 | </para> | ||
2348 | |||
2349 | <para> | ||
2350 | The other possible flags are | ||
2351 | <constant>SNDRV_PCM_INFO_PAUSE</constant> and | ||
2352 | <constant>SNDRV_PCM_INFO_RESUME</constant>. The | ||
2353 | <constant>PAUSE</constant> bit means that the pcm supports the | ||
2354 | <quote>pause</quote> operation, while the | ||
2355 | <constant>RESUME</constant> bit means that the pcm supports | ||
2356 | the <quote>suspend/resume</quote> operation. If these flags | ||
2357 | are set, the <structfield>trigger</structfield> callback below | ||
2358 | must handle the corresponding commands. | ||
2359 | </para> | ||
2360 | |||
2361 | <para> | ||
2362 | When the PCM substreams can be synchronized (typically, | ||
2363 | synchorinized start/stop of a playback and a capture streams), | ||
2364 | you can give <constant>SNDRV_PCM_INFO_SYNC_START</constant>, | ||
2365 | too. In this case, you'll need to check the linked-list of | ||
2366 | PCM substreams in the trigger callback. This will be | ||
2367 | described in the later section. | ||
2368 | </para> | ||
2369 | </listitem> | ||
2370 | |||
2371 | <listitem> | ||
2372 | <para> | ||
2373 | <structfield>formats</structfield> field contains the bit-flags | ||
2374 | of supported formats (<constant>SNDRV_PCM_FMTBIT_XXX</constant>). | ||
2375 | If the hardware supports more than one format, give all or'ed | ||
2376 | bits. In the example above, the signed 16bit little-endian | ||
2377 | format is specified. | ||
2378 | </para> | ||
2379 | </listitem> | ||
2380 | |||
2381 | <listitem> | ||
2382 | <para> | ||
2383 | <structfield>rates</structfield> field contains the bit-flags of | ||
2384 | supported rates (<constant>SNDRV_PCM_RATE_XXX</constant>). | ||
2385 | When the chip supports continuous rates, pass | ||
2386 | <constant>CONTINUOUS</constant> bit additionally. | ||
2387 | The pre-defined rate bits are provided only for typical | ||
2388 | rates. If your chip supports unconventional rates, you need to add | ||
2389 | <constant>KNOT</constant> bit and set up the hardware | ||
2390 | constraint manually (explained later). | ||
2391 | </para> | ||
2392 | </listitem> | ||
2393 | |||
2394 | <listitem> | ||
2395 | <para> | ||
2396 | <structfield>rate_min</structfield> and | ||
2397 | <structfield>rate_max</structfield> define the minimal and | ||
2398 | maximal sample rate. This should correspond somehow to | ||
2399 | <structfield>rates</structfield> bits. | ||
2400 | </para> | ||
2401 | </listitem> | ||
2402 | |||
2403 | <listitem> | ||
2404 | <para> | ||
2405 | <structfield>channel_min</structfield> and | ||
2406 | <structfield>channel_max</structfield> | ||
2407 | define, as you might already expected, the minimal and maximal | ||
2408 | number of channels. | ||
2409 | </para> | ||
2410 | </listitem> | ||
2411 | |||
2412 | <listitem> | ||
2413 | <para> | ||
2414 | <structfield>buffer_bytes_max</structfield> defines the | ||
2415 | maximal buffer size in bytes. There is no | ||
2416 | <structfield>buffer_bytes_min</structfield> field, since | ||
2417 | it can be calculated from the minimal period size and the | ||
2418 | minimal number of periods. | ||
2419 | Meanwhile, <structfield>period_bytes_min</structfield> and | ||
2420 | define the minimal and maximal size of the period in bytes. | ||
2421 | <structfield>periods_max</structfield> and | ||
2422 | <structfield>periods_min</structfield> define the maximal and | ||
2423 | minimal number of periods in the buffer. | ||
2424 | </para> | ||
2425 | |||
2426 | <para> | ||
2427 | The <quote>period</quote> is a term, that corresponds to | ||
2428 | fragment in the OSS world. The period defines the size at | ||
2429 | which the PCM interrupt is generated. This size strongly | ||
2430 | depends on the hardware. | ||
2431 | Generally, the smaller period size will give you more | ||
2432 | interrupts, that is, more controls. | ||
2433 | In the case of capture, this size defines the input latency. | ||
2434 | On the other hand, the whole buffer size defines the | ||
2435 | output latency for the playback direction. | ||
2436 | </para> | ||
2437 | </listitem> | ||
2438 | |||
2439 | <listitem> | ||
2440 | <para> | ||
2441 | There is also a field <structfield>fifo_size</structfield>. | ||
2442 | This specifies the size of the hardware FIFO, but it's not | ||
2443 | used currently in the driver nor in the alsa-lib. So, you | ||
2444 | can ignore this field. | ||
2445 | </para> | ||
2446 | </listitem> | ||
2447 | </itemizedlist> | ||
2448 | </para> | ||
2449 | </section> | ||
2450 | |||
2451 | <section id="pcm-interface-runtime-config"> | ||
2452 | <title>PCM Configurations</title> | ||
2453 | <para> | ||
2454 | Ok, let's go back again to the PCM runtime records. | ||
2455 | The most frequently referred records in the runtime instance are | ||
2456 | the PCM configurations. | ||
2457 | The PCM configurations are stored on runtime instance | ||
2458 | after the application sends <type>hw_params</type> data via | ||
2459 | alsa-lib. There are many fields copied from hw_params and | ||
2460 | sw_params structs. For example, | ||
2461 | <structfield>format</structfield> holds the format type | ||
2462 | chosen by the application. This field contains the enum value | ||
2463 | <constant>SNDRV_PCM_FORMAT_XXX</constant>. | ||
2464 | </para> | ||
2465 | |||
2466 | <para> | ||
2467 | One thing to be noted is that the configured buffer and period | ||
2468 | sizes are stored in <quote>frames</quote> in the runtime | ||
2469 | In the ALSA world, 1 frame = channels * samples-size. | ||
2470 | For conversion between frames and bytes, you can use the | ||
2471 | helper functions, <function>frames_to_bytes()</function> and | ||
2472 | <function>bytes_to_frames()</function>. | ||
2473 | <informalexample> | ||
2474 | <programlisting> | ||
2475 | <![CDATA[ | ||
2476 | period_bytes = frames_to_bytes(runtime, runtime->period_size); | ||
2477 | ]]> | ||
2478 | </programlisting> | ||
2479 | </informalexample> | ||
2480 | </para> | ||
2481 | |||
2482 | <para> | ||
2483 | Also, many software parameters (sw_params) are | ||
2484 | stored in frames, too. Please check the type of the field. | ||
2485 | <type>snd_pcm_uframes_t</type> is for the frames as unsigned | ||
2486 | integer while <type>snd_pcm_sframes_t</type> is for the frames | ||
2487 | as signed integer. | ||
2488 | </para> | ||
2489 | </section> | ||
2490 | |||
2491 | <section id="pcm-interface-runtime-dma"> | ||
2492 | <title>DMA Buffer Information</title> | ||
2493 | <para> | ||
2494 | The DMA buffer is defined by the following four fields, | ||
2495 | <structfield>dma_area</structfield>, | ||
2496 | <structfield>dma_addr</structfield>, | ||
2497 | <structfield>dma_bytes</structfield> and | ||
2498 | <structfield>dma_private</structfield>. | ||
2499 | The <structfield>dma_area</structfield> holds the buffer | ||
2500 | pointer (the logical address). You can call | ||
2501 | <function>memcpy</function> from/to | ||
2502 | this pointer. Meanwhile, <structfield>dma_addr</structfield> | ||
2503 | holds the physical address of the buffer. This field is | ||
2504 | specified only when the buffer is a linear buffer. | ||
2505 | <structfield>dma_bytes</structfield> holds the size of buffer | ||
2506 | in bytes. <structfield>dma_private</structfield> is used for | ||
2507 | the ALSA DMA allocator. | ||
2508 | </para> | ||
2509 | |||
2510 | <para> | ||
2511 | If you use a standard ALSA function, | ||
2512 | <function>snd_pcm_lib_malloc_pages()</function>, for | ||
2513 | allocating the buffer, these fields are set by the ALSA middle | ||
2514 | layer, and you should <emphasis>not</emphasis> change them by | ||
2515 | yourself. You can read them but not write them. | ||
2516 | On the other hand, if you want to allocate the buffer by | ||
2517 | yourself, you'll need to manage it in hw_params callback. | ||
2518 | At least, <structfield>dma_bytes</structfield> is mandatory. | ||
2519 | <structfield>dma_area</structfield> is necessary when the | ||
2520 | buffer is mmapped. If your driver doesn't support mmap, this | ||
2521 | field is not necessary. <structfield>dma_addr</structfield> | ||
2522 | is also not mandatory. You can use | ||
2523 | <structfield>dma_private</structfield> as you like, too. | ||
2524 | </para> | ||
2525 | </section> | ||
2526 | |||
2527 | <section id="pcm-interface-runtime-status"> | ||
2528 | <title>Running Status</title> | ||
2529 | <para> | ||
2530 | The running status can be referred via <constant>runtime->status</constant>. | ||
2531 | This is the pointer to <type>snd_pcm_mmap_status_t</type> | ||
2532 | record. For example, you can get the current DMA hardware | ||
2533 | pointer via <constant>runtime->status->hw_ptr</constant>. | ||
2534 | </para> | ||
2535 | |||
2536 | <para> | ||
2537 | The DMA application pointer can be referred via | ||
2538 | <constant>runtime->control</constant>, which points | ||
2539 | <type>snd_pcm_mmap_control_t</type> record. | ||
2540 | However, accessing directly to this value is not recommended. | ||
2541 | </para> | ||
2542 | </section> | ||
2543 | |||
2544 | <section id="pcm-interface-runtime-private"> | ||
2545 | <title>Private Data</title> | ||
2546 | <para> | ||
2547 | You can allocate a record for the substream and store it in | ||
2548 | <constant>runtime->private_data</constant>. Usually, this | ||
2549 | done in | ||
2550 | <link linkend="pcm-interface-operators-open-callback"><citetitle> | ||
2551 | the open callback</citetitle></link>. | ||
2552 | Don't mix this with <constant>pcm->private_data</constant>. | ||
2553 | The <constant>pcm->private_data</constant> usually points the | ||
2554 | chip instance assigned statically at the creation of PCM, while the | ||
2555 | <constant>runtime->private_data</constant> points a dynamic | ||
2556 | data created at the PCM open callback. | ||
2557 | |||
2558 | <informalexample> | ||
2559 | <programlisting> | ||
2560 | <![CDATA[ | ||
2561 | static int snd_xxx_open(snd_pcm_substream_t *substream) | ||
2562 | { | ||
2563 | my_pcm_data_t *data; | ||
2564 | .... | ||
2565 | data = kmalloc(sizeof(*data), GFP_KERNEL); | ||
2566 | substream->runtime->private_data = data; | ||
2567 | .... | ||
2568 | } | ||
2569 | ]]> | ||
2570 | </programlisting> | ||
2571 | </informalexample> | ||
2572 | </para> | ||
2573 | |||
2574 | <para> | ||
2575 | The allocated object must be released in | ||
2576 | <link linkend="pcm-interface-operators-open-callback"><citetitle> | ||
2577 | the close callback</citetitle></link>. | ||
2578 | </para> | ||
2579 | </section> | ||
2580 | |||
2581 | <section id="pcm-interface-runtime-intr"> | ||
2582 | <title>Interrupt Callbacks</title> | ||
2583 | <para> | ||
2584 | The field <structfield>transfer_ack_begin</structfield> and | ||
2585 | <structfield>transfer_ack_end</structfield> are called at | ||
2586 | the beginning and the end of | ||
2587 | <function>snd_pcm_period_elapsed()</function>, respectively. | ||
2588 | </para> | ||
2589 | </section> | ||
2590 | |||
2591 | </section> | ||
2592 | |||
2593 | <section id="pcm-interface-operators"> | ||
2594 | <title>Operators</title> | ||
2595 | <para> | ||
2596 | OK, now let me explain the detail of each pcm callback | ||
2597 | (<parameter>ops</parameter>). In general, every callback must | ||
2598 | return 0 if successful, or a negative number with the error | ||
2599 | number such as <constant>-EINVAL</constant> at any | ||
2600 | error. | ||
2601 | </para> | ||
2602 | |||
2603 | <para> | ||
2604 | The callback function takes at least the argument with | ||
2605 | <type>snd_pcm_substream_t</type> pointer. For retrieving the | ||
2606 | chip record from the given substream instance, you can use the | ||
2607 | following macro. | ||
2608 | |||
2609 | <informalexample> | ||
2610 | <programlisting> | ||
2611 | <![CDATA[ | ||
2612 | int xxx() { | ||
2613 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
2614 | .... | ||
2615 | } | ||
2616 | ]]> | ||
2617 | </programlisting> | ||
2618 | </informalexample> | ||
2619 | |||
2620 | The macro reads <constant>substream->private_data</constant>, | ||
2621 | which is a copy of <constant>pcm->private_data</constant>. | ||
2622 | You can override the former if you need to assign different data | ||
2623 | records per PCM substream. For example, cmi8330 driver assigns | ||
2624 | different private_data for playback and capture directions, | ||
2625 | because it uses two different codecs (SB- and AD-compatible) for | ||
2626 | different directions. | ||
2627 | </para> | ||
2628 | |||
2629 | <section id="pcm-interface-operators-open-callback"> | ||
2630 | <title>open callback</title> | ||
2631 | <para> | ||
2632 | <informalexample> | ||
2633 | <programlisting> | ||
2634 | <![CDATA[ | ||
2635 | static int snd_xxx_open(snd_pcm_substream_t *substream); | ||
2636 | ]]> | ||
2637 | </programlisting> | ||
2638 | </informalexample> | ||
2639 | |||
2640 | This is called when a pcm substream is opened. | ||
2641 | </para> | ||
2642 | |||
2643 | <para> | ||
2644 | At least, here you have to initialize the runtime->hw | ||
2645 | record. Typically, this is done by like this: | ||
2646 | |||
2647 | <informalexample> | ||
2648 | <programlisting> | ||
2649 | <![CDATA[ | ||
2650 | static int snd_xxx_open(snd_pcm_substream_t *substream) | ||
2651 | { | ||
2652 | mychip_t *chip = snd_pcm_substream_chip(substream); | ||
2653 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
2654 | |||
2655 | runtime->hw = snd_mychip_playback_hw; | ||
2656 | return 0; | ||
2657 | } | ||
2658 | ]]> | ||
2659 | </programlisting> | ||
2660 | </informalexample> | ||
2661 | |||
2662 | where <parameter>snd_mychip_playback_hw</parameter> is the | ||
2663 | pre-defined hardware description. | ||
2664 | </para> | ||
2665 | |||
2666 | <para> | ||
2667 | You can allocate a private data in this callback, as described | ||
2668 | in <link linkend="pcm-interface-runtime-private"><citetitle> | ||
2669 | Private Data</citetitle></link> section. | ||
2670 | </para> | ||
2671 | |||
2672 | <para> | ||
2673 | If the hardware configuration needs more constraints, set the | ||
2674 | hardware constraints here, too. | ||
2675 | See <link linkend="pcm-interface-constraints"><citetitle> | ||
2676 | Constraints</citetitle></link> for more details. | ||
2677 | </para> | ||
2678 | </section> | ||
2679 | |||
2680 | <section id="pcm-interface-operators-close-callback"> | ||
2681 | <title>close callback</title> | ||
2682 | <para> | ||
2683 | <informalexample> | ||
2684 | <programlisting> | ||
2685 | <![CDATA[ | ||
2686 | static int snd_xxx_close(snd_pcm_substream_t *substream); | ||
2687 | ]]> | ||
2688 | </programlisting> | ||
2689 | </informalexample> | ||
2690 | |||
2691 | Obviously, this is called when a pcm substream is closed. | ||
2692 | </para> | ||
2693 | |||
2694 | <para> | ||
2695 | Any private instance for a pcm substream allocated in the | ||
2696 | open callback will be released here. | ||
2697 | |||
2698 | <informalexample> | ||
2699 | <programlisting> | ||
2700 | <![CDATA[ | ||
2701 | static int snd_xxx_close(snd_pcm_substream_t *substream) | ||
2702 | { | ||
2703 | .... | ||
2704 | kfree(substream->runtime->private_data); | ||
2705 | .... | ||
2706 | } | ||
2707 | ]]> | ||
2708 | </programlisting> | ||
2709 | </informalexample> | ||
2710 | </para> | ||
2711 | </section> | ||
2712 | |||
2713 | <section id="pcm-interface-operators-ioctl-callback"> | ||
2714 | <title>ioctl callback</title> | ||
2715 | <para> | ||
2716 | This is used for any special action to pcm ioctls. But | ||
2717 | usually you can pass a generic ioctl callback, | ||
2718 | <function>snd_pcm_lib_ioctl</function>. | ||
2719 | </para> | ||
2720 | </section> | ||
2721 | |||
2722 | <section id="pcm-interface-operators-hw-params-callback"> | ||
2723 | <title>hw_params callback</title> | ||
2724 | <para> | ||
2725 | <informalexample> | ||
2726 | <programlisting> | ||
2727 | <![CDATA[ | ||
2728 | static int snd_xxx_hw_params(snd_pcm_substream_t * substream, | ||
2729 | snd_pcm_hw_params_t * hw_params); | ||
2730 | ]]> | ||
2731 | </programlisting> | ||
2732 | </informalexample> | ||
2733 | |||
2734 | This and <structfield>hw_free</structfield> callbacks exist | ||
2735 | only on ALSA 0.9.x. | ||
2736 | </para> | ||
2737 | |||
2738 | <para> | ||
2739 | This is called when the hardware parameter | ||
2740 | (<structfield>hw_params</structfield>) is set | ||
2741 | up by the application, | ||
2742 | that is, once when the buffer size, the period size, the | ||
2743 | format, etc. are defined for the pcm substream. | ||
2744 | </para> | ||
2745 | |||
2746 | <para> | ||
2747 | Many hardware set-up should be done in this callback, | ||
2748 | including the allocation of buffers. | ||
2749 | </para> | ||
2750 | |||
2751 | <para> | ||
2752 | Parameters to be initialized are retrieved by | ||
2753 | <function>params_xxx()</function> macros. For allocating a | ||
2754 | buffer, you can call a helper function, | ||
2755 | |||
2756 | <informalexample> | ||
2757 | <programlisting> | ||
2758 | <![CDATA[ | ||
2759 | snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | ||
2760 | ]]> | ||
2761 | </programlisting> | ||
2762 | </informalexample> | ||
2763 | |||
2764 | <function>snd_pcm_lib_malloc_pages()</function> is available | ||
2765 | only when the DMA buffers have been pre-allocated. | ||
2766 | See the section <link | ||
2767 | linkend="buffer-and-memory-buffer-types"><citetitle> | ||
2768 | Buffer Types</citetitle></link> for more details. | ||
2769 | </para> | ||
2770 | |||
2771 | <para> | ||
2772 | Note that this and <structfield>prepare</structfield> callbacks | ||
2773 | may be called multiple times per initialization. | ||
2774 | For example, the OSS emulation may | ||
2775 | call these callbacks at each change via its ioctl. | ||
2776 | </para> | ||
2777 | |||
2778 | <para> | ||
2779 | Thus, you need to take care not to allocate the same buffers | ||
2780 | many times, which will lead to memory leak! Calling the | ||
2781 | helper function above many times is OK. It will release the | ||
2782 | previous buffer automatically when it was already allocated. | ||
2783 | </para> | ||
2784 | |||
2785 | <para> | ||
2786 | Another note is that this callback is non-atomic | ||
2787 | (schedulable). This is important, because the | ||
2788 | <structfield>trigger</structfield> callback | ||
2789 | is atomic (non-schedulable). That is, mutex or any | ||
2790 | schedule-related functions are not available in | ||
2791 | <structfield>trigger</structfield> callback. | ||
2792 | Please see the subsection | ||
2793 | <link linkend="pcm-interface-atomicity"><citetitle> | ||
2794 | Atomicity</citetitle></link> for details. | ||
2795 | </para> | ||
2796 | </section> | ||
2797 | |||
2798 | <section id="pcm-interface-operators-hw-free-callback"> | ||
2799 | <title>hw_free callback</title> | ||
2800 | <para> | ||
2801 | <informalexample> | ||
2802 | <programlisting> | ||
2803 | <![CDATA[ | ||
2804 | static int snd_xxx_hw_free(snd_pcm_substream_t * substream); | ||
2805 | ]]> | ||
2806 | </programlisting> | ||
2807 | </informalexample> | ||
2808 | </para> | ||
2809 | |||
2810 | <para> | ||
2811 | This is called to release the resources allocated via | ||
2812 | <structfield>hw_params</structfield>. For example, releasing the | ||
2813 | buffer via | ||
2814 | <function>snd_pcm_lib_malloc_pages()</function> is done by | ||
2815 | calling the following: | ||
2816 | |||
2817 | <informalexample> | ||
2818 | <programlisting> | ||
2819 | <![CDATA[ | ||
2820 | snd_pcm_lib_free_pages(substream); | ||
2821 | ]]> | ||
2822 | </programlisting> | ||
2823 | </informalexample> | ||
2824 | </para> | ||
2825 | |||
2826 | <para> | ||
2827 | This function is always called before the close callback is called. | ||
2828 | Also, the callback may be called multiple times, too. | ||
2829 | Keep track whether the resource was already released. | ||
2830 | </para> | ||
2831 | </section> | ||
2832 | |||
2833 | <section id="pcm-interface-operators-prepare-callback"> | ||
2834 | <title>prepare callback</title> | ||
2835 | <para> | ||
2836 | <informalexample> | ||
2837 | <programlisting> | ||
2838 | <![CDATA[ | ||
2839 | static int snd_xxx_prepare(snd_pcm_substream_t * substream); | ||
2840 | ]]> | ||
2841 | </programlisting> | ||
2842 | </informalexample> | ||
2843 | </para> | ||
2844 | |||
2845 | <para> | ||
2846 | This callback is called when the pcm is | ||
2847 | <quote>prepared</quote>. You can set the format type, sample | ||
2848 | rate, etc. here. The difference from | ||
2849 | <structfield>hw_params</structfield> is that the | ||
2850 | <structfield>prepare</structfield> callback will be called at each | ||
2851 | time | ||
2852 | <function>snd_pcm_prepare()</function> is called, i.e. when | ||
2853 | recovered after underruns, etc. | ||
2854 | </para> | ||
2855 | |||
2856 | <para> | ||
2857 | Note that this callback became non-atomic since the recent version. | ||
2858 | You can use schedule-related fucntions safely in this callback now. | ||
2859 | </para> | ||
2860 | |||
2861 | <para> | ||
2862 | In this and the following callbacks, you can refer to the | ||
2863 | values via the runtime record, | ||
2864 | substream->runtime. | ||
2865 | For example, to get the current | ||
2866 | rate, format or channels, access to | ||
2867 | runtime->rate, | ||
2868 | runtime->format or | ||
2869 | runtime->channels, respectively. | ||
2870 | The physical address of the allocated buffer is set to | ||
2871 | runtime->dma_area. The buffer and period sizes are | ||
2872 | in runtime->buffer_size and runtime->period_size, | ||
2873 | respectively. | ||
2874 | </para> | ||
2875 | |||
2876 | <para> | ||
2877 | Be careful that this callback will be called many times at | ||
2878 | each set up, too. | ||
2879 | </para> | ||
2880 | </section> | ||
2881 | |||
2882 | <section id="pcm-interface-operators-trigger-callback"> | ||
2883 | <title>trigger callback</title> | ||
2884 | <para> | ||
2885 | <informalexample> | ||
2886 | <programlisting> | ||
2887 | <![CDATA[ | ||
2888 | static int snd_xxx_trigger(snd_pcm_substream_t * substream, int cmd); | ||
2889 | ]]> | ||
2890 | </programlisting> | ||
2891 | </informalexample> | ||
2892 | |||
2893 | This is called when the pcm is started, stopped or paused. | ||
2894 | </para> | ||
2895 | |||
2896 | <para> | ||
2897 | Which action is specified in the second argument, | ||
2898 | <constant>SNDRV_PCM_TRIGGER_XXX</constant> in | ||
2899 | <filename><sound/pcm.h></filename>. At least, | ||
2900 | <constant>START</constant> and <constant>STOP</constant> | ||
2901 | commands must be defined in this callback. | ||
2902 | |||
2903 | <informalexample> | ||
2904 | <programlisting> | ||
2905 | <![CDATA[ | ||
2906 | switch (cmd) { | ||
2907 | case SNDRV_PCM_TRIGGER_START: | ||
2908 | // do something to start the PCM engine | ||
2909 | break; | ||
2910 | case SNDRV_PCM_TRIGGER_STOP: | ||
2911 | // do something to stop the PCM engine | ||
2912 | break; | ||
2913 | default: | ||
2914 | return -EINVAL; | ||
2915 | } | ||
2916 | ]]> | ||
2917 | </programlisting> | ||
2918 | </informalexample> | ||
2919 | </para> | ||
2920 | |||
2921 | <para> | ||
2922 | When the pcm supports the pause operation (given in info | ||
2923 | field of the hardware table), <constant>PAUSE_PUSE</constant> | ||
2924 | and <constant>PAUSE_RELEASE</constant> commands must be | ||
2925 | handled here, too. The former is the command to pause the pcm, | ||
2926 | and the latter to restart the pcm again. | ||
2927 | </para> | ||
2928 | |||
2929 | <para> | ||
2930 | When the pcm supports the suspend/resume operation | ||
2931 | (i.e. <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set), | ||
2932 | <constant>SUSPEND</constant> and <constant>RESUME</constant> | ||
2933 | commands must be handled, too. | ||
2934 | These commands are issued when the power-management status is | ||
2935 | changed. Obviously, the <constant>SUSPEND</constant> and | ||
2936 | <constant>RESUME</constant> | ||
2937 | do suspend and resume of the pcm substream, and usually, they | ||
2938 | are identical with <constant>STOP</constant> and | ||
2939 | <constant>START</constant> commands, respectively. | ||
2940 | </para> | ||
2941 | |||
2942 | <para> | ||
2943 | As mentioned, this callback is atomic. You cannot call | ||
2944 | the function going to sleep. | ||
2945 | The trigger callback should be as minimal as possible, | ||
2946 | just really triggering the DMA. The other stuff should be | ||
2947 | initialized hw_params and prepare callbacks properly | ||
2948 | beforehand. | ||
2949 | </para> | ||
2950 | </section> | ||
2951 | |||
2952 | <section id="pcm-interface-operators-pointer-callback"> | ||
2953 | <title>pointer callback</title> | ||
2954 | <para> | ||
2955 | <informalexample> | ||
2956 | <programlisting> | ||
2957 | <![CDATA[ | ||
2958 | static snd_pcm_uframes_t snd_xxx_pointer(snd_pcm_substream_t * substream) | ||
2959 | ]]> | ||
2960 | </programlisting> | ||
2961 | </informalexample> | ||
2962 | |||
2963 | This callback is called when the PCM middle layer inquires | ||
2964 | the current hardware position on the buffer. The position must | ||
2965 | be returned in frames (which was in bytes on ALSA 0.5.x), | ||
2966 | ranged from 0 to buffer_size - 1. | ||
2967 | </para> | ||
2968 | |||
2969 | <para> | ||
2970 | This is called usually from the buffer-update routine in the | ||
2971 | pcm middle layer, which is invoked when | ||
2972 | <function>snd_pcm_period_elapsed()</function> is called in the | ||
2973 | interrupt routine. Then the pcm middle layer updates the | ||
2974 | position and calculates the available space, and wakes up the | ||
2975 | sleeping poll threads, etc. | ||
2976 | </para> | ||
2977 | |||
2978 | <para> | ||
2979 | This callback is also atomic. | ||
2980 | </para> | ||
2981 | </section> | ||
2982 | |||
2983 | <section id="pcm-interface-operators-copy-silence"> | ||
2984 | <title>copy and silence callbacks</title> | ||
2985 | <para> | ||
2986 | These callbacks are not mandatory, and can be omitted in | ||
2987 | most cases. These callbacks are used when the hardware buffer | ||
2988 | cannot be on the normal memory space. Some chips have their | ||
2989 | own buffer on the hardware which is not mappable. In such a | ||
2990 | case, you have to transfer the data manually from the memory | ||
2991 | buffer to the hardware buffer. Or, if the buffer is | ||
2992 | non-contiguous on both physical and virtual memory spaces, | ||
2993 | these callbacks must be defined, too. | ||
2994 | </para> | ||
2995 | |||
2996 | <para> | ||
2997 | If these two callbacks are defined, copy and set-silence | ||
2998 | operations are done by them. The detailed will be described in | ||
2999 | the later section <link | ||
3000 | linkend="buffer-and-memory"><citetitle>Buffer and Memory | ||
3001 | Management</citetitle></link>. | ||
3002 | </para> | ||
3003 | </section> | ||
3004 | |||
3005 | <section id="pcm-interface-operators-ack"> | ||
3006 | <title>ack callback</title> | ||
3007 | <para> | ||
3008 | This callback is also not mandatory. This callback is called | ||
3009 | when the appl_ptr is updated in read or write operations. | ||
3010 | Some drivers like emu10k1-fx and cs46xx need to track the | ||
3011 | current appl_ptr for the internal buffer, and this callback | ||
3012 | is useful only for such a purpose. | ||
3013 | </para> | ||
3014 | <para> | ||
3015 | This callback is atomic. | ||
3016 | </para> | ||
3017 | </section> | ||
3018 | |||
3019 | <section id="pcm-interface-operators-page-callback"> | ||
3020 | <title>page callback</title> | ||
3021 | |||
3022 | <para> | ||
3023 | This callback is also not mandatory. This callback is used | ||
3024 | mainly for the non-contiguous buffer. The mmap calls this | ||
3025 | callback to get the page address. Some examples will be | ||
3026 | explained in the later section <link | ||
3027 | linkend="buffer-and-memory"><citetitle>Buffer and Memory | ||
3028 | Management</citetitle></link>, too. | ||
3029 | </para> | ||
3030 | </section> | ||
3031 | </section> | ||
3032 | |||
3033 | <section id="pcm-interface-interrupt-handler"> | ||
3034 | <title>Interrupt Handler</title> | ||
3035 | <para> | ||
3036 | The rest of pcm stuff is the PCM interrupt handler. The | ||
3037 | role of PCM interrupt handler in the sound driver is to update | ||
3038 | the buffer position and to tell the PCM middle layer when the | ||
3039 | buffer position goes across the prescribed period size. To | ||
3040 | inform this, call <function>snd_pcm_period_elapsed()</function> | ||
3041 | function. | ||
3042 | </para> | ||
3043 | |||
3044 | <para> | ||
3045 | There are several types of sound chips to generate the interrupts. | ||
3046 | </para> | ||
3047 | |||
3048 | <section id="pcm-interface-interrupt-handler-boundary"> | ||
3049 | <title>Interrupts at the period (fragment) boundary</title> | ||
3050 | <para> | ||
3051 | This is the most frequently found type: the hardware | ||
3052 | generates an interrupt at each period boundary. | ||
3053 | In this case, you can call | ||
3054 | <function>snd_pcm_period_elapsed()</function> at each | ||
3055 | interrupt. | ||
3056 | </para> | ||
3057 | |||
3058 | <para> | ||
3059 | <function>snd_pcm_period_elapsed()</function> takes the | ||
3060 | substream pointer as its argument. Thus, you need to keep the | ||
3061 | substream pointer accessible from the chip instance. For | ||
3062 | example, define substream field in the chip record to hold the | ||
3063 | current running substream pointer, and set the pointer value | ||
3064 | at open callback (and reset at close callback). | ||
3065 | </para> | ||
3066 | |||
3067 | <para> | ||
3068 | If you aquire a spinlock in the interrupt handler, and the | ||
3069 | lock is used in other pcm callbacks, too, then you have to | ||
3070 | release the lock before calling | ||
3071 | <function>snd_pcm_period_elapsed()</function>, because | ||
3072 | <function>snd_pcm_period_elapsed()</function> calls other pcm | ||
3073 | callbacks inside. | ||
3074 | </para> | ||
3075 | |||
3076 | <para> | ||
3077 | A typical coding would be like: | ||
3078 | |||
3079 | <example> | ||
3080 | <title>Interrupt Handler Case #1</title> | ||
3081 | <programlisting> | ||
3082 | <![CDATA[ | ||
3083 | static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, | ||
3084 | struct pt_regs *regs) | ||
3085 | { | ||
3086 | mychip_t *chip = dev_id; | ||
3087 | spin_lock(&chip->lock); | ||
3088 | .... | ||
3089 | if (pcm_irq_invoked(chip)) { | ||
3090 | /* call updater, unlock before it */ | ||
3091 | spin_unlock(&chip->lock); | ||
3092 | snd_pcm_period_elapsed(chip->substream); | ||
3093 | spin_lock(&chip->lock); | ||
3094 | // acknowledge the interrupt if necessary | ||
3095 | } | ||
3096 | .... | ||
3097 | spin_unlock(&chip->lock); | ||
3098 | return IRQ_HANDLED; | ||
3099 | } | ||
3100 | ]]> | ||
3101 | </programlisting> | ||
3102 | </example> | ||
3103 | </para> | ||
3104 | </section> | ||
3105 | |||
3106 | <section id="pcm-interface-interrupt-handler-timer"> | ||
3107 | <title>High-frequent timer interrupts</title> | ||
3108 | <para> | ||
3109 | This is the case when the hardware doesn't generate interrupts | ||
3110 | at the period boundary but do timer-interrupts at the fixed | ||
3111 | timer rate (e.g. es1968 or ymfpci drivers). | ||
3112 | In this case, you need to check the current hardware | ||
3113 | position and accumulates the processed sample length at each | ||
3114 | interrupt. When the accumulated size overcomes the period | ||
3115 | size, call | ||
3116 | <function>snd_pcm_period_elapsed()</function> and reset the | ||
3117 | accumulator. | ||
3118 | </para> | ||
3119 | |||
3120 | <para> | ||
3121 | A typical coding would be like the following. | ||
3122 | |||
3123 | <example> | ||
3124 | <title>Interrupt Handler Case #2</title> | ||
3125 | <programlisting> | ||
3126 | <![CDATA[ | ||
3127 | static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, | ||
3128 | struct pt_regs *regs) | ||
3129 | { | ||
3130 | mychip_t *chip = dev_id; | ||
3131 | spin_lock(&chip->lock); | ||
3132 | .... | ||
3133 | if (pcm_irq_invoked(chip)) { | ||
3134 | unsigned int last_ptr, size; | ||
3135 | /* get the current hardware pointer (in frames) */ | ||
3136 | last_ptr = get_hw_ptr(chip); | ||
3137 | /* calculate the processed frames since the | ||
3138 | * last update | ||
3139 | */ | ||
3140 | if (last_ptr < chip->last_ptr) | ||
3141 | size = runtime->buffer_size + last_ptr | ||
3142 | - chip->last_ptr; | ||
3143 | else | ||
3144 | size = last_ptr - chip->last_ptr; | ||
3145 | /* remember the last updated point */ | ||
3146 | chip->last_ptr = last_ptr; | ||
3147 | /* accumulate the size */ | ||
3148 | chip->size += size; | ||
3149 | /* over the period boundary? */ | ||
3150 | if (chip->size >= runtime->period_size) { | ||
3151 | /* reset the accumulator */ | ||
3152 | chip->size %= runtime->period_size; | ||
3153 | /* call updater */ | ||
3154 | spin_unlock(&chip->lock); | ||
3155 | snd_pcm_period_elapsed(substream); | ||
3156 | spin_lock(&chip->lock); | ||
3157 | } | ||
3158 | // acknowledge the interrupt if necessary | ||
3159 | } | ||
3160 | .... | ||
3161 | spin_unlock(&chip->lock); | ||
3162 | return IRQ_HANDLED; | ||
3163 | } | ||
3164 | ]]> | ||
3165 | </programlisting> | ||
3166 | </example> | ||
3167 | </para> | ||
3168 | </section> | ||
3169 | |||
3170 | <section id="pcm-interface-interrupt-handler-both"> | ||
3171 | <title>On calling <function>snd_pcm_period_elapsed()</function></title> | ||
3172 | <para> | ||
3173 | In both cases, even if more than one period are elapsed, you | ||
3174 | don't have to call | ||
3175 | <function>snd_pcm_period_elapsed()</function> many times. Call | ||
3176 | only once. And the pcm layer will check the current hardware | ||
3177 | pointer and update to the latest status. | ||
3178 | </para> | ||
3179 | </section> | ||
3180 | </section> | ||
3181 | |||
3182 | <section id="pcm-interface-atomicity"> | ||
3183 | <title>Atomicity</title> | ||
3184 | <para> | ||
3185 | One of the most important (and thus difficult to debug) problem | ||
3186 | on the kernel programming is the race condition. | ||
3187 | On linux kernel, usually it's solved via spin-locks or | ||
3188 | semaphores. In general, if the race condition may | ||
3189 | happen in the interrupt handler, it's handled as atomic, and you | ||
3190 | have to use spinlock for protecting the critical session. If it | ||
3191 | never happens in the interrupt and it may take relatively long | ||
3192 | time, you should use semaphore. | ||
3193 | </para> | ||
3194 | |||
3195 | <para> | ||
3196 | As already seen, some pcm callbacks are atomic and some are | ||
3197 | not. For example, <parameter>hw_params</parameter> callback is | ||
3198 | non-atomic, while <parameter>trigger</parameter> callback is | ||
3199 | atomic. This means, the latter is called already in a spinlock | ||
3200 | held by the PCM middle layer. Please take this atomicity into | ||
3201 | account when you use a spinlock or a semaphore in the callbacks. | ||
3202 | </para> | ||
3203 | |||
3204 | <para> | ||
3205 | In the atomic callbacks, you cannot use functions which may call | ||
3206 | <function>schedule</function> or go to | ||
3207 | <function>sleep</function>. The semaphore and mutex do sleep, | ||
3208 | and hence they cannot be used inside the atomic callbacks | ||
3209 | (e.g. <parameter>trigger</parameter> callback). | ||
3210 | For taking a certain delay in such a callback, please use | ||
3211 | <function>udelay()</function> or <function>mdelay()</function>. | ||
3212 | </para> | ||
3213 | |||
3214 | <para> | ||
3215 | All three atomic callbacks (trigger, pointer, and ack) are | ||
3216 | called with local interrupts disabled. | ||
3217 | </para> | ||
3218 | |||
3219 | </section> | ||
3220 | <section id="pcm-interface-constraints"> | ||
3221 | <title>Constraints</title> | ||
3222 | <para> | ||
3223 | If your chip supports unconventional sample rates, or only the | ||
3224 | limited samples, you need to set a constraint for the | ||
3225 | condition. | ||
3226 | </para> | ||
3227 | |||
3228 | <para> | ||
3229 | For example, in order to restrict the sample rates in the some | ||
3230 | supported values, use | ||
3231 | <function>snd_pcm_hw_constraint_list()</function>. | ||
3232 | You need to call this function in the open callback. | ||
3233 | |||
3234 | <example> | ||
3235 | <title>Example of Hardware Constraints</title> | ||
3236 | <programlisting> | ||
3237 | <![CDATA[ | ||
3238 | static unsigned int rates[] = | ||
3239 | {4000, 10000, 22050, 44100}; | ||
3240 | static snd_pcm_hw_constraint_list_t constraints_rates = { | ||
3241 | .count = ARRAY_SIZE(rates), | ||
3242 | .list = rates, | ||
3243 | .mask = 0, | ||
3244 | }; | ||
3245 | |||
3246 | static int snd_mychip_pcm_open(snd_pcm_substream_t *substream) | ||
3247 | { | ||
3248 | int err; | ||
3249 | .... | ||
3250 | err = snd_pcm_hw_constraint_list(substream->runtime, 0, | ||
3251 | SNDRV_PCM_HW_PARAM_RATE, | ||
3252 | &constraints_rates); | ||
3253 | if (err < 0) | ||
3254 | return err; | ||
3255 | .... | ||
3256 | } | ||
3257 | ]]> | ||
3258 | </programlisting> | ||
3259 | </example> | ||
3260 | </para> | ||
3261 | |||
3262 | <para> | ||
3263 | There are many different constraints. | ||
3264 | Look in <filename>sound/pcm.h</filename> for a complete list. | ||
3265 | You can even define your own constraint rules. | ||
3266 | For example, let's suppose my_chip can manage a substream of 1 channel | ||
3267 | if and only if the format is S16_LE, otherwise it supports any format | ||
3268 | specified in the <type>snd_pcm_hardware_t</type> stucture (or in any | ||
3269 | other constraint_list). You can build a rule like this: | ||
3270 | |||
3271 | <example> | ||
3272 | <title>Example of Hardware Constraints for Channels</title> | ||
3273 | <programlisting> | ||
3274 | <![CDATA[ | ||
3275 | static int hw_rule_format_by_channels(snd_pcm_hw_params_t *params, | ||
3276 | snd_pcm_hw_rule_t *rule) | ||
3277 | { | ||
3278 | snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); | ||
3279 | snd_mask_t *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | ||
3280 | snd_mask_t fmt; | ||
3281 | |||
3282 | snd_mask_any(&fmt); /* Init the struct */ | ||
3283 | if (c->min < 2) { | ||
3284 | fmt.bits[0] &= SNDRV_PCM_FMTBIT_S16_LE; | ||
3285 | return snd_mask_refine(f, &fmt); | ||
3286 | } | ||
3287 | return 0; | ||
3288 | } | ||
3289 | ]]> | ||
3290 | </programlisting> | ||
3291 | </example> | ||
3292 | </para> | ||
3293 | |||
3294 | <para> | ||
3295 | Then you need to call this function to add your rule: | ||
3296 | |||
3297 | <informalexample> | ||
3298 | <programlisting> | ||
3299 | <![CDATA[ | ||
3300 | snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | ||
3301 | hw_rule_channels_by_format, 0, SNDRV_PCM_HW_PARAM_FORMAT, | ||
3302 | -1); | ||
3303 | ]]> | ||
3304 | </programlisting> | ||
3305 | </informalexample> | ||
3306 | </para> | ||
3307 | |||
3308 | <para> | ||
3309 | The rule function is called when an application sets the number of | ||
3310 | channels. But an application can set the format before the number of | ||
3311 | channels. Thus you also need to define the inverse rule: | ||
3312 | |||
3313 | <example> | ||
3314 | <title>Example of Hardware Constraints for Channels</title> | ||
3315 | <programlisting> | ||
3316 | <![CDATA[ | ||
3317 | static int hw_rule_channels_by_format(snd_pcm_hw_params_t *params, | ||
3318 | snd_pcm_hw_rule_t *rule) | ||
3319 | { | ||
3320 | snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); | ||
3321 | snd_mask_t *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | ||
3322 | snd_interval_t ch; | ||
3323 | |||
3324 | snd_interval_any(&ch); | ||
3325 | if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { | ||
3326 | ch.min = ch.max = 1; | ||
3327 | ch.integer = 1; | ||
3328 | return snd_interval_refine(c, &ch); | ||
3329 | } | ||
3330 | return 0; | ||
3331 | } | ||
3332 | ]]> | ||
3333 | </programlisting> | ||
3334 | </example> | ||
3335 | </para> | ||
3336 | |||
3337 | <para> | ||
3338 | ...and in the open callback: | ||
3339 | <informalexample> | ||
3340 | <programlisting> | ||
3341 | <![CDATA[ | ||
3342 | snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, | ||
3343 | hw_rule_format_by_channels, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | ||
3344 | -1); | ||
3345 | ]]> | ||
3346 | </programlisting> | ||
3347 | </informalexample> | ||
3348 | </para> | ||
3349 | |||
3350 | <para> | ||
3351 | I won't explain more details here, rather I | ||
3352 | would like to say, <quote>Luke, use the source.</quote> | ||
3353 | </para> | ||
3354 | </section> | ||
3355 | |||
3356 | </chapter> | ||
3357 | |||
3358 | |||
3359 | <!-- ****************************************************** --> | ||
3360 | <!-- Control Interface --> | ||
3361 | <!-- ****************************************************** --> | ||
3362 | <chapter id="control-interface"> | ||
3363 | <title>Control Interface</title> | ||
3364 | |||
3365 | <section id="control-interface-general"> | ||
3366 | <title>General</title> | ||
3367 | <para> | ||
3368 | The control interface is used widely for many switches, | ||
3369 | sliders, etc. which are accessed from the user-space. Its most | ||
3370 | important use is the mixer interface. In other words, on ALSA | ||
3371 | 0.9.x, all the mixer stuff is implemented on the control kernel | ||
3372 | API (while there was an independent mixer kernel API on 0.5.x). | ||
3373 | </para> | ||
3374 | |||
3375 | <para> | ||
3376 | ALSA has a well-defined AC97 control module. If your chip | ||
3377 | supports only the AC97 and nothing else, you can skip this | ||
3378 | section. | ||
3379 | </para> | ||
3380 | |||
3381 | <para> | ||
3382 | The control API is defined in | ||
3383 | <filename><sound/control.h></filename>. | ||
3384 | Include this file if you add your own controls. | ||
3385 | </para> | ||
3386 | </section> | ||
3387 | |||
3388 | <section id="control-interface-definition"> | ||
3389 | <title>Definition of Controls</title> | ||
3390 | <para> | ||
3391 | For creating a new control, you need to define the three | ||
3392 | callbacks: <structfield>info</structfield>, | ||
3393 | <structfield>get</structfield> and | ||
3394 | <structfield>put</structfield>. Then, define a | ||
3395 | <type>snd_kcontrol_new_t</type> record, such as: | ||
3396 | |||
3397 | <example> | ||
3398 | <title>Definition of a Control</title> | ||
3399 | <programlisting> | ||
3400 | <![CDATA[ | ||
3401 | static snd_kcontrol_new_t my_control __devinitdata = { | ||
3402 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3403 | .name = "PCM Playback Switch", | ||
3404 | .index = 0, | ||
3405 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | ||
3406 | .private_values = 0xffff, | ||
3407 | .info = my_control_info, | ||
3408 | .get = my_control_get, | ||
3409 | .put = my_control_put | ||
3410 | }; | ||
3411 | ]]> | ||
3412 | </programlisting> | ||
3413 | </example> | ||
3414 | </para> | ||
3415 | |||
3416 | <para> | ||
3417 | Most likely the control is created via | ||
3418 | <function>snd_ctl_new1()</function>, and in such a case, you can | ||
3419 | add <parameter>__devinitdata</parameter> prefix to the | ||
3420 | definition like above. | ||
3421 | </para> | ||
3422 | |||
3423 | <para> | ||
3424 | The <structfield>iface</structfield> field specifies the type of | ||
3425 | the control, | ||
3426 | <constant>SNDRV_CTL_ELEM_IFACE_XXX</constant>. There are | ||
3427 | <constant>MIXER</constant>, <constant>PCM</constant>, | ||
3428 | <constant>CARD</constant>, etc. | ||
3429 | </para> | ||
3430 | |||
3431 | <para> | ||
3432 | The <structfield>name</structfield> is the name identifier | ||
3433 | string. On ALSA 0.9.x, the control name is very important, | ||
3434 | because its role is classified from its name. There are | ||
3435 | pre-defined standard control names. The details are described in | ||
3436 | the subsection | ||
3437 | <link linkend="control-interface-control-names"><citetitle> | ||
3438 | Control Names</citetitle></link>. | ||
3439 | </para> | ||
3440 | |||
3441 | <para> | ||
3442 | The <structfield>index</structfield> field holds the index number | ||
3443 | of this control. If there are several different controls with | ||
3444 | the same name, they can be distinguished by the index | ||
3445 | number. This is the case when | ||
3446 | several codecs exist on the card. If the index is zero, you can | ||
3447 | omit the definition above. | ||
3448 | </para> | ||
3449 | |||
3450 | <para> | ||
3451 | The <structfield>access</structfield> field contains the access | ||
3452 | type of this control. Give the combination of bit masks, | ||
3453 | <constant>SNDRV_CTL_ELEM_ACCESS_XXX</constant>, there. | ||
3454 | The detailed will be explained in the subsection | ||
3455 | <link linkend="control-interface-access-flags"><citetitle> | ||
3456 | Access Flags</citetitle></link>. | ||
3457 | </para> | ||
3458 | |||
3459 | <para> | ||
3460 | The <structfield>private_values</structfield> field contains | ||
3461 | an arbitrary long integer value for this record. When using | ||
3462 | generic <structfield>info</structfield>, | ||
3463 | <structfield>get</structfield> and | ||
3464 | <structfield>put</structfield> callbacks, you can pass a value | ||
3465 | through this field. If several small numbers are necessary, you can | ||
3466 | combine them in bitwise. Or, it's possible to give a pointer | ||
3467 | (casted to unsigned long) of some record to this field, too. | ||
3468 | </para> | ||
3469 | |||
3470 | <para> | ||
3471 | The other three are | ||
3472 | <link linkend="control-interface-callbacks"><citetitle> | ||
3473 | callback functions</citetitle></link>. | ||
3474 | </para> | ||
3475 | </section> | ||
3476 | |||
3477 | <section id="control-interface-control-names"> | ||
3478 | <title>Control Names</title> | ||
3479 | <para> | ||
3480 | There are some standards for defining the control names. A | ||
3481 | control is usually defined from the three parts as | ||
3482 | <quote>SOURCE DIRECTION FUNCTION</quote>. | ||
3483 | </para> | ||
3484 | |||
3485 | <para> | ||
3486 | The first, <constant>SOURCE</constant>, specifies the source | ||
3487 | of the control, and is a string such as <quote>Master</quote>, | ||
3488 | <quote>PCM</quote>, <quote>CD</quote> or | ||
3489 | <quote>Line</quote>. There are many pre-defined sources. | ||
3490 | </para> | ||
3491 | |||
3492 | <para> | ||
3493 | The second, <constant>DIRECTION</constant>, is one of the | ||
3494 | following strings according to the direction of the control: | ||
3495 | <quote>Playback</quote>, <quote>Capture</quote>, <quote>Bypass | ||
3496 | Playback</quote> and <quote>Bypass Capture</quote>. Or, it can | ||
3497 | be omitted, meaning both playback and capture directions. | ||
3498 | </para> | ||
3499 | |||
3500 | <para> | ||
3501 | The third, <constant>FUNCTION</constant>, is one of the | ||
3502 | following strings according to the function of the control: | ||
3503 | <quote>Switch</quote>, <quote>Volume</quote> and | ||
3504 | <quote>Route</quote>. | ||
3505 | </para> | ||
3506 | |||
3507 | <para> | ||
3508 | The example of control names are, thus, <quote>Master Capture | ||
3509 | Switch</quote> or <quote>PCM Playback Volume</quote>. | ||
3510 | </para> | ||
3511 | |||
3512 | <para> | ||
3513 | There are some exceptions: | ||
3514 | </para> | ||
3515 | |||
3516 | <section id="control-interface-control-names-global"> | ||
3517 | <title>Global capture and playback</title> | ||
3518 | <para> | ||
3519 | <quote>Capture Source</quote>, <quote>Capture Switch</quote> | ||
3520 | and <quote>Capture Volume</quote> are used for the global | ||
3521 | capture (input) source, switch and volume. Similarly, | ||
3522 | <quote>Playback Switch</quote> and <quote>Playback | ||
3523 | Volume</quote> are used for the global output gain switch and | ||
3524 | volume. | ||
3525 | </para> | ||
3526 | </section> | ||
3527 | |||
3528 | <section id="control-interface-control-names-tone"> | ||
3529 | <title>Tone-controls</title> | ||
3530 | <para> | ||
3531 | tone-control switch and volumes are specified like | ||
3532 | <quote>Tone Control - XXX</quote>, e.g. <quote>Tone Control - | ||
3533 | Switch</quote>, <quote>Tone Control - Bass</quote>, | ||
3534 | <quote>Tone Control - Center</quote>. | ||
3535 | </para> | ||
3536 | </section> | ||
3537 | |||
3538 | <section id="control-interface-control-names-3d"> | ||
3539 | <title>3D controls</title> | ||
3540 | <para> | ||
3541 | 3D-control switches and volumes are specified like <quote>3D | ||
3542 | Control - XXX</quote>, e.g. <quote>3D Control - | ||
3543 | Switch</quote>, <quote>3D Control - Center</quote>, <quote>3D | ||
3544 | Control - Space</quote>. | ||
3545 | </para> | ||
3546 | </section> | ||
3547 | |||
3548 | <section id="control-interface-control-names-mic"> | ||
3549 | <title>Mic boost</title> | ||
3550 | <para> | ||
3551 | Mic-boost switch is set as <quote>Mic Boost</quote> or | ||
3552 | <quote>Mic Boost (6dB)</quote>. | ||
3553 | </para> | ||
3554 | |||
3555 | <para> | ||
3556 | More precise information can be found in | ||
3557 | <filename>Documentation/sound/alsa/ControlNames.txt</filename>. | ||
3558 | </para> | ||
3559 | </section> | ||
3560 | </section> | ||
3561 | |||
3562 | <section id="control-interface-access-flags"> | ||
3563 | <title>Access Flags</title> | ||
3564 | |||
3565 | <para> | ||
3566 | The access flag is the bit-flags which specifies the access type | ||
3567 | of the given control. The default access type is | ||
3568 | <constant>SNDRV_CTL_ELEM_ACCESS_READWRITE</constant>, | ||
3569 | which means both read and write are allowed to this control. | ||
3570 | When the access flag is omitted (i.e. = 0), it is | ||
3571 | regarded as <constant>READWRITE</constant> access as default. | ||
3572 | </para> | ||
3573 | |||
3574 | <para> | ||
3575 | When the control is read-only, pass | ||
3576 | <constant>SNDRV_CTL_ELEM_ACCESS_READ</constant> instead. | ||
3577 | In this case, you don't have to define | ||
3578 | <structfield>put</structfield> callback. | ||
3579 | Similarly, when the control is write-only (although it's a rare | ||
3580 | case), you can use <constant>WRITE</constant> flag instead, and | ||
3581 | you don't need <structfield>get</structfield> callback. | ||
3582 | </para> | ||
3583 | |||
3584 | <para> | ||
3585 | If the control value changes frequently (e.g. the VU meter), | ||
3586 | <constant>VOLATILE</constant> flag should be given. This means | ||
3587 | that the control may be changed without | ||
3588 | <link linkend="control-interface-change-notification"><citetitle> | ||
3589 | notification</citetitle></link>. Applications should poll such | ||
3590 | a control constantly. | ||
3591 | </para> | ||
3592 | |||
3593 | <para> | ||
3594 | When the control is inactive, set | ||
3595 | <constant>INACTIVE</constant> flag, too. | ||
3596 | There are <constant>LOCK</constant> and | ||
3597 | <constant>OWNER</constant> flags for changing the write | ||
3598 | permissions. | ||
3599 | </para> | ||
3600 | |||
3601 | </section> | ||
3602 | |||
3603 | <section id="control-interface-callbacks"> | ||
3604 | <title>Callbacks</title> | ||
3605 | |||
3606 | <section id="control-interface-callbacks-info"> | ||
3607 | <title>info callback</title> | ||
3608 | <para> | ||
3609 | The <structfield>info</structfield> callback is used to get | ||
3610 | the detailed information of this control. This must store the | ||
3611 | values of the given <type>snd_ctl_elem_info_t</type> | ||
3612 | object. For example, for a boolean control with a single | ||
3613 | element will be: | ||
3614 | |||
3615 | <example> | ||
3616 | <title>Example of info callback</title> | ||
3617 | <programlisting> | ||
3618 | <![CDATA[ | ||
3619 | static int snd_myctl_info(snd_kcontrol_t *kcontrol, | ||
3620 | snd_ctl_elem_info_t *uinfo) | ||
3621 | { | ||
3622 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
3623 | uinfo->count = 1; | ||
3624 | uinfo->value.integer.min = 0; | ||
3625 | uinfo->value.integer.max = 1; | ||
3626 | return 0; | ||
3627 | } | ||
3628 | ]]> | ||
3629 | </programlisting> | ||
3630 | </example> | ||
3631 | </para> | ||
3632 | |||
3633 | <para> | ||
3634 | The <structfield>type</structfield> field specifies the type | ||
3635 | of the control. There are <constant>BOOLEAN</constant>, | ||
3636 | <constant>INTEGER</constant>, <constant>ENUMERATED</constant>, | ||
3637 | <constant>BYTES</constant>, <constant>IEC958</constant> and | ||
3638 | <constant>INTEGER64</constant>. The | ||
3639 | <structfield>count</structfield> field specifies the | ||
3640 | number of elements in this control. For example, a stereo | ||
3641 | volume would have count = 2. The | ||
3642 | <structfield>value</structfield> field is a union, and | ||
3643 | the values stored are depending on the type. The boolean and | ||
3644 | integer are identical. | ||
3645 | </para> | ||
3646 | |||
3647 | <para> | ||
3648 | The enumerated type is a bit different from others. You'll | ||
3649 | need to set the string for the currently given item index. | ||
3650 | |||
3651 | <informalexample> | ||
3652 | <programlisting> | ||
3653 | <![CDATA[ | ||
3654 | static int snd_myctl_info(snd_kcontrol_t *kcontrol, | ||
3655 | snd_ctl_elem_info_t *uinfo) | ||
3656 | { | ||
3657 | static char *texts[4] = { | ||
3658 | "First", "Second", "Third", "Fourth" | ||
3659 | }; | ||
3660 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
3661 | uinfo->count = 1; | ||
3662 | uinfo->value.enumerated.items = 4; | ||
3663 | if (uinfo->value.enumerated.item > 3) | ||
3664 | uinfo->value.enumerated.item = 3; | ||
3665 | strcpy(uinfo->value.enumerated.name, | ||
3666 | texts[uinfo->value.enumerated.item]); | ||
3667 | return 0; | ||
3668 | } | ||
3669 | ]]> | ||
3670 | </programlisting> | ||
3671 | </informalexample> | ||
3672 | </para> | ||
3673 | </section> | ||
3674 | |||
3675 | <section id="control-interface-callbacks-get"> | ||
3676 | <title>get callback</title> | ||
3677 | |||
3678 | <para> | ||
3679 | This callback is used to read the current value of the | ||
3680 | control and to return to the user-space. | ||
3681 | </para> | ||
3682 | |||
3683 | <para> | ||
3684 | For example, | ||
3685 | |||
3686 | <example> | ||
3687 | <title>Example of get callback</title> | ||
3688 | <programlisting> | ||
3689 | <![CDATA[ | ||
3690 | static int snd_myctl_get(snd_kcontrol_t *kcontrol, | ||
3691 | snd_ctl_elem_value_t *ucontrol) | ||
3692 | { | ||
3693 | mychip_t *chip = snd_kcontrol_chip(kcontrol); | ||
3694 | ucontrol->value.integer.value[0] = get_some_value(chip); | ||
3695 | return 0; | ||
3696 | } | ||
3697 | ]]> | ||
3698 | </programlisting> | ||
3699 | </example> | ||
3700 | </para> | ||
3701 | |||
3702 | <para> | ||
3703 | Here, the chip instance is retrieved via | ||
3704 | <function>snd_kcontrol_chip()</function> macro. This macro | ||
3705 | converts from kcontrol->private_data to the type defined by | ||
3706 | <type>chip_t</type>. The | ||
3707 | kcontrol->private_data field is | ||
3708 | given as the argument of <function>snd_ctl_new()</function> | ||
3709 | (see the later subsection | ||
3710 | <link linkend="control-interface-constructor"><citetitle>Constructor</citetitle></link>). | ||
3711 | </para> | ||
3712 | |||
3713 | <para> | ||
3714 | The <structfield>value</structfield> field is depending on | ||
3715 | the type of control as well as on info callback. For example, | ||
3716 | the sb driver uses this field to store the register offset, | ||
3717 | the bit-shift and the bit-mask. The | ||
3718 | <structfield>private_value</structfield> is set like | ||
3719 | <informalexample> | ||
3720 | <programlisting> | ||
3721 | <![CDATA[ | ||
3722 | .private_value = reg | (shift << 16) | (mask << 24) | ||
3723 | ]]> | ||
3724 | </programlisting> | ||
3725 | </informalexample> | ||
3726 | and is retrieved in callbacks like | ||
3727 | <informalexample> | ||
3728 | <programlisting> | ||
3729 | <![CDATA[ | ||
3730 | static int snd_sbmixer_get_single(snd_kcontrol_t *kcontrol, | ||
3731 | snd_ctl_elem_value_t *ucontrol) | ||
3732 | { | ||
3733 | int reg = kcontrol->private_value & 0xff; | ||
3734 | int shift = (kcontrol->private_value >> 16) & 0xff; | ||
3735 | int mask = (kcontrol->private_value >> 24) & 0xff; | ||
3736 | .... | ||
3737 | } | ||
3738 | ]]> | ||
3739 | </programlisting> | ||
3740 | </informalexample> | ||
3741 | </para> | ||
3742 | |||
3743 | <para> | ||
3744 | In <structfield>get</structfield> callback, you have to fill all the elements if the | ||
3745 | control has more than one elements, | ||
3746 | i.e. <structfield>count</structfield> > 1. | ||
3747 | In the example above, we filled only one element | ||
3748 | (<structfield>value.integer.value[0]</structfield>) since it's | ||
3749 | assumed as <structfield>count</structfield> = 1. | ||
3750 | </para> | ||
3751 | </section> | ||
3752 | |||
3753 | <section id="control-interface-callbacks-put"> | ||
3754 | <title>put callback</title> | ||
3755 | |||
3756 | <para> | ||
3757 | This callback is used to write a value from the user-space. | ||
3758 | </para> | ||
3759 | |||
3760 | <para> | ||
3761 | For example, | ||
3762 | |||
3763 | <example> | ||
3764 | <title>Example of put callback</title> | ||
3765 | <programlisting> | ||
3766 | <![CDATA[ | ||
3767 | static int snd_myctl_put(snd_kcontrol_t *kcontrol, | ||
3768 | snd_ctl_elem_value_t *ucontrol) | ||
3769 | { | ||
3770 | mychip_t *chip = snd_kcontrol_chip(kcontrol); | ||
3771 | int changed = 0; | ||
3772 | if (chip->current_value != | ||
3773 | ucontrol->value.integer.value[0]) { | ||
3774 | change_current_value(chip, | ||
3775 | ucontrol->value.integer.value[0]); | ||
3776 | changed = 1; | ||
3777 | } | ||
3778 | return changed; | ||
3779 | } | ||
3780 | ]]> | ||
3781 | </programlisting> | ||
3782 | </example> | ||
3783 | |||
3784 | As seen above, you have to return 1 if the value is | ||
3785 | changed. If the value is not changed, return 0 instead. | ||
3786 | If any fatal error happens, return a negative error code as | ||
3787 | usual. | ||
3788 | </para> | ||
3789 | |||
3790 | <para> | ||
3791 | Like <structfield>get</structfield> callback, | ||
3792 | when the control has more than one elements, | ||
3793 | all elemehts must be evaluated in this callback, too. | ||
3794 | </para> | ||
3795 | </section> | ||
3796 | |||
3797 | <section id="control-interface-callbacks-all"> | ||
3798 | <title>Callbacks are not atomic</title> | ||
3799 | <para> | ||
3800 | All these three callbacks are basically not atomic. | ||
3801 | </para> | ||
3802 | </section> | ||
3803 | </section> | ||
3804 | |||
3805 | <section id="control-interface-constructor"> | ||
3806 | <title>Constructor</title> | ||
3807 | <para> | ||
3808 | When everything is ready, finally we can create a new | ||
3809 | control. For creating a control, there are two functions to be | ||
3810 | called, <function>snd_ctl_new1()</function> and | ||
3811 | <function>snd_ctl_add()</function>. | ||
3812 | </para> | ||
3813 | |||
3814 | <para> | ||
3815 | In the simplest way, you can do like this: | ||
3816 | |||
3817 | <informalexample> | ||
3818 | <programlisting> | ||
3819 | <![CDATA[ | ||
3820 | if ((err = snd_ctl_add(card, snd_ctl_new1(&my_control, chip))) < 0) | ||
3821 | return err; | ||
3822 | ]]> | ||
3823 | </programlisting> | ||
3824 | </informalexample> | ||
3825 | |||
3826 | where <parameter>my_control</parameter> is the | ||
3827 | <type>snd_kcontrol_new_t</type> object defined above, and chip | ||
3828 | is the object pointer to be passed to | ||
3829 | kcontrol->private_data | ||
3830 | which can be referred in callbacks. | ||
3831 | </para> | ||
3832 | |||
3833 | <para> | ||
3834 | <function>snd_ctl_new1()</function> allocates a new | ||
3835 | <type>snd_kcontrol_t</type> instance (that's why the definition | ||
3836 | of <parameter>my_control</parameter> can be with | ||
3837 | <parameter>__devinitdata</parameter> | ||
3838 | prefix), and <function>snd_ctl_add</function> assigns the given | ||
3839 | control component to the card. | ||
3840 | </para> | ||
3841 | </section> | ||
3842 | |||
3843 | <section id="control-interface-change-notification"> | ||
3844 | <title>Change Notification</title> | ||
3845 | <para> | ||
3846 | If you need to change and update a control in the interrupt | ||
3847 | routine, you can call <function>snd_ctl_notify()</function>. For | ||
3848 | example, | ||
3849 | |||
3850 | <informalexample> | ||
3851 | <programlisting> | ||
3852 | <![CDATA[ | ||
3853 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, id_pointer); | ||
3854 | ]]> | ||
3855 | </programlisting> | ||
3856 | </informalexample> | ||
3857 | |||
3858 | This function takes the card pointer, the event-mask, and the | ||
3859 | control id pointer for the notification. The event-mask | ||
3860 | specifies the types of notification, for example, in the above | ||
3861 | example, the change of control values is notified. | ||
3862 | The id pointer is the pointer of <type>snd_ctl_elem_id_t</type> | ||
3863 | to be notified. | ||
3864 | You can find some examples in <filename>es1938.c</filename> or | ||
3865 | <filename>es1968.c</filename> for hardware volume interrupts. | ||
3866 | </para> | ||
3867 | </section> | ||
3868 | |||
3869 | </chapter> | ||
3870 | |||
3871 | |||
3872 | <!-- ****************************************************** --> | ||
3873 | <!-- API for AC97 Codec --> | ||
3874 | <!-- ****************************************************** --> | ||
3875 | <chapter id="api-ac97"> | ||
3876 | <title>API for AC97 Codec</title> | ||
3877 | |||
3878 | <section> | ||
3879 | <title>General</title> | ||
3880 | <para> | ||
3881 | The ALSA AC97 codec layer is a well-defined one, and you don't | ||
3882 | have to write many codes to control it. Only low-level control | ||
3883 | routines are necessary. The AC97 codec API is defined in | ||
3884 | <filename><sound/ac97_codec.h></filename>. | ||
3885 | </para> | ||
3886 | </section> | ||
3887 | |||
3888 | <section id="api-ac97-example"> | ||
3889 | <title>Full Code Example</title> | ||
3890 | <para> | ||
3891 | <example> | ||
3892 | <title>Example of AC97 Interface</title> | ||
3893 | <programlisting> | ||
3894 | <![CDATA[ | ||
3895 | struct snd_mychip { | ||
3896 | .... | ||
3897 | ac97_t *ac97; | ||
3898 | .... | ||
3899 | }; | ||
3900 | |||
3901 | static unsigned short snd_mychip_ac97_read(ac97_t *ac97, | ||
3902 | unsigned short reg) | ||
3903 | { | ||
3904 | mychip_t *chip = ac97->private_data; | ||
3905 | .... | ||
3906 | // read a register value here from the codec | ||
3907 | return the_register_value; | ||
3908 | } | ||
3909 | |||
3910 | static void snd_mychip_ac97_write(ac97_t *ac97, | ||
3911 | unsigned short reg, unsigned short val) | ||
3912 | { | ||
3913 | mychip_t *chip = ac97->private_data; | ||
3914 | .... | ||
3915 | // write the given register value to the codec | ||
3916 | } | ||
3917 | |||
3918 | static int snd_mychip_ac97(mychip_t *chip) | ||
3919 | { | ||
3920 | ac97_bus_t *bus; | ||
3921 | ac97_template_t ac97; | ||
3922 | int err; | ||
3923 | static ac97_bus_ops_t ops = { | ||
3924 | .write = snd_mychip_ac97_write, | ||
3925 | .read = snd_mychip_ac97_read, | ||
3926 | }; | ||
3927 | |||
3928 | if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus)) < 0) | ||
3929 | return err; | ||
3930 | memset(&ac97, 0, sizeof(ac97)); | ||
3931 | ac97.private_data = chip; | ||
3932 | return snd_ac97_mixer(bus, &ac97, &chip->ac97); | ||
3933 | } | ||
3934 | |||
3935 | ]]> | ||
3936 | </programlisting> | ||
3937 | </example> | ||
3938 | </para> | ||
3939 | </section> | ||
3940 | |||
3941 | <section id="api-ac97-constructor"> | ||
3942 | <title>Constructor</title> | ||
3943 | <para> | ||
3944 | For creating an ac97 instance, first call <function>snd_ac97_bus</function> | ||
3945 | with an <type>ac97_bus_ops_t</type> record with callback functions. | ||
3946 | |||
3947 | <informalexample> | ||
3948 | <programlisting> | ||
3949 | <![CDATA[ | ||
3950 | ac97_bus_t *bus; | ||
3951 | static ac97_bus_ops_t ops = { | ||
3952 | .write = snd_mychip_ac97_write, | ||
3953 | .read = snd_mychip_ac97_read, | ||
3954 | }; | ||
3955 | |||
3956 | snd_ac97_bus(card, 0, &ops, NULL, &pbus); | ||
3957 | ]]> | ||
3958 | </programlisting> | ||
3959 | </informalexample> | ||
3960 | |||
3961 | The bus record is shared among all belonging ac97 instances. | ||
3962 | </para> | ||
3963 | |||
3964 | <para> | ||
3965 | And then call <function>snd_ac97_mixer()</function> with an <type>ac97_template_t</type> | ||
3966 | record together with the bus pointer created above. | ||
3967 | |||
3968 | <informalexample> | ||
3969 | <programlisting> | ||
3970 | <![CDATA[ | ||
3971 | ac97_template_t ac97; | ||
3972 | int err; | ||
3973 | |||
3974 | memset(&ac97, 0, sizeof(ac97)); | ||
3975 | ac97.private_data = chip; | ||
3976 | snd_ac97_mixer(bus, &ac97, &chip->ac97); | ||
3977 | ]]> | ||
3978 | </programlisting> | ||
3979 | </informalexample> | ||
3980 | |||
3981 | where chip->ac97 is the pointer of a newly created | ||
3982 | <type>ac97_t</type> instance. | ||
3983 | In this case, the chip pointer is set as the private data, so that | ||
3984 | the read/write callback functions can refer to this chip instance. | ||
3985 | This instance is not necessarily stored in the chip | ||
3986 | record. When you need to change the register values from the | ||
3987 | driver, or need the suspend/resume of ac97 codecs, keep this | ||
3988 | pointer to pass to the corresponding functions. | ||
3989 | </para> | ||
3990 | </section> | ||
3991 | |||
3992 | <section id="api-ac97-callbacks"> | ||
3993 | <title>Callbacks</title> | ||
3994 | <para> | ||
3995 | The standard callbacks are <structfield>read</structfield> and | ||
3996 | <structfield>write</structfield>. Obviously they | ||
3997 | correspond to the functions for read and write accesses to the | ||
3998 | hardware low-level codes. | ||
3999 | </para> | ||
4000 | |||
4001 | <para> | ||
4002 | The <structfield>read</structfield> callback returns the | ||
4003 | register value specified in the argument. | ||
4004 | |||
4005 | <informalexample> | ||
4006 | <programlisting> | ||
4007 | <![CDATA[ | ||
4008 | static unsigned short snd_mychip_ac97_read(ac97_t *ac97, | ||
4009 | unsigned short reg) | ||
4010 | { | ||
4011 | mychip_t *chip = ac97->private_data; | ||
4012 | .... | ||
4013 | return the_register_value; | ||
4014 | } | ||
4015 | ]]> | ||
4016 | </programlisting> | ||
4017 | </informalexample> | ||
4018 | |||
4019 | Here, the chip can be cast from ac97->private_data. | ||
4020 | </para> | ||
4021 | |||
4022 | <para> | ||
4023 | Meanwhile, the <structfield>write</structfield> callback is | ||
4024 | used to set the register value. | ||
4025 | |||
4026 | <informalexample> | ||
4027 | <programlisting> | ||
4028 | <![CDATA[ | ||
4029 | static void snd_mychip_ac97_write(ac97_t *ac97, | ||
4030 | unsigned short reg, unsigned short val) | ||
4031 | ]]> | ||
4032 | </programlisting> | ||
4033 | </informalexample> | ||
4034 | </para> | ||
4035 | |||
4036 | <para> | ||
4037 | These callbacks are non-atomic like the callbacks of control API. | ||
4038 | </para> | ||
4039 | |||
4040 | <para> | ||
4041 | There are also other callbacks: | ||
4042 | <structfield>reset</structfield>, | ||
4043 | <structfield>wait</structfield> and | ||
4044 | <structfield>init</structfield>. | ||
4045 | </para> | ||
4046 | |||
4047 | <para> | ||
4048 | The <structfield>reset</structfield> callback is used to reset | ||
4049 | the codec. If the chip requires a special way of reset, you can | ||
4050 | define this callback. | ||
4051 | </para> | ||
4052 | |||
4053 | <para> | ||
4054 | The <structfield>wait</structfield> callback is used for a | ||
4055 | certain wait at the standard initialization of the codec. If the | ||
4056 | chip requires the extra wait-time, define this callback. | ||
4057 | </para> | ||
4058 | |||
4059 | <para> | ||
4060 | The <structfield>init</structfield> callback is used for | ||
4061 | additional initialization of the codec. | ||
4062 | </para> | ||
4063 | </section> | ||
4064 | |||
4065 | <section id="api-ac97-updating-registers"> | ||
4066 | <title>Updating Registers in The Driver</title> | ||
4067 | <para> | ||
4068 | If you need to access to the codec from the driver, you can | ||
4069 | call the following functions: | ||
4070 | <function>snd_ac97_write()</function>, | ||
4071 | <function>snd_ac97_read()</function>, | ||
4072 | <function>snd_ac97_update()</function> and | ||
4073 | <function>snd_ac97_update_bits()</function>. | ||
4074 | </para> | ||
4075 | |||
4076 | <para> | ||
4077 | Both <function>snd_ac97_write()</function> and | ||
4078 | <function>snd_ac97_update()</function> functions are used to | ||
4079 | set a value to the given register | ||
4080 | (<constant>AC97_XXX</constant>). The difference between them is | ||
4081 | that <function>snd_ac97_update()</function> doesn't write a | ||
4082 | value if the given value has been already set, while | ||
4083 | <function>snd_ac97_write()</function> always rewrites the | ||
4084 | value. | ||
4085 | |||
4086 | <informalexample> | ||
4087 | <programlisting> | ||
4088 | <![CDATA[ | ||
4089 | snd_ac97_write(ac97, AC97_MASTER, 0x8080); | ||
4090 | snd_ac97_update(ac97, AC97_MASTER, 0x8080); | ||
4091 | ]]> | ||
4092 | </programlisting> | ||
4093 | </informalexample> | ||
4094 | </para> | ||
4095 | |||
4096 | <para> | ||
4097 | <function>snd_ac97_read()</function> is used to read the value | ||
4098 | of the given register. For example, | ||
4099 | |||
4100 | <informalexample> | ||
4101 | <programlisting> | ||
4102 | <![CDATA[ | ||
4103 | value = snd_ac97_read(ac97, AC97_MASTER); | ||
4104 | ]]> | ||
4105 | </programlisting> | ||
4106 | </informalexample> | ||
4107 | </para> | ||
4108 | |||
4109 | <para> | ||
4110 | <function>snd_ac97_update_bits()</function> is used to update | ||
4111 | some bits of the given register. | ||
4112 | |||
4113 | <informalexample> | ||
4114 | <programlisting> | ||
4115 | <![CDATA[ | ||
4116 | snd_ac97_update_bits(ac97, reg, mask, value); | ||
4117 | ]]> | ||
4118 | </programlisting> | ||
4119 | </informalexample> | ||
4120 | </para> | ||
4121 | |||
4122 | <para> | ||
4123 | Also, there is a function to change the sample rate (of a | ||
4124 | certain register such as | ||
4125 | <constant>AC97_PCM_FRONT_DAC_RATE</constant>) when VRA or | ||
4126 | DRA is supported by the codec: | ||
4127 | <function>snd_ac97_set_rate()</function>. | ||
4128 | |||
4129 | <informalexample> | ||
4130 | <programlisting> | ||
4131 | <![CDATA[ | ||
4132 | snd_ac97_set_rate(ac97, AC97_PCM_FRONT_DAC_RATE, 44100); | ||
4133 | ]]> | ||
4134 | </programlisting> | ||
4135 | </informalexample> | ||
4136 | </para> | ||
4137 | |||
4138 | <para> | ||
4139 | The following registers are available for setting the rate: | ||
4140 | <constant>AC97_PCM_MIC_ADC_RATE</constant>, | ||
4141 | <constant>AC97_PCM_FRONT_DAC_RATE</constant>, | ||
4142 | <constant>AC97_PCM_LR_ADC_RATE</constant>, | ||
4143 | <constant>AC97_SPDIF</constant>. When the | ||
4144 | <constant>AC97_SPDIF</constant> is specified, the register is | ||
4145 | not really changed but the corresponding IEC958 status bits will | ||
4146 | be updated. | ||
4147 | </para> | ||
4148 | </section> | ||
4149 | |||
4150 | <section id="api-ac97-clock-adjustment"> | ||
4151 | <title>Clock Adjustment</title> | ||
4152 | <para> | ||
4153 | On some chip, the clock of the codec isn't 48000 but using a | ||
4154 | PCI clock (to save a quartz!). In this case, change the field | ||
4155 | bus->clock to the corresponding | ||
4156 | value. For example, intel8x0 | ||
4157 | and es1968 drivers have the auto-measurement function of the | ||
4158 | clock. | ||
4159 | </para> | ||
4160 | </section> | ||
4161 | |||
4162 | <section id="api-ac97-proc-files"> | ||
4163 | <title>Proc Files</title> | ||
4164 | <para> | ||
4165 | The ALSA AC97 interface will create a proc file such as | ||
4166 | <filename>/proc/asound/card0/codec97#0/ac97#0-0</filename> and | ||
4167 | <filename>ac97#0-0+regs</filename>. You can refer to these files to | ||
4168 | see the current status and registers of the codec. | ||
4169 | </para> | ||
4170 | </section> | ||
4171 | |||
4172 | <section id="api-ac97-multiple-codecs"> | ||
4173 | <title>Multiple Codecs</title> | ||
4174 | <para> | ||
4175 | When there are several codecs on the same card, you need to | ||
4176 | call <function>snd_ac97_new()</function> multiple times with | ||
4177 | ac97.num=1 or greater. The <structfield>num</structfield> field | ||
4178 | specifies the codec | ||
4179 | number. | ||
4180 | </para> | ||
4181 | |||
4182 | <para> | ||
4183 | If you have set up multiple codecs, you need to either write | ||
4184 | different callbacks for each codec or check | ||
4185 | ac97->num in the | ||
4186 | callback routines. | ||
4187 | </para> | ||
4188 | </section> | ||
4189 | |||
4190 | </chapter> | ||
4191 | |||
4192 | |||
4193 | <!-- ****************************************************** --> | ||
4194 | <!-- MIDI (MPU401-UART) Interface --> | ||
4195 | <!-- ****************************************************** --> | ||
4196 | <chapter id="midi-interface"> | ||
4197 | <title>MIDI (MPU401-UART) Interface</title> | ||
4198 | |||
4199 | <section id="midi-interface-general"> | ||
4200 | <title>General</title> | ||
4201 | <para> | ||
4202 | Many soundcards have built-in MIDI (MPU401-UART) | ||
4203 | interfaces. When the soundcard supports the standard MPU401-UART | ||
4204 | interface, most likely you can use the ALSA MPU401-UART API. The | ||
4205 | MPU401-UART API is defined in | ||
4206 | <filename><sound/mpu401.h></filename>. | ||
4207 | </para> | ||
4208 | |||
4209 | <para> | ||
4210 | Some soundchips have similar but a little bit different | ||
4211 | implementation of mpu401 stuff. For example, emu10k1 has its own | ||
4212 | mpu401 routines. | ||
4213 | </para> | ||
4214 | </section> | ||
4215 | |||
4216 | <section id="midi-interface-constructor"> | ||
4217 | <title>Constructor</title> | ||
4218 | <para> | ||
4219 | For creating a rawmidi object, call | ||
4220 | <function>snd_mpu401_uart_new()</function>. | ||
4221 | |||
4222 | <informalexample> | ||
4223 | <programlisting> | ||
4224 | <![CDATA[ | ||
4225 | snd_rawmidi_t *rmidi; | ||
4226 | snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated, | ||
4227 | irq, irq_flags, &rmidi); | ||
4228 | ]]> | ||
4229 | </programlisting> | ||
4230 | </informalexample> | ||
4231 | </para> | ||
4232 | |||
4233 | <para> | ||
4234 | The first argument is the card pointer, and the second is the | ||
4235 | index of this component. You can create up to 8 rawmidi | ||
4236 | devices. | ||
4237 | </para> | ||
4238 | |||
4239 | <para> | ||
4240 | The third argument is the type of the hardware, | ||
4241 | <constant>MPU401_HW_XXX</constant>. If it's not a special one, | ||
4242 | you can use <constant>MPU401_HW_MPU401</constant>. | ||
4243 | </para> | ||
4244 | |||
4245 | <para> | ||
4246 | The 4th argument is the i/o port address. Many | ||
4247 | backward-compatible MPU401 has an i/o port such as 0x330. Or, it | ||
4248 | might be a part of its own PCI i/o region. It depends on the | ||
4249 | chip design. | ||
4250 | </para> | ||
4251 | |||
4252 | <para> | ||
4253 | When the i/o port address above is a part of the PCI i/o | ||
4254 | region, the MPU401 i/o port might have been already allocated | ||
4255 | (reserved) by the driver itself. In such a case, pass non-zero | ||
4256 | to the 5th argument | ||
4257 | (<parameter>integrated</parameter>). Otherwise, pass 0 to it, | ||
4258 | and | ||
4259 | the mpu401-uart layer will allocate the i/o ports by itself. | ||
4260 | </para> | ||
4261 | |||
4262 | <para> | ||
4263 | Usually, the port address corresponds to the command port and | ||
4264 | port + 1 corresponds to the data port. If not, you may change | ||
4265 | the <structfield>cport</structfield> field of | ||
4266 | <type>mpu401_t</type> manually | ||
4267 | afterward. However, <type>mpu401_t</type> pointer is not | ||
4268 | returned explicitly by | ||
4269 | <function>snd_mpu401_uart_new()</function>. You need to cast | ||
4270 | rmidi->private_data to | ||
4271 | <type>mpu401_t</type> explicitly, | ||
4272 | |||
4273 | <informalexample> | ||
4274 | <programlisting> | ||
4275 | <![CDATA[ | ||
4276 | mpu401_t *mpu; | ||
4277 | mpu = rmidi->private_data; | ||
4278 | ]]> | ||
4279 | </programlisting> | ||
4280 | </informalexample> | ||
4281 | |||
4282 | and reset the cport as you like: | ||
4283 | |||
4284 | <informalexample> | ||
4285 | <programlisting> | ||
4286 | <![CDATA[ | ||
4287 | mpu->cport = my_own_control_port; | ||
4288 | ]]> | ||
4289 | </programlisting> | ||
4290 | </informalexample> | ||
4291 | </para> | ||
4292 | |||
4293 | <para> | ||
4294 | The 6th argument specifies the irq number for UART. If the irq | ||
4295 | is already allocated, pass 0 to the 7th argument | ||
4296 | (<parameter>irq_flags</parameter>). Otherwise, pass the flags | ||
4297 | for irq allocation | ||
4298 | (<constant>SA_XXX</constant> bits) to it, and the irq will be | ||
4299 | reserved by the mpu401-uart layer. If the card doesn't generates | ||
4300 | UART interrupts, pass -1 as the irq number. Then a timer | ||
4301 | interrupt will be invoked for polling. | ||
4302 | </para> | ||
4303 | </section> | ||
4304 | |||
4305 | <section id="midi-interface-interrupt-handler"> | ||
4306 | <title>Interrupt Handler</title> | ||
4307 | <para> | ||
4308 | When the interrupt is allocated in | ||
4309 | <function>snd_mpu401_uart_new()</function>, the private | ||
4310 | interrupt handler is used, hence you don't have to do nothing | ||
4311 | else than creating the mpu401 stuff. Otherwise, you have to call | ||
4312 | <function>snd_mpu401_uart_interrupt()</function> explicitly when | ||
4313 | a UART interrupt is invoked and checked in your own interrupt | ||
4314 | handler. | ||
4315 | </para> | ||
4316 | |||
4317 | <para> | ||
4318 | In this case, you need to pass the private_data of the | ||
4319 | returned rawmidi object from | ||
4320 | <function>snd_mpu401_uart_new()</function> as the second | ||
4321 | argument of <function>snd_mpu401_uart_interrupt()</function>. | ||
4322 | |||
4323 | <informalexample> | ||
4324 | <programlisting> | ||
4325 | <![CDATA[ | ||
4326 | snd_mpu401_uart_interrupt(irq, rmidi->private_data, regs); | ||
4327 | ]]> | ||
4328 | </programlisting> | ||
4329 | </informalexample> | ||
4330 | </para> | ||
4331 | </section> | ||
4332 | |||
4333 | </chapter> | ||
4334 | |||
4335 | |||
4336 | <!-- ****************************************************** --> | ||
4337 | <!-- RawMIDI Interface --> | ||
4338 | <!-- ****************************************************** --> | ||
4339 | <chapter id="rawmidi-interface"> | ||
4340 | <title>RawMIDI Interface</title> | ||
4341 | |||
4342 | <section id="rawmidi-interface-overview"> | ||
4343 | <title>Overview</title> | ||
4344 | |||
4345 | <para> | ||
4346 | The raw MIDI interface is used for hardware MIDI ports that can | ||
4347 | be accessed as a byte stream. It is not used for synthesizer | ||
4348 | chips that do not directly understand MIDI. | ||
4349 | </para> | ||
4350 | |||
4351 | <para> | ||
4352 | ALSA handles file and buffer management. All you have to do is | ||
4353 | to write some code to move data between the buffer and the | ||
4354 | hardware. | ||
4355 | </para> | ||
4356 | |||
4357 | <para> | ||
4358 | The rawmidi API is defined in | ||
4359 | <filename><sound/rawmidi.h></filename>. | ||
4360 | </para> | ||
4361 | </section> | ||
4362 | |||
4363 | <section id="rawmidi-interface-constructor"> | ||
4364 | <title>Constructor</title> | ||
4365 | |||
4366 | <para> | ||
4367 | To create a rawmidi device, call the | ||
4368 | <function>snd_rawmidi_new</function> function: | ||
4369 | <informalexample> | ||
4370 | <programlisting> | ||
4371 | <![CDATA[ | ||
4372 | snd_rawmidi_t *rmidi; | ||
4373 | err = snd_rawmidi_new(chip->card, "MyMIDI", 0, outs, ins, &rmidi); | ||
4374 | if (err < 0) | ||
4375 | return err; | ||
4376 | rmidi->private_data = chip; | ||
4377 | strcpy(rmidi->name, "My MIDI"); | ||
4378 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | | ||
4379 | SNDRV_RAWMIDI_INFO_INPUT | | ||
4380 | SNDRV_RAWMIDI_INFO_DUPLEX; | ||
4381 | ]]> | ||
4382 | </programlisting> | ||
4383 | </informalexample> | ||
4384 | </para> | ||
4385 | |||
4386 | <para> | ||
4387 | The first argument is the card pointer, the second argument is | ||
4388 | the ID string. | ||
4389 | </para> | ||
4390 | |||
4391 | <para> | ||
4392 | The third argument is the index of this component. You can | ||
4393 | create up to 8 rawmidi devices. | ||
4394 | </para> | ||
4395 | |||
4396 | <para> | ||
4397 | The fourth and fifth arguments are the number of output and | ||
4398 | input substreams, respectively, of this device. (A substream is | ||
4399 | the equivalent of a MIDI port.) | ||
4400 | </para> | ||
4401 | |||
4402 | <para> | ||
4403 | Set the <structfield>info_flags</structfield> field to specify | ||
4404 | the capabilities of the device. | ||
4405 | Set <constant>SNDRV_RAWMIDI_INFO_OUTPUT</constant> if there is | ||
4406 | at least one output port, | ||
4407 | <constant>SNDRV_RAWMIDI_INFO_INPUT</constant> if there is at | ||
4408 | least one input port, | ||
4409 | and <constant>SNDRV_RAWMIDI_INFO_DUPLEX</constant> if the device | ||
4410 | can handle output and input at the same time. | ||
4411 | </para> | ||
4412 | |||
4413 | <para> | ||
4414 | After the rawmidi device is created, you need to set the | ||
4415 | operators (callbacks) for each substream. There are helper | ||
4416 | functions to set the operators for all substream of a device: | ||
4417 | <informalexample> | ||
4418 | <programlisting> | ||
4419 | <![CDATA[ | ||
4420 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_mymidi_output_ops); | ||
4421 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_mymidi_input_ops); | ||
4422 | ]]> | ||
4423 | </programlisting> | ||
4424 | </informalexample> | ||
4425 | </para> | ||
4426 | |||
4427 | <para> | ||
4428 | The operators are usually defined like this: | ||
4429 | <informalexample> | ||
4430 | <programlisting> | ||
4431 | <![CDATA[ | ||
4432 | static snd_rawmidi_ops_t snd_mymidi_output_ops = { | ||
4433 | .open = snd_mymidi_output_open, | ||
4434 | .close = snd_mymidi_output_close, | ||
4435 | .trigger = snd_mymidi_output_trigger, | ||
4436 | }; | ||
4437 | ]]> | ||
4438 | </programlisting> | ||
4439 | </informalexample> | ||
4440 | These callbacks are explained in the <link | ||
4441 | linkend="rawmidi-interface-callbacks"><citetitle>Callbacks</citetitle></link> | ||
4442 | section. | ||
4443 | </para> | ||
4444 | |||
4445 | <para> | ||
4446 | If there is more than one substream, you should give each one a | ||
4447 | unique name: | ||
4448 | <informalexample> | ||
4449 | <programlisting> | ||
4450 | <![CDATA[ | ||
4451 | struct list_head *list; | ||
4452 | snd_rawmidi_substream_t *substream; | ||
4453 | list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { | ||
4454 | substream = list_entry(list, snd_rawmidi_substream_t, list); | ||
4455 | sprintf(substream->name, "My MIDI Port %d", substream->number + 1); | ||
4456 | } | ||
4457 | /* same for SNDRV_RAWMIDI_STREAM_INPUT */ | ||
4458 | ]]> | ||
4459 | </programlisting> | ||
4460 | </informalexample> | ||
4461 | </para> | ||
4462 | </section> | ||
4463 | |||
4464 | <section id="rawmidi-interface-callbacks"> | ||
4465 | <title>Callbacks</title> | ||
4466 | |||
4467 | <para> | ||
4468 | In all callbacks, the private data that you've set for the | ||
4469 | rawmidi device can be accessed as | ||
4470 | substream->rmidi->private_data. | ||
4471 | <!-- <code> isn't available before DocBook 4.3 --> | ||
4472 | </para> | ||
4473 | |||
4474 | <para> | ||
4475 | If there is more than one port, your callbacks can determine the | ||
4476 | port index from the snd_rawmidi_substream_t data passed to each | ||
4477 | callback: | ||
4478 | <informalexample> | ||
4479 | <programlisting> | ||
4480 | <![CDATA[ | ||
4481 | snd_rawmidi_substream_t *substream; | ||
4482 | int index = substream->number; | ||
4483 | ]]> | ||
4484 | </programlisting> | ||
4485 | </informalexample> | ||
4486 | </para> | ||
4487 | |||
4488 | <section id="rawmidi-interface-op-open"> | ||
4489 | <title><function>open</function> callback</title> | ||
4490 | |||
4491 | <informalexample> | ||
4492 | <programlisting> | ||
4493 | <![CDATA[ | ||
4494 | static int snd_xxx_open(snd_rawmidi_substream_t *substream); | ||
4495 | ]]> | ||
4496 | </programlisting> | ||
4497 | </informalexample> | ||
4498 | |||
4499 | <para> | ||
4500 | This is called when a substream is opened. | ||
4501 | You can initialize the hardware here, but you should not yet | ||
4502 | start transmitting/receiving data. | ||
4503 | </para> | ||
4504 | </section> | ||
4505 | |||
4506 | <section id="rawmidi-interface-op-close"> | ||
4507 | <title><function>close</function> callback</title> | ||
4508 | |||
4509 | <informalexample> | ||
4510 | <programlisting> | ||
4511 | <![CDATA[ | ||
4512 | static int snd_xxx_close(snd_rawmidi_substream_t *substream); | ||
4513 | ]]> | ||
4514 | </programlisting> | ||
4515 | </informalexample> | ||
4516 | |||
4517 | <para> | ||
4518 | Guess what. | ||
4519 | </para> | ||
4520 | |||
4521 | <para> | ||
4522 | The <function>open</function> and <function>close</function> | ||
4523 | callbacks of a rawmidi device are serialized with a mutex, | ||
4524 | and can sleep. | ||
4525 | </para> | ||
4526 | </section> | ||
4527 | |||
4528 | <section id="rawmidi-interface-op-trigger-out"> | ||
4529 | <title><function>trigger</function> callback for output | ||
4530 | substreams</title> | ||
4531 | |||
4532 | <informalexample> | ||
4533 | <programlisting> | ||
4534 | <![CDATA[ | ||
4535 | static void snd_xxx_output_trigger(snd_rawmidi_substream_t *substream, int up); | ||
4536 | ]]> | ||
4537 | </programlisting> | ||
4538 | </informalexample> | ||
4539 | |||
4540 | <para> | ||
4541 | This is called with a nonzero <parameter>up</parameter> | ||
4542 | parameter when there is some data in the substream buffer that | ||
4543 | must be transmitted. | ||
4544 | </para> | ||
4545 | |||
4546 | <para> | ||
4547 | To read data from the buffer, call | ||
4548 | <function>snd_rawmidi_transmit_peek</function>. It will | ||
4549 | return the number of bytes that have been read; this will be | ||
4550 | less than the number of bytes requested when there is no more | ||
4551 | data in the buffer. | ||
4552 | After the data has been transmitted successfully, call | ||
4553 | <function>snd_rawmidi_transmit_ack</function> to remove the | ||
4554 | data from the substream buffer: | ||
4555 | <informalexample> | ||
4556 | <programlisting> | ||
4557 | <![CDATA[ | ||
4558 | unsigned char data; | ||
4559 | while (snd_rawmidi_transmit_peek(substream, &data, 1) == 1) { | ||
4560 | if (mychip_try_to_transmit(data)) | ||
4561 | snd_rawmidi_transmit_ack(substream, 1); | ||
4562 | else | ||
4563 | break; /* hardware FIFO full */ | ||
4564 | } | ||
4565 | ]]> | ||
4566 | </programlisting> | ||
4567 | </informalexample> | ||
4568 | </para> | ||
4569 | |||
4570 | <para> | ||
4571 | If you know beforehand that the hardware will accept data, you | ||
4572 | can use the <function>snd_rawmidi_transmit</function> function | ||
4573 | which reads some data and removes it from the buffer at once: | ||
4574 | <informalexample> | ||
4575 | <programlisting> | ||
4576 | <![CDATA[ | ||
4577 | while (mychip_transmit_possible()) { | ||
4578 | unsigned char data; | ||
4579 | if (snd_rawmidi_transmit(substream, &data, 1) != 1) | ||
4580 | break; /* no more data */ | ||
4581 | mychip_transmit(data); | ||
4582 | } | ||
4583 | ]]> | ||
4584 | </programlisting> | ||
4585 | </informalexample> | ||
4586 | </para> | ||
4587 | |||
4588 | <para> | ||
4589 | If you know beforehand how many bytes you can accept, you can | ||
4590 | use a buffer size greater than one with the | ||
4591 | <function>snd_rawmidi_transmit*</function> functions. | ||
4592 | </para> | ||
4593 | |||
4594 | <para> | ||
4595 | The <function>trigger</function> callback must not sleep. If | ||
4596 | the hardware FIFO is full before the substream buffer has been | ||
4597 | emptied, you have to continue transmitting data later, either | ||
4598 | in an interrupt handler, or with a timer if the hardware | ||
4599 | doesn't have a MIDI transmit interrupt. | ||
4600 | </para> | ||
4601 | |||
4602 | <para> | ||
4603 | The <function>trigger</function> callback is called with a | ||
4604 | zero <parameter>up</parameter> parameter when the transmission | ||
4605 | of data should be aborted. | ||
4606 | </para> | ||
4607 | </section> | ||
4608 | |||
4609 | <section id="rawmidi-interface-op-trigger-in"> | ||
4610 | <title><function>trigger</function> callback for input | ||
4611 | substreams</title> | ||
4612 | |||
4613 | <informalexample> | ||
4614 | <programlisting> | ||
4615 | <![CDATA[ | ||
4616 | static void snd_xxx_input_trigger(snd_rawmidi_substream_t *substream, int up); | ||
4617 | ]]> | ||
4618 | </programlisting> | ||
4619 | </informalexample> | ||
4620 | |||
4621 | <para> | ||
4622 | This is called with a nonzero <parameter>up</parameter> | ||
4623 | parameter to enable receiving data, or with a zero | ||
4624 | <parameter>up</parameter> parameter do disable receiving data. | ||
4625 | </para> | ||
4626 | |||
4627 | <para> | ||
4628 | The <function>trigger</function> callback must not sleep; the | ||
4629 | actual reading of data from the device is usually done in an | ||
4630 | interrupt handler. | ||
4631 | </para> | ||
4632 | |||
4633 | <para> | ||
4634 | When data reception is enabled, your interrupt handler should | ||
4635 | call <function>snd_rawmidi_receive</function> for all received | ||
4636 | data: | ||
4637 | <informalexample> | ||
4638 | <programlisting> | ||
4639 | <![CDATA[ | ||
4640 | void snd_mychip_midi_interrupt(...) | ||
4641 | { | ||
4642 | while (mychip_midi_available()) { | ||
4643 | unsigned char data; | ||
4644 | data = mychip_midi_read(); | ||
4645 | snd_rawmidi_receive(substream, &data, 1); | ||
4646 | } | ||
4647 | } | ||
4648 | ]]> | ||
4649 | </programlisting> | ||
4650 | </informalexample> | ||
4651 | </para> | ||
4652 | </section> | ||
4653 | |||
4654 | <section id="rawmidi-interface-op-drain"> | ||
4655 | <title><function>drain</function> callback</title> | ||
4656 | |||
4657 | <informalexample> | ||
4658 | <programlisting> | ||
4659 | <![CDATA[ | ||
4660 | static void snd_xxx_drain(snd_rawmidi_substream_t *substream); | ||
4661 | ]]> | ||
4662 | </programlisting> | ||
4663 | </informalexample> | ||
4664 | |||
4665 | <para> | ||
4666 | This is only used with output substreams. This function should wait | ||
4667 | until all data read from the substream buffer has been transmitted. | ||
4668 | This ensures that the device can be closed and the driver unloaded | ||
4669 | without losing data. | ||
4670 | </para> | ||
4671 | |||
4672 | <para> | ||
4673 | This callback is optional. If you do not set | ||
4674 | <structfield>drain</structfield> in the snd_rawmidi_ops_t | ||
4675 | structure, ALSA will simply wait for 50 milliseconds | ||
4676 | instead. | ||
4677 | </para> | ||
4678 | </section> | ||
4679 | </section> | ||
4680 | |||
4681 | </chapter> | ||
4682 | |||
4683 | |||
4684 | <!-- ****************************************************** --> | ||
4685 | <!-- Miscellaneous Devices --> | ||
4686 | <!-- ****************************************************** --> | ||
4687 | <chapter id="misc-devices"> | ||
4688 | <title>Miscellaneous Devices</title> | ||
4689 | |||
4690 | <section id="misc-devices-opl3"> | ||
4691 | <title>FM OPL3</title> | ||
4692 | <para> | ||
4693 | The FM OPL3 is still used on many chips (mainly for backward | ||
4694 | compatibility). ALSA has a nice OPL3 FM control layer, too. The | ||
4695 | OPL3 API is defined in | ||
4696 | <filename><sound/opl3.h></filename>. | ||
4697 | </para> | ||
4698 | |||
4699 | <para> | ||
4700 | FM registers can be directly accessed through direct-FM API, | ||
4701 | defined in <filename><sound/asound_fm.h></filename>. In | ||
4702 | ALSA native mode, FM registers are accessed through | ||
4703 | Hardware-Dependant Device direct-FM extension API, whereas in | ||
4704 | OSS compatible mode, FM registers can be accessed with OSS | ||
4705 | direct-FM compatible API on <filename>/dev/dmfmX</filename> device. | ||
4706 | </para> | ||
4707 | |||
4708 | <para> | ||
4709 | For creating the OPL3 component, you have two functions to | ||
4710 | call. The first one is a constructor for <type>opl3_t</type> | ||
4711 | instance. | ||
4712 | |||
4713 | <informalexample> | ||
4714 | <programlisting> | ||
4715 | <![CDATA[ | ||
4716 | opl3_t *opl3; | ||
4717 | snd_opl3_create(card, lport, rport, OPL3_HW_OPL3_XXX, | ||
4718 | integrated, &opl3); | ||
4719 | ]]> | ||
4720 | </programlisting> | ||
4721 | </informalexample> | ||
4722 | </para> | ||
4723 | |||
4724 | <para> | ||
4725 | The first argument is the card pointer, the second one is the | ||
4726 | left port address, and the third is the right port address. In | ||
4727 | most cases, the right port is placed at the left port + 2. | ||
4728 | </para> | ||
4729 | |||
4730 | <para> | ||
4731 | The fourth argument is the hardware type. | ||
4732 | </para> | ||
4733 | |||
4734 | <para> | ||
4735 | When the left and right ports have been already allocated by | ||
4736 | the card driver, pass non-zero to the fifth argument | ||
4737 | (<parameter>integrated</parameter>). Otherwise, opl3 module will | ||
4738 | allocate the specified ports by itself. | ||
4739 | </para> | ||
4740 | |||
4741 | <para> | ||
4742 | When the accessing to the hardware requires special method | ||
4743 | instead of the standard I/O access, you can create opl3 instance | ||
4744 | separately with <function>snd_opl3_new()</function>. | ||
4745 | |||
4746 | <informalexample> | ||
4747 | <programlisting> | ||
4748 | <![CDATA[ | ||
4749 | opl3_t *opl3; | ||
4750 | snd_opl3_new(card, OPL3_HW_OPL3_XXX, &opl3); | ||
4751 | ]]> | ||
4752 | </programlisting> | ||
4753 | </informalexample> | ||
4754 | </para> | ||
4755 | |||
4756 | <para> | ||
4757 | Then set <structfield>command</structfield>, | ||
4758 | <structfield>private_data</structfield> and | ||
4759 | <structfield>private_free</structfield> for the private | ||
4760 | access function, the private data and the destructor. | ||
4761 | The l_port and r_port are not necessarily set. Only the | ||
4762 | command must be set properly. You can retrieve the data | ||
4763 | from opl3->private_data field. | ||
4764 | </para> | ||
4765 | |||
4766 | <para> | ||
4767 | After creating the opl3 instance via <function>snd_opl3_new()</function>, | ||
4768 | call <function>snd_opl3_init()</function> to initialize the chip to the | ||
4769 | proper state. Note that <function>snd_opl3_create()</function> always | ||
4770 | calls it internally. | ||
4771 | </para> | ||
4772 | |||
4773 | <para> | ||
4774 | If the opl3 instance is created successfully, then create a | ||
4775 | hwdep device for this opl3. | ||
4776 | |||
4777 | <informalexample> | ||
4778 | <programlisting> | ||
4779 | <![CDATA[ | ||
4780 | snd_hwdep_t *opl3hwdep; | ||
4781 | snd_opl3_hwdep_new(opl3, 0, 1, &opl3hwdep); | ||
4782 | ]]> | ||
4783 | </programlisting> | ||
4784 | </informalexample> | ||
4785 | </para> | ||
4786 | |||
4787 | <para> | ||
4788 | The first argument is the <type>opl3_t</type> instance you | ||
4789 | created, and the second is the index number, usually 0. | ||
4790 | </para> | ||
4791 | |||
4792 | <para> | ||
4793 | The third argument is the index-offset for the sequencer | ||
4794 | client assigned to the OPL3 port. When there is an MPU401-UART, | ||
4795 | give 1 for here (UART always takes 0). | ||
4796 | </para> | ||
4797 | </section> | ||
4798 | |||
4799 | <section id="misc-devices-hardware-dependent"> | ||
4800 | <title>Hardware-Dependent Devices</title> | ||
4801 | <para> | ||
4802 | Some chips need the access from the user-space for special | ||
4803 | controls or for loading the micro code. In such a case, you can | ||
4804 | create a hwdep (hardware-dependent) device. The hwdep API is | ||
4805 | defined in <filename><sound/hwdep.h></filename>. You can | ||
4806 | find examples in opl3 driver or | ||
4807 | <filename>isa/sb/sb16_csp.c</filename>. | ||
4808 | </para> | ||
4809 | |||
4810 | <para> | ||
4811 | Creation of the <type>hwdep</type> instance is done via | ||
4812 | <function>snd_hwdep_new()</function>. | ||
4813 | |||
4814 | <informalexample> | ||
4815 | <programlisting> | ||
4816 | <![CDATA[ | ||
4817 | snd_hwdep_t *hw; | ||
4818 | snd_hwdep_new(card, "My HWDEP", 0, &hw); | ||
4819 | ]]> | ||
4820 | </programlisting> | ||
4821 | </informalexample> | ||
4822 | |||
4823 | where the third argument is the index number. | ||
4824 | </para> | ||
4825 | |||
4826 | <para> | ||
4827 | You can then pass any pointer value to the | ||
4828 | <parameter>private_data</parameter>. | ||
4829 | If you assign a private data, you should define the | ||
4830 | destructor, too. The destructor function is set to | ||
4831 | <structfield>private_free</structfield> field. | ||
4832 | |||
4833 | <informalexample> | ||
4834 | <programlisting> | ||
4835 | <![CDATA[ | ||
4836 | mydata_t *p = kmalloc(sizeof(*p), GFP_KERNEL); | ||
4837 | hw->private_data = p; | ||
4838 | hw->private_free = mydata_free; | ||
4839 | ]]> | ||
4840 | </programlisting> | ||
4841 | </informalexample> | ||
4842 | |||
4843 | and the implementation of destructor would be: | ||
4844 | |||
4845 | <informalexample> | ||
4846 | <programlisting> | ||
4847 | <![CDATA[ | ||
4848 | static void mydata_free(snd_hwdep_t *hw) | ||
4849 | { | ||
4850 | mydata_t *p = hw->private_data; | ||
4851 | kfree(p); | ||
4852 | } | ||
4853 | ]]> | ||
4854 | </programlisting> | ||
4855 | </informalexample> | ||
4856 | </para> | ||
4857 | |||
4858 | <para> | ||
4859 | The arbitrary file operations can be defined for this | ||
4860 | instance. The file operators are defined in | ||
4861 | <parameter>ops</parameter> table. For example, assume that | ||
4862 | this chip needs an ioctl. | ||
4863 | |||
4864 | <informalexample> | ||
4865 | <programlisting> | ||
4866 | <![CDATA[ | ||
4867 | hw->ops.open = mydata_open; | ||
4868 | hw->ops.ioctl = mydata_ioctl; | ||
4869 | hw->ops.release = mydata_release; | ||
4870 | ]]> | ||
4871 | </programlisting> | ||
4872 | </informalexample> | ||
4873 | |||
4874 | And implement the callback functions as you like. | ||
4875 | </para> | ||
4876 | </section> | ||
4877 | |||
4878 | <section id="misc-devices-IEC958"> | ||
4879 | <title>IEC958 (S/PDIF)</title> | ||
4880 | <para> | ||
4881 | Usually the controls for IEC958 devices are implemented via | ||
4882 | control interface. There is a macro to compose a name string for | ||
4883 | IEC958 controls, <function>SNDRV_CTL_NAME_IEC958()</function> | ||
4884 | defined in <filename><include/asound.h></filename>. | ||
4885 | </para> | ||
4886 | |||
4887 | <para> | ||
4888 | There are some standard controls for IEC958 status bits. These | ||
4889 | controls use the type <type>SNDRV_CTL_ELEM_TYPE_IEC958</type>, | ||
4890 | and the size of element is fixed as 4 bytes array | ||
4891 | (value.iec958.status[x]). For <structfield>info</structfield> | ||
4892 | callback, you don't specify | ||
4893 | the value field for this type (the count field must be set, | ||
4894 | though). | ||
4895 | </para> | ||
4896 | |||
4897 | <para> | ||
4898 | <quote>IEC958 Playback Con Mask</quote> is used to return the | ||
4899 | bit-mask for the IEC958 status bits of consumer mode. Similarly, | ||
4900 | <quote>IEC958 Playback Pro Mask</quote> returns the bitmask for | ||
4901 | professional mode. They are read-only controls, and are defined | ||
4902 | as MIXER controls (iface = | ||
4903 | <constant>SNDRV_CTL_ELEM_IFACE_MIXER</constant>). | ||
4904 | </para> | ||
4905 | |||
4906 | <para> | ||
4907 | Meanwhile, <quote>IEC958 Playback Default</quote> control is | ||
4908 | defined for getting and setting the current default IEC958 | ||
4909 | bits. Note that this one is usually defined as a PCM control | ||
4910 | (iface = <constant>SNDRV_CTL_ELEM_IFACE_PCM</constant>), | ||
4911 | although in some places it's defined as a MIXER control. | ||
4912 | </para> | ||
4913 | |||
4914 | <para> | ||
4915 | In addition, you can define the control switches to | ||
4916 | enable/disable or to set the raw bit mode. The implementation | ||
4917 | will depend on the chip, but the control should be named as | ||
4918 | <quote>IEC958 xxx</quote>, preferably using | ||
4919 | <function>SNDRV_CTL_NAME_IEC958()</function> macro. | ||
4920 | </para> | ||
4921 | |||
4922 | <para> | ||
4923 | You can find several cases, for example, | ||
4924 | <filename>pci/emu10k1</filename>, | ||
4925 | <filename>pci/ice1712</filename>, or | ||
4926 | <filename>pci/cmipci.c</filename>. | ||
4927 | </para> | ||
4928 | </section> | ||
4929 | |||
4930 | </chapter> | ||
4931 | |||
4932 | |||
4933 | <!-- ****************************************************** --> | ||
4934 | <!-- Buffer and Memory Management --> | ||
4935 | <!-- ****************************************************** --> | ||
4936 | <chapter id="buffer-and-memory"> | ||
4937 | <title>Buffer and Memory Management</title> | ||
4938 | |||
4939 | <section id="buffer-and-memory-buffer-types"> | ||
4940 | <title>Buffer Types</title> | ||
4941 | <para> | ||
4942 | ALSA provides several different buffer allocation functions | ||
4943 | depending on the bus and the architecture. All these have a | ||
4944 | consistent API. The allocation of physically-contiguous pages is | ||
4945 | done via | ||
4946 | <function>snd_malloc_xxx_pages()</function> function, where xxx | ||
4947 | is the bus type. | ||
4948 | </para> | ||
4949 | |||
4950 | <para> | ||
4951 | The allocation of pages with fallback is | ||
4952 | <function>snd_malloc_xxx_pages_fallback()</function>. This | ||
4953 | function tries to allocate the specified pages but if the pages | ||
4954 | are not available, it tries to reduce the page sizes until the | ||
4955 | enough space is found. | ||
4956 | </para> | ||
4957 | |||
4958 | <para> | ||
4959 | For releasing the space, call | ||
4960 | <function>snd_free_xxx_pages()</function> function. | ||
4961 | </para> | ||
4962 | |||
4963 | <para> | ||
4964 | Usually, ALSA drivers try to allocate and reserve | ||
4965 | a large contiguous physical space | ||
4966 | at the time the module is loaded for the later use. | ||
4967 | This is called <quote>pre-allocation</quote>. | ||
4968 | As already written, you can call the following function at the | ||
4969 | construction of pcm instance (in the case of PCI bus). | ||
4970 | |||
4971 | <informalexample> | ||
4972 | <programlisting> | ||
4973 | <![CDATA[ | ||
4974 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
4975 | snd_dma_pci_data(pci), size, max); | ||
4976 | ]]> | ||
4977 | </programlisting> | ||
4978 | </informalexample> | ||
4979 | |||
4980 | where <parameter>size</parameter> is the byte size to be | ||
4981 | pre-allocated and the <parameter>max</parameter> is the maximal | ||
4982 | size to be changed via <filename>prealloc</filename> proc file. | ||
4983 | The allocator will try to get as large area as possible | ||
4984 | within the given size. | ||
4985 | </para> | ||
4986 | |||
4987 | <para> | ||
4988 | The second argument (type) and the third argument (device pointer) | ||
4989 | are dependent on the bus. | ||
4990 | In the case of ISA bus, pass <function>snd_dma_isa_data()</function> | ||
4991 | as the third argument with <constant>SNDRV_DMA_TYPE_DEV</constant> type. | ||
4992 | For the continuous buffer unrelated to the bus can be pre-allocated | ||
4993 | with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the | ||
4994 | <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer, | ||
4995 | whereh <constant>GFP_KERNEL</constant> is the kernel allocation flag to | ||
4996 | use. For the SBUS, <constant>SNDRV_DMA_TYPE_SBUS</constant> and | ||
4997 | <function>snd_dma_sbus_data(sbus_dev)</function> are used instead. | ||
4998 | For the PCI scatter-gather buffers, use | ||
4999 | <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with | ||
5000 | <function>snd_dma_pci_data(pci)</function> | ||
5001 | (see the section | ||
5002 | <link linkend="buffer-and-memory-non-contiguous"><citetitle>Non-Contiguous Buffers | ||
5003 | </citetitle></link>). | ||
5004 | </para> | ||
5005 | |||
5006 | <para> | ||
5007 | Once when the buffer is pre-allocated, you can use the | ||
5008 | allocator in the <structfield>hw_params</structfield> callback | ||
5009 | |||
5010 | <informalexample> | ||
5011 | <programlisting> | ||
5012 | <![CDATA[ | ||
5013 | snd_pcm_lib_malloc_pages(substream, size); | ||
5014 | ]]> | ||
5015 | </programlisting> | ||
5016 | </informalexample> | ||
5017 | |||
5018 | Note that you have to pre-allocate to use this function. | ||
5019 | </para> | ||
5020 | </section> | ||
5021 | |||
5022 | <section id="buffer-and-memory-external-hardware"> | ||
5023 | <title>External Hardware Buffers</title> | ||
5024 | <para> | ||
5025 | Some chips have their own hardware buffers and the DMA | ||
5026 | transfer from the host memory is not available. In such a case, | ||
5027 | you need to either 1) copy/set the audio data directly to the | ||
5028 | external hardware buffer, or 2) make an intermediate buffer and | ||
5029 | copy/set the data from it to the external hardware buffer in | ||
5030 | interrupts (or in tasklets, preferably). | ||
5031 | </para> | ||
5032 | |||
5033 | <para> | ||
5034 | The first case works fine if the external hardware buffer is enough | ||
5035 | large. This method doesn't need any extra buffers and thus is | ||
5036 | more effective. You need to define the | ||
5037 | <structfield>copy</structfield> and | ||
5038 | <structfield>silence</structfield> callbacks for | ||
5039 | the data transfer. However, there is a drawback: it cannot | ||
5040 | be mmapped. The examples are GUS's GF1 PCM or emu8000's | ||
5041 | wavetable PCM. | ||
5042 | </para> | ||
5043 | |||
5044 | <para> | ||
5045 | The second case allows the mmap of the buffer, although you have | ||
5046 | to handle an interrupt or a tasklet for transferring the data | ||
5047 | from the intermediate buffer to the hardware buffer. You can find an | ||
5048 | example in vxpocket driver. | ||
5049 | </para> | ||
5050 | |||
5051 | <para> | ||
5052 | Another case is that the chip uses a PCI memory-map | ||
5053 | region for the buffer instead of the host memory. In this case, | ||
5054 | mmap is available only on certain architectures like intel. In | ||
5055 | non-mmap mode, the data cannot be transferred as the normal | ||
5056 | way. Thus you need to define <structfield>copy</structfield> and | ||
5057 | <structfield>silence</structfield> callbacks as well | ||
5058 | as in the cases above. The examples are found in | ||
5059 | <filename>rme32.c</filename> and <filename>rme96.c</filename>. | ||
5060 | </para> | ||
5061 | |||
5062 | <para> | ||
5063 | The implementation of <structfield>copy</structfield> and | ||
5064 | <structfield>silence</structfield> callbacks depends upon | ||
5065 | whether the hardware supports interleaved or non-interleaved | ||
5066 | samples. The <structfield>copy</structfield> callback is | ||
5067 | defined like below, a bit | ||
5068 | differently depending whether the direction is playback or | ||
5069 | capture: | ||
5070 | |||
5071 | <informalexample> | ||
5072 | <programlisting> | ||
5073 | <![CDATA[ | ||
5074 | static int playback_copy(snd_pcm_substream_t *substream, int channel, | ||
5075 | snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count); | ||
5076 | static int capture_copy(snd_pcm_substream_t *substream, int channel, | ||
5077 | snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count); | ||
5078 | ]]> | ||
5079 | </programlisting> | ||
5080 | </informalexample> | ||
5081 | </para> | ||
5082 | |||
5083 | <para> | ||
5084 | In the case of interleaved samples, the second argument | ||
5085 | (<parameter>channel</parameter>) is not used. The third argument | ||
5086 | (<parameter>pos</parameter>) points the | ||
5087 | current position offset in frames. | ||
5088 | </para> | ||
5089 | |||
5090 | <para> | ||
5091 | The meaning of the fourth argument is different between | ||
5092 | playback and capture. For playback, it holds the source data | ||
5093 | pointer, and for capture, it's the destination data pointer. | ||
5094 | </para> | ||
5095 | |||
5096 | <para> | ||
5097 | The last argument is the number of frames to be copied. | ||
5098 | </para> | ||
5099 | |||
5100 | <para> | ||
5101 | What you have to do in this callback is again different | ||
5102 | between playback and capture directions. In the case of | ||
5103 | playback, you do: copy the given amount of data | ||
5104 | (<parameter>count</parameter>) at the specified pointer | ||
5105 | (<parameter>src</parameter>) to the specified offset | ||
5106 | (<parameter>pos</parameter>) on the hardware buffer. When | ||
5107 | coded like memcpy-like way, the copy would be like: | ||
5108 | |||
5109 | <informalexample> | ||
5110 | <programlisting> | ||
5111 | <![CDATA[ | ||
5112 | my_memcpy(my_buffer + frames_to_bytes(runtime, pos), src, | ||
5113 | frames_to_bytes(runtime, count)); | ||
5114 | ]]> | ||
5115 | </programlisting> | ||
5116 | </informalexample> | ||
5117 | </para> | ||
5118 | |||
5119 | <para> | ||
5120 | For the capture direction, you do: copy the given amount of | ||
5121 | data (<parameter>count</parameter>) at the specified offset | ||
5122 | (<parameter>pos</parameter>) on the hardware buffer to the | ||
5123 | specified pointer (<parameter>dst</parameter>). | ||
5124 | |||
5125 | <informalexample> | ||
5126 | <programlisting> | ||
5127 | <![CDATA[ | ||
5128 | my_memcpy(dst, my_buffer + frames_to_bytes(runtime, pos), | ||
5129 | frames_to_bytes(runtime, count)); | ||
5130 | ]]> | ||
5131 | </programlisting> | ||
5132 | </informalexample> | ||
5133 | |||
5134 | Note that both of the position and the data amount are given | ||
5135 | in frames. | ||
5136 | </para> | ||
5137 | |||
5138 | <para> | ||
5139 | In the case of non-interleaved samples, the implementation | ||
5140 | will be a bit more complicated. | ||
5141 | </para> | ||
5142 | |||
5143 | <para> | ||
5144 | You need to check the channel argument, and if it's -1, copy | ||
5145 | the whole channels. Otherwise, you have to copy only the | ||
5146 | specified channel. Please check | ||
5147 | <filename>isa/gus/gus_pcm.c</filename> as an example. | ||
5148 | </para> | ||
5149 | |||
5150 | <para> | ||
5151 | The <structfield>silence</structfield> callback is also | ||
5152 | implemented in a similar way. | ||
5153 | |||
5154 | <informalexample> | ||
5155 | <programlisting> | ||
5156 | <![CDATA[ | ||
5157 | static int silence(snd_pcm_substream_t *substream, int channel, | ||
5158 | snd_pcm_uframes_t pos, snd_pcm_uframes_t count); | ||
5159 | ]]> | ||
5160 | </programlisting> | ||
5161 | </informalexample> | ||
5162 | </para> | ||
5163 | |||
5164 | <para> | ||
5165 | The meanings of arguments are identical with the | ||
5166 | <structfield>copy</structfield> | ||
5167 | callback, although there is no <parameter>src/dst</parameter> | ||
5168 | argument. In the case of interleaved samples, the channel | ||
5169 | argument has no meaning, as well as on | ||
5170 | <structfield>copy</structfield> callback. | ||
5171 | </para> | ||
5172 | |||
5173 | <para> | ||
5174 | The role of <structfield>silence</structfield> callback is to | ||
5175 | set the given amount | ||
5176 | (<parameter>count</parameter>) of silence data at the | ||
5177 | specified offset (<parameter>pos</parameter>) on the hardware | ||
5178 | buffer. Suppose that the data format is signed (that is, the | ||
5179 | silent-data is 0), and the implementation using a memset-like | ||
5180 | function would be like: | ||
5181 | |||
5182 | <informalexample> | ||
5183 | <programlisting> | ||
5184 | <![CDATA[ | ||
5185 | my_memcpy(my_buffer + frames_to_bytes(runtime, pos), 0, | ||
5186 | frames_to_bytes(runtime, count)); | ||
5187 | ]]> | ||
5188 | </programlisting> | ||
5189 | </informalexample> | ||
5190 | </para> | ||
5191 | |||
5192 | <para> | ||
5193 | In the case of non-interleaved samples, again, the | ||
5194 | implementation becomes a bit more complicated. See, for example, | ||
5195 | <filename>isa/gus/gus_pcm.c</filename>. | ||
5196 | </para> | ||
5197 | </section> | ||
5198 | |||
5199 | <section id="buffer-and-memory-non-contiguous"> | ||
5200 | <title>Non-Contiguous Buffers</title> | ||
5201 | <para> | ||
5202 | If your hardware supports the page table like emu10k1 or the | ||
5203 | buffer descriptors like via82xx, you can use the scatter-gather | ||
5204 | (SG) DMA. ALSA provides an interface for handling SG-buffers. | ||
5205 | The API is provided in <filename><sound/pcm.h></filename>. | ||
5206 | </para> | ||
5207 | |||
5208 | <para> | ||
5209 | For creating the SG-buffer handler, call | ||
5210 | <function>snd_pcm_lib_preallocate_pages()</function> or | ||
5211 | <function>snd_pcm_lib_preallocate_pages_for_all()</function> | ||
5212 | with <constant>SNDRV_DMA_TYPE_DEV_SG</constant> | ||
5213 | in the PCM constructor like other PCI pre-allocator. | ||
5214 | You need to pass the <function>snd_dma_pci_data(pci)</function>, | ||
5215 | where pci is the struct <structname>pci_dev</structname> pointer | ||
5216 | of the chip as well. | ||
5217 | The <type>snd_sg_buf_t</type> instance is created as | ||
5218 | substream->dma_private. You can cast | ||
5219 | the pointer like: | ||
5220 | |||
5221 | <informalexample> | ||
5222 | <programlisting> | ||
5223 | <![CDATA[ | ||
5224 | snd_pcm_sgbuf_t *sgbuf = (snd_pcm_sgbuf_t*)substream->dma_private; | ||
5225 | ]]> | ||
5226 | </programlisting> | ||
5227 | </informalexample> | ||
5228 | </para> | ||
5229 | |||
5230 | <para> | ||
5231 | Then call <function>snd_pcm_lib_malloc_pages()</function> | ||
5232 | in <structfield>hw_params</structfield> callback | ||
5233 | as well as in the case of normal PCI buffer. | ||
5234 | The SG-buffer handler will allocate the non-contiguous kernel | ||
5235 | pages of the given size and map them onto the virtually contiguous | ||
5236 | memory. The virtual pointer is addressed in runtime->dma_area. | ||
5237 | The physical address (runtime->dma_addr) is set to zero, | ||
5238 | because the buffer is physically non-contigous. | ||
5239 | The physical address table is set up in sgbuf->table. | ||
5240 | You can get the physical address at a certain offset via | ||
5241 | <function>snd_pcm_sgbuf_get_addr()</function>. | ||
5242 | </para> | ||
5243 | |||
5244 | <para> | ||
5245 | When a SG-handler is used, you need to set | ||
5246 | <function>snd_pcm_sgbuf_ops_page</function> as | ||
5247 | the <structfield>page</structfield> callback. | ||
5248 | (See <link linkend="pcm-interface-operators-page-callback"> | ||
5249 | <citetitle>page callback section</citetitle></link>.) | ||
5250 | </para> | ||
5251 | |||
5252 | <para> | ||
5253 | For releasing the data, call | ||
5254 | <function>snd_pcm_lib_free_pages()</function> in the | ||
5255 | <structfield>hw_free</structfield> callback as usual. | ||
5256 | </para> | ||
5257 | </section> | ||
5258 | |||
5259 | <section id="buffer-and-memory-vmalloced"> | ||
5260 | <title>Vmalloc'ed Buffers</title> | ||
5261 | <para> | ||
5262 | It's possible to use a buffer allocated via | ||
5263 | <function>vmalloc</function>, for example, for an intermediate | ||
5264 | buffer. Since the allocated pages are not contiguous, you need | ||
5265 | to set the <structfield>page</structfield> callback to obtain | ||
5266 | the physical address at every offset. | ||
5267 | </para> | ||
5268 | |||
5269 | <para> | ||
5270 | The implementation of <structfield>page</structfield> callback | ||
5271 | would be like this: | ||
5272 | |||
5273 | <informalexample> | ||
5274 | <programlisting> | ||
5275 | <![CDATA[ | ||
5276 | #include <linux/vmalloc.h> | ||
5277 | |||
5278 | /* get the physical page pointer on the given offset */ | ||
5279 | static struct page *mychip_page(snd_pcm_substream_t *substream, | ||
5280 | unsigned long offset) | ||
5281 | { | ||
5282 | void *pageptr = substream->runtime->dma_area + offset; | ||
5283 | return vmalloc_to_page(pageptr); | ||
5284 | } | ||
5285 | ]]> | ||
5286 | </programlisting> | ||
5287 | </informalexample> | ||
5288 | </para> | ||
5289 | </section> | ||
5290 | |||
5291 | </chapter> | ||
5292 | |||
5293 | |||
5294 | <!-- ****************************************************** --> | ||
5295 | <!-- Proc Interface --> | ||
5296 | <!-- ****************************************************** --> | ||
5297 | <chapter id="proc-interface"> | ||
5298 | <title>Proc Interface</title> | ||
5299 | <para> | ||
5300 | ALSA provides an easy interface for procfs. The proc files are | ||
5301 | very useful for debugging. I recommend you set up proc files if | ||
5302 | you write a driver and want to get a running status or register | ||
5303 | dumps. The API is found in | ||
5304 | <filename><sound/info.h></filename>. | ||
5305 | </para> | ||
5306 | |||
5307 | <para> | ||
5308 | For creating a proc file, call | ||
5309 | <function>snd_card_proc_new()</function>. | ||
5310 | |||
5311 | <informalexample> | ||
5312 | <programlisting> | ||
5313 | <![CDATA[ | ||
5314 | snd_info_entry_t *entry; | ||
5315 | int err = snd_card_proc_new(card, "my-file", &entry); | ||
5316 | ]]> | ||
5317 | </programlisting> | ||
5318 | </informalexample> | ||
5319 | |||
5320 | where the second argument specifies the proc-file name to be | ||
5321 | created. The above example will create a file | ||
5322 | <filename>my-file</filename> under the card directory, | ||
5323 | e.g. <filename>/proc/asound/card0/my-file</filename>. | ||
5324 | </para> | ||
5325 | |||
5326 | <para> | ||
5327 | Like other components, the proc entry created via | ||
5328 | <function>snd_card_proc_new()</function> will be registered and | ||
5329 | released automatically in the card registration and release | ||
5330 | functions. | ||
5331 | </para> | ||
5332 | |||
5333 | <para> | ||
5334 | When the creation is successful, the function stores a new | ||
5335 | instance at the pointer given in the third argument. | ||
5336 | It is initialized as a text proc file for read only. For using | ||
5337 | this proc file as a read-only text file as it is, set the read | ||
5338 | callback with a private data via | ||
5339 | <function>snd_info_set_text_ops()</function>. | ||
5340 | |||
5341 | <informalexample> | ||
5342 | <programlisting> | ||
5343 | <![CDATA[ | ||
5344 | snd_info_set_text_ops(entry, chip, read_size, my_proc_read); | ||
5345 | ]]> | ||
5346 | </programlisting> | ||
5347 | </informalexample> | ||
5348 | |||
5349 | where the second argument (<parameter>chip</parameter>) is the | ||
5350 | private data to be used in the callbacks. The third parameter | ||
5351 | specifies the read buffer size and the fourth | ||
5352 | (<parameter>my_proc_read</parameter>) is the callback function, which | ||
5353 | is defined like | ||
5354 | |||
5355 | <informalexample> | ||
5356 | <programlisting> | ||
5357 | <![CDATA[ | ||
5358 | static void my_proc_read(snd_info_entry_t *entry, | ||
5359 | snd_info_buffer_t *buffer); | ||
5360 | ]]> | ||
5361 | </programlisting> | ||
5362 | </informalexample> | ||
5363 | |||
5364 | </para> | ||
5365 | |||
5366 | <para> | ||
5367 | In the read callback, use <function>snd_iprintf()</function> for | ||
5368 | output strings, which works just like normal | ||
5369 | <function>printf()</function>. For example, | ||
5370 | |||
5371 | <informalexample> | ||
5372 | <programlisting> | ||
5373 | <![CDATA[ | ||
5374 | static void my_proc_read(snd_info_entry_t *entry, | ||
5375 | snd_info_buffer_t *buffer) | ||
5376 | { | ||
5377 | chip_t *chip = entry->private_data; | ||
5378 | |||
5379 | snd_iprintf(buffer, "This is my chip!\n"); | ||
5380 | snd_iprintf(buffer, "Port = %ld\n", chip->port); | ||
5381 | } | ||
5382 | ]]> | ||
5383 | </programlisting> | ||
5384 | </informalexample> | ||
5385 | </para> | ||
5386 | |||
5387 | <para> | ||
5388 | The file permission can be changed afterwards. As default, it's | ||
5389 | set as read only for all users. If you want to add the write | ||
5390 | permission to the user (root as default), set like below: | ||
5391 | |||
5392 | <informalexample> | ||
5393 | <programlisting> | ||
5394 | <![CDATA[ | ||
5395 | entry->mode = S_IFREG | S_IRUGO | S_IWUSR; | ||
5396 | ]]> | ||
5397 | </programlisting> | ||
5398 | </informalexample> | ||
5399 | |||
5400 | and set the write buffer size and the callback | ||
5401 | |||
5402 | <informalexample> | ||
5403 | <programlisting> | ||
5404 | <![CDATA[ | ||
5405 | entry->c.text.write_size = 256; | ||
5406 | entry->c.text.write = my_proc_write; | ||
5407 | ]]> | ||
5408 | </programlisting> | ||
5409 | </informalexample> | ||
5410 | </para> | ||
5411 | |||
5412 | <para> | ||
5413 | The buffer size for read is set to 1024 implicitly by | ||
5414 | <function>snd_info_set_text_ops()</function>. It should suffice | ||
5415 | in most cases (the size will be aligned to | ||
5416 | <constant>PAGE_SIZE</constant> anyway), but if you need to handle | ||
5417 | very large text files, you can set it explicitly, too. | ||
5418 | |||
5419 | <informalexample> | ||
5420 | <programlisting> | ||
5421 | <![CDATA[ | ||
5422 | entry->c.text.read_size = 65536; | ||
5423 | ]]> | ||
5424 | </programlisting> | ||
5425 | </informalexample> | ||
5426 | </para> | ||
5427 | |||
5428 | <para> | ||
5429 | For the write callback, you can use | ||
5430 | <function>snd_info_get_line()</function> to get a text line, and | ||
5431 | <function>snd_info_get_str()</function> to retrieve a string from | ||
5432 | the line. Some examples are found in | ||
5433 | <filename>core/oss/mixer_oss.c</filename>, core/oss/and | ||
5434 | <filename>pcm_oss.c</filename>. | ||
5435 | </para> | ||
5436 | |||
5437 | <para> | ||
5438 | For a raw-data proc-file, set the attributes like the following: | ||
5439 | |||
5440 | <informalexample> | ||
5441 | <programlisting> | ||
5442 | <![CDATA[ | ||
5443 | static struct snd_info_entry_ops my_file_io_ops = { | ||
5444 | .read = my_file_io_read, | ||
5445 | }; | ||
5446 | |||
5447 | entry->content = SNDRV_INFO_CONTENT_DATA; | ||
5448 | entry->private_data = chip; | ||
5449 | entry->c.ops = &my_file_io_ops; | ||
5450 | entry->size = 4096; | ||
5451 | entry->mode = S_IFREG | S_IRUGO; | ||
5452 | ]]> | ||
5453 | </programlisting> | ||
5454 | </informalexample> | ||
5455 | </para> | ||
5456 | |||
5457 | <para> | ||
5458 | The callback is much more complicated than the text-file | ||
5459 | version. You need to use a low-level i/o functions such as | ||
5460 | <function>copy_from/to_user()</function> to transfer the | ||
5461 | data. | ||
5462 | |||
5463 | <informalexample> | ||
5464 | <programlisting> | ||
5465 | <![CDATA[ | ||
5466 | static long my_file_io_read(snd_info_entry_t *entry, | ||
5467 | void *file_private_data, | ||
5468 | struct file *file, | ||
5469 | char *buf, | ||
5470 | unsigned long count, | ||
5471 | unsigned long pos) | ||
5472 | { | ||
5473 | long size = count; | ||
5474 | if (pos + size > local_max_size) | ||
5475 | size = local_max_size - pos; | ||
5476 | if (copy_to_user(buf, local_data + pos, size)) | ||
5477 | return -EFAULT; | ||
5478 | return size; | ||
5479 | } | ||
5480 | ]]> | ||
5481 | </programlisting> | ||
5482 | </informalexample> | ||
5483 | </para> | ||
5484 | |||
5485 | </chapter> | ||
5486 | |||
5487 | |||
5488 | <!-- ****************************************************** --> | ||
5489 | <!-- Power Management --> | ||
5490 | <!-- ****************************************************** --> | ||
5491 | <chapter id="power-management"> | ||
5492 | <title>Power Management</title> | ||
5493 | <para> | ||
5494 | If the chip is supposed to work with with suspend/resume | ||
5495 | functions, you need to add the power-management codes to the | ||
5496 | driver. The additional codes for the power-management should be | ||
5497 | <function>ifdef</function>'ed with | ||
5498 | <constant>CONFIG_PM</constant>. | ||
5499 | </para> | ||
5500 | |||
5501 | <para> | ||
5502 | ALSA provides the common power-management layer. Each card driver | ||
5503 | needs to have only low-level suspend and resume callbacks. | ||
5504 | |||
5505 | <informalexample> | ||
5506 | <programlisting> | ||
5507 | <![CDATA[ | ||
5508 | #ifdef CONFIG_PM | ||
5509 | static int snd_my_suspend(snd_card_t *card, pm_message_t state) | ||
5510 | { | ||
5511 | .... // do things for suspsend | ||
5512 | return 0; | ||
5513 | } | ||
5514 | static int snd_my_resume(snd_card_t *card) | ||
5515 | { | ||
5516 | .... // do things for suspsend | ||
5517 | return 0; | ||
5518 | } | ||
5519 | #endif | ||
5520 | ]]> | ||
5521 | </programlisting> | ||
5522 | </informalexample> | ||
5523 | </para> | ||
5524 | |||
5525 | <para> | ||
5526 | The scheme of the real suspend job is as following. | ||
5527 | |||
5528 | <orderedlist> | ||
5529 | <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> | ||
5530 | <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem> | ||
5531 | <listitem><para>Save the register values if necessary.</para></listitem> | ||
5532 | <listitem><para>Stop the hardware if necessary.</para></listitem> | ||
5533 | <listitem><para>Disable the PCI device by calling <function>pci_disable_device()</function>.</para></listitem> | ||
5534 | </orderedlist> | ||
5535 | </para> | ||
5536 | |||
5537 | <para> | ||
5538 | A typical code would be like: | ||
5539 | |||
5540 | <informalexample> | ||
5541 | <programlisting> | ||
5542 | <![CDATA[ | ||
5543 | static int mychip_suspend(snd_card_t *card, pm_message_t state) | ||
5544 | { | ||
5545 | /* (1) */ | ||
5546 | mychip_t *chip = card->pm_private_data; | ||
5547 | /* (2) */ | ||
5548 | snd_pcm_suspend_all(chip->pcm); | ||
5549 | /* (3) */ | ||
5550 | snd_mychip_save_registers(chip); | ||
5551 | /* (4) */ | ||
5552 | snd_mychip_stop_hardware(chip); | ||
5553 | /* (5) */ | ||
5554 | pci_disable_device(chip->pci); | ||
5555 | return 0; | ||
5556 | } | ||
5557 | ]]> | ||
5558 | </programlisting> | ||
5559 | </informalexample> | ||
5560 | </para> | ||
5561 | |||
5562 | <para> | ||
5563 | The scheme of the real resume job is as following. | ||
5564 | |||
5565 | <orderedlist> | ||
5566 | <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> | ||
5567 | <listitem><para>Enable the pci device again by calling | ||
5568 | <function>pci_enable_device()</function>.</para></listitem> | ||
5569 | <listitem><para>Re-initialize the chip.</para></listitem> | ||
5570 | <listitem><para>Restore the saved registers if necessary.</para></listitem> | ||
5571 | <listitem><para>Resume the mixer, e.g. calling | ||
5572 | <function>snd_ac97_resume()</function>.</para></listitem> | ||
5573 | <listitem><para>Restart the hardware (if any).</para></listitem> | ||
5574 | </orderedlist> | ||
5575 | </para> | ||
5576 | |||
5577 | <para> | ||
5578 | A typical code would be like: | ||
5579 | |||
5580 | <informalexample> | ||
5581 | <programlisting> | ||
5582 | <![CDATA[ | ||
5583 | static void mychip_resume(mychip_t *chip) | ||
5584 | { | ||
5585 | /* (1) */ | ||
5586 | mychip_t *chip = card->pm_private_data; | ||
5587 | /* (2) */ | ||
5588 | pci_enable_device(chip->pci); | ||
5589 | /* (3) */ | ||
5590 | snd_mychip_reinit_chip(chip); | ||
5591 | /* (4) */ | ||
5592 | snd_mychip_restore_registers(chip); | ||
5593 | /* (5) */ | ||
5594 | snd_ac97_resume(chip->ac97); | ||
5595 | /* (6) */ | ||
5596 | snd_mychip_restart_chip(chip); | ||
5597 | return 0; | ||
5598 | } | ||
5599 | ]]> | ||
5600 | </programlisting> | ||
5601 | </informalexample> | ||
5602 | </para> | ||
5603 | |||
5604 | <para> | ||
5605 | OK, we have all callbacks now. Let's set up them now. In the | ||
5606 | initialization of the card, add the following: | ||
5607 | |||
5608 | <informalexample> | ||
5609 | <programlisting> | ||
5610 | <![CDATA[ | ||
5611 | static int __devinit snd_mychip_probe(struct pci_dev *pci, | ||
5612 | const struct pci_device_id *pci_id) | ||
5613 | { | ||
5614 | .... | ||
5615 | snd_card_t *card; | ||
5616 | mychip_t *chip; | ||
5617 | .... | ||
5618 | snd_card_set_pm_callback(card, snd_my_suspend, snd_my_resume, chip); | ||
5619 | .... | ||
5620 | } | ||
5621 | ]]> | ||
5622 | </programlisting> | ||
5623 | </informalexample> | ||
5624 | |||
5625 | Here you don't have to put ifdef CONFIG_PM around, since it's already | ||
5626 | checked in the header and expanded to empty if not needed. | ||
5627 | </para> | ||
5628 | |||
5629 | <para> | ||
5630 | If you need a space for saving the registers, you'll need to | ||
5631 | allocate the buffer for it here, too, since it would be fatal | ||
5632 | if you cannot allocate a memory in the suspend phase. | ||
5633 | The allocated buffer should be released in the corresponding | ||
5634 | destructor. | ||
5635 | </para> | ||
5636 | |||
5637 | <para> | ||
5638 | And next, set suspend/resume callbacks to the pci_driver, | ||
5639 | This can be done by passing a macro SND_PCI_PM_CALLBACKS | ||
5640 | in the pci_driver struct. This macro is expanded to the correct | ||
5641 | (global) callbacks if CONFIG_PM is set. | ||
5642 | |||
5643 | <informalexample> | ||
5644 | <programlisting> | ||
5645 | <![CDATA[ | ||
5646 | static struct pci_driver driver = { | ||
5647 | .name = "My Chip", | ||
5648 | .id_table = snd_my_ids, | ||
5649 | .probe = snd_my_probe, | ||
5650 | .remove = __devexit_p(snd_my_remove), | ||
5651 | SND_PCI_PM_CALLBACKS | ||
5652 | }; | ||
5653 | ]]> | ||
5654 | </programlisting> | ||
5655 | </informalexample> | ||
5656 | </para> | ||
5657 | |||
5658 | </chapter> | ||
5659 | |||
5660 | |||
5661 | <!-- ****************************************************** --> | ||
5662 | <!-- Module Parameters --> | ||
5663 | <!-- ****************************************************** --> | ||
5664 | <chapter id="module-parameters"> | ||
5665 | <title>Module Parameters</title> | ||
5666 | <para> | ||
5667 | There are standard module options for ALSA. At least, each | ||
5668 | module should have <parameter>index</parameter>, | ||
5669 | <parameter>id</parameter> and <parameter>enable</parameter> | ||
5670 | options. | ||
5671 | </para> | ||
5672 | |||
5673 | <para> | ||
5674 | If the module supports multiple cards (usually up to | ||
5675 | 8 = <constant>SNDRV_CARDS</constant> cards), they should be | ||
5676 | arrays. The default initial values are defined already as | ||
5677 | constants for ease of programming: | ||
5678 | |||
5679 | <informalexample> | ||
5680 | <programlisting> | ||
5681 | <![CDATA[ | ||
5682 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | ||
5683 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | ||
5684 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | ||
5685 | ]]> | ||
5686 | </programlisting> | ||
5687 | </informalexample> | ||
5688 | </para> | ||
5689 | |||
5690 | <para> | ||
5691 | If the module supports only a single card, they could be single | ||
5692 | variables, instead. <parameter>enable</parameter> option is not | ||
5693 | always necessary in this case, but it wouldn't be so bad to have a | ||
5694 | dummy option for compatibility. | ||
5695 | </para> | ||
5696 | |||
5697 | <para> | ||
5698 | The module parameters must be declared with the standard | ||
5699 | <function>module_param()()</function>, | ||
5700 | <function>module_param_array()()</function> and | ||
5701 | <function>MODULE_PARM_DESC()</function> macros. | ||
5702 | </para> | ||
5703 | |||
5704 | <para> | ||
5705 | The typical coding would be like below: | ||
5706 | |||
5707 | <informalexample> | ||
5708 | <programlisting> | ||
5709 | <![CDATA[ | ||
5710 | #define CARD_NAME "My Chip" | ||
5711 | |||
5712 | module_param_array(index, int, NULL, 0444); | ||
5713 | MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); | ||
5714 | module_param_array(id, charp, NULL, 0444); | ||
5715 | MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); | ||
5716 | module_param_array(enable, bool, NULL, 0444); | ||
5717 | MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); | ||
5718 | ]]> | ||
5719 | </programlisting> | ||
5720 | </informalexample> | ||
5721 | </para> | ||
5722 | |||
5723 | <para> | ||
5724 | Also, don't forget to define the module description, classes, | ||
5725 | license and devices. Especially, the recent modprobe requires to | ||
5726 | define the module license as GPL, etc., otherwise the system is | ||
5727 | shown as <quote>tainted</quote>. | ||
5728 | |||
5729 | <informalexample> | ||
5730 | <programlisting> | ||
5731 | <![CDATA[ | ||
5732 | MODULE_DESCRIPTION("My Chip"); | ||
5733 | MODULE_LICENSE("GPL"); | ||
5734 | MODULE_SUPPORTED_DEVICE("{{Vendor,My Chip Name}}"); | ||
5735 | ]]> | ||
5736 | </programlisting> | ||
5737 | </informalexample> | ||
5738 | </para> | ||
5739 | |||
5740 | </chapter> | ||
5741 | |||
5742 | |||
5743 | <!-- ****************************************************** --> | ||
5744 | <!-- How To Put Your Driver --> | ||
5745 | <!-- ****************************************************** --> | ||
5746 | <chapter id="how-to-put-your-driver"> | ||
5747 | <title>How To Put Your Driver Into ALSA Tree</title> | ||
5748 | <section> | ||
5749 | <title>General</title> | ||
5750 | <para> | ||
5751 | So far, you've learned how to write the driver codes. | ||
5752 | And you might have a question now: how to put my own | ||
5753 | driver into the ALSA driver tree? | ||
5754 | Here (finally :) the standard procedure is described briefly. | ||
5755 | </para> | ||
5756 | |||
5757 | <para> | ||
5758 | Suppose that you'll create a new PCI driver for the card | ||
5759 | <quote>xyz</quote>. The card module name would be | ||
5760 | snd-xyz. The new driver is usually put into alsa-driver | ||
5761 | tree, <filename>alsa-driver/pci</filename> directory in | ||
5762 | the case of PCI cards. | ||
5763 | Then the driver is evaluated, audited and tested | ||
5764 | by developers and users. After a certain time, the driver | ||
5765 | will go to alsa-kernel tree (to the corresponding directory, | ||
5766 | such as <filename>alsa-kernel/pci</filename>) and eventually | ||
5767 | integrated into Linux 2.6 tree (the directory would be | ||
5768 | <filename>linux/sound/pci</filename>). | ||
5769 | </para> | ||
5770 | |||
5771 | <para> | ||
5772 | In the following sections, the driver code is supposed | ||
5773 | to be put into alsa-driver tree. The two cases are assumed: | ||
5774 | a driver consisting of a single source file and one consisting | ||
5775 | of several source files. | ||
5776 | </para> | ||
5777 | </section> | ||
5778 | |||
5779 | <section> | ||
5780 | <title>Driver with A Single Source File</title> | ||
5781 | <para> | ||
5782 | <orderedlist> | ||
5783 | <listitem> | ||
5784 | <para> | ||
5785 | Modify alsa-driver/pci/Makefile | ||
5786 | </para> | ||
5787 | |||
5788 | <para> | ||
5789 | Suppose you have a file xyz.c. Add the following | ||
5790 | two lines | ||
5791 | <informalexample> | ||
5792 | <programlisting> | ||
5793 | <![CDATA[ | ||
5794 | snd-xyz-objs := xyz.o | ||
5795 | obj-$(CONFIG_SND_XYZ) += snd-xyz.o | ||
5796 | ]]> | ||
5797 | </programlisting> | ||
5798 | </informalexample> | ||
5799 | </para> | ||
5800 | </listitem> | ||
5801 | |||
5802 | <listitem> | ||
5803 | <para> | ||
5804 | Create the Kconfig entry | ||
5805 | </para> | ||
5806 | |||
5807 | <para> | ||
5808 | Add the new entry of Kconfig for your xyz driver. | ||
5809 | <informalexample> | ||
5810 | <programlisting> | ||
5811 | <![CDATA[ | ||
5812 | config SND_XYZ | ||
5813 | tristate "Foobar XYZ" | ||
5814 | depends on SND | ||
5815 | select SND_PCM | ||
5816 | help | ||
5817 | Say Y here to include support for Foobar XYZ soundcard. | ||
5818 | |||
5819 | To compile this driver as a module, choose M here: the module | ||
5820 | will be called snd-xyz. | ||
5821 | ]]> | ||
5822 | </programlisting> | ||
5823 | </informalexample> | ||
5824 | |||
5825 | the line, select SND_PCM, specifies that the driver xyz supports | ||
5826 | PCM. In addition to SND_PCM, the following components are | ||
5827 | supported for select command: | ||
5828 | SND_RAWMIDI, SND_TIMER, SND_HWDEP, SND_MPU401_UART, | ||
5829 | SND_OPL3_LIB, SND_OPL4_LIB, SND_VX_LIB, SND_AC97_CODEC. | ||
5830 | Add the select command for each supported component. | ||
5831 | </para> | ||
5832 | |||
5833 | <para> | ||
5834 | Note that some selections imply the lowlevel selections. | ||
5835 | For example, PCM includes TIMER, MPU401_UART includes RAWMIDI, | ||
5836 | AC97_CODEC includes PCM, and OPL3_LIB includes HWDEP. | ||
5837 | You don't need to give the lowlevel selections again. | ||
5838 | </para> | ||
5839 | |||
5840 | <para> | ||
5841 | For the details of Kconfig script, refer to the kbuild | ||
5842 | documentation. | ||
5843 | </para> | ||
5844 | |||
5845 | </listitem> | ||
5846 | |||
5847 | <listitem> | ||
5848 | <para> | ||
5849 | Run cvscompile script to re-generate the configure script and | ||
5850 | build the whole stuff again. | ||
5851 | </para> | ||
5852 | </listitem> | ||
5853 | </orderedlist> | ||
5854 | </para> | ||
5855 | </section> | ||
5856 | |||
5857 | <section> | ||
5858 | <title>Drivers with Several Source Files</title> | ||
5859 | <para> | ||
5860 | Suppose that the driver snd-xyz have several source files. | ||
5861 | They are located in the new subdirectory, | ||
5862 | pci/xyz. | ||
5863 | |||
5864 | <orderedlist> | ||
5865 | <listitem> | ||
5866 | <para> | ||
5867 | Add a new directory (<filename>xyz</filename>) in | ||
5868 | <filename>alsa-driver/pci/Makefile</filename> like below | ||
5869 | |||
5870 | <informalexample> | ||
5871 | <programlisting> | ||
5872 | <![CDATA[ | ||
5873 | obj-$(CONFIG_SND) += xyz/ | ||
5874 | ]]> | ||
5875 | </programlisting> | ||
5876 | </informalexample> | ||
5877 | </para> | ||
5878 | </listitem> | ||
5879 | |||
5880 | <listitem> | ||
5881 | <para> | ||
5882 | Under the directory <filename>xyz</filename>, create a Makefile | ||
5883 | |||
5884 | <example> | ||
5885 | <title>Sample Makefile for a driver xyz</title> | ||
5886 | <programlisting> | ||
5887 | <![CDATA[ | ||
5888 | ifndef SND_TOPDIR | ||
5889 | SND_TOPDIR=../.. | ||
5890 | endif | ||
5891 | |||
5892 | include $(SND_TOPDIR)/toplevel.config | ||
5893 | include $(SND_TOPDIR)/Makefile.conf | ||
5894 | |||
5895 | snd-xyz-objs := xyz.o abc.o def.o | ||
5896 | |||
5897 | obj-$(CONFIG_SND_XYZ) += snd-xyz.o | ||
5898 | |||
5899 | include $(SND_TOPDIR)/Rules.make | ||
5900 | ]]> | ||
5901 | </programlisting> | ||
5902 | </example> | ||
5903 | </para> | ||
5904 | </listitem> | ||
5905 | |||
5906 | <listitem> | ||
5907 | <para> | ||
5908 | Create the Kconfig entry | ||
5909 | </para> | ||
5910 | |||
5911 | <para> | ||
5912 | This procedure is as same as in the last section. | ||
5913 | </para> | ||
5914 | </listitem> | ||
5915 | |||
5916 | <listitem> | ||
5917 | <para> | ||
5918 | Run cvscompile script to re-generate the configure script and | ||
5919 | build the whole stuff again. | ||
5920 | </para> | ||
5921 | </listitem> | ||
5922 | </orderedlist> | ||
5923 | </para> | ||
5924 | </section> | ||
5925 | |||
5926 | </chapter> | ||
5927 | |||
5928 | <!-- ****************************************************** --> | ||
5929 | <!-- Useful Functions --> | ||
5930 | <!-- ****************************************************** --> | ||
5931 | <chapter id="useful-functions"> | ||
5932 | <title>Useful Functions</title> | ||
5933 | |||
5934 | <section id="useful-functions-snd-printk"> | ||
5935 | <title><function>snd_printk()</function> and friends</title> | ||
5936 | <para> | ||
5937 | ALSA provides a verbose version of | ||
5938 | <function>printk()</function> function. If a kernel config | ||
5939 | <constant>CONFIG_SND_VERBOSE_PRINTK</constant> is set, this | ||
5940 | function prints the given message together with the file name | ||
5941 | and the line of the caller. The <constant>KERN_XXX</constant> | ||
5942 | prefix is processed as | ||
5943 | well as the original <function>printk()</function> does, so it's | ||
5944 | recommended to add this prefix, e.g. | ||
5945 | |||
5946 | <informalexample> | ||
5947 | <programlisting> | ||
5948 | <![CDATA[ | ||
5949 | snd_printk(KERN_ERR "Oh my, sorry, it's extremely bad!\n"); | ||
5950 | ]]> | ||
5951 | </programlisting> | ||
5952 | </informalexample> | ||
5953 | </para> | ||
5954 | |||
5955 | <para> | ||
5956 | There are also <function>printk()</function>'s for | ||
5957 | debugging. <function>snd_printd()</function> can be used for | ||
5958 | general debugging purposes. If | ||
5959 | <constant>CONFIG_SND_DEBUG</constant> is set, this function is | ||
5960 | compiled, and works just like | ||
5961 | <function>snd_printk()</function>. If the ALSA is compiled | ||
5962 | without the debugging flag, it's ignored. | ||
5963 | </para> | ||
5964 | |||
5965 | <para> | ||
5966 | <function>snd_printdd()</function> is compiled in only when | ||
5967 | <constant>CONFIG_SND_DEBUG_DETECT</constant> is set. Please note | ||
5968 | that <constant>DEBUG_DETECT</constant> is not set as default | ||
5969 | even if you configure the alsa-driver with | ||
5970 | <option>--with-debug=full</option> option. You need to give | ||
5971 | explicitly <option>--with-debug=detect</option> option instead. | ||
5972 | </para> | ||
5973 | </section> | ||
5974 | |||
5975 | <section id="useful-functions-snd-assert"> | ||
5976 | <title><function>snd_assert()</function></title> | ||
5977 | <para> | ||
5978 | <function>snd_assert()</function> macro is similar with the | ||
5979 | normal <function>assert()</function> macro. For example, | ||
5980 | |||
5981 | <informalexample> | ||
5982 | <programlisting> | ||
5983 | <![CDATA[ | ||
5984 | snd_assert(pointer != NULL, return -EINVAL); | ||
5985 | ]]> | ||
5986 | </programlisting> | ||
5987 | </informalexample> | ||
5988 | </para> | ||
5989 | |||
5990 | <para> | ||
5991 | The first argument is the expression to evaluate, and the | ||
5992 | second argument is the action if it fails. When | ||
5993 | <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an | ||
5994 | error message such as <computeroutput>BUG? (xxx) (called from | ||
5995 | yyy)</computeroutput>. When no debug flag is set, this is | ||
5996 | ignored. | ||
5997 | </para> | ||
5998 | </section> | ||
5999 | |||
6000 | <section id="useful-functions-snd-runtime-check"> | ||
6001 | <title><function>snd_runtime_check()</function></title> | ||
6002 | <para> | ||
6003 | This macro is quite similar with | ||
6004 | <function>snd_assert()</function>. Unlike | ||
6005 | <function>snd_assert()</function>, the expression is always | ||
6006 | evaluated regardless of | ||
6007 | <constant>CONFIG_SND_DEBUG</constant>. When | ||
6008 | <constant>CONFIG_SND_DEBUG</constant> is set, the macro will | ||
6009 | show a message like <computeroutput>ERROR (xx) (called from | ||
6010 | yyy)</computeroutput>. | ||
6011 | </para> | ||
6012 | </section> | ||
6013 | |||
6014 | <section id="useful-functions-snd-bug"> | ||
6015 | <title><function>snd_BUG()</function></title> | ||
6016 | <para> | ||
6017 | It calls <function>snd_assert(0,)</function> -- that is, just | ||
6018 | prints the error message at the point. It's useful to show that | ||
6019 | a fatal error happens there. | ||
6020 | </para> | ||
6021 | </section> | ||
6022 | </chapter> | ||
6023 | |||
6024 | |||
6025 | <!-- ****************************************************** --> | ||
6026 | <!-- Acknowledgments --> | ||
6027 | <!-- ****************************************************** --> | ||
6028 | <chapter id="acknowledments"> | ||
6029 | <title>Acknowledgments</title> | ||
6030 | <para> | ||
6031 | I would like to thank Phil Kerr for his help for improvement and | ||
6032 | corrections of this document. | ||
6033 | </para> | ||
6034 | <para> | ||
6035 | Kevin Conder reformatted the original plain-text to the | ||
6036 | DocBook format. | ||
6037 | </para> | ||
6038 | <para> | ||
6039 | Giuliano Pochini corrected typos and contributed the example codes | ||
6040 | in the hardware constraints section. | ||
6041 | </para> | ||
6042 | </chapter> | ||
6043 | |||
6044 | |||
6045 | </book> | ||
diff --git a/Documentation/sound/alsa/Joystick.txt b/Documentation/sound/alsa/Joystick.txt new file mode 100644 index 000000000000..ccda41b10f8a --- /dev/null +++ b/Documentation/sound/alsa/Joystick.txt | |||
@@ -0,0 +1,86 @@ | |||
1 | Analog Joystick Support on ALSA Drivers | ||
2 | ======================================= | ||
3 | Oct. 14, 2003 | ||
4 | Takashi Iwai <tiwai@suse.de> | ||
5 | |||
6 | General | ||
7 | ------- | ||
8 | |||
9 | First of all, you need to enable GAMEPORT support on Linux kernel for | ||
10 | using a joystick with the ALSA driver. For the details of gameport | ||
11 | support, refer to Documentation/input/joystick.txt. | ||
12 | |||
13 | The joystick support of ALSA drivers is different between ISA and PCI | ||
14 | cards. In the case of ISA (PnP) cards, it's usually handled by the | ||
15 | independent module (ns558). Meanwhile, the ALSA PCI drivers have the | ||
16 | built-in gameport support. Hence, when the ALSA PCI driver is built | ||
17 | in the kernel, CONFIG_GAMEPORT must be 'y', too. Otherwise, the | ||
18 | gameport support on that card will be (silently) disabled. | ||
19 | |||
20 | Some adapter modules probe the physical connection of the device at | ||
21 | the load time. It'd be safer to plug in the joystick device before | ||
22 | loading the module. | ||
23 | |||
24 | |||
25 | PCI Cards | ||
26 | --------- | ||
27 | |||
28 | For PCI cards, the joystick is enabled when the appropriate module | ||
29 | option is specified. Some drivers don't need options, and the | ||
30 | joystick support is always enabled. In the former ALSA version, there | ||
31 | was a dynamic control API for the joystick activation. It was | ||
32 | changed, however, to the static module options because of the system | ||
33 | stability and the resource management. | ||
34 | |||
35 | The following PCI drivers support the joystick natively. | ||
36 | |||
37 | Driver Module Option Available Values | ||
38 | --------------------------------------------------------------------------- | ||
39 | als4000 joystick_port 0 = disable (default), 1 = auto-detect, | ||
40 | manual: any address (e.g. 0x200) | ||
41 | au88x0 N/A N/A | ||
42 | azf3328 joystick 0 = disable, 1 = enable, -1 = auto (default) | ||
43 | ens1370 joystick 0 = disable (default), 1 = enable | ||
44 | ens1371 joystick_port 0 = disable (default), 1 = auto-detect, | ||
45 | manual: 0x200, 0x208, 0x210, 0x218 | ||
46 | cmipci joystick_port 0 = disable (default), 1 = auto-detect, | ||
47 | manual: any address (e.g. 0x200) | ||
48 | cs4281 N/A N/A | ||
49 | cs46xx N/A N/A | ||
50 | es1938 N/A N/A | ||
51 | es1968 joystick 0 = disable (default), 1 = enable | ||
52 | sonicvibes N/A N/A | ||
53 | trident N/A N/A | ||
54 | via82xx(*1) joystick 0 = disable (default), 1 = enable | ||
55 | ymfpci joystick_port 0 = disable (default), 1 = auto-detect, | ||
56 | manual: 0x201, 0x202, 0x204, 0x205(*2) | ||
57 | --------------------------------------------------------------------------- | ||
58 | |||
59 | *1) VIA686A/B only | ||
60 | *2) With YMF744/754 chips, the port address can be chosen arbitrarily | ||
61 | |||
62 | The following drivers don't support gameport natively, but there are | ||
63 | additional modules. Load the corresponding module to add the gameport | ||
64 | support. | ||
65 | |||
66 | Driver Additional Module | ||
67 | ----------------------------- | ||
68 | emu10k1 emu10k1-gp | ||
69 | fm801 fm801-gp | ||
70 | ----------------------------- | ||
71 | |||
72 | Note: the "pcigame" and "cs461x" modules are for the OSS drivers only. | ||
73 | These ALSA drivers (cs46xx, trident and au88x0) have the | ||
74 | built-in gameport support. | ||
75 | |||
76 | As mentioned above, ALSA PCI drivers have the built-in gameport | ||
77 | support, so you don't have to load ns558 module. Just load "joydev" | ||
78 | and the appropriate adapter module (e.g. "analog"). | ||
79 | |||
80 | |||
81 | ISA Cards | ||
82 | --------- | ||
83 | |||
84 | ALSA ISA drivers don't have the built-in gameport support. | ||
85 | Instead, you need to load "ns558" module in addition to "joydev" and | ||
86 | the adapter module (e.g. "analog"). | ||
diff --git a/Documentation/sound/alsa/MIXART.txt b/Documentation/sound/alsa/MIXART.txt new file mode 100644 index 000000000000..5cb970612870 --- /dev/null +++ b/Documentation/sound/alsa/MIXART.txt | |||
@@ -0,0 +1,100 @@ | |||
1 | Alsa driver for Digigram miXart8 and miXart8AES/EBU soundcards | ||
2 | Digigram <alsa@digigram.com> | ||
3 | |||
4 | |||
5 | GENERAL | ||
6 | ======= | ||
7 | |||
8 | The miXart8 is a multichannel audio processing and mixing soundcard | ||
9 | that has 4 stereo audio inputs and 4 stereo audio outputs. | ||
10 | The miXart8AES/EBU is the same with a add-on card that offers further | ||
11 | 4 digital stereo audio inputs and outputs. | ||
12 | Furthermore the add-on card offers external clock synchronisation | ||
13 | (AES/EBU, Word Clock, Time Code and Video Synchro) | ||
14 | |||
15 | The mainboard has a PowerPC that offers onboard mpeg encoding and | ||
16 | decoding, samplerate conversions and various effects. | ||
17 | |||
18 | The driver don't work properly at all until the certain firmwares | ||
19 | are loaded, i.e. no PCM nor mixer devices will appear. | ||
20 | Use the mixartloader that can be found in the alsa-tools package. | ||
21 | |||
22 | |||
23 | VERSION 0.1.0 | ||
24 | ============= | ||
25 | |||
26 | One miXart8 board will be represented as 4 alsa cards, each with 1 | ||
27 | stereo analog capture 'pcm0c' and 1 stereo analog playback 'pcm0p' device. | ||
28 | With a miXart8AES/EBU there is in addition 1 stereo digital input | ||
29 | 'pcm1c' and 1 stereo digital output 'pcm1p' per card. | ||
30 | |||
31 | Formats | ||
32 | ------- | ||
33 | U8, S16_LE, S16_BE, S24_3LE, S24_3BE, FLOAT_LE, FLOAT_BE | ||
34 | Sample rates : 8000 - 48000 Hz continously | ||
35 | |||
36 | Playback | ||
37 | -------- | ||
38 | For instance the playback devices are configured to have max. 4 | ||
39 | substreams performing hardware mixing. This could be changed to a | ||
40 | maximum of 24 substreams if wished. | ||
41 | Mono files will be played on the left and right channel. Each channel | ||
42 | can be muted for each stream to use 8 analog/digital outputs seperately. | ||
43 | |||
44 | Capture | ||
45 | ------- | ||
46 | There is one substream per capture device. For instance only stereo | ||
47 | formats are supported. | ||
48 | |||
49 | Mixer | ||
50 | ----- | ||
51 | <Master> and <Master Capture> : analog volume control of playback and capture PCM. | ||
52 | <PCM 0-3> and <PCM Capture> : digital volume control of each analog substream. | ||
53 | <AES 0-3> and <AES Capture> : digital volume control of each AES/EBU substream. | ||
54 | <Monitoring> : Loopback from 'pcm0c' to 'pcm0p' with digital volume | ||
55 | and mute control. | ||
56 | |||
57 | Rem : for best audio quality try to keep a 0 attenuation on the PCM | ||
58 | and AES volume controls which is set by 219 in the range from 0 to 255 | ||
59 | (about 86% with alsamixer) | ||
60 | |||
61 | |||
62 | NOT YET IMPLEMENTED | ||
63 | =================== | ||
64 | |||
65 | - external clock support (AES/EBU, Word Clock, Time Code, Video Sync) | ||
66 | - MPEG audio formats | ||
67 | - mono record | ||
68 | - on-board effects and samplerate conversions | ||
69 | - linked streams | ||
70 | |||
71 | |||
72 | FIRMWARE | ||
73 | ======== | ||
74 | |||
75 | [As of 2.6.11, the firmware can be loaded automatically with hotplug | ||
76 | when CONFIG_FW_LOADER is set. The mixartloader is necessary only | ||
77 | for older versions or when you build the driver into kernel.] | ||
78 | |||
79 | For loading the firmware automatically after the module is loaded, use | ||
80 | the post-install command. For example, add the following entry to | ||
81 | /etc/modprobe.conf for miXart driver: | ||
82 | |||
83 | install snd-mixart /sbin/modprobe --first-time -i snd-mixart && \ | ||
84 | /usr/bin/mixartloader | ||
85 | (for 2.2/2.4 kernels, add "post-install snd-mixart /usr/bin/vxloader" to | ||
86 | /etc/modules.conf, instead.) | ||
87 | |||
88 | The firmware binaries are installed on /usr/share/alsa/firmware | ||
89 | (or /usr/local/share/alsa/firmware, depending to the prefix option of | ||
90 | configure). There will be a miXart.conf file, which define the dsp image | ||
91 | files. | ||
92 | |||
93 | The firmware files are copyright by Digigram SA | ||
94 | |||
95 | |||
96 | COPYRIGHT | ||
97 | ========= | ||
98 | |||
99 | Copyright (c) 2003 Digigram SA <alsa@digigram.com> | ||
100 | Distributalbe under GPL. | ||
diff --git a/Documentation/sound/alsa/OSS-Emulation.txt b/Documentation/sound/alsa/OSS-Emulation.txt new file mode 100644 index 000000000000..ec2a02541d5b --- /dev/null +++ b/Documentation/sound/alsa/OSS-Emulation.txt | |||
@@ -0,0 +1,297 @@ | |||
1 | NOTES ON KERNEL OSS-EMULATION | ||
2 | ============================= | ||
3 | |||
4 | Jan. 22, 2004 Takashi Iwai <tiwai@suse.de> | ||
5 | |||
6 | |||
7 | Modules | ||
8 | ======= | ||
9 | |||
10 | ALSA provides a powerful OSS emulation on the kernel. | ||
11 | The OSS emulation for PCM, mixer and sequencer devices is implemented | ||
12 | as add-on kernel modules, snd-pcm-oss, snd-mixer-oss and snd-seq-oss. | ||
13 | When you need to access the OSS PCM, mixer or sequencer devices, the | ||
14 | corresponding module has to be loaded. | ||
15 | |||
16 | These modules are loaded automatically when the corresponding service | ||
17 | is called. The alias is defined sound-service-x-y, where x and y are | ||
18 | the card number and the minor unit number. Usually you don't have to | ||
19 | define these aliases by yourself. | ||
20 | |||
21 | Only necessary step for auto-loading of OSS modules is to define the | ||
22 | card alias in /etc/modprobe.conf, such as | ||
23 | |||
24 | alias sound-slot-0 snd-emu10k1 | ||
25 | |||
26 | As the second card, define sound-slot-1 as well. | ||
27 | Note that you can't use the aliased name as the target name (i.e. | ||
28 | "alias sound-slot-0 snd-card-0" doesn't work any more like the old | ||
29 | modutils). | ||
30 | |||
31 | The currently available OSS configuration is shown in | ||
32 | /proc/asound/oss/sndstat. This shows in the same syntax of | ||
33 | /dev/sndstat, which is available on the commercial OSS driver. | ||
34 | On ALSA, you can symlink /dev/sndstat to this proc file. | ||
35 | |||
36 | Please note that the devices listed in this proc file appear only | ||
37 | after the corresponding OSS-emulation module is loaded. Don't worry | ||
38 | even if "NOT ENABLED IN CONFIG" is shown in it. | ||
39 | |||
40 | |||
41 | Device Mapping | ||
42 | ============== | ||
43 | |||
44 | ALSA supports the following OSS device files: | ||
45 | |||
46 | PCM: | ||
47 | /dev/dspX | ||
48 | /dev/adspX | ||
49 | |||
50 | Mixer: | ||
51 | /dev/mixerX | ||
52 | |||
53 | MIDI: | ||
54 | /dev/midi0X | ||
55 | /dev/amidi0X | ||
56 | |||
57 | Sequencer: | ||
58 | /dev/sequencer | ||
59 | /dev/sequencer2 (aka /dev/music) | ||
60 | |||
61 | where X is the card number from 0 to 7. | ||
62 | |||
63 | (NOTE: Some distributions have the device files like /dev/midi0 and | ||
64 | /dev/midi1. They are NOT for OSS but for tclmidi, which is | ||
65 | a totally different thing.) | ||
66 | |||
67 | Unlike the real OSS, ALSA cannot use the device files more than the | ||
68 | assigned ones. For example, the first card cannot use /dev/dsp1 or | ||
69 | /dev/dsp2, but only /dev/dsp0 and /dev/adsp0. | ||
70 | |||
71 | As seen above, PCM and MIDI may have two devices. Usually, the first | ||
72 | PCM device (hw:0,0 in ALSA) is mapped to /dev/dsp and the secondary | ||
73 | device (hw:0,1) to /dev/adsp (if available). For MIDI, /dev/midi and | ||
74 | /dev/amidi, respectively. | ||
75 | |||
76 | You can change this device mapping via the module options of | ||
77 | snd-pcm-oss and snd-rawmidi. In the case of PCM, the following | ||
78 | options are available for snd-pcm-oss: | ||
79 | |||
80 | dsp_map PCM device number assigned to /dev/dspX | ||
81 | (default = 0) | ||
82 | adsp_map PCM device number assigned to /dev/adspX | ||
83 | (default = 1) | ||
84 | |||
85 | For example, to map the third PCM device (hw:0,2) to /dev/adsp0, | ||
86 | define like this: | ||
87 | |||
88 | options snd-pcm-oss adsp_map=2 | ||
89 | |||
90 | The options take arrays. For configuring the second card, specify | ||
91 | two entries separated by comma. For example, to map the third PCM | ||
92 | device on the second card to /dev/adsp1, define like below: | ||
93 | |||
94 | options snd-pcm-oss adsp_map=0,2 | ||
95 | |||
96 | To change the mapping of MIDI devices, the following options are | ||
97 | available for snd-rawmidi: | ||
98 | |||
99 | midi_map MIDI device number assigned to /dev/midi0X | ||
100 | (default = 0) | ||
101 | amidi_map MIDI device number assigned to /dev/amidi0X | ||
102 | (default = 1) | ||
103 | |||
104 | For example, to assign the third MIDI device on the first card to | ||
105 | /dev/midi00, define as follows: | ||
106 | |||
107 | options snd-rawmidi midi_map=2 | ||
108 | |||
109 | |||
110 | PCM Mode | ||
111 | ======== | ||
112 | |||
113 | As default, ALSA emulates the OSS PCM with so-called plugin layer, | ||
114 | i.e. tries to convert the sample format, rate or channels | ||
115 | automatically when the card doesn't support it natively. | ||
116 | This will lead to some problems for some applications like quake or | ||
117 | wine, especially if they use the card only in the MMAP mode. | ||
118 | |||
119 | In such a case, you can change the behavior of PCM per application by | ||
120 | writing a command to the proc file. There is a proc file for each PCM | ||
121 | stream, /proc/asound/cardX/pcmY[cp]/oss, where X is the card number | ||
122 | (zero-based), Y the PCM device number (zero-based), and 'p' is for | ||
123 | playback and 'c' for capture, respectively. Note that this proc file | ||
124 | exists only after snd-pcm-oss module is loaded. | ||
125 | |||
126 | The command sequence has the following syntax: | ||
127 | |||
128 | app_name fragments fragment_size [options] | ||
129 | |||
130 | app_name is the name of application with (higher priority) or without | ||
131 | path. | ||
132 | fragments specifies the number of fragments or zero if no specific | ||
133 | number is given. | ||
134 | fragment_size is the size of fragment in bytes or zero if not given. | ||
135 | options is the optional parameters. The following options are | ||
136 | available: | ||
137 | |||
138 | disable the application tries to open a pcm device for | ||
139 | this channel but does not want to use it. | ||
140 | direct don't use plugins | ||
141 | block force block open mode | ||
142 | non-block force non-block open mode | ||
143 | partial-frag write also partial fragments (affects playback only) | ||
144 | no-silence do not fill silence ahead to avoid clicks | ||
145 | |||
146 | The disable option is useful when one stream direction (playback or | ||
147 | capture) is not handled correctly by the application although the | ||
148 | hardware itself does support both directions. | ||
149 | The direct option is used, as mentioned above, to bypass the automatic | ||
150 | conversion and useful for MMAP-applications. | ||
151 | For example, to playback the first PCM device without plugins for | ||
152 | quake, send a command via echo like the following: | ||
153 | |||
154 | % echo "quake 0 0 direct" > /proc/asound/card0/pcm0p/oss | ||
155 | |||
156 | While quake wants only playback, you may append the second command | ||
157 | to notify driver that only this direction is about to be allocated: | ||
158 | |||
159 | % echo "quake 0 0 disable" > /proc/asound/card0/pcm0c/oss | ||
160 | |||
161 | The permission of proc files depend on the module options of snd. | ||
162 | As default it's set as root, so you'll likely need to be superuser for | ||
163 | sending the command above. | ||
164 | |||
165 | The block and non-block options are used to change the behavior of | ||
166 | opening the device file. | ||
167 | |||
168 | As default, ALSA behaves as original OSS drivers, i.e. does not block | ||
169 | the file when it's busy. The -EBUSY error is returned in this case. | ||
170 | |||
171 | This blocking behavior can be changed globally via nonblock_open | ||
172 | module option of snd-pcm-oss. For using the blocking mode as default | ||
173 | for OSS devices, define like the following: | ||
174 | |||
175 | options snd-pcm-oss nonblock_open=0 | ||
176 | |||
177 | The partial-frag and no-silence commands have been added recently. | ||
178 | Both commands are for optimization use only. The former command | ||
179 | specifies to invoke the write transfer only when the whole fragment is | ||
180 | filled. The latter stops writing the silence data ahead | ||
181 | automatically. Both are disabled as default. | ||
182 | |||
183 | You can check the currently defined configuration by reading the proc | ||
184 | file. The read image can be sent to the proc file again, hence you | ||
185 | can save the current configuration | ||
186 | |||
187 | % cat /proc/asound/card0/pcm0p/oss > /somewhere/oss-cfg | ||
188 | |||
189 | and restore it like | ||
190 | |||
191 | % cat /somewhere/oss-cfg > /proc/asound/card0/pcm0p/oss | ||
192 | |||
193 | Also, for clearing all the current configuration, send "erase" command | ||
194 | as below: | ||
195 | |||
196 | % echo "erase" > /proc/asound/card0/pcm0p/oss | ||
197 | |||
198 | |||
199 | Mixer Elements | ||
200 | ============== | ||
201 | |||
202 | Since ALSA has completely different mixer interface, the emulation of | ||
203 | OSS mixer is relatively complicated. ALSA builds up a mixer element | ||
204 | from several different ALSA (mixer) controls based on the name | ||
205 | string. For example, the volume element SOUND_MIXER_PCM is composed | ||
206 | from "PCM Playback Volume" and "PCM Playback Switch" controls for the | ||
207 | playback direction and from "PCM Capture Volume" and "PCM Capture | ||
208 | Switch" for the capture directory (if exists). When the PCM volume of | ||
209 | OSS is changed, all the volume and switch controls above are adjusted | ||
210 | automatically. | ||
211 | |||
212 | As default, ALSA uses the following control for OSS volumes: | ||
213 | |||
214 | OSS volume ALSA control Index | ||
215 | ----------------------------------------------------- | ||
216 | SOUND_MIXER_VOLUME Master 0 | ||
217 | SOUND_MIXER_BASS Tone Control - Bass 0 | ||
218 | SOUND_MIXER_TREBLE Tone Control - Treble 0 | ||
219 | SOUND_MIXER_SYNTH Synth 0 | ||
220 | SOUND_MIXER_PCM PCM 0 | ||
221 | SOUND_MIXER_SPEAKER PC Speaker 0 | ||
222 | SOUND_MIXER_LINE Line 0 | ||
223 | SOUND_MIXER_MIC Mic 0 | ||
224 | SOUND_MIXER_CD CD 0 | ||
225 | SOUND_MIXER_IMIX Monitor Mix 0 | ||
226 | SOUND_MIXER_ALTPCM PCM 1 | ||
227 | SOUND_MIXER_RECLEV (not assigned) | ||
228 | SOUND_MIXER_IGAIN Capture 0 | ||
229 | SOUND_MIXER_OGAIN Playback 0 | ||
230 | SOUND_MIXER_LINE1 Aux 0 | ||
231 | SOUND_MIXER_LINE2 Aux 1 | ||
232 | SOUND_MIXER_LINE3 Aux 2 | ||
233 | SOUND_MIXER_DIGITAL1 Digital 0 | ||
234 | SOUND_MIXER_DIGITAL2 Digital 1 | ||
235 | SOUND_MIXER_DIGITAL3 Digital 2 | ||
236 | SOUND_MIXER_PHONEIN Phone 0 | ||
237 | SOUND_MIXER_PHONEOUT Phone 1 | ||
238 | SOUND_MIXER_VIDEO Video 0 | ||
239 | SOUND_MIXER_RADIO Radio 0 | ||
240 | SOUND_MIXER_MONITOR Monitor 0 | ||
241 | |||
242 | The second column is the base-string of the corresponding ALSA | ||
243 | control. In fact, the controls with "XXX [Playback|Capture] | ||
244 | [Volume|Switch]" will be checked in addition. | ||
245 | |||
246 | The current assignment of these mixer elements is listed in the proc | ||
247 | file, /proc/asound/cardX/oss_mixer, which will be like the following | ||
248 | |||
249 | VOLUME "Master" 0 | ||
250 | BASS "" 0 | ||
251 | TREBLE "" 0 | ||
252 | SYNTH "" 0 | ||
253 | PCM "PCM" 0 | ||
254 | ... | ||
255 | |||
256 | where the first column is the OSS volume element, the second column | ||
257 | the base-string of the corresponding ALSA control, and the third the | ||
258 | control index. When the string is empty, it means that the | ||
259 | corresponding OSS control is not available. | ||
260 | |||
261 | For changing the assignment, you can write the configuration to this | ||
262 | proc file. For example, to map "Wave Playback" to the PCM volume, | ||
263 | send the command like the following: | ||
264 | |||
265 | % echo 'VOLUME "Wave Playback" 0' > /proc/asound/card0/oss_mixer | ||
266 | |||
267 | The command is exactly as same as listed in the proc file. You can | ||
268 | change one or more elements, one volume per line. In the last | ||
269 | example, both "Wave Playback Volume" and "Wave Playback Switch" will | ||
270 | be affected when PCM volume is changed. | ||
271 | |||
272 | Like the case of PCM proc file, the permission of proc files depend on | ||
273 | the module options of snd. you'll likely need to be superuser for | ||
274 | sending the command above. | ||
275 | |||
276 | As well as in the case of PCM proc file, you can save and restore the | ||
277 | current mixer configuration by reading and writing the whole file | ||
278 | image. | ||
279 | |||
280 | |||
281 | Unsupported Features | ||
282 | ==================== | ||
283 | |||
284 | MMAP on ICE1712 driver | ||
285 | ---------------------- | ||
286 | ICE1712 supports only the unconventional format, interleaved | ||
287 | 10-channels 24bit (packed in 32bit) format. Therefore you cannot mmap | ||
288 | the buffer as the conventional (mono or 2-channels, 8 or 16bit) format | ||
289 | on OSS. | ||
290 | |||
291 | USB devices | ||
292 | ----------- | ||
293 | Some USB devices support only 24bit format packed in 3bytes. This | ||
294 | format is not supported by OSS and no conversion is provided by kernel | ||
295 | OSS emulation. You can use the user-space OSS emulation via libaoss | ||
296 | instead. | ||
297 | |||
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt new file mode 100644 index 000000000000..25c5d648aef6 --- /dev/null +++ b/Documentation/sound/alsa/Procfile.txt | |||
@@ -0,0 +1,191 @@ | |||
1 | Proc Files of ALSA Drivers | ||
2 | ========================== | ||
3 | Takashi Iwai <tiwai@suse.de> | ||
4 | |||
5 | General | ||
6 | ------- | ||
7 | |||
8 | ALSA has its own proc tree, /proc/asound. Many useful information are | ||
9 | found in this tree. When you encounter a problem and need debugging, | ||
10 | check the files listed in the following sections. | ||
11 | |||
12 | Each card has its subtree cardX, where X is from 0 to 7. The | ||
13 | card-specific files are stored in the card* subdirectories. | ||
14 | |||
15 | |||
16 | Global Information | ||
17 | ------------------ | ||
18 | |||
19 | cards | ||
20 | Shows the list of currently configured ALSA drivers, | ||
21 | index, the id string, short and long descriptions. | ||
22 | |||
23 | version | ||
24 | Shows the version string and compile date. | ||
25 | |||
26 | modules | ||
27 | Lists the module of each card | ||
28 | |||
29 | devices | ||
30 | Lists the ALSA native device mappings. | ||
31 | |||
32 | meminfo | ||
33 | Shows the status of allocated pages via ALSA drivers. | ||
34 | Appears only when CONFIG_SND_DEBUG=y. | ||
35 | |||
36 | hwdep | ||
37 | Lists the currently available hwdep devices in format of | ||
38 | <card>-<device>: <name> | ||
39 | |||
40 | pcm | ||
41 | Lists the currently available PCM devices in format of | ||
42 | <card>-<device>: <id>: <name> : <sub-streams> | ||
43 | |||
44 | timer | ||
45 | Lists the currently available timer devices | ||
46 | |||
47 | |||
48 | oss/devices | ||
49 | Lists the OSS device mappings. | ||
50 | |||
51 | oss/sndstat | ||
52 | Provides the output compatible with /dev/sndstat. | ||
53 | You can symlink this to /dev/sndstat. | ||
54 | |||
55 | |||
56 | Card Specific Files | ||
57 | ------------------- | ||
58 | |||
59 | The card-specific files are found in /proc/asound/card* directories. | ||
60 | Some drivers (e.g. cmipci) have their own proc entries for the | ||
61 | register dump, etc (e.g. /proc/asound/card*/cmipci shows the register | ||
62 | dump). These files would be really helpful for debugging. | ||
63 | |||
64 | When PCM devices are available on this card, you can see directories | ||
65 | like pcm0p or pcm1c. They hold the PCM information for each PCM | ||
66 | stream. The number after 'pcm' is the PCM device number from 0, and | ||
67 | the last 'p' or 'c' means playback or capture direction. The files in | ||
68 | this subtree is described later. | ||
69 | |||
70 | The status of MIDI I/O is found in midi* files. It shows the device | ||
71 | name and the received/transmitted bytes through the MIDI device. | ||
72 | |||
73 | When the card is equipped with AC97 codecs, there are codec97#* | ||
74 | subdirectories (desribed later). | ||
75 | |||
76 | When the OSS mixer emulation is enabled (and the module is loaded), | ||
77 | oss_mixer file appears here, too. This shows the current mapping of | ||
78 | OSS mixer elements to the ALSA control elements. You can change the | ||
79 | mapping by writing to this device. Read OSS-Emulation.txt for | ||
80 | details. | ||
81 | |||
82 | |||
83 | PCM Proc Files | ||
84 | -------------- | ||
85 | |||
86 | card*/pcm*/info | ||
87 | The general information of this PCM device: card #, device #, | ||
88 | substreams, etc. | ||
89 | |||
90 | card*/pcm*/xrun_debug | ||
91 | This file appears when CONFIG_SND_DEBUG=y. | ||
92 | This shows the status of xrun (= buffer overrun/xrun) debug of | ||
93 | ALSA PCM middle layer, as an integer from 0 to 2. The value | ||
94 | can be changed by writing to this file, such as | ||
95 | |||
96 | # cat 2 > /proc/asound/card0/pcm0p/xrun_debug | ||
97 | |||
98 | When this value is greater than 0, the driver will show the | ||
99 | messages to kernel log when an xrun is detected. The debug | ||
100 | message is shown also when the invalid H/W pointer is detected | ||
101 | at the update of periods (usually called from the interrupt | ||
102 | handler). | ||
103 | |||
104 | When this value is greater than 1, the driver will show the | ||
105 | stack trace additionally. This may help the debugging. | ||
106 | |||
107 | card*/pcm*/sub*/info | ||
108 | The general information of this PCM sub-stream. | ||
109 | |||
110 | card*/pcm*/sub*/status | ||
111 | The current status of this PCM sub-stream, elapsed time, | ||
112 | H/W position, etc. | ||
113 | |||
114 | card*/pcm*/sub*/hw_params | ||
115 | The hardware parameters set for this sub-stream. | ||
116 | |||
117 | card*/pcm*/sub*/sw_params | ||
118 | The soft parameters set for this sub-stream. | ||
119 | |||
120 | card*/pcm*/sub*/prealloc | ||
121 | The buffer pre-allocation information. | ||
122 | |||
123 | |||
124 | AC97 Codec Information | ||
125 | ---------------------- | ||
126 | |||
127 | card*/codec97#*/ac97#?-? | ||
128 | Shows the general information of this AC97 codec chip, such as | ||
129 | name, capabilities, set up. | ||
130 | |||
131 | card*/codec97#0/ac97#?-?+regs | ||
132 | Shows the AC97 register dump. Useful for debugging. | ||
133 | |||
134 | When CONFIG_SND_DEBUG is enabled, you can write to this file for | ||
135 | changing an AC97 register directly. Pass two hex numbers. | ||
136 | For example, | ||
137 | |||
138 | # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs | ||
139 | |||
140 | |||
141 | Sequencer Information | ||
142 | --------------------- | ||
143 | |||
144 | seq/drivers | ||
145 | Lists the currently available ALSA sequencer drivers. | ||
146 | |||
147 | seq/clients | ||
148 | Shows the list of currently available sequencer clinets and | ||
149 | ports. The connection status and the running status are shown | ||
150 | in this file, too. | ||
151 | |||
152 | seq/queues | ||
153 | Lists the currently allocated/running sequener queues. | ||
154 | |||
155 | seq/timer | ||
156 | Lists the currently allocated/running sequencer timers. | ||
157 | |||
158 | seq/oss | ||
159 | Lists the OSS-compatible sequencer stuffs. | ||
160 | |||
161 | |||
162 | Help For Debugging? | ||
163 | ------------------- | ||
164 | |||
165 | When the problem is related with PCM, first try to turn on xrun_debug | ||
166 | mode. This will give you the kernel messages when and where xrun | ||
167 | happened. | ||
168 | |||
169 | If it's really a bug, report it with the following information | ||
170 | |||
171 | - the name of the driver/card, show in /proc/asound/cards | ||
172 | - the reigster dump, if available (e.g. card*/cmipci) | ||
173 | |||
174 | when it's a PCM problem, | ||
175 | |||
176 | - set-up of PCM, shown in hw_parms, sw_params, and status in the PCM | ||
177 | sub-stream directory | ||
178 | |||
179 | when it's a mixer problem, | ||
180 | |||
181 | - AC97 proc files, codec97#*/* files | ||
182 | |||
183 | for USB audio/midi, | ||
184 | |||
185 | - output of lsusb -v | ||
186 | - stream* files in card directory | ||
187 | |||
188 | |||
189 | The ALSA bug-tracking system is found at: | ||
190 | |||
191 | https://bugtrack.alsa-project.org/alsa-bug/ | ||
diff --git a/Documentation/sound/alsa/SB-Live-mixer.txt b/Documentation/sound/alsa/SB-Live-mixer.txt new file mode 100644 index 000000000000..651adaf60473 --- /dev/null +++ b/Documentation/sound/alsa/SB-Live-mixer.txt | |||
@@ -0,0 +1,356 @@ | |||
1 | |||
2 | Sound Blaster Live mixer / default DSP code | ||
3 | =========================================== | ||
4 | |||
5 | |||
6 | The EMU10K1 chips have a DSP part which can be programmed to support | ||
7 | various ways of sample processing, which is described here. | ||
8 | (This acticle does not deal with the overall functionality of the | ||
9 | EMU10K1 chips. See the manuals section for further details.) | ||
10 | |||
11 | The ALSA driver programs this portion of chip by default code | ||
12 | (can be altered later) which offers the following functionality: | ||
13 | |||
14 | |||
15 | 1) IEC958 (S/PDIF) raw PCM | ||
16 | -------------------------- | ||
17 | |||
18 | This PCM device (it's the 4th PCM device (index 3!) and first subdevice | ||
19 | (index 0) for a given card) allows to forward 48kHz, stereo, 16-bit | ||
20 | little endian streams without any modifications to the digital output | ||
21 | (coaxial or optical). The universal interface allows the creation of up | ||
22 | to 8 raw PCM devices operating at 48kHz, 16-bit little endian. It would | ||
23 | be easy to add support for multichannel devices to the current code, | ||
24 | but the conversion routines exist only for stereo (2-channel streams) | ||
25 | at the time. | ||
26 | |||
27 | Look to tram_poke routines in lowlevel/emu10k1/emufx.c for more details. | ||
28 | |||
29 | |||
30 | 2) Digital mixer controls | ||
31 | ------------------------- | ||
32 | |||
33 | These controls are built using the DSP instructions. They offer extended | ||
34 | functionality. Only the default build-in code in the ALSA driver is described | ||
35 | here. Note that the controls work as attenuators: the maximum value is the | ||
36 | neutral position leaving the signal unchanged. Note that if the same destination | ||
37 | is mentioned in multiple controls, the signal is accumulated and can be wrapped | ||
38 | (set to maximal or minimal value without checking of overflow). | ||
39 | |||
40 | |||
41 | Explanation of used abbreviations: | ||
42 | |||
43 | DAC - digital to analog converter | ||
44 | ADC - analog to digital converter | ||
45 | I2S - one-way three wire serial bus for digital sound by Philips Semiconductors | ||
46 | (this standard is used for connecting standalone DAC and ADC converters) | ||
47 | LFE - low frequency effects (subwoofer signal) | ||
48 | AC97 - a chip containing an analog mixer, DAC and ADC converters | ||
49 | IEC958 - S/PDIF | ||
50 | FX-bus - the EMU10K1 chip has an effect bus containing 16 accumulators. | ||
51 | Each of the synthesizer voices can feed its output to these accumulators | ||
52 | and the DSP microcontroller can operate with the resulting sum. | ||
53 | |||
54 | |||
55 | name='Wave Playback Volume',index=0 | ||
56 | |||
57 | This control is used to attenuate samples for left and right PCM FX-bus | ||
58 | accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples. | ||
59 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. | ||
60 | |||
61 | name='Wave Surround Playback Volume',index=0 | ||
62 | |||
63 | This control is used to attenuate samples for left and right PCM FX-bus | ||
64 | accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples. | ||
65 | The result samples are forwarded to the rear I2S DACs. These DACs operates | ||
66 | separately (they are not inside the AC97 codec). | ||
67 | |||
68 | name='Wave Center Playback Volume',index=0 | ||
69 | |||
70 | This control is used to attenuate samples for left and right PCM FX-bus | ||
71 | accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples. | ||
72 | The result is mixed to mono signal (single channel) and forwarded to | ||
73 | the ??rear?? right DAC PCM slot of the AC97 codec. | ||
74 | |||
75 | name='Wave LFE Playback Volume',index=0 | ||
76 | |||
77 | This control is used to attenuate samples for left and right PCM FX-bus | ||
78 | accumulators. ALSA uses accumulators 0 and 1 for left and right PCM. | ||
79 | The result is mixed to mono signal (single channel) and forwarded to | ||
80 | the ??rear?? left DAC PCM slot of the AC97 codec. | ||
81 | |||
82 | name='Wave Capture Volume',index=0 | ||
83 | name='Wave Capture Switch',index=0 | ||
84 | |||
85 | These controls are used to attenuate samples for left and right PCM FX-bus | ||
86 | accumulator. ALSA uses accumulators 0 and 1 for left and right PCM. | ||
87 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | ||
88 | PCM device). | ||
89 | |||
90 | name='Music Playback Volume',index=0 | ||
91 | |||
92 | This control is used to attenuate samples for left and right MIDI FX-bus | ||
93 | accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. | ||
94 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. | ||
95 | |||
96 | name='Music Capture Volume',index=0 | ||
97 | name='Music Capture Switch',index=0 | ||
98 | |||
99 | These controls are used to attenuate samples for left and right MIDI FX-bus | ||
100 | accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. | ||
101 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | ||
102 | PCM device). | ||
103 | |||
104 | name='Surround Playback Volume',index=0 | ||
105 | |||
106 | This control is used to attenuate samples for left and right rear PCM FX-bus | ||
107 | accumulators. ALSA uses accumulators 2 and 3 for left and right rear PCM samples. | ||
108 | The result samples are forwarded to the rear I2S DACs. These DACs operate | ||
109 | separately (they are not inside the AC97 codec). | ||
110 | |||
111 | name='Surround Capture Volume',index=0 | ||
112 | name='Surround Capture Switch',index=0 | ||
113 | |||
114 | These controls are used to attenuate samples for left and right rear PCM FX-bus | ||
115 | accumulators. ALSA uses accumulators 2 and 3 for left and right rear PCM samples. | ||
116 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | ||
117 | PCM device). | ||
118 | |||
119 | name='Center Playback Volume',index=0 | ||
120 | |||
121 | This control is used to attenuate sample for center PCM FX-bus accumulator. | ||
122 | ALSA uses accumulator 6 for center PCM sample. The result sample is forwarded | ||
123 | to the ??rear?? right DAC PCM slot of the AC97 codec. | ||
124 | |||
125 | name='LFE Playback Volume',index=0 | ||
126 | |||
127 | This control is used to attenuate sample for center PCM FX-bus accumulator. | ||
128 | ALSA uses accumulator 6 for center PCM sample. The result sample is forwarded | ||
129 | to the ??rear?? left DAC PCM slot of the AC97 codec. | ||
130 | |||
131 | name='AC97 Playback Volume',index=0 | ||
132 | |||
133 | This control is used to attenuate samples for left and right front ADC PCM slots | ||
134 | of the AC97 codec. The result samples are forwarded to the front DAC PCM | ||
135 | slots of the AC97 codec. | ||
136 | ******************************************************************************** | ||
137 | *** Note: This control should be zero for the standard operations, otherwise *** | ||
138 | *** a digital loopback is activated. *** | ||
139 | ******************************************************************************** | ||
140 | |||
141 | name='AC97 Capture Volume',index=0 | ||
142 | |||
143 | This control is used to attenuate samples for left and right front ADC PCM slots | ||
144 | of the AC97 codec. The result is forwarded to the ADC capture FIFO (thus to | ||
145 | the standard capture PCM device). | ||
146 | ******************************************************************************** | ||
147 | *** Note: This control should be 100 (maximal value), otherwise no analog *** | ||
148 | *** inputs of the AC97 codec can be captured (recorded). *** | ||
149 | ******************************************************************************** | ||
150 | |||
151 | name='IEC958 TTL Playback Volume',index=0 | ||
152 | |||
153 | This control is used to attenuate samples from left and right IEC958 TTL | ||
154 | digital inputs (usually used by a CDROM drive). The result samples are | ||
155 | forwarded to the front DAC PCM slots of the AC97 codec. | ||
156 | |||
157 | name='IEC958 TTL Capture Volume',index=0 | ||
158 | |||
159 | This control is used to attenuate samples from left and right IEC958 TTL | ||
160 | digital inputs (usually used by a CDROM drive). The result samples are | ||
161 | forwarded to the ADC capture FIFO (thus to the standard capture PCM device). | ||
162 | |||
163 | name='Zoom Video Playback Volume',index=0 | ||
164 | |||
165 | This control is used to attenuate samples from left and right zoom video | ||
166 | digital inputs (usually used by a CDROM drive). The result samples are | ||
167 | forwarded to the front DAC PCM slots of the AC97 codec. | ||
168 | |||
169 | name='Zoom Video Capture Volume',index=0 | ||
170 | |||
171 | This control is used to attenuate samples from left and right zoom video | ||
172 | digital inputs (usually used by a CDROM drive). The result samples are | ||
173 | forwarded to the ADC capture FIFO (thus to the standard capture PCM device). | ||
174 | |||
175 | name='IEC958 LiveDrive Playback Volume',index=0 | ||
176 | |||
177 | This control is used to attenuate samples from left and right IEC958 optical | ||
178 | digital input. The result samples are forwarded to the front DAC PCM slots | ||
179 | of the AC97 codec. | ||
180 | |||
181 | name='IEC958 LiveDrive Capture Volume',index=0 | ||
182 | |||
183 | This control is used to attenuate samples from left and right IEC958 optical | ||
184 | digital inputs. The result samples are forwarded to the ADC capture FIFO | ||
185 | (thus to the standard capture PCM device). | ||
186 | |||
187 | name='IEC958 Coaxial Playback Volume',index=0 | ||
188 | |||
189 | This control is used to attenuate samples from left and right IEC958 coaxial | ||
190 | digital inputs. The result samples are forwarded to the front DAC PCM slots | ||
191 | of the AC97 codec. | ||
192 | |||
193 | name='IEC958 Coaxial Capture Volume',index=0 | ||
194 | |||
195 | This control is used to attenuate samples from left and right IEC958 coaxial | ||
196 | digital inputs. The result samples are forwarded to the ADC capture FIFO | ||
197 | (thus to the standard capture PCM device). | ||
198 | |||
199 | name='Line LiveDrive Playback Volume',index=0 | ||
200 | name='Line LiveDrive Playback Volume',index=1 | ||
201 | |||
202 | This control is used to attenuate samples from left and right I2S ADC | ||
203 | inputs (on the LiveDrive). The result samples are forwarded to the front | ||
204 | DAC PCM slots of the AC97 codec. | ||
205 | |||
206 | name='Line LiveDrive Capture Volume',index=1 | ||
207 | name='Line LiveDrive Capture Volume',index=1 | ||
208 | |||
209 | This control is used to attenuate samples from left and right I2S ADC | ||
210 | inputs (on the LiveDrive). The result samples are forwarded to the ADC | ||
211 | capture FIFO (thus to the standard capture PCM device). | ||
212 | |||
213 | name='Tone Control - Switch',index=0 | ||
214 | |||
215 | This control turns the tone control on or off. The samples for front, rear | ||
216 | and center / LFE outputs are affected. | ||
217 | |||
218 | name='Tone Control - Bass',index=0 | ||
219 | |||
220 | This control sets the bass intensity. There is no neutral value!! | ||
221 | When the tone control code is activated, the samples are always modified. | ||
222 | The closest value to pure signal is 20. | ||
223 | |||
224 | name='Tone Control - Treble',index=0 | ||
225 | |||
226 | This control sets the treble intensity. There is no neutral value!! | ||
227 | When the tone control code is activated, the samples are always modified. | ||
228 | The closest value to pure signal is 20. | ||
229 | |||
230 | name='IEC958 Optical Raw Playback Switch',index=0 | ||
231 | |||
232 | If this switch is on, then the samples for the IEC958 (S/PDIF) digital | ||
233 | output are taken only from the raw FX8010 PCM, otherwise standard front | ||
234 | PCM samples are taken. | ||
235 | |||
236 | name='Headphone Playback Volume',index=1 | ||
237 | |||
238 | This control attenuates the samples for the headphone output. | ||
239 | |||
240 | name='Headphone Center Playback Switch',index=1 | ||
241 | |||
242 | If this switch is on, then the sample for the center PCM is put to the | ||
243 | left headphone output (useful for SB Live cards without separate center/LFE | ||
244 | output). | ||
245 | |||
246 | name='Headphone LFE Playback Switch',index=1 | ||
247 | |||
248 | If this switch is on, then the sample for the center PCM is put to the | ||
249 | right headphone output (useful for SB Live cards without separate center/LFE | ||
250 | output). | ||
251 | |||
252 | |||
253 | 3) PCM stream related controls | ||
254 | ------------------------------ | ||
255 | |||
256 | name='EMU10K1 PCM Volume',index 0-31 | ||
257 | |||
258 | Channel volume attenuation in range 0-0xffff. The maximum value (no | ||
259 | attenuation) is default. The channel mapping for three values is | ||
260 | as follows: | ||
261 | |||
262 | 0 - mono, default 0xffff (no attenuation) | ||
263 | 1 - left, default 0xffff (no attenuation) | ||
264 | 2 - right, default 0xffff (no attenuation) | ||
265 | |||
266 | name='EMU10K1 PCM Send Routing',index 0-31 | ||
267 | |||
268 | This control specifies the destination - FX-bus accumulators. There are | ||
269 | twelve values with this mapping: | ||
270 | |||
271 | 0 - mono, A destination (FX-bus 0-15), default 0 | ||
272 | 1 - mono, B destination (FX-bus 0-15), default 1 | ||
273 | 2 - mono, C destination (FX-bus 0-15), default 2 | ||
274 | 3 - mono, D destination (FX-bus 0-15), default 3 | ||
275 | 4 - left, A destination (FX-bus 0-15), default 0 | ||
276 | 5 - left, B destination (FX-bus 0-15), default 1 | ||
277 | 6 - left, C destination (FX-bus 0-15), default 2 | ||
278 | 7 - left, D destination (FX-bus 0-15), default 3 | ||
279 | 8 - right, A destination (FX-bus 0-15), default 0 | ||
280 | 9 - right, B destination (FX-bus 0-15), default 1 | ||
281 | 10 - right, C destination (FX-bus 0-15), default 2 | ||
282 | 11 - right, D destination (FX-bus 0-15), default 3 | ||
283 | |||
284 | Don't forget that it's illegal to assign a channel to the same FX-bus accumulator | ||
285 | more than once (it means 0=0 && 1=0 is an invalid combination). | ||
286 | |||
287 | name='EMU10K1 PCM Send Volume',index 0-31 | ||
288 | |||
289 | It specifies the attenuation (amount) for given destination in range 0-255. | ||
290 | The channel mapping is following: | ||
291 | |||
292 | 0 - mono, A destination attn, default 255 (no attenuation) | ||
293 | 1 - mono, B destination attn, default 255 (no attenuation) | ||
294 | 2 - mono, C destination attn, default 0 (mute) | ||
295 | 3 - mono, D destination attn, default 0 (mute) | ||
296 | 4 - left, A destination attn, default 255 (no attenuation) | ||
297 | 5 - left, B destination attn, default 0 (mute) | ||
298 | 6 - left, C destination attn, default 0 (mute) | ||
299 | 7 - left, D destination attn, default 0 (mute) | ||
300 | 8 - right, A destination attn, default 0 (mute) | ||
301 | 9 - right, B destination attn, default 255 (no attenuation) | ||
302 | 10 - right, C destination attn, default 0 (mute) | ||
303 | 11 - right, D destination attn, default 0 (mute) | ||
304 | |||
305 | |||
306 | |||
307 | 4) MANUALS/PATENTS: | ||
308 | ------------------- | ||
309 | |||
310 | ftp://opensource.creative.com/pub/doc | ||
311 | ------------------------------------- | ||
312 | |||
313 | Files: | ||
314 | LM4545.pdf AC97 Codec | ||
315 | |||
316 | m2049.pdf The EMU10K1 Digital Audio Processor | ||
317 | |||
318 | hog63.ps FX8010 - A DSP Chip Architecture for Audio Effects | ||
319 | |||
320 | |||
321 | WIPO Patents | ||
322 | ------------ | ||
323 | Patent numbers: | ||
324 | WO 9901813 (A1) Audio Effects Processor with multiple asynchronous (Jan. 14, 1999) | ||
325 | streams | ||
326 | |||
327 | WO 9901814 (A1) Processor with Instruction Set for Audio Effects (Jan. 14, 1999) | ||
328 | |||
329 | WO 9901953 (A1) Audio Effects Processor having Decoupled Instruction | ||
330 | Execution and Audio Data Sequencing (Jan. 14, 1999) | ||
331 | |||
332 | |||
333 | US Patents (http://www.uspto.gov/) | ||
334 | ---------------------------------- | ||
335 | |||
336 | US 5925841 Digital Sampling Instrument employing cache memory (Jul. 20, 1999) | ||
337 | |||
338 | US 5928342 Audio Effects Processor integrated on a single chip (Jul. 27, 1999) | ||
339 | with a multiport memory onto which multiple asynchronous | ||
340 | digital sound samples can be concurrently loaded | ||
341 | |||
342 | US 5930158 Processor with Instruction Set for Audio Effects (Jul. 27, 1999) | ||
343 | |||
344 | US 6032235 Memory initialization circuit (Tram) (Feb. 29, 2000) | ||
345 | |||
346 | US 6138207 Interpolation looping of audio samples in cache connected to (Oct. 24, 2000) | ||
347 | system bus with prioritization and modification of bus transfers | ||
348 | in accordance with loop ends and minimum block sizes | ||
349 | |||
350 | US 6151670 Method for conserving memory storage using a (Nov. 21, 2000) | ||
351 | pool of short term memory registers | ||
352 | |||
353 | US 6195715 Interrupt control for multiple programs communicating with (Feb. 27, 2001) | ||
354 | a common interrupt by associating programs to GP registers, | ||
355 | defining interrupt register, polling GP registers, and invoking | ||
356 | callback routine associated with defined interrupt register | ||
diff --git a/Documentation/sound/alsa/VIA82xx-mixer.txt b/Documentation/sound/alsa/VIA82xx-mixer.txt new file mode 100644 index 000000000000..1b0ac06ba95d --- /dev/null +++ b/Documentation/sound/alsa/VIA82xx-mixer.txt | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | VIA82xx mixer | ||
3 | ============= | ||
4 | |||
5 | On many VIA82xx boards, the 'Input Source Select' mixer control does not work. | ||
6 | Setting it to 'Input2' on such boards will cause recording to hang, or fail | ||
7 | with EIO (input/output error) via OSS emulation. This control should be left | ||
8 | at 'Input1' for such cards. | ||
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt new file mode 100644 index 000000000000..e9d07b8f1acb --- /dev/null +++ b/Documentation/sound/alsa/hda_codec.txt | |||
@@ -0,0 +1,299 @@ | |||
1 | Notes on Universal Interface for Intel High Definition Audio Codec | ||
2 | ------------------------------------------------------------------ | ||
3 | |||
4 | Takashi Iwai <tiwai@suse.de> | ||
5 | |||
6 | |||
7 | [Still a draft version] | ||
8 | |||
9 | |||
10 | General | ||
11 | ======= | ||
12 | |||
13 | The snd-hda-codec module supports the generic access function for the | ||
14 | High Definition (HD) audio codecs. It's designed to be independent | ||
15 | from the controller code like ac97 codec module. The real accessors | ||
16 | from/to the controller must be implemented in the lowlevel driver. | ||
17 | |||
18 | The structure of this module is similar with ac97_codec module. | ||
19 | Each codec chip belongs to a bus class which communicates with the | ||
20 | controller. | ||
21 | |||
22 | |||
23 | Initialization of Bus Instance | ||
24 | ============================== | ||
25 | |||
26 | The card driver has to create struct hda_bus at first. The template | ||
27 | struct should be filled and passed to the constructor: | ||
28 | |||
29 | struct hda_bus_template { | ||
30 | void *private_data; | ||
31 | struct pci_dev *pci; | ||
32 | const char *modelname; | ||
33 | struct hda_bus_ops ops; | ||
34 | }; | ||
35 | |||
36 | The card driver can set and use the private_data field to retrieve its | ||
37 | own data in callback functions. The pci field is used when the patch | ||
38 | needs to check the PCI subsystem IDs, so on. For non-PCI system, it | ||
39 | doesn't have to be set, of course. | ||
40 | The modelname field specifies the board's specific configuration. The | ||
41 | string is passed to the codec parser, and it depends on the parser how | ||
42 | the string is used. | ||
43 | These fields, private_data, pci and modelname are all optional. | ||
44 | |||
45 | The ops field contains the callback functions as the following: | ||
46 | |||
47 | struct hda_bus_ops { | ||
48 | int (*command)(struct hda_codec *codec, hda_nid_t nid, int direct, | ||
49 | unsigned int verb, unsigned int parm); | ||
50 | unsigned int (*get_response)(struct hda_codec *codec); | ||
51 | void (*private_free)(struct hda_bus *); | ||
52 | }; | ||
53 | |||
54 | The command callback is called when the codec module needs to send a | ||
55 | VERB to the controller. It's always a single command. | ||
56 | The get_response callback is called when the codec requires the answer | ||
57 | for the last command. These two callbacks are mandatory and have to | ||
58 | be given. | ||
59 | The last, private_free callback, is optional. It's called in the | ||
60 | destructor to release any necessary data in the lowlevel driver. | ||
61 | |||
62 | The bus instance is created via snd_hda_bus_new(). You need to pass | ||
63 | the card instance, the template, and the pointer to store the | ||
64 | resultant bus instance. | ||
65 | |||
66 | int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp, | ||
67 | struct hda_bus **busp); | ||
68 | |||
69 | It returns zero if successful. A negative return value means any | ||
70 | error during creation. | ||
71 | |||
72 | |||
73 | Creation of Codec Instance | ||
74 | ========================== | ||
75 | |||
76 | Each codec chip on the board is then created on the BUS instance. | ||
77 | To create a codec instance, call snd_hda_codec_new(). | ||
78 | |||
79 | int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | ||
80 | struct hda_codec **codecp); | ||
81 | |||
82 | The first argument is the BUS instance, the second argument is the | ||
83 | address of the codec, and the last one is the pointer to store the | ||
84 | resultant codec instance (can be NULL if not needed). | ||
85 | |||
86 | The codec is stored in a linked list of bus instance. You can follow | ||
87 | the codec list like: | ||
88 | |||
89 | struct list_head *p; | ||
90 | struct hda_codec *codec; | ||
91 | list_for_each(p, &bus->codec_list) { | ||
92 | codec = list_entry(p, struct hda_codec, list); | ||
93 | ... | ||
94 | } | ||
95 | |||
96 | The codec isn't initialized at this stage properly. The | ||
97 | initialization sequence is called when the controls are built later. | ||
98 | |||
99 | |||
100 | Codec Access | ||
101 | ============ | ||
102 | |||
103 | To access codec, use snd_codec_read() and snd_codec_write(). | ||
104 | snd_hda_param_read() is for reading parameters. | ||
105 | For writing a sequence of verbs, use snd_hda_sequence_write(). | ||
106 | |||
107 | To retrieve the number of sub nodes connected to the given node, use | ||
108 | snd_hda_get_sub_nodes(). The connection list can be obtained via | ||
109 | snd_hda_get_connections() call. | ||
110 | |||
111 | When an unsolicited event happens, pass the event via | ||
112 | snd_hda_queue_unsol_event() so that the codec routines will process it | ||
113 | later. | ||
114 | |||
115 | |||
116 | (Mixer) Controls | ||
117 | ================ | ||
118 | |||
119 | To create mixer controls of all codecs, call | ||
120 | snd_hda_build_controls(). It then builds the mixers and does | ||
121 | initialization stuff on each codec. | ||
122 | |||
123 | |||
124 | PCM Stuff | ||
125 | ========= | ||
126 | |||
127 | snd_hda_build_pcms() gives the necessary information to create PCM | ||
128 | streams. When it's called, each codec belonging to the bus stores | ||
129 | codec->num_pcms and codec->pcm_info fields. The num_pcms indicates | ||
130 | the number of elements in pcm_info array. The card driver is supposed | ||
131 | to traverse the codec linked list, read the pcm information in | ||
132 | pcm_info array, and build pcm instances according to them. | ||
133 | |||
134 | The pcm_info array contains the following record: | ||
135 | |||
136 | /* PCM information for each substream */ | ||
137 | struct hda_pcm_stream { | ||
138 | unsigned int substreams; /* number of substreams, 0 = not exist */ | ||
139 | unsigned int channels_min; /* min. number of channels */ | ||
140 | unsigned int channels_max; /* max. number of channels */ | ||
141 | hda_nid_t nid; /* default NID to query rates/formats/bps, or set up */ | ||
142 | u32 rates; /* supported rates */ | ||
143 | u64 formats; /* supported formats (SNDRV_PCM_FMTBIT_) */ | ||
144 | unsigned int maxbps; /* supported max. bit per sample */ | ||
145 | struct hda_pcm_ops ops; | ||
146 | }; | ||
147 | |||
148 | /* for PCM creation */ | ||
149 | struct hda_pcm { | ||
150 | char *name; | ||
151 | struct hda_pcm_stream stream[2]; | ||
152 | }; | ||
153 | |||
154 | The name can be passed to snd_pcm_new(). The stream field contains | ||
155 | the information for playback (SNDRV_PCM_STREAM_PLAYBACK = 0) and | ||
156 | capture (SNDRV_PCM_STREAM_CAPTURE = 1) directions. The card driver | ||
157 | should pass substreams to snd_pcm_new() for the number of substreams | ||
158 | to create. | ||
159 | |||
160 | The channels_min, channels_max, rates and formats should be copied to | ||
161 | runtime->hw record. They and maxbps fields are used also to compute | ||
162 | the format value for the HDA codec and controller. Call | ||
163 | snd_hda_calc_stream_format() to get the format value. | ||
164 | |||
165 | The ops field contains the following callback functions: | ||
166 | |||
167 | struct hda_pcm_ops { | ||
168 | int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec, | ||
169 | snd_pcm_substream_t *substream); | ||
170 | int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec, | ||
171 | snd_pcm_substream_t *substream); | ||
172 | int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec, | ||
173 | unsigned int stream_tag, unsigned int format, | ||
174 | snd_pcm_substream_t *substream); | ||
175 | int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec, | ||
176 | snd_pcm_substream_t *substream); | ||
177 | }; | ||
178 | |||
179 | All are non-NULL, so you can call them safely without NULL check. | ||
180 | |||
181 | The open callback should be called in PCM open after runtime->hw is | ||
182 | set up. It may override some setting and constraints additionally. | ||
183 | Similarly, the close callback should be called in the PCM close. | ||
184 | |||
185 | The prepare callback should be called in PCM prepare. This will set | ||
186 | up the codec chip properly for the operation. The cleanup should be | ||
187 | called in hw_free to clean up the configuration. | ||
188 | |||
189 | The caller should check the return value, at least for open and | ||
190 | prepare callbacks. When a negative value is returned, some error | ||
191 | occurred. | ||
192 | |||
193 | |||
194 | Proc Files | ||
195 | ========== | ||
196 | |||
197 | Each codec dumps the widget node information in | ||
198 | /proc/asound/card*/codec#* file. This information would be really | ||
199 | helpful for debugging. Please provide its contents together with the | ||
200 | bug report. | ||
201 | |||
202 | |||
203 | Power Management | ||
204 | ================ | ||
205 | |||
206 | It's simple: | ||
207 | Call snd_hda_suspend() in the PM suspend callback. | ||
208 | Call snd_hda_resume() in the PM resume callback. | ||
209 | |||
210 | |||
211 | Codec Preset (Patch) | ||
212 | ==================== | ||
213 | |||
214 | To set up and handle the codec functionality fully, each codec may | ||
215 | have a codec preset (patch). It's defined in struct hda_codec_preset: | ||
216 | |||
217 | struct hda_codec_preset { | ||
218 | unsigned int id; | ||
219 | unsigned int mask; | ||
220 | unsigned int subs; | ||
221 | unsigned int subs_mask; | ||
222 | unsigned int rev; | ||
223 | const char *name; | ||
224 | int (*patch)(struct hda_codec *codec); | ||
225 | }; | ||
226 | |||
227 | When the codec id and codec subsystem id match with the given id and | ||
228 | subs fields bitwise (with bitmask mask and subs_mask), the callback | ||
229 | patch is called. The patch callback should initialize the codec and | ||
230 | set the codec->patch_ops field. This is defined as below: | ||
231 | |||
232 | struct hda_codec_ops { | ||
233 | int (*build_controls)(struct hda_codec *codec); | ||
234 | int (*build_pcms)(struct hda_codec *codec); | ||
235 | int (*init)(struct hda_codec *codec); | ||
236 | void (*free)(struct hda_codec *codec); | ||
237 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | ||
238 | #ifdef CONFIG_PM | ||
239 | int (*suspend)(struct hda_codec *codec, pm_message_t state); | ||
240 | int (*resume)(struct hda_codec *codec); | ||
241 | #endif | ||
242 | }; | ||
243 | |||
244 | The build_controls callback is called from snd_hda_build_controls(). | ||
245 | Similarly, the build_pcms callback is called from | ||
246 | snd_hda_build_pcms(). The init callback is called after | ||
247 | build_controls to initialize the hardware. | ||
248 | The free callback is called as a destructor. | ||
249 | |||
250 | The unsol_event callback is called when an unsolicited event is | ||
251 | received. | ||
252 | |||
253 | The suspend and resume callbacks are for power management. | ||
254 | |||
255 | Each entry can be NULL if not necessary to be called. | ||
256 | |||
257 | |||
258 | Generic Parser | ||
259 | ============== | ||
260 | |||
261 | When the device doesn't match with any given presets, the widgets are | ||
262 | parsed via th generic parser (hda_generic.c). Its support is | ||
263 | limited: no multi-channel support, for example. | ||
264 | |||
265 | |||
266 | Digital I/O | ||
267 | =========== | ||
268 | |||
269 | Call snd_hda_create_spdif_out_ctls() from the patch to create controls | ||
270 | related with SPDIF out. In the patch resume callback, call | ||
271 | snd_hda_resume_spdif(). | ||
272 | |||
273 | |||
274 | Helper Functions | ||
275 | ================ | ||
276 | |||
277 | snd_hda_get_codec_name() stores the codec name on the given string. | ||
278 | |||
279 | snd_hda_check_board_config() can be used to obtain the configuration | ||
280 | information matching with the device. Define the table with struct | ||
281 | hda_board_config entries (zero-terminated), and pass it to the | ||
282 | function. The function checks the modelname given as a module | ||
283 | parameter, and PCI subsystem IDs. If the matching entry is found, it | ||
284 | returns the config field value. | ||
285 | |||
286 | snd_hda_add_new_ctls() can be used to create and add control entries. | ||
287 | Pass the zero-terminated array of snd_kcontrol_new_t. The same array | ||
288 | can be passed to snd_hda_resume_ctls() for resume. | ||
289 | Note that this will call control->put callback of these entries. So, | ||
290 | put callback should check codec->in_resume and force to restore the | ||
291 | given value if it's non-zero even if the value is identical with the | ||
292 | cached value. | ||
293 | |||
294 | Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be | ||
295 | used for the entry of snd_kcontrol_new_t. | ||
296 | |||
297 | The input MUX helper callbacks for such a control are provided, too: | ||
298 | snd_hda_input_mux_info() and snd_hda_input_mux_put(). See | ||
299 | patch_realtek.c for example. | ||
diff --git a/Documentation/sound/alsa/seq_oss.html b/Documentation/sound/alsa/seq_oss.html new file mode 100644 index 000000000000..d9776cf60c07 --- /dev/null +++ b/Documentation/sound/alsa/seq_oss.html | |||
@@ -0,0 +1,409 @@ | |||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | ||
2 | <HTML> | ||
3 | <HEAD> | ||
4 | <TITLE>OSS Sequencer Emulation on ALSA</TITLE> | ||
5 | </HEAD> | ||
6 | <BODY> | ||
7 | |||
8 | <CENTER> | ||
9 | <H1> | ||
10 | |||
11 | <HR WIDTH="100%"></H1></CENTER> | ||
12 | |||
13 | <CENTER> | ||
14 | <H1> | ||
15 | OSS Sequencer Emulation on ALSA</H1></CENTER> | ||
16 | |||
17 | <HR WIDTH="100%"> | ||
18 | <P>Copyright (c) 1998,1999 by Takashi Iwai | ||
19 | <TT><A HREF="mailto:iwai@ww.uni-erlangen.de"><iwai@ww.uni-erlangen.de></A></TT> | ||
20 | <P>ver.0.1.8; Nov. 16, 1999 | ||
21 | <H2> | ||
22 | |||
23 | <HR WIDTH="100%"></H2> | ||
24 | |||
25 | <H2> | ||
26 | 1. Description</H2> | ||
27 | This directory contains the OSS sequencer emulation driver on ALSA. Note | ||
28 | that this program is still in the development state. | ||
29 | <P>What this does - it provides the emulation of the OSS sequencer, access | ||
30 | via | ||
31 | <TT>/dev/sequencer</TT> and <TT>/dev/music</TT> devices. | ||
32 | The most of applications using OSS can run if the appropriate ALSA | ||
33 | sequencer is prepared. | ||
34 | <P>The following features are emulated by this driver: | ||
35 | <UL> | ||
36 | <LI> | ||
37 | Normal sequencer and MIDI events:</LI> | ||
38 | |||
39 | <BR>They are converted to the ALSA sequencer events, and sent to the corresponding | ||
40 | port. | ||
41 | <LI> | ||
42 | Timer events:</LI> | ||
43 | |||
44 | <BR>The timer is not selectable by ioctl. The control rate is fixed to | ||
45 | 100 regardless of HZ. That is, even on Alpha system, a tick is always | ||
46 | 1/100 second. The base rate and tempo can be changed in <TT>/dev/music</TT>. | ||
47 | |||
48 | <LI> | ||
49 | Patch loading:</LI> | ||
50 | |||
51 | <BR>It purely depends on the synth drivers whether it's supported since | ||
52 | the patch loading is realized by callback to the synth driver. | ||
53 | <LI> | ||
54 | I/O controls:</LI> | ||
55 | |||
56 | <BR>Most of controls are accepted. Some controls | ||
57 | are dependent on the synth driver, as well as even on original OSS.</UL> | ||
58 | Furthermore, you can find the following advanced features: | ||
59 | <UL> | ||
60 | <LI> | ||
61 | Better queue mechanism:</LI> | ||
62 | |||
63 | <BR>The events are queued before processing them. | ||
64 | <LI> | ||
65 | Multiple applications:</LI> | ||
66 | |||
67 | <BR>You can run two or more applications simultaneously (even for OSS sequencer)! | ||
68 | However, each MIDI device is exclusive - that is, if a MIDI device is opened | ||
69 | once by some application, other applications can't use it. No such a restriction | ||
70 | in synth devices. | ||
71 | <LI> | ||
72 | Real-time event processing:</LI> | ||
73 | |||
74 | <BR>The events can be processed in real time without using out of bound | ||
75 | ioctl. To switch to real-time mode, send ABSTIME 0 event. The followed | ||
76 | events will be processed in real-time without queued. To switch off the | ||
77 | real-time mode, send RELTIME 0 event. | ||
78 | <LI> | ||
79 | <TT>/proc</TT> interface:</LI> | ||
80 | |||
81 | <BR>The status of applications and devices can be shown via <TT>/proc/asound/seq/oss</TT> | ||
82 | at any time. In the later version, configuration will be changed via <TT>/proc</TT> | ||
83 | interface, too.</UL> | ||
84 | |||
85 | <H2> | ||
86 | 2. Installation</H2> | ||
87 | Run configure script with both sequencer support (<TT>--with-sequencer=yes</TT>) | ||
88 | and OSS emulation (<TT>--with-oss=yes</TT>) options. A module <TT>snd-seq-oss.o</TT> | ||
89 | will be created. If the synth module of your sound card supports for OSS | ||
90 | emulation (so far, only Emu8000 driver), this module will be loaded automatically. | ||
91 | Otherwise, you need to load this module manually. | ||
92 | <P>At beginning, this module probes all the MIDI ports which have been | ||
93 | already connected to the sequencer. Once after that, the creation and deletion | ||
94 | of ports are watched by announcement mechanism of ALSA sequencer. | ||
95 | <P>The available synth and MIDI devices can be found in proc interface. | ||
96 | Run "<TT>cat /proc/asound/seq/oss</TT>", and check the devices. For example, | ||
97 | if you use an AWE64 card, you'll see like the following: | ||
98 | <PRE> OSS sequencer emulation version 0.1.8 | ||
99 | ALSA client number 63 | ||
100 | ALSA receiver port 0 | ||
101 | |||
102 | Number of applications: 0 | ||
103 | |||
104 | Number of synth devices: 1 | ||
105 | |||
106 | synth 0: [EMU8000] | ||
107 | type 0x1 : subtype 0x20 : voices 32 | ||
108 | capabilties : ioctl enabled / load_patch enabled | ||
109 | |||
110 | Number of MIDI devices: 3 | ||
111 | |||
112 | midi 0: [Emu8000 Port-0] ALSA port 65:0 | ||
113 | capability write / opened none | ||
114 | |||
115 | midi 1: [Emu8000 Port-1] ALSA port 65:1 | ||
116 | capability write / opened none | ||
117 | |||
118 | midi 2: [0: MPU-401 (UART)] ALSA port 64:0 | ||
119 | capability read/write / opened none</PRE> | ||
120 | Note that the device number may be different from the information of | ||
121 | <TT>/proc/asound/oss-devices</TT> | ||
122 | or ones of the original OSS driver. Use the device number listed in <TT>/proc/asound/seq/oss</TT> | ||
123 | to play via OSS sequencer emulation. | ||
124 | <H2> | ||
125 | 3. Using Synthesizer Devices</H2> | ||
126 | Run your favorite program. I've tested playmidi-2.4, awemidi-0.4.3, gmod-3.1 | ||
127 | and xmp-1.1.5. You can load samples via <TT>/dev/sequencer</TT> like sfxload, | ||
128 | too. | ||
129 | <P>If the lowlevel driver supports multiple access to synth devices (like | ||
130 | Emu8000 driver), two or more applications are allowed to run at the same | ||
131 | time. | ||
132 | <H2> | ||
133 | 4. Using MIDI Devices</H2> | ||
134 | So far, only MIDI output was tested. MIDI input was not checked at all, | ||
135 | but hopefully it will work. Use the device number listed in <TT>/proc/asound/seq/oss</TT>. | ||
136 | Be aware that these numbers are mostly different from the list in | ||
137 | <TT>/proc/asound/oss-devices</TT>. | ||
138 | <H2> | ||
139 | 5. Module Options</H2> | ||
140 | The following module options are available: | ||
141 | <UL> | ||
142 | <LI> | ||
143 | <TT>maxqlen</TT></LI> | ||
144 | |||
145 | <BR>specifies the maximum read/write queue length. This queue is private | ||
146 | for OSS sequencer, so that it is independent from the queue length of ALSA | ||
147 | sequencer. Default value is 1024. | ||
148 | <LI> | ||
149 | <TT>seq_oss_debug</TT></LI> | ||
150 | |||
151 | <BR>specifies the debug level and accepts zero (= no debug message) or | ||
152 | positive integer. Default value is 0.</UL> | ||
153 | |||
154 | <H2> | ||
155 | 6. Queue Mechanism</H2> | ||
156 | OSS sequencer emulation uses an ALSA priority queue. The | ||
157 | events from <TT>/dev/sequencer</TT> are processed and put onto the queue | ||
158 | specified by module option. | ||
159 | <P>All the events from <TT>/dev/sequencer</TT> are parsed at beginning. | ||
160 | The timing events are also parsed at this moment, so that the events may | ||
161 | be processed in real-time. Sending an event ABSTIME 0 switches the operation | ||
162 | mode to real-time mode, and sending an event RELTIME 0 switches it off. | ||
163 | In the real-time mode, all events are dispatched immediately. | ||
164 | <P>The queued events are dispatched to the corresponding ALSA sequencer | ||
165 | ports after scheduled time by ALSA sequencer dispatcher. | ||
166 | <P>If the write-queue is full, the application sleeps until a certain amount | ||
167 | (as default one half) becomes empty in blocking mode. The synchronization | ||
168 | to write timing was implemented, too. | ||
169 | <P>The input from MIDI devices or echo-back events are stored on read FIFO | ||
170 | queue. If application reads <TT>/dev/sequencer</TT> in blocking mode, the | ||
171 | process will be awaked. | ||
172 | |||
173 | <H2> | ||
174 | 7. Interface to Synthesizer Device</H2> | ||
175 | |||
176 | <H3> | ||
177 | 7.1. Registration</H3> | ||
178 | To register an OSS synthesizer device, use <TT>snd_seq_oss_synth_register</TT> | ||
179 | function. | ||
180 | <PRE>int snd_seq_oss_synth_register(char *name, int type, int subtype, int nvoices, | ||
181 | snd_seq_oss_callback_t *oper, void *private_data)</PRE> | ||
182 | The arguments <TT>name</TT>, <TT>type</TT>, <TT>subtype</TT> and | ||
183 | <TT>nvoices</TT> | ||
184 | are used for making the appropriate synth_info structure for ioctl. The | ||
185 | return value is an index number of this device. This index must be remembered | ||
186 | for unregister. If registration is failed, -errno will be returned. | ||
187 | <P>To release this device, call <TT>snd_seq_oss_synth_unregister function</TT>: | ||
188 | <PRE>int snd_seq_oss_synth_unregister(int index),</PRE> | ||
189 | where the <TT>index</TT> is the index number returned by register function. | ||
190 | <H3> | ||
191 | 7.2. Callbacks</H3> | ||
192 | OSS synthesizer devices have capability for sample downloading and ioctls | ||
193 | like sample reset. In OSS emulation, these special features are realized | ||
194 | by using callbacks. The registration argument oper is used to specify these | ||
195 | callbacks. The following callback functions must be defined: | ||
196 | <PRE>snd_seq_oss_callback_t: | ||
197 | int (*open)(snd_seq_oss_arg_t *p, void *closure); | ||
198 | int (*close)(snd_seq_oss_arg_t *p); | ||
199 | int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg); | ||
200 | int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char *buf, int offs, int count); | ||
201 | int (*reset)(snd_seq_oss_arg_t *p); | ||
202 | Except for <TT>open</TT> and <TT>close</TT> callbacks, they are allowed | ||
203 | to be NULL. | ||
204 | <P>Each callback function takes the argument type snd_seq_oss_arg_t as the | ||
205 | first argument. | ||
206 | <PRE>struct snd_seq_oss_arg_t { | ||
207 | int app_index; | ||
208 | int file_mode; | ||
209 | int seq_mode; | ||
210 | snd_seq_addr_t addr; | ||
211 | void *private_data; | ||
212 | int event_passing; | ||
213 | };</PRE> | ||
214 | The first three fields, <TT>app_index</TT>, <TT>file_mode</TT> and | ||
215 | <TT>seq_mode</TT> | ||
216 | are initialized by OSS sequencer. The <TT>app_index</TT> is the application | ||
217 | index which is unique to each application opening OSS sequencer. The | ||
218 | <TT>file_mode</TT> | ||
219 | is bit-flags indicating the file operation mode. See | ||
220 | <TT>seq_oss.h</TT> | ||
221 | for its meaning. The <TT>seq_mode</TT> is sequencer operation mode. In | ||
222 | the current version, only <TT>SND_OSSSEQ_MODE_SYNTH</TT> is used. | ||
223 | <P>The next two fields, <TT>addr</TT> and <TT>private_data</TT>, must be | ||
224 | filled by the synth driver at open callback. The <TT>addr</TT> contains | ||
225 | the address of ALSA sequencer port which is assigned to this device. If | ||
226 | the driver allocates memory for <TT>private_data</TT>, it must be released | ||
227 | in close callback by itself. | ||
228 | <P>The last field, <TT>event_passing</TT>, indicates how to translate note-on | ||
229 | / off events. In <TT>PROCESS_EVENTS</TT> mode, the note 255 is regarded | ||
230 | as velocity change, and key pressure event is passed to the port. In <TT>PASS_EVENTS</TT> | ||
231 | mode, all note on/off events are passed to the port without modified. <TT>PROCESS_KEYPRESS</TT> | ||
232 | mode checks the note above 128 and regards it as key pressure event (mainly | ||
233 | for Emu8000 driver). | ||
234 | <H4> | ||
235 | 7.2.1. Open Callback</H4> | ||
236 | The <TT>open</TT> is called at each time this device is opened by an application | ||
237 | using OSS sequencer. This must not be NULL. Typically, the open callback | ||
238 | does the following procedure: | ||
239 | <OL> | ||
240 | <LI> | ||
241 | Allocate private data record.</LI> | ||
242 | |||
243 | <LI> | ||
244 | Create an ALSA sequencer port.</LI> | ||
245 | |||
246 | <LI> | ||
247 | Set the new port address on arg->addr.</LI> | ||
248 | |||
249 | <LI> | ||
250 | Set the private data record pointer on arg->private_data.</LI> | ||
251 | </OL> | ||
252 | Note that the type bit-flags in port_info of this synth port must NOT contain | ||
253 | <TT>TYPE_MIDI_GENERIC</TT> | ||
254 | bit. Instead, <TT>TYPE_SPECIFIC</TT> should be used. Also, <TT>CAP_SUBSCRIPTION</TT> | ||
255 | bit should NOT be included, too. This is necessary to tell it from other | ||
256 | normal MIDI devices. If the open procedure succeeded, return zero. Otherwise, | ||
257 | return -errno. | ||
258 | <H4> | ||
259 | 7.2.2 Ioctl Callback</H4> | ||
260 | The <TT>ioctl</TT> callback is called when the sequencer receives device-specific | ||
261 | ioctls. The following two ioctls should be processed by this callback: | ||
262 | <UL> | ||
263 | <LI> | ||
264 | <TT>IOCTL_SEQ_RESET_SAMPLES</TT></LI> | ||
265 | |||
266 | <BR>reset all samples on memory -- return 0 | ||
267 | <LI> | ||
268 | <TT>IOCTL_SYNTH_MEMAVL</TT></LI> | ||
269 | |||
270 | <BR>return the available memory size | ||
271 | <LI> | ||
272 | <TT>FM_4OP_ENABLE</TT></LI> | ||
273 | |||
274 | <BR>can be ignored usually</UL> | ||
275 | The other ioctls are processed inside the sequencer without passing to | ||
276 | the lowlevel driver. | ||
277 | <H4> | ||
278 | 7.2.3 Load_Patch Callback</H4> | ||
279 | The <TT>load_patch</TT> callback is used for sample-downloading. This callback | ||
280 | must read the data on user-space and transfer to each device. Return 0 | ||
281 | if succeeded, and -errno if failed. The format argument is the patch key | ||
282 | in patch_info record. The buf is user-space pointer where patch_info record | ||
283 | is stored. The offs can be ignored. The count is total data size of this | ||
284 | sample data. | ||
285 | <H4> | ||
286 | 7.2.4 Close Callback</H4> | ||
287 | The <TT>close</TT> callback is called when this device is closed by the | ||
288 | applicaion. If any private data was allocated in open callback, it must | ||
289 | be released in the close callback. The deletion of ALSA port should be | ||
290 | done here, too. This callback must not be NULL. | ||
291 | <H4> | ||
292 | 7.2.5 Reset Callback</H4> | ||
293 | The <TT>reset</TT> callback is called when sequencer device is reset or | ||
294 | closed by applications. The callback should turn off the sounds on the | ||
295 | relevant port immediately, and initialize the status of the port. If this | ||
296 | callback is undefined, OSS seq sends a <TT>HEARTBEAT</TT> event to the | ||
297 | port. | ||
298 | <H3> | ||
299 | 7.3 Events</H3> | ||
300 | Most of the events are processed by sequencer and translated to the adequate | ||
301 | ALSA sequencer events, so that each synth device can receive by input_event | ||
302 | callback of ALSA sequencer port. The following ALSA events should be implemented | ||
303 | by the driver: | ||
304 | <BR> | ||
305 | <TABLE BORDER WIDTH="75%" NOSAVE > | ||
306 | <TR NOSAVE> | ||
307 | <TD NOSAVE><B>ALSA event</B></TD> | ||
308 | |||
309 | <TD><B>Original OSS events</B></TD> | ||
310 | </TR> | ||
311 | |||
312 | <TR> | ||
313 | <TD>NOTEON</TD> | ||
314 | |||
315 | <TD>SEQ_NOTEON | ||
316 | <BR>MIDI_NOTEON</TD> | ||
317 | </TR> | ||
318 | |||
319 | <TR> | ||
320 | <TD>NOTE</TD> | ||
321 | |||
322 | <TD>SEQ_NOTEOFF | ||
323 | <BR>MIDI_NOTEOFF</TD> | ||
324 | </TR> | ||
325 | |||
326 | <TR NOSAVE> | ||
327 | <TD NOSAVE>KEYPRESS</TD> | ||
328 | |||
329 | <TD>MIDI_KEY_PRESSURE</TD> | ||
330 | </TR> | ||
331 | |||
332 | <TR NOSAVE> | ||
333 | <TD>CHANPRESS</TD> | ||
334 | |||
335 | <TD NOSAVE>SEQ_AFTERTOUCH | ||
336 | <BR>MIDI_CHN_PRESSURE</TD> | ||
337 | </TR> | ||
338 | |||
339 | <TR NOSAVE> | ||
340 | <TD NOSAVE>PGMCHANGE</TD> | ||
341 | |||
342 | <TD NOSAVE>SEQ_PGMCHANGE | ||
343 | <BR>MIDI_PGM_CHANGE</TD> | ||
344 | </TR> | ||
345 | |||
346 | <TR> | ||
347 | <TD>PITCHBEND</TD> | ||
348 | |||
349 | <TD>SEQ_CONTROLLER(CTRL_PITCH_BENDER) | ||
350 | <BR>MIDI_PITCH_BEND</TD> | ||
351 | </TR> | ||
352 | |||
353 | <TR> | ||
354 | <TD>CONTROLLER</TD> | ||
355 | |||
356 | <TD>MIDI_CTL_CHANGE | ||
357 | <BR>SEQ_BALANCE (with CTL_PAN)</TD> | ||
358 | </TR> | ||
359 | |||
360 | <TR> | ||
361 | <TD>CONTROL14</TD> | ||
362 | |||
363 | <TD>SEQ_CONTROLLER</TD> | ||
364 | </TR> | ||
365 | |||
366 | <TR> | ||
367 | <TD>REGPARAM</TD> | ||
368 | |||
369 | <TD>SEQ_CONTROLLER(CTRL_PITCH_BENDER_RANGE)</TD> | ||
370 | </TR> | ||
371 | |||
372 | <TR> | ||
373 | <TD>SYSEX</TD> | ||
374 | |||
375 | <TD>SEQ_SYSEX</TD> | ||
376 | </TR> | ||
377 | </TABLE> | ||
378 | |||
379 | <P>The most of these behavior can be realized by MIDI emulation driver | ||
380 | included in the Emu8000 lowlevel driver. In the future release, this module | ||
381 | will be independent. | ||
382 | <P>Some OSS events (<TT>SEQ_PRIVATE</TT> and <TT>SEQ_VOLUME</TT> events) are passed as event | ||
383 | type SND_SEQ_OSS_PRIVATE. The OSS sequencer passes these event 8 byte | ||
384 | packets without any modification. The lowlevel driver should process these | ||
385 | events appropriately. | ||
386 | <H2> | ||
387 | 8. Interface to MIDI Device</H2> | ||
388 | Since the OSS emulation probes the creation and deletion of ALSA MIDI sequencer | ||
389 | ports automatically by receiving announcement from ALSA sequencer, the | ||
390 | MIDI devices don't need to be registered explicitly like synth devices. | ||
391 | However, the MIDI port_info registered to ALSA sequencer must include a group | ||
392 | name <TT>SND_SEQ_GROUP_DEVICE</TT> and a capability-bit <TT>CAP_READ</TT> or | ||
393 | <TT>CAP_WRITE</TT>. Also, subscription capabilities, <TT>CAP_SUBS_READ</TT> or <TT>CAP_SUBS_WRITE</TT>, | ||
394 | must be defined, too. If these conditions are not satisfied, the port is not | ||
395 | registered as OSS sequencer MIDI device. | ||
396 | <P>The events via MIDI devices are parsed in OSS sequencer and converted | ||
397 | to the corresponding ALSA sequencer events. The input from MIDI sequencer | ||
398 | is also converted to MIDI byte events by OSS sequencer. This works just | ||
399 | a reverse way of seq_midi module. | ||
400 | <H2> | ||
401 | 9. Known Problems / TODO's</H2> | ||
402 | |||
403 | <UL> | ||
404 | <LI> | ||
405 | Patch loading via ALSA instrument layer is not implemented yet.</LI> | ||
406 | </UL> | ||
407 | |||
408 | </BODY> | ||
409 | </HTML> | ||
diff --git a/Documentation/sound/alsa/serial-u16550.txt b/Documentation/sound/alsa/serial-u16550.txt new file mode 100644 index 000000000000..c1919559d509 --- /dev/null +++ b/Documentation/sound/alsa/serial-u16550.txt | |||
@@ -0,0 +1,88 @@ | |||
1 | |||
2 | Serial UART 16450/16550 MIDI driver | ||
3 | =================================== | ||
4 | |||
5 | The adaptor module parameter allows you to select either: | ||
6 | |||
7 | 0 - Roland Soundcanvas support (default) | ||
8 | 1 - Midiator MS-124T support (1) | ||
9 | 2 - Midiator MS-124W S/A mode (2) | ||
10 | 3 - MS-124W M/B mode support (3) | ||
11 | 4 - Generic device with multiple input support (4) | ||
12 | |||
13 | For the Midiator MS-124W, you must set the physical M-S and A-B | ||
14 | switches on the Midiator to match the driver mode you select. | ||
15 | |||
16 | In Roland Soundcanvas mode, multiple ALSA raw MIDI substreams are supported | ||
17 | (midiCnD0-midiCnD15). Whenever you write to a different substream, the driver | ||
18 | sends the nonstandard MIDI command sequence F5 NN, where NN is the substream | ||
19 | number plus 1. Roland modules use this command to switch between different | ||
20 | "parts", so this feature lets you treat each part as a distinct raw MIDI | ||
21 | substream. The driver provides no way to send F5 00 (no selection) or to not | ||
22 | send the F5 NN command sequence at all; perhaps it ought to. | ||
23 | |||
24 | Usage example for simple serial converter: | ||
25 | |||
26 | /sbin/setserial /dev/ttyS0 uart none | ||
27 | /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 speed=115200 | ||
28 | |||
29 | Usage example for Roland SoundCanvas with 4 MIDI ports: | ||
30 | |||
31 | /sbin/setserial /dev/ttyS0 uart none | ||
32 | /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 outs=4 | ||
33 | |||
34 | In MS-124T mode, one raw MIDI substream is supported (midiCnD0); the outs | ||
35 | module parameter is automatically set to 1. The driver sends the same data to | ||
36 | all four MIDI Out connectors. Set the A-B switch and the speed module | ||
37 | parameter to match (A=19200, B=9600). | ||
38 | |||
39 | Usage example for MS-124T, with A-B switch in A position: | ||
40 | |||
41 | /sbin/setserial /dev/ttyS0 uart none | ||
42 | /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 adaptor=1 \ | ||
43 | speed=19200 | ||
44 | |||
45 | In MS-124W S/A mode, one raw MIDI substream is supported (midiCnD0); | ||
46 | the outs module parameter is automatically set to 1. The driver sends | ||
47 | the same data to all four MIDI Out connectors at full MIDI speed. | ||
48 | |||
49 | Usage example for S/A mode: | ||
50 | |||
51 | /sbin/setserial /dev/ttyS0 uart none | ||
52 | /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 adaptor=2 | ||
53 | |||
54 | In MS-124W M/B mode, the driver supports 16 ALSA raw MIDI substreams; | ||
55 | the outs module parameter is automatically set to 16. The substream | ||
56 | number gives a bitmask of which MIDI Out connectors the data should be | ||
57 | sent to, with midiCnD1 sending to Out 1, midiCnD2 to Out 2, midiCnD4 to | ||
58 | Out 3, and midiCnD8 to Out 4. Thus midiCnD15 sends the data to all 4 ports. | ||
59 | As a special case, midiCnD0 also sends to all ports, since it is not useful | ||
60 | to send the data to no ports. M/B mode has extra overhead to select the MIDI | ||
61 | Out for each byte, so the aggregate data rate across all four MIDI Outs is | ||
62 | at most one byte every 520 us, as compared with the full MIDI data rate of | ||
63 | one byte every 320 us per port. | ||
64 | |||
65 | Usage example for M/B mode: | ||
66 | |||
67 | /sbin/setserial /dev/ttyS0 uart none | ||
68 | /sbin/modprobe snd-serial-u16550 port=0x3f8 irq=4 adaptor=3 | ||
69 | |||
70 | The MS-124W hardware's M/A mode is currently not supported. This mode allows | ||
71 | the MIDI Outs to act independently at double the aggregate throughput of M/B, | ||
72 | but does not allow sending the same byte simultaneously to multiple MIDI Outs. | ||
73 | The M/A protocol requires the driver to twiddle the modem control lines under | ||
74 | timing constraints, so it would be a bit more complicated to implement than | ||
75 | the other modes. | ||
76 | |||
77 | Midiator models other than MS-124W and MS-124T are currently not supported. | ||
78 | Note that the suffix letter is significant; the MS-124 and MS-124B are not | ||
79 | compatible, nor are the other known models MS-101, MS-101B, MS-103, and MS-114. | ||
80 | I do have documentation (tim.mann@compaq.com) that partially covers these models, | ||
81 | but no units to experiment with. The MS-124W support is tested with a real unit. | ||
82 | The MS-124T support is untested, but should work. | ||
83 | |||
84 | The Generic driver supports multiple input and output substreams over a single | ||
85 | serial port. Similar to Roland Soundcanvas mode, F5 NN is used to select the | ||
86 | appropriate input or output stream (depending on the data direction). | ||
87 | Additionally, the CTS signal is used to regulate the data flow. The number of | ||
88 | inputs is specified by the ins parameter. | ||
diff --git a/Documentation/sound/oss/AD1816 b/Documentation/sound/oss/AD1816 new file mode 100644 index 000000000000..14bd8f25d523 --- /dev/null +++ b/Documentation/sound/oss/AD1816 | |||
@@ -0,0 +1,84 @@ | |||
1 | Documentation for the AD1816(A) sound driver | ||
2 | ============================================ | ||
3 | |||
4 | Installation: | ||
5 | ------------- | ||
6 | |||
7 | To get your AD1816(A) based sound card work, you'll have to enable support for | ||
8 | experimental code ("Prompt for development and/or incomplete code/drivers") | ||
9 | and isapnp ("Plug and Play support", "ISA Plug and Play support"). Enable | ||
10 | "Sound card support", "OSS modules support" and "Support for AD1816(A) based | ||
11 | cards (EXPERIMENTAL)" in the sound configuration menu, too. Now build, install | ||
12 | and reboot the new kernel as usual. | ||
13 | |||
14 | Features: | ||
15 | --------- | ||
16 | |||
17 | List of features supported by this driver: | ||
18 | - full-duplex support | ||
19 | - supported audio formats: unsigned 8bit, signed 16bit little endian, | ||
20 | signed 16bit big endian, µ-law, A-law | ||
21 | - supported channels: mono and stereo | ||
22 | - supported recording sources: Master, CD, Line, Line1, Line2, Mic | ||
23 | - supports phat 3d stereo circuit (Line 3) | ||
24 | |||
25 | |||
26 | Supported cards: | ||
27 | ---------------- | ||
28 | |||
29 | The following cards are known to work with this driver: | ||
30 | - Terratec Base 1 | ||
31 | - Terratec Base 64 | ||
32 | - HP Kayak | ||
33 | - Acer FX-3D | ||
34 | - SY-1816 | ||
35 | - Highscreen Sound-Boostar 32 Wave 3D | ||
36 | - Highscreen Sound-Boostar 16 | ||
37 | - AVM Apex Pro card | ||
38 | - (Aztech SC-16 3D) | ||
39 | - (Newcom SC-16 3D) | ||
40 | - (Terratec EWS64S) | ||
41 | |||
42 | Cards listed in brackets are not supported reliable. If you have such a card | ||
43 | you should add the extra parameter: | ||
44 | options=1 | ||
45 | when loading the ad1816 module via modprobe. | ||
46 | |||
47 | |||
48 | Troubleshooting: | ||
49 | ---------------- | ||
50 | |||
51 | First of all you should check, if the driver has been loaded | ||
52 | properly. | ||
53 | |||
54 | If loading of the driver succeeds, but playback/capture fails, check | ||
55 | if you used the correct values for irq, dma and dma2 when loading the module. | ||
56 | If one of them is wrong you usually get the following error message: | ||
57 | |||
58 | Nov 6 17:06:13 tek01 kernel: Sound: DMA (output) timed out - IRQ/DRQ config error? | ||
59 | |||
60 | If playback/capture is too fast or to slow, you should have a look at | ||
61 | the clock chip of your sound card. The AD1816 was designed for a 33MHz | ||
62 | oscillator, however most sound card manufacturer use slightly | ||
63 | different oscillators as they are cheaper than 33MHz oscillators. If | ||
64 | you have such a card you have to adjust the ad1816_clockfreq parameter | ||
65 | above. For example: For a card using a 32.875MHz oscillator use | ||
66 | ad1816_clockfreq=32875 instead of ad1816_clockfreq=33000. | ||
67 | |||
68 | |||
69 | Updates, bugfixes and bugreports: | ||
70 | -------------------------------- | ||
71 | |||
72 | As the driver is still experimental and under development, you should | ||
73 | watch out for updates. Updates of the driver are available on the | ||
74 | Internet from one of my home pages: | ||
75 | http://www.student.informatik.tu-darmstadt.de/~tek/projects/linux.html | ||
76 | or: | ||
77 | http://www.tu-darmstadt.de/~tek01/projects/linux.html | ||
78 | |||
79 | Bugreports, bugfixes and related questions should be sent via E-Mail to: | ||
80 | tek@rbg.informatik.tu-darmstadt.de | ||
81 | |||
82 | Thorsten Knabe <tek@rbg.informatik.tu-darmstadt.de> | ||
83 | Christoph Hellwig <hch@infradead.org> | ||
84 | Last modified: 2000/09/20 | ||
diff --git a/Documentation/sound/oss/ALS b/Documentation/sound/oss/ALS new file mode 100644 index 000000000000..d01ffbfd5808 --- /dev/null +++ b/Documentation/sound/oss/ALS | |||
@@ -0,0 +1,66 @@ | |||
1 | ALS-007/ALS-100/ALS-200 based sound cards | ||
2 | ========================================= | ||
3 | |||
4 | Support for sound cards based around the Avance Logic | ||
5 | ALS-007/ALS-100/ALS-200 chip is included. These chips are a single | ||
6 | chip PnP sound solution which is mostly hardware compatible with the | ||
7 | Sound Blaster 16 card, with most differences occurring in the use of | ||
8 | the mixer registers. For this reason the ALS code is integrated | ||
9 | as part of the Sound Blaster 16 driver (adding only 800 bytes to the | ||
10 | SB16 driver). | ||
11 | |||
12 | To use an ALS sound card under Linux, enable the following options as | ||
13 | modules in the sound configuration section of the kernel config: | ||
14 | - 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support | ||
15 | - FM synthesizer (YM3812/OPL-3) support | ||
16 | - standalone MPU401 support may be required for some cards; for the | ||
17 | ALS-007, when using isapnptools, it is required | ||
18 | Since the ALS-007/100/200 are PnP cards, ISAPnP support should probably be | ||
19 | compiled in. If kernel level PnP support is not included, isapnptools will | ||
20 | be required to configure the card before the sound modules are loaded. | ||
21 | |||
22 | When using kernel level ISAPnP, the kernel should correctly identify and | ||
23 | configure all resources required by the card when the "sb" module is | ||
24 | inserted. Note that the ALS-007 does not have a 16 bit DMA channel and that | ||
25 | the MPU401 interface on this card uses a different interrupt to the audio | ||
26 | section. This should all be correctly configured by the kernel; if problems | ||
27 | with the MPU401 interface surface, try using the standalone MPU401 module, | ||
28 | passing "0" as the "sb" module's "mpu_io" module parameter to prevent the | ||
29 | soundblaster driver attempting to register the MPU401 itself. The onboard | ||
30 | synth device can be accessed using the "opl3" module. | ||
31 | |||
32 | If isapnptools is used to wake up the sound card (as in 2.2.x), the settings | ||
33 | of the card's resources should be passed to the kernel modules ("sb", "opl3" | ||
34 | and "mpu401") using the module parameters. When configuring an ALS-007, be | ||
35 | sure to specify different IRQs for the audio and MPU401 sections - this card | ||
36 | requires they be different. For "sb", "io", "irq" and "dma" should be set | ||
37 | to the same values used to configure the audio section of the card with | ||
38 | isapnp. "dma16" should be explicitly set to "-1" for an ALS-007 since this | ||
39 | card does not have a 16 bit dma channel; if not specified the kernel will | ||
40 | default to using channel 5 anyway which will cause audio not to work. | ||
41 | "mpu_io" should be set to 0. The "io" parameter of the "opl3" module should | ||
42 | also agree with the setting used by isapnp. To get the MPU401 interface | ||
43 | working on an ALS-007 card, the "mpu401" module will be required since this | ||
44 | card uses separate IRQs for the audio and MPU401 sections and there is no | ||
45 | parameter available to pass a different IRQ to the "sb" driver (whose | ||
46 | inbuilt MPU401 driver would otherwise be fine). Insert the mpu401 module | ||
47 | passing appropriate values using the "io" and "irq" parameters. | ||
48 | |||
49 | The resulting sound driver will provide the following capabilities: | ||
50 | - 8 and 16 bit audio playback | ||
51 | - 8 and 16 bit audio recording | ||
52 | - Software selection of record source (line in, CD, FM, mic, master) | ||
53 | - Record and playback of midi data via the external MPU-401 | ||
54 | - Playback of midi data using inbuilt FM synthesizer | ||
55 | - Control of the ALS-007 mixer via any OSS-compatible mixer programs. | ||
56 | Controls available are Master (L&R), Line in (L&R), CD (L&R), | ||
57 | DSP/PCM/audio out (L&R), FM (L&R) and Mic in (mono). | ||
58 | |||
59 | Jonathan Woithe | ||
60 | jwoithe@physics.adelaide.edu.au | ||
61 | 30 March 1998 | ||
62 | |||
63 | Modified 2000-02-26 by Dave Forrest, drf5n@virginia.edu to add ALS100/ALS200 | ||
64 | Modified 2000-04-10 by Paul Laufer, pelaufer@csupomona.edu to add ISAPnP info. | ||
65 | Modified 2000-11-19 by Jonathan Woithe, jwoithe@physics.adelaide.edu.au | ||
66 | - updated information for kernel 2.4.x. | ||
diff --git a/Documentation/sound/oss/AWE32 b/Documentation/sound/oss/AWE32 new file mode 100644 index 000000000000..cb179bfeb522 --- /dev/null +++ b/Documentation/sound/oss/AWE32 | |||
@@ -0,0 +1,76 @@ | |||
1 | Installing and using Creative AWE midi sound under Linux. | ||
2 | |||
3 | This documentation is devoted to the Creative Sound Blaster AWE32, AWE64 and | ||
4 | SB32. | ||
5 | |||
6 | 1) Make sure you have an ORIGINAL Creative SB32, AWE32 or AWE64 card. This | ||
7 | is important, because the driver works only with real Creative cards. | ||
8 | |||
9 | 2) The first thing you need to do is re-compile your kernel with support for | ||
10 | your sound card. Run your favourite tool to configure the kernel and when | ||
11 | you get to the "Sound" menu you should enable support for the following: | ||
12 | |||
13 | Sound card support, | ||
14 | OSS sound modules, | ||
15 | 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support, | ||
16 | AWE32 synth | ||
17 | |||
18 | If your card is "Plug and Play" you will also need to enable these two | ||
19 | options, found under the "Plug and Play configuration" menu: | ||
20 | |||
21 | Plug and Play support | ||
22 | ISA Plug and Play support | ||
23 | |||
24 | Now compile and install the kernel in normal fashion. If you don't know | ||
25 | how to do this you can find instructions for this in the README file | ||
26 | located in the root directory of the kernel source. | ||
27 | |||
28 | 3) Before you can start playing midi files you will have to load a sound | ||
29 | bank file. The utility needed for doing this is called "sfxload", and it | ||
30 | is one of the utilities found in a package called "awesfx". If this | ||
31 | package is not available in your distribution you can download the AWE | ||
32 | snapshot from Creative Labs Open Source website: | ||
33 | |||
34 | http://www.opensource.creative.com/snapshot.html | ||
35 | |||
36 | Once you have unpacked the AWE snapshot you will see a "awesfx" | ||
37 | directory. Follow the instructions in awesfx/docs/INSTALL to install the | ||
38 | utilities in this package. After doing this, sfxload should be installed | ||
39 | as: | ||
40 | |||
41 | /usr/local/bin/sfxload | ||
42 | |||
43 | To enable AWE general midi synthesis you should also get the sound bank | ||
44 | file for general midi from: | ||
45 | |||
46 | http://members.xoom.com/yar/synthgm.sbk.gz | ||
47 | |||
48 | Copy it to a directory of your choice, and unpack it there. | ||
49 | |||
50 | 4) Edit /etc/modprobe.conf, and insert the following lines at the end of the | ||
51 | file: | ||
52 | |||
53 | alias sound-slot-0 sb | ||
54 | alias sound-service-0-1 awe_wave | ||
55 | install awe_wave /sbin/modprobe --first-time -i awe_wave && /usr/local/bin/sfxload PATH_TO_SOUND_BANK_FILE | ||
56 | |||
57 | You will of course have to change "PATH_TO_SOUND_BANK_FILE" to the full | ||
58 | path of of the sound bank file. That will enable the Sound Blaster and AWE | ||
59 | wave synthesis. To play midi files you should get one of these programs if | ||
60 | you don't already have them: | ||
61 | |||
62 | Playmidi: http://playmidi.openprojects.net | ||
63 | |||
64 | AWEMidi Player (drvmidi) Included in the previously mentioned AWE | ||
65 | snapshot. | ||
66 | |||
67 | You will probably have to pass the "-e" switch to playmidi to have it use | ||
68 | your midi device. drvmidi should work without switches. | ||
69 | |||
70 | If something goes wrong please e-mail me. All comments and suggestions are | ||
71 | welcome. | ||
72 | |||
73 | Yaroslav Rosomakho (alons55@dialup.ptt.ru) | ||
74 | http://www.yar.opennet.ru | ||
75 | |||
76 | Last Updated: Feb 3 2001 | ||
diff --git a/Documentation/sound/oss/AudioExcelDSP16 b/Documentation/sound/oss/AudioExcelDSP16 new file mode 100644 index 000000000000..c0f08922993b --- /dev/null +++ b/Documentation/sound/oss/AudioExcelDSP16 | |||
@@ -0,0 +1,101 @@ | |||
1 | Driver | ||
2 | ------ | ||
3 | |||
4 | Informations about Audio Excel DSP 16 driver can be found in the source | ||
5 | file aedsp16.c | ||
6 | Please, read the head of the source before using it. It contain useful | ||
7 | informations. | ||
8 | |||
9 | Configuration | ||
10 | ------------- | ||
11 | |||
12 | The Audio Excel configuration, is now done with the standard Linux setup. | ||
13 | You have to configure the sound card (Sound Blaster or Microsoft Sound System) | ||
14 | and, if you want it, the Roland MPU-401 (do not use the Sound Blaster MPU-401, | ||
15 | SB-MPU401) in the main driver menu. Activate the lowlevel drivers then select | ||
16 | the Audio Excel hardware that you want to initialize. Check the IRQ/DMA/MIRQ | ||
17 | of the Audio Excel initialization: it must be the same as the SBPRO (or MSS) | ||
18 | setup. If the parameters are different, correct it. | ||
19 | I you own a Gallant's audio card based on SC-6600, activate the SC-6600 support. | ||
20 | If you want to change the configuration of the sound board, be sure to | ||
21 | check off all the configuration items before re-configure it. | ||
22 | |||
23 | Module parameters | ||
24 | ----------------- | ||
25 | To use this driver as a module, you must configure some module parameters, to | ||
26 | set up I/O addresses, IRQ lines and DMA channels. Some parameters are | ||
27 | mandatory while some others are optional. Here a list of parameters you can | ||
28 | use with this module: | ||
29 | |||
30 | Name Description | ||
31 | ==== =========== | ||
32 | MANDATORY | ||
33 | io I/O base address (0x220 or 0x240) | ||
34 | irq irq line (5, 7, 9, 10 or 11) | ||
35 | dma dma channel (0, 1 or 3) | ||
36 | |||
37 | OPTIONAL | ||
38 | mss_base I/O base address for activate MSS mode (default SBPRO) | ||
39 | (0x530 or 0xE80) | ||
40 | mpu_base I/O base address for activate MPU-401 mode | ||
41 | (0x300, 0x310, 0x320 or 0x330) | ||
42 | mpu_irq MPU-401 irq line (5, 7, 9, 10 or 0) | ||
43 | |||
44 | The /etc/modprobe.conf will have lines like this: | ||
45 | |||
46 | options opl3 io=0x388 | ||
47 | options ad1848 io=0x530 irq=11 dma=3 | ||
48 | options aedsp16 io=0x220 irq=11 dma=3 mss_base=0x530 | ||
49 | |||
50 | Where the aedsp16 options are the options for this driver while opl3 and | ||
51 | ad1848 are the corresponding options for the MSS and OPL3 modules. | ||
52 | |||
53 | Loading MSS and OPL3 needs to pre load the aedsp16 module to set up correctly | ||
54 | the sound card. Installation dependencies must be written in the modprobe.conf | ||
55 | file: | ||
56 | |||
57 | install ad1848 /sbin/modprobe aedsp16 && /sbin/modprobe -i ad1848 | ||
58 | install opl3 /sbin/modprobe aedsp16 && /sbin/modprobe -i opl3 | ||
59 | |||
60 | Then you must load the sound modules stack in this order: | ||
61 | sound -> aedsp16 -> [ ad1848, opl3 ] | ||
62 | |||
63 | With the above configuration, loading ad1848 or opl3 modules, will | ||
64 | automatically load all the sound stack. | ||
65 | |||
66 | Sound cards supported | ||
67 | --------------------- | ||
68 | This driver supports the SC-6000 and SC-6600 based Gallant's sound card. | ||
69 | It don't support the Audio Excel DSP 16 III (try the SC-6600 code). | ||
70 | I'm working on the III version of the card: if someone have useful | ||
71 | informations about it, please let me know. | ||
72 | For all the non-supported audio cards, you have to boot MS-DOS (or WIN95) | ||
73 | activating the audio card with the MS-DOS device driver, then you have to | ||
74 | <ctrl>-<alt>-<del> and boot Linux. | ||
75 | Follow these steps: | ||
76 | |||
77 | 1) Compile Linux kernel with standard sound driver, using the emulation | ||
78 | you want, with the parameters of your audio card, | ||
79 | e.g. Microsoft Sound System irq10 dma3 | ||
80 | 2) Install your new kernel as the default boot kernel. | ||
81 | 3) Boot MS-DOS and configure the audio card with the boot time device | ||
82 | driver, for MSS irq10 dma3 in our example. | ||
83 | 4) <ctrl>-<alt>-<del> and boot Linux. This will maintain the DOS configuration | ||
84 | and will boot the new kernel with sound driver. The sound driver will find | ||
85 | the audio card and will recognize and attach it. | ||
86 | |||
87 | Reports on User successes | ||
88 | ------------------------- | ||
89 | |||
90 | > Date: Mon, 29 Jul 1996 08:35:40 +0100 | ||
91 | > From: Mr S J Greenaway <sjg95@unixfe.rl.ac.uk> | ||
92 | > To: riccardo@cdc8g5.cdc.polimi.it (Riccardo Facchetti) | ||
93 | > Subject: Re: Audio Excel DSP 16 initialization code | ||
94 | > | ||
95 | > Just to let you know got my Audio Excel (emulating a MSS) working | ||
96 | > with my original SB16, thanks for the driver! | ||
97 | |||
98 | |||
99 | Last revised: 20 August 1998 | ||
100 | Riccardo Facchetti | ||
101 | fizban@tin.it | ||
diff --git a/Documentation/sound/oss/CMI8330 b/Documentation/sound/oss/CMI8330 new file mode 100644 index 000000000000..9c439f1a6dba --- /dev/null +++ b/Documentation/sound/oss/CMI8330 | |||
@@ -0,0 +1,153 @@ | |||
1 | Documentation for CMI 8330 (SoundPRO) | ||
2 | ------------------------------------- | ||
3 | Alessandro Zummo <azummo@ita.flashnet.it> | ||
4 | |||
5 | ( Be sure to read Documentation/sound/oss/SoundPro too ) | ||
6 | |||
7 | |||
8 | This adapter is now directly supported by the sb driver. | ||
9 | |||
10 | The only thing you have to do is to compile the kernel sound | ||
11 | support as a module and to enable kernel ISAPnP support, | ||
12 | as shown below. | ||
13 | |||
14 | |||
15 | CONFIG_SOUND=m | ||
16 | CONFIG_SOUND_SB=m | ||
17 | |||
18 | CONFIG_PNP=y | ||
19 | CONFIG_ISAPNP=y | ||
20 | |||
21 | |||
22 | and optionally: | ||
23 | |||
24 | |||
25 | CONFIG_SOUND_MPU401=m | ||
26 | |||
27 | for MPU401 support. | ||
28 | |||
29 | |||
30 | (I suggest you to use "make menuconfig" or "make xconfig" | ||
31 | for a more comfortable configuration editing) | ||
32 | |||
33 | |||
34 | |||
35 | Then you can do | ||
36 | |||
37 | modprobe sb | ||
38 | |||
39 | and everything will be (hopefully) configured. | ||
40 | |||
41 | You should get something similar in syslog: | ||
42 | |||
43 | sb: CMI8330 detected. | ||
44 | sb: CMI8330 sb base located at 0x220 | ||
45 | sb: CMI8330 mpu base located at 0x330 | ||
46 | sb: CMI8330 mail reports to Alessandro Zummo <azummo@ita.flashnet.it> | ||
47 | sb: ISAPnP reports CMI 8330 SoundPRO at i/o 0x220, irq 7, dma 1,5 | ||
48 | |||
49 | |||
50 | |||
51 | |||
52 | The old documentation file follows for reference | ||
53 | purposes. | ||
54 | |||
55 | |||
56 | How to enable CMI 8330 (SOUNDPRO) soundchip on Linux | ||
57 | ------------------------------------------ | ||
58 | Stefan Laudat <Stefan.Laudat@asit.ro> | ||
59 | |||
60 | [Note: The CMI 8338 is unrelated and is supported by cmpci.o] | ||
61 | |||
62 | |||
63 | In order to use CMI8330 under Linux you just have to use a proper isapnp.conf, a good isapnp and a little bit of patience. I use isapnp 1.17, but | ||
64 | you may get a better one I guess at http://www.roestock.demon.co.uk/isapnptools/. | ||
65 | |||
66 | Of course you will have to compile kernel sound support as module, as shown below: | ||
67 | |||
68 | CONFIG_SOUND=m | ||
69 | CONFIG_SOUND_OSS=m | ||
70 | CONFIG_SOUND_SB=m | ||
71 | CONFIG_SOUND_ADLIB=m | ||
72 | CONFIG_SOUND_MPU401=m | ||
73 | # Mikro$chaft sound system (kinda useful here ;)) | ||
74 | CONFIG_SOUND_MSS=m | ||
75 | |||
76 | The /etc/isapnp.conf file will be: | ||
77 | |||
78 | <snip below> | ||
79 | |||
80 | |||
81 | (READPORT 0x0203) | ||
82 | (ISOLATE PRESERVE) | ||
83 | (IDENTIFY *) | ||
84 | (VERBOSITY 2) | ||
85 | (CONFLICT (IO FATAL)(IRQ FATAL)(DMA FATAL)(MEM FATAL)) # or WARNING | ||
86 | (VERIFYLD N) | ||
87 | |||
88 | |||
89 | # WSS | ||
90 | |||
91 | (CONFIGURE CMI0001/16777472 (LD 0 | ||
92 | (IO 0 (SIZE 8) (BASE 0x0530)) | ||
93 | (IO 1 (SIZE 8) (BASE 0x0388)) | ||
94 | (INT 0 (IRQ 7 (MODE +E))) | ||
95 | (DMA 0 (CHANNEL 0)) | ||
96 | (NAME "CMI0001/16777472[0]{CMI8330/C3D Audio Adapter}") | ||
97 | (ACT Y) | ||
98 | )) | ||
99 | |||
100 | # MPU | ||
101 | |||
102 | (CONFIGURE CMI0001/16777472 (LD 1 | ||
103 | (IO 0 (SIZE 2) (BASE 0x0330)) | ||
104 | (INT 0 (IRQ 11 (MODE +E))) | ||
105 | (NAME "CMI0001/16777472[1]{CMI8330/C3D Audio Adapter}") | ||
106 | (ACT Y) | ||
107 | )) | ||
108 | |||
109 | # Joystick | ||
110 | |||
111 | (CONFIGURE CMI0001/16777472 (LD 2 | ||
112 | (IO 0 (SIZE 8) (BASE 0x0200)) | ||
113 | (NAME "CMI0001/16777472[2]{CMI8330/C3D Audio Adapter}") | ||
114 | (ACT Y) | ||
115 | )) | ||
116 | |||
117 | # SoundBlaster | ||
118 | |||
119 | (CONFIGURE CMI0001/16777472 (LD 3 | ||
120 | (IO 0 (SIZE 16) (BASE 0x0220)) | ||
121 | (INT 0 (IRQ 5 (MODE +E))) | ||
122 | (DMA 0 (CHANNEL 1)) | ||
123 | (DMA 1 (CHANNEL 5)) | ||
124 | (NAME "CMI0001/16777472[3]{CMI8330/C3D Audio Adapter}") | ||
125 | (ACT Y) | ||
126 | )) | ||
127 | |||
128 | |||
129 | (WAITFORKEY) | ||
130 | |||
131 | <end of snip> | ||
132 | |||
133 | The module sequence is trivial: | ||
134 | |||
135 | /sbin/insmod soundcore | ||
136 | /sbin/insmod sound | ||
137 | /sbin/insmod uart401 | ||
138 | # insert this first | ||
139 | /sbin/insmod ad1848 io=0x530 irq=7 dma=0 soundpro=1 | ||
140 | # The sb module is an alternative to the ad1848 (Microsoft Sound System) | ||
141 | # Anyhow, this is full duplex and has MIDI | ||
142 | /sbin/insmod sb io=0x220 dma=1 dma16=5 irq=5 mpu_io=0x330 | ||
143 | |||
144 | |||
145 | |||
146 | Alma Chao <elysian@ethereal.torsion.org> suggests the following /etc/modprobe.conf: | ||
147 | |||
148 | alias sound ad1848 | ||
149 | alias synth0 opl3 | ||
150 | options ad1848 io=0x530 irq=7 dma=0 soundpro=1 | ||
151 | options opl3 io=0x388 | ||
152 | |||
153 | |||
diff --git a/Documentation/sound/oss/CMI8338 b/Documentation/sound/oss/CMI8338 new file mode 100644 index 000000000000..387d058c3f95 --- /dev/null +++ b/Documentation/sound/oss/CMI8338 | |||
@@ -0,0 +1,85 @@ | |||
1 | Audio driver for CM8338/CM8738 chips by Chen-Li Tien | ||
2 | |||
3 | |||
4 | HARDWARE SUPPORTED | ||
5 | ================================================================================ | ||
6 | C-Media CMI8338 | ||
7 | C-Media CMI8738 | ||
8 | On-board C-Media chips | ||
9 | |||
10 | |||
11 | STEPS TO BUILD DRIVER | ||
12 | ================================================================================ | ||
13 | |||
14 | 1. Backup the Config.in and Makefile in the sound driver directory | ||
15 | (/usr/src/linux/driver/sound). | ||
16 | The Configure.help provide help when you config driver in step | ||
17 | 4, please backup the original one (/usr/src/linux/Document) and | ||
18 | copy this file. | ||
19 | The cmpci is document for the driver in detail, please copy it | ||
20 | to /usr/src/linux/Document/sound so you can refer it. Backup if | ||
21 | there is already one. | ||
22 | |||
23 | 2. Extract the tar file by 'tar xvzf cmpci-xx.tar.gz' in the above | ||
24 | directory. | ||
25 | |||
26 | 3. Change directory to /usr/src/linux | ||
27 | |||
28 | 4. Config cm8338 driver by 'make menuconfig', 'make config' or | ||
29 | 'make xconfig' command. | ||
30 | |||
31 | 5. Please select Sound Card (CONFIG_SOUND=m) support and CMPCI | ||
32 | driver (CONFIG_SOUND_CMPCI=m) as modules. Resident mode not tested. | ||
33 | For driver option, please refer 'DRIVER PARAMETER' | ||
34 | |||
35 | 6. Compile the kernel if necessary. | ||
36 | |||
37 | 7. Compile the modules by 'make modules'. | ||
38 | |||
39 | 8. Install the modules by 'make modules_install' | ||
40 | |||
41 | |||
42 | INSTALL DRIVER | ||
43 | ================================================================================ | ||
44 | |||
45 | 1. Before first time to run the driver, create module dependency by | ||
46 | 'depmod -a' | ||
47 | |||
48 | 2. To install the driver manually, enter 'modprobe cmpci'. | ||
49 | |||
50 | 3. Driver installation for various distributions: | ||
51 | |||
52 | a. Slackware 4.0 | ||
53 | Add the 'modprobe cmpci' command in your /etc/rc.d/rc.modules | ||
54 | file.so you can start the driver automatically each time booting. | ||
55 | |||
56 | b. Caldera OpenLinux 2.2 | ||
57 | Use LISA to load the cmpci module. | ||
58 | |||
59 | c. RedHat 6.0 and S.u.S.E. 6.1 | ||
60 | Add following command in /etc/conf.modules: | ||
61 | |||
62 | alias sound cmpci | ||
63 | |||
64 | also visit http://www.cmedia.com.tw for installation instruction. | ||
65 | |||
66 | DRIVER PARAMETER | ||
67 | ================================================================================ | ||
68 | |||
69 | Some functions for the cm8738 can be configured in Kernel Configuration | ||
70 | or modules parameters. Set these parameters to 1 to enable. | ||
71 | |||
72 | mpuio: I/O ports base for MPU-401, 0 if disabled. | ||
73 | fmio: I/O ports base for OPL-3, 0 if disabled. | ||
74 | spdif_inverse:Inverse the S/PDIF-in signal, this depends on your | ||
75 | CD-ROM or DVD-ROM. | ||
76 | spdif_loop: Enable S/PDIF loop, this route S/PDIF-in to S/PDIF-out | ||
77 | directly. | ||
78 | speakers: Number of speakers used. | ||
79 | use_line_as_rear:Enable this if you want to use line-in as | ||
80 | rear-out. | ||
81 | use_line_as_bass:Enable this if you want to use line-in as | ||
82 | bass-out. | ||
83 | joystick: Enable joystick. You will need to install Linux joystick | ||
84 | driver. | ||
85 | |||
diff --git a/Documentation/sound/oss/CS4232 b/Documentation/sound/oss/CS4232 new file mode 100644 index 000000000000..7d6af7a5c1c2 --- /dev/null +++ b/Documentation/sound/oss/CS4232 | |||
@@ -0,0 +1,23 @@ | |||
1 | To configure the Crystal CS423x sound chip and activate its DSP functions, | ||
2 | modules may be loaded in this order: | ||
3 | |||
4 | modprobe sound | ||
5 | insmod ad1848 | ||
6 | insmod uart401 | ||
7 | insmod cs4232 io=* irq=* dma=* dma2=* | ||
8 | |||
9 | This is the meaning of the parameters: | ||
10 | |||
11 | io--I/O address of the Windows Sound System (normally 0x534) | ||
12 | irq--IRQ of this device | ||
13 | dma and dma2--DMA channels (DMA2 may be 0) | ||
14 | |||
15 | On some cards, the board attempts to do non-PnP setup, and fails. If you | ||
16 | have problems, use Linux' PnP facilities. | ||
17 | |||
18 | To get MIDI facilities add | ||
19 | |||
20 | insmod opl3 io=* | ||
21 | |||
22 | where "io" is the I/O address of the OPL3 synthesizer. This will be shown | ||
23 | in /proc/sys/pnp and is normally 0x388. | ||
diff --git a/Documentation/sound/oss/ESS b/Documentation/sound/oss/ESS new file mode 100644 index 000000000000..bba93b4d2def --- /dev/null +++ b/Documentation/sound/oss/ESS | |||
@@ -0,0 +1,34 @@ | |||
1 | Documentation for the ESS AudioDrive chips | ||
2 | |||
3 | In 2.4 kernels the SoundBlaster driver not only tries to detect an ESS chip, it | ||
4 | tries to detect the type of ESS chip too. The correct detection of the chip | ||
5 | doesn't always succeed however, so unless you use the kernel isapnp facilities | ||
6 | (and you chip is pnp capable) the default behaviour is 2.0 behaviour which | ||
7 | means: only detect ES688 and ES1688. | ||
8 | |||
9 | All ESS chips now have a recording level setting. This is a need-to-have for | ||
10 | people who want to use their ESS for recording sound. | ||
11 | |||
12 | Every chip that's detected as a later-than-es1688 chip has a 6 bits logarithmic | ||
13 | master volume control. | ||
14 | |||
15 | Every chip that's detected as a ES1887 now has Full Duplex support. Made a | ||
16 | little testprogram that shows that is works, haven't seen a real program that | ||
17 | needs this however. | ||
18 | |||
19 | For ESS chips an additional parameter "esstype" can be specified. This controls | ||
20 | the (auto) detection of the ESS chips. It can have 3 kinds of values: | ||
21 | |||
22 | -1 Act like 2.0 kernels: only detect ES688 or ES1688. | ||
23 | 0 Try to auto-detect the chip (may fail for ES1688) | ||
24 | 688 The chip will be treated as ES688 | ||
25 | 1688 ,, ,, ,, ,, ,, ,, ES1688 | ||
26 | 1868 ,, ,, ,, ,, ,, ,, ES1868 | ||
27 | 1869 ,, ,, ,, ,, ,, ,, ES1869 | ||
28 | 1788 ,, ,, ,, ,, ,, ,, ES1788 | ||
29 | 1887 ,, ,, ,, ,, ,, ,, ES1887 | ||
30 | 1888 ,, ,, ,, ,, ,, ,, ES1888 | ||
31 | |||
32 | Because Full Duplex is supported for ES1887 you can specify a second DMA | ||
33 | channel by specifying module parameter dma16. It can be one of: 0, 1, 3 or 5. | ||
34 | |||
diff --git a/Documentation/sound/oss/ESS1868 b/Documentation/sound/oss/ESS1868 new file mode 100644 index 000000000000..55e922f21bc0 --- /dev/null +++ b/Documentation/sound/oss/ESS1868 | |||
@@ -0,0 +1,55 @@ | |||
1 | Documentation for the ESS1868F AudioDrive PnP sound card | ||
2 | |||
3 | The ESS1868 sound card is a PnP ESS1688-compatible 16-bit sound card. | ||
4 | |||
5 | It should be automatically detected by the Linux Kernel isapnp support when you | ||
6 | load the sb.o module. Otherwise you should take care of: | ||
7 | |||
8 | * The ESS1868 does not allow use of a 16-bit DMA, thus DMA 0, 1, 2, and 3 | ||
9 | may only be used. | ||
10 | |||
11 | * isapnptools version 1.14 does work with ESS1868. Earlier versions might | ||
12 | not. | ||
13 | |||
14 | * Sound support MUST be compiled as MODULES, not statically linked | ||
15 | into the kernel. | ||
16 | |||
17 | |||
18 | NOTE: this is only needed when not using the kernel isapnp support! | ||
19 | |||
20 | For configuring the sound card's I/O addresses, IRQ and DMA, here is a | ||
21 | sample copy of the isapnp.conf directives regarding the ESS1868: | ||
22 | |||
23 | (CONFIGURE ESS1868/-1 (LD 1 | ||
24 | (IO 0 (BASE 0x0220)) | ||
25 | (IO 1 (BASE 0x0388)) | ||
26 | (IO 2 (BASE 0x0330)) | ||
27 | (DMA 0 (CHANNEL 1)) | ||
28 | (INT 0 (IRQ 5 (MODE +E))) | ||
29 | (ACT Y) | ||
30 | )) | ||
31 | |||
32 | (for a full working isapnp.conf file, remember the | ||
33 | (ISOLATE) | ||
34 | (IDENTIFY *) | ||
35 | at the beginning and the | ||
36 | (WAITFORKEY) | ||
37 | at the end.) | ||
38 | |||
39 | In this setup, the main card I/O is 0x0220, FM synthesizer is 0x0388, and | ||
40 | the MPU-401 MIDI port is located at 0x0330. IRQ is IRQ 5, DMA is channel 1. | ||
41 | |||
42 | After configuring the sound card via isapnp, to use the card you must load | ||
43 | the sound modules with the proper I/O information. Here is my setup: | ||
44 | |||
45 | # ESS1868F AudioDrive initialization | ||
46 | |||
47 | /sbin/modprobe sound | ||
48 | /sbin/insmod uart401 | ||
49 | /sbin/insmod sb io=0x220 irq=5 dma=1 dma16=-1 | ||
50 | /sbin/insmod mpu401 io=0x330 | ||
51 | /sbin/insmod opl3 io=0x388 | ||
52 | /sbin/insmod v_midi | ||
53 | |||
54 | opl3 is the FM synthesizer | ||
55 | /sbin/insmod opl3 io=0x388 | ||
diff --git a/Documentation/sound/oss/INSTALL.awe b/Documentation/sound/oss/INSTALL.awe new file mode 100644 index 000000000000..310f42ca1e83 --- /dev/null +++ b/Documentation/sound/oss/INSTALL.awe | |||
@@ -0,0 +1,134 @@ | |||
1 | ================================================================ | ||
2 | INSTALLATION OF AWE32 SOUND DRIVER FOR LINUX | ||
3 | Takashi Iwai <iwai@ww.uni-erlangen.de> | ||
4 | ================================================================ | ||
5 | |||
6 | ---------------------------------------------------------------- | ||
7 | * Attention to SB-PnP Card Users | ||
8 | |||
9 | If you're using PnP cards, the initialization of PnP is required | ||
10 | before loading this driver. You have now three options: | ||
11 | 1. Use isapnptools. | ||
12 | 2. Use in-kernel isapnp support. | ||
13 | 3. Initialize PnP on DOS/Windows, then boot linux by loadlin. | ||
14 | In this document, only the case 1 case is treated. | ||
15 | |||
16 | ---------------------------------------------------------------- | ||
17 | * Installation on Red Hat 5.0 Sound Driver | ||
18 | |||
19 | Please use install-rh.sh under RedHat5.0 directory. | ||
20 | DO NOT USE install.sh below. | ||
21 | See INSTALL.RH for more details. | ||
22 | |||
23 | ---------------------------------------------------------------- | ||
24 | * Installation/Update by Shell Script | ||
25 | |||
26 | 1. Become root | ||
27 | |||
28 | % su | ||
29 | |||
30 | 2. If you have never configured the kernel tree yet, run make config | ||
31 | once (to make dependencies and symlinks). | ||
32 | |||
33 | # cd /usr/src/linux | ||
34 | # make xconfig | ||
35 | |||
36 | 3. Run install.sh script | ||
37 | |||
38 | # sh ./install.sh | ||
39 | |||
40 | 4. Configure your kernel | ||
41 | |||
42 | (for Linux 2.[01].x user) | ||
43 | # cd /usr/src/linux | ||
44 | # make xconfig (or make menuconfig) | ||
45 | |||
46 | (for Linux 1.2.x user) | ||
47 | # cd /usr/src/linux | ||
48 | # make config | ||
49 | |||
50 | Answer YES to both "lowlevel drivers" and "AWE32 wave synth" items | ||
51 | in Sound menu. ("lowlevel drivers" will appear only in 2.x | ||
52 | kernel.) | ||
53 | |||
54 | 5. Make your kernel (and modules), and install them as usual. | ||
55 | |||
56 | 5a. make kernel image | ||
57 | # make zImage | ||
58 | |||
59 | 5b. make modules and install them | ||
60 | # make modules && make modules_install | ||
61 | |||
62 | 5c. If you're using lilo, copy the kernel image and run lilo. | ||
63 | Otherwise, copy the kernel image to suitable directory or | ||
64 | media for your system. | ||
65 | |||
66 | 6. Reboot the kernel if necessary. | ||
67 | - If you updated only the modules, you don't have to reboot | ||
68 | the system. Just remove the old sound modules here. | ||
69 | in | ||
70 | # rmmod sound.o (linux-2.0 or OSS/Free) | ||
71 | # rmmod awe_wave.o (linux-2.1) | ||
72 | |||
73 | 7. If your AWE card is a PnP and not initialized yet, you'll have to | ||
74 | do it by isapnp tools. Otherwise, skip to 8. | ||
75 | |||
76 | This section described only a brief explanation. For more | ||
77 | details, please see the AWE64-Mini-HOWTO or isapnp tools FAQ. | ||
78 | |||
79 | 7a. If you have no isapnp.conf file, generate it by pnpdump. | ||
80 | Otherwise, skip to 7d. | ||
81 | # pnpdump > /etc/isapnp.conf | ||
82 | |||
83 | 7b. Edit isapnp.conf file. Comment out the appropriate | ||
84 | lines containing desirable I/O ports, DMA and IRQs. | ||
85 | Don't forget to enable (ACT Y) line. | ||
86 | |||
87 | 7c. Add two i/o ports (0xA20 and 0xE20) in WaveTable part. | ||
88 | ex) | ||
89 | (CONFIGURE CTL0048/58128 (LD 2 | ||
90 | # ANSI string -->WaveTable<-- | ||
91 | (IO 0 (BASE 0x0620)) | ||
92 | (IO 1 (BASE 0x0A20)) | ||
93 | (IO 2 (BASE 0x0E20)) | ||
94 | (ACT Y) | ||
95 | )) | ||
96 | |||
97 | 7d. Load the config file. | ||
98 | CAUTION: This will reset all PnP cards! | ||
99 | |||
100 | # isapnp /etc/isapnp.conf | ||
101 | |||
102 | 8. Load the sound module (if you configured it as a module): | ||
103 | |||
104 | for 2.0 kernel or OSS/Free monolithic module: | ||
105 | |||
106 | # modprobe sound.o | ||
107 | |||
108 | for 2.1 kernel: | ||
109 | |||
110 | # modprobe sound | ||
111 | # insmod uart401 | ||
112 | # insmod sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330 | ||
113 | (These values depend on your settings.) | ||
114 | # insmod awe_wave | ||
115 | (Be sure to load awe_wave after sb!) | ||
116 | |||
117 | See Documentation/sound/oss/AWE32 for | ||
118 | more details. | ||
119 | |||
120 | 9. (only for obsolete systems) If you don't have /dev/sequencer | ||
121 | device file, make it according to Readme.linux file on | ||
122 | /usr/src/linux/drivers/sound. (Run a shell script included in | ||
123 | that file). <-- This file no longer exists in the recent kernels! | ||
124 | |||
125 | 10. OK, load your own soundfont file, and enjoy MIDI! | ||
126 | |||
127 | % sfxload synthgm.sbk | ||
128 | % drvmidi foo.mid | ||
129 | |||
130 | 11. For more advanced use (eg. dynamic loading, virtual bank and | ||
131 | etc.), please read the awedrv FAQ or the instructions in awesfx | ||
132 | and awemidi packages. | ||
133 | |||
134 | Good luck! | ||
diff --git a/Documentation/sound/oss/Introduction b/Documentation/sound/oss/Introduction new file mode 100644 index 000000000000..15d4fb975ac0 --- /dev/null +++ b/Documentation/sound/oss/Introduction | |||
@@ -0,0 +1,459 @@ | |||
1 | Introduction Notes on Modular Sound Drivers and Soundcore | ||
2 | Wade Hampton | ||
3 | 2/14/2001 | ||
4 | |||
5 | Purpose: | ||
6 | ======== | ||
7 | This document provides some general notes on the modular | ||
8 | sound drivers and their configuration, along with the | ||
9 | support modules sound.o and soundcore.o. | ||
10 | |||
11 | Note, some of this probably should be added to the Sound-HOWTO! | ||
12 | |||
13 | Note, soundlow.o was present with 2.2 kernels but is not | ||
14 | required for 2.4.x kernels. References have been removed | ||
15 | to this. | ||
16 | |||
17 | |||
18 | Copying: | ||
19 | ======== | ||
20 | none | ||
21 | |||
22 | |||
23 | History: | ||
24 | ======== | ||
25 | 0.1.0 11/20/1998 First version, draft | ||
26 | 1.0.0 11/1998 Alan Cox changes, incorporation in 2.2.0 | ||
27 | as Documentation/sound/oss/Introduction | ||
28 | 1.1.0 6/30/1999 Second version, added notes on making the drivers, | ||
29 | added info on multiple sound cards of similar types,] | ||
30 | added more diagnostics info, added info about esd. | ||
31 | added info on OSS and ALSA. | ||
32 | 1.1.1 19991031 Added notes on sound-slot- and sound-service. | ||
33 | (Alan Cox) | ||
34 | 1.1.2 20000920 Modified for Kernel 2.4 (Christoph Hellwig) | ||
35 | 1.1.3 20010214 Minor notes and corrections (Wade Hampton) | ||
36 | Added examples of sound-slot-0, etc. | ||
37 | |||
38 | |||
39 | Modular Sound Drivers: | ||
40 | ====================== | ||
41 | |||
42 | Thanks to the GREAT work by Alan Cox (alan@lxorguk.ukuu.org.uk), | ||
43 | |||
44 | [And Oleg Drokin, Thomas Sailer, Andrew Veliath and more than a few | ||
45 | others - not to mention Hannu's original code being designed well | ||
46 | enough to cope with that kind of chopping up](Alan) | ||
47 | |||
48 | the standard Linux kernels support a modular sound driver. From | ||
49 | Alan's comments in linux/drivers/sound/README.FIRST: | ||
50 | |||
51 | The modular sound driver patches were funded by Red Hat Software | ||
52 | (www.redhat.com). The sound driver here is thus a modified version of | ||
53 | Hannu's code. Please bear that in mind when considering the appropriate | ||
54 | forums for bug reporting. | ||
55 | |||
56 | The modular sound drivers may be loaded via insmod or modprobe. | ||
57 | To support all the various sound modules, there are two general | ||
58 | support modules that must be loaded first: | ||
59 | |||
60 | soundcore.o: Top level handler for the sound system, provides | ||
61 | a set of functions for registration of devices | ||
62 | by type. | ||
63 | |||
64 | sound.o: Common sound functions required by all modules. | ||
65 | |||
66 | For the specific sound modules (e.g., sb.o for the Soundblaster), | ||
67 | read the documentation on that module to determine what options | ||
68 | are available, for example IRQ, address, DMA. | ||
69 | |||
70 | Warning, the options for different cards sometime use different names | ||
71 | for the same or a similar feature (dma1= versus dma16=). As a last | ||
72 | resort, inspect the code (search for MODULE_PARM). | ||
73 | |||
74 | Notes: | ||
75 | |||
76 | 1. There is a new OpenSource sound driver called ALSA which is | ||
77 | currently under development: http://www.alsa-project.org/ | ||
78 | The ALSA drivers support some newer hardware that may not | ||
79 | be supported by this sound driver and also provide some | ||
80 | additional features. | ||
81 | |||
82 | 2. The commercial OSS driver may be obtained from the site: | ||
83 | http://www/opensound.com. This may be used for cards that | ||
84 | are unsupported by the kernel driver, or may be used | ||
85 | by other operating systems. | ||
86 | |||
87 | 3. The enlightenment sound daemon may be used for playing | ||
88 | multiple sounds at the same time via a single card, eliminating | ||
89 | some of the requirements for multiple sound card systems. For | ||
90 | more information, see: http://www.tux.org/~ricdude/EsounD.html | ||
91 | The "esd" program may be used with the real-player and mpeg | ||
92 | players like mpg123 and x11amp. The newer real-player | ||
93 | and some games even include built-in support for ESD! | ||
94 | |||
95 | |||
96 | Building the Modules: | ||
97 | ===================== | ||
98 | |||
99 | This document does not provide full details on building the | ||
100 | kernel, etc. The notes below apply only to making the kernel | ||
101 | sound modules. If this conflicts with the kernel's README, | ||
102 | the README takes precedence. | ||
103 | |||
104 | 1. To make the kernel sound modules, cd to your /usr/src/linux | ||
105 | directory (typically) and type make config, make menuconfig, | ||
106 | or make xconfig (to start the command line, dialog, or x-based | ||
107 | configuration tool). | ||
108 | |||
109 | 2. Select the Sound option and a dialog will be displayed. | ||
110 | |||
111 | 3. Select M (module) for "Sound card support". | ||
112 | |||
113 | 4. Select your sound driver(s) as a module. For ProAudio, Sound | ||
114 | Blaster, etc., select M (module) for OSS sound modules. | ||
115 | [thanks to Marvin Stodolsky <stodolsk@erols.com>]A | ||
116 | |||
117 | 5. Make the kernel (e.g., make bzImage), and install the kernel. | ||
118 | |||
119 | 6. Make the modules and install them (make modules; make modules_install). | ||
120 | |||
121 | Note, for 2.5.x kernels, make sure you have the newer module-init-tools | ||
122 | installed or modules will not be loaded properly. 2.5.x requires an | ||
123 | updated module-init-tools. | ||
124 | |||
125 | |||
126 | Plug and Play (PnP: | ||
127 | =================== | ||
128 | |||
129 | If the sound card is an ISA PnP card, isapnp may be used | ||
130 | to configure the card. See the file isapnp.txt in the | ||
131 | directory one level up (e.g., /usr/src/linux/Documentation). | ||
132 | |||
133 | Also the 2.4.x kernels provide PnP capabilities, see the | ||
134 | file NEWS in this directory. | ||
135 | |||
136 | PCI sound cards are highly recommended, as they are far | ||
137 | easier to configure and from what I have read, they use | ||
138 | less resources and are more CPU efficient. | ||
139 | |||
140 | |||
141 | INSMOD: | ||
142 | ======= | ||
143 | |||
144 | If loading via insmod, the common modules must be loaded in the | ||
145 | order below BEFORE loading the other sound modules. The card-specific | ||
146 | modules may then be loaded (most require parameters). For example, | ||
147 | I use the following via a shell script to load my SoundBlaster: | ||
148 | |||
149 | SB_BASE=0x240 | ||
150 | SB_IRQ=9 | ||
151 | SB_DMA=3 | ||
152 | SB_DMA2=5 | ||
153 | SB_MPU=0x300 | ||
154 | # | ||
155 | echo Starting sound | ||
156 | /sbin/insmod soundcore | ||
157 | /sbin/insmod sound | ||
158 | # | ||
159 | echo Starting sound blaster.... | ||
160 | /sbin/insmod uart401 | ||
161 | /sbin/insmod sb io=$SB_BASE irq=$SB_IRQ dma=$SB_DMA dma16=$SB_DMA2 mpu_io=$SB_MP | ||
162 | |||
163 | When using sound as a module, I typically put these commands | ||
164 | in a file such as /root/soundon.sh. | ||
165 | |||
166 | |||
167 | MODPROBE: | ||
168 | ========= | ||
169 | |||
170 | If loading via modprobe, these common files are automatically loaded | ||
171 | when requested by modprobe. For example, my /etc/modprobe.conf contains: | ||
172 | |||
173 | alias sound sb | ||
174 | options sb io=0x240 irq=9 dma=3 dma16=5 mpu_io=0x300 | ||
175 | |||
176 | All you need to do to load the module is: | ||
177 | |||
178 | /sbin/modprobe sb | ||
179 | |||
180 | |||
181 | Sound Status: | ||
182 | ============= | ||
183 | |||
184 | The status of sound may be read/checked by: | ||
185 | cat (anyfile).au >/dev/audio | ||
186 | |||
187 | [WWH: This may not work properly for SoundBlaster PCI 128 cards | ||
188 | such as the es1370/1 (see the es1370/1 files in this directory) | ||
189 | as they do not automatically support uLaw on /dev/audio.] | ||
190 | |||
191 | The status of the modules and which modules depend on | ||
192 | which other modules may be checked by: | ||
193 | /sbin/lsmod | ||
194 | |||
195 | /sbin/lsmod should show something like the following: | ||
196 | sb 26280 0 | ||
197 | uart401 5640 0 [sb] | ||
198 | sound 57112 0 [sb uart401] | ||
199 | soundcore 1968 8 [sb sound] | ||
200 | |||
201 | |||
202 | Removing Sound: | ||
203 | =============== | ||
204 | |||
205 | Sound may be removed by using /sbin/rmmod in the reverse order | ||
206 | in which you load the modules. Note, if a program has a sound device | ||
207 | open (e.g., xmixer), that module (and the modules on which it | ||
208 | depends) may not be unloaded. | ||
209 | |||
210 | For example, I use the following to remove my Soundblaster (rmmod | ||
211 | in the reverse order in which I loaded the modules): | ||
212 | |||
213 | /sbin/rmmod sb | ||
214 | /sbin/rmmod uart401 | ||
215 | /sbin/rmmod sound | ||
216 | /sbin/rmmod soundcore | ||
217 | |||
218 | When using sound as a module, I typically put these commands | ||
219 | in a script such as /root/soundoff.sh. | ||
220 | |||
221 | |||
222 | Removing Sound for use with OSS: | ||
223 | ================================ | ||
224 | |||
225 | If you get really stuck or have a card that the kernel modules | ||
226 | will not support, you can get a commercial sound driver from | ||
227 | http://www.opensound.com. Before loading the commercial sound | ||
228 | driver, you should do the following: | ||
229 | |||
230 | 1. remove sound modules (detailed above) | ||
231 | 2. remove the sound modules from /etc/modprobe.conf | ||
232 | 3. move the sound modules from /lib/modules/<kernel>/misc | ||
233 | (for example, I make a /lib/modules/<kernel>/misc/tmp | ||
234 | directory and copy the sound module files to that | ||
235 | directory). | ||
236 | |||
237 | |||
238 | Multiple Sound Cards: | ||
239 | ===================== | ||
240 | |||
241 | The sound drivers will support multiple sound cards and there | ||
242 | are some great applications like multitrack that support them. | ||
243 | Typically, you need two sound cards of different types. Note, this | ||
244 | uses more precious interrupts and DMA channels and sometimes | ||
245 | can be a configuration nightmare. I have heard reports of 3-4 | ||
246 | sound cards (typically I only use 2). You can sometimes use | ||
247 | multiple PCI sound cards of the same type. | ||
248 | |||
249 | On my machine I have two sound cards (cs4232 and Soundblaster Vibra | ||
250 | 16). By loading sound as modules, I can control which is the first | ||
251 | sound device (/dev/dsp, /dev/audio, /dev/mixer) and which is | ||
252 | the second. Normally, the cs4232 (Dell sound on the motherboard) | ||
253 | would be the first sound device, but I prefer the Soundblaster. | ||
254 | All you have to do is to load the one you want as /dev/dsp | ||
255 | first (in my case "sb") and then load the other one | ||
256 | (in my case "cs4232"). | ||
257 | |||
258 | If you have two cards of the same type that are jumpered | ||
259 | cards or different PnP revisions, you may load the same | ||
260 | module twice. For example, I have a SoundBlaster vibra 16 | ||
261 | and an older SoundBlaster 16 (jumpers). To load the module | ||
262 | twice, you need to do the following: | ||
263 | |||
264 | 1. Copy the sound modules to a new name. For example | ||
265 | sb.o could be copied (or symlinked) to sb1.o for the | ||
266 | second SoundBlaster. | ||
267 | |||
268 | 2. Make a second entry in /etc/modprobe.conf, for example, | ||
269 | sound1 or sb1. This second entry should refer to the | ||
270 | new module names for example sb1, and should include | ||
271 | the I/O, etc. for the second sound card. | ||
272 | |||
273 | 3. Update your soundon.sh script, etc. | ||
274 | |||
275 | Warning: I have never been able to get two PnP sound cards of the | ||
276 | same type to load at the same time. I have tried this several times | ||
277 | with the Soundblaster Vibra 16 cards. OSS has indicated that this | ||
278 | is a PnP problem.... If anyone has any luck doing this, please | ||
279 | send me an E-MAIL. PCI sound cards should not have this problem.a | ||
280 | Since this was originally release, I have received a couple of | ||
281 | mails from people who have accomplished this! | ||
282 | |||
283 | NOTE: In Linux 2.4 the Sound Blaster driver (and only this one yet) | ||
284 | supports multiple cards with one module by default. | ||
285 | Read the file 'Soundblaster' in this directory for details. | ||
286 | |||
287 | |||
288 | Sound Problems: | ||
289 | =============== | ||
290 | |||
291 | First RTFM (including the troubleshooting section | ||
292 | in the Sound-HOWTO). | ||
293 | |||
294 | 1) If you are having problems loading the modules (for | ||
295 | example, if you get device conflict errors) try the | ||
296 | following: | ||
297 | |||
298 | A) If you have Win95 or NT on the same computer, | ||
299 | write down what addresses, IRQ, and DMA channels | ||
300 | those were using for the same hardware. You probably | ||
301 | can use these addresses, IRQs, and DMA channels. | ||
302 | You should really do this BEFORE attempting to get | ||
303 | sound working! | ||
304 | |||
305 | B) Check (cat) /proc/interrupts, /proc/ioports, | ||
306 | and /proc/dma. Are you trying to use an address, | ||
307 | IRQ or DMA port that another device is using? | ||
308 | |||
309 | C) Check (cat) /proc/isapnp | ||
310 | |||
311 | D) Inspect your /var/log/messages file. Often that will | ||
312 | indicate what IRQ or IO port could not be obtained. | ||
313 | |||
314 | E) Try another port or IRQ. Note this may involve | ||
315 | using the PnP tools to move the sound card to | ||
316 | another location. Sometimes this is the only way | ||
317 | and it is more or less trial and error. | ||
318 | |||
319 | 2) If you get motor-boating (the same sound or part of a | ||
320 | sound clip repeated), you probably have either an IRQ | ||
321 | or DMA conflict. Move the card to another IRQ or DMA | ||
322 | port. This has happened to me when playing long files | ||
323 | when I had an IRQ conflict. | ||
324 | |||
325 | 3. If you get dropouts or pauses when playing high sample | ||
326 | rate files such as using mpg123 or x11amp/xmms, you may | ||
327 | have too slow of a CPU and may have to use the options to | ||
328 | play the files at 1/2 speed. For example, you may use | ||
329 | the -2 or -4 option on mpg123. You may also get this | ||
330 | when trying to play mpeg files stored on a CD-ROM | ||
331 | (my Toshiba T8000 PII/366 sometimes has this problem). | ||
332 | |||
333 | 4. If you get "cannot access device" errors, your /dev/dsp | ||
334 | files, etc. may be set to owner root, mode 600. You | ||
335 | may have to use the command: | ||
336 | chmod 666 /dev/dsp /dev/mixer /dev/audio | ||
337 | |||
338 | 5. If you get "device busy" errors, another program has the | ||
339 | sound device open. For example, if using the Enlightenment | ||
340 | sound daemon "esd", the "esd" program has the sound device. | ||
341 | If using "esd", please RTFM the docs on ESD. For example, | ||
342 | esddsp <program> may be used to play files via a non-esd | ||
343 | aware program. | ||
344 | |||
345 | 6) Ask for help on the sound list or send E-MAIL to the | ||
346 | sound driver author/maintainer. | ||
347 | |||
348 | 7) Turn on debug in drivers/sound/sound_config.h (DEB, DDB, MDB). | ||
349 | |||
350 | 8) If the system reports insufficient DMA memory then you may want to | ||
351 | load sound with the "dmabufs=1" option. Or in /etc/conf.modules add | ||
352 | |||
353 | preinstall sound dmabufs=1 | ||
354 | |||
355 | This makes the sound system allocate its buffers and hang onto them. | ||
356 | |||
357 | You may also set persistent DMA when building a 2.4.x kernel. | ||
358 | |||
359 | |||
360 | Configuring Sound: | ||
361 | ================== | ||
362 | |||
363 | There are several ways of configuring your sound: | ||
364 | |||
365 | 1) On the kernel command line (when using the sound driver(s) | ||
366 | compiled in the kernel). Check the driver source and | ||
367 | documentation for details. | ||
368 | |||
369 | 2) On the command line when using insmod or in a bash script | ||
370 | using command line calls to load sound. | ||
371 | |||
372 | 3) In /etc/modprobe.conf when using modprobe. | ||
373 | |||
374 | 4) Via Red Hat's GPL'd /usr/sbin/sndconfig program (text based). | ||
375 | |||
376 | 5) Via the OSS soundconf program (with the commercial version | ||
377 | of the OSS driver. | ||
378 | |||
379 | 6) By just loading the module and let isapnp do everything relevant | ||
380 | for you. This works only with a few drivers yet and - of course - | ||
381 | only with isapnp hardware. | ||
382 | |||
383 | And I am sure, several other ways. | ||
384 | |||
385 | Anyone want to write a linuxconf module for configuring sound? | ||
386 | |||
387 | |||
388 | Module Loading: | ||
389 | =============== | ||
390 | |||
391 | When a sound card is first referenced and sound is modular, the sound system | ||
392 | will ask for the sound devices to be loaded. Initially it requests that | ||
393 | the driver for the sound system is loaded. It then will ask for | ||
394 | sound-slot-0, where 0 is the first sound card. (sound-slot-1 the second and | ||
395 | so on). Thus you can do | ||
396 | |||
397 | alias sound-slot-0 sb | ||
398 | |||
399 | To load a soundblaster at this point. If the slot loading does not provide | ||
400 | the desired device - for example a soundblaster does not directly provide | ||
401 | a midi synth in all cases then it will request "sound-service-0-n" where n | ||
402 | is | ||
403 | |||
404 | 0 Mixer | ||
405 | |||
406 | 2 MIDI | ||
407 | |||
408 | 3, 4 DSP audio | ||
409 | |||
410 | |||
411 | For example, I use the following to load my Soundblaster PCI 128 | ||
412 | (ES 1371) card first, followed by my SoundBlaster Vibra 16 card, | ||
413 | then by my TV card: | ||
414 | |||
415 | # Load the Soundblaster PCI 128 as /dev/dsp, /dev/dsp1, /dev/mixer | ||
416 | alias sound-slot-0 es1371 | ||
417 | |||
418 | # Load the Soundblaster Vibra 16 as /dev/dsp2, /dev/mixer1 | ||
419 | alias sound-slot-1 sb | ||
420 | options sb io=0x240 irq=5 dma=1 dma16=5 mpu_io=0x330 | ||
421 | |||
422 | # Load the BTTV (TV card) as /dev/mixer2 | ||
423 | alias sound-slot-2 bttv | ||
424 | alias sound-service-2-0 tvmixer | ||
425 | |||
426 | pre-install bttv modprobe tuner ; modprobe tvmixer | ||
427 | pre-install tvmixer modprobe msp3400; modprobe tvaudio | ||
428 | options tuner debug=0 type=8 | ||
429 | options bttv card=0 radio=0 pll=0 | ||
430 | |||
431 | |||
432 | For More Information (RTFM): | ||
433 | ============================ | ||
434 | 1) Information on kernel modules: manual pages for insmod and modprobe. | ||
435 | |||
436 | 2) Information on PnP, RTFM manual pages for isapnp. | ||
437 | |||
438 | 3) Sound-HOWTO and Sound-Playing-HOWTO. | ||
439 | |||
440 | 4) OSS's WWW site at http://www.opensound.com. | ||
441 | |||
442 | 5) All the files in Documentation/sound. | ||
443 | |||
444 | 6) The comments and code in linux/drivers/sound. | ||
445 | |||
446 | 7) The sndconfig and rhsound documentation from Red Hat. | ||
447 | |||
448 | 8) The Linux-sound mailing list: sound-list@redhat.com. | ||
449 | |||
450 | 9) Enlightenment documentation (for info on esd) | ||
451 | http://www.tux.org/~ricdude/EsounD.html. | ||
452 | |||
453 | 10) ALSA home page: http://www.alsa-project.org/ | ||
454 | |||
455 | |||
456 | Contact Information: | ||
457 | ==================== | ||
458 | Wade Hampton: (whampton@staffnet.com) | ||
459 | |||
diff --git a/Documentation/sound/oss/MAD16 b/Documentation/sound/oss/MAD16 new file mode 100644 index 000000000000..865dbd848742 --- /dev/null +++ b/Documentation/sound/oss/MAD16 | |||
@@ -0,0 +1,56 @@ | |||
1 | (This recipe has been edited to update the configuration symbols, | ||
2 | and change over to modprobe.conf for 2.6) | ||
3 | |||
4 | From: Shaw Carruthers <shaw@shawc.demon.co.uk> | ||
5 | |||
6 | I have been using mad16 sound for some time now with no problems, current | ||
7 | kernel 2.1.89 | ||
8 | |||
9 | lsmod shows: | ||
10 | |||
11 | mad16 5176 0 | ||
12 | sb 22044 0 [mad16] | ||
13 | uart401 5576 0 [mad16 sb] | ||
14 | ad1848 14176 1 [mad16] | ||
15 | sound 61928 0 [mad16 sb uart401 ad1848] | ||
16 | |||
17 | .config has: | ||
18 | |||
19 | CONFIG_SOUND=m | ||
20 | CONFIG_SOUND_ADLIB=m | ||
21 | CONFIG_SOUND_MAD16=m | ||
22 | CONFIG_SOUND_YM3812=m | ||
23 | |||
24 | modprobe.conf has: | ||
25 | |||
26 | alias char-major-14-* mad16 | ||
27 | options sb mad16=1 | ||
28 | options mad16 io=0x530 irq=7 dma=0 dma16=1 && /usr/local/bin/aumix -w 15 -p 20 -m 0 -1 0 -2 0 -3 0 -i 0 | ||
29 | |||
30 | |||
31 | To get the built in mixer to work this needs to be: | ||
32 | |||
33 | options adlib_card io=0x388 # FM synthesizer | ||
34 | options sb mad16=1 | ||
35 | options mad16 io=0x530 irq=7 dma=0 dma16=1 mpu_io=816 mpu_irq=5 && /usr/local/bin/aumix -w 15 -p 20 -m 0 -1 0 -2 0 -3 0 -i 0 | ||
36 | |||
37 | The addition of the "mpu_io=816 mpu_irq=5" to the mad16 options line is | ||
38 | |||
39 | ------------------------------------------------------------------------ | ||
40 | The mad16 module in addition supports the following options: | ||
41 | |||
42 | option: meaning: default: | ||
43 | joystick=0,1 disabled, enabled disabled | ||
44 | cdtype=0x00,0x02,0x04, disabled, Sony CDU31A, disabled | ||
45 | 0x06,0x08,0x0a Mitsumi, Panasonic, | ||
46 | Secondary IDE, Primary IDE | ||
47 | cdport=0x340,0x320, 0x340 | ||
48 | 0x330,0x360 | ||
49 | cdirq=0,3,5,7,9,10,11 disabled, IRQ3, ... disabled | ||
50 | cddma=0,5,6,7 disabled, DMA5, ... DMA5 for Mitsumi or IDE | ||
51 | cddma=0,1,2,3 disabled, DMA1, ... DMA3 for Sony or Panasonic | ||
52 | opl4=0,1 OPL3, OPL4 OPL3 | ||
53 | |||
54 | for more details see linux/drivers/sound/mad16.c | ||
55 | |||
56 | Rui Sousa | ||
diff --git a/Documentation/sound/oss/Maestro b/Documentation/sound/oss/Maestro new file mode 100644 index 000000000000..4a80eb3f8e00 --- /dev/null +++ b/Documentation/sound/oss/Maestro | |||
@@ -0,0 +1,123 @@ | |||
1 | An OSS/Lite Driver for the ESS Maestro family of sound cards | ||
2 | |||
3 | Zach Brown, December 1999 | ||
4 | |||
5 | Driver Status and Availability | ||
6 | ------------------------------ | ||
7 | |||
8 | The most recent version of this driver will hopefully always be available at | ||
9 | http://www.zabbo.net/maestro/ | ||
10 | |||
11 | I will try and maintain the most recent stable version of the driver | ||
12 | in both the stable and development kernel lines. | ||
13 | |||
14 | ESS Maestro Chip Family | ||
15 | ----------------------- | ||
16 | |||
17 | There are 3 main variants of the ESS Maestro PCI sound chip. The first | ||
18 | is the Maestro 1. It was originally produced by Platform Tech as the | ||
19 | 'AGOGO'. It can be recognized by Platform Tech's PCI ID 0x1285 with | ||
20 | 0x0100 as the device ID. It was put on some sound boards and a few laptops. | ||
21 | ESS bought the design and cleaned it up as the Maestro 2. This starts | ||
22 | their marking with the ESS vendor ID 0x125D and the 'year' device IDs. | ||
23 | The Maestro 2 claims 0x1968 while the Maestro 2e has 0x1978. | ||
24 | |||
25 | The various families of Maestro are mostly identical as far as this | ||
26 | driver is concerned. It doesn't touch the DSP parts that differ (though | ||
27 | it could for FM synthesis). | ||
28 | |||
29 | Driver OSS Behavior | ||
30 | -------------------- | ||
31 | |||
32 | This OSS driver exports /dev/mixer and /dev/dsp to applications, which | ||
33 | mostly adhere to the OSS spec. This driver doesn't register itself | ||
34 | with /dev/sndstat, so don't expect information to appear there. | ||
35 | |||
36 | The /dev/dsp device exported behaves almost as expected. Playback is | ||
37 | supported in all the various lovely formats. 8/16bit stereo/mono from | ||
38 | 8khz to 48khz, and mmap()ing for playback behaves. Capture/recording | ||
39 | is limited due to oddities with the Maestro hardware. One can only | ||
40 | record in 16bit stereo. For recording the maestro uses non interleaved | ||
41 | stereo buffers so that mmap()ing the incoming data does not result in | ||
42 | a ring buffer of LRLR data. mmap()ing of the read buffers is therefore | ||
43 | disallowed until this can be cleaned up. | ||
44 | |||
45 | /dev/mixer is an interface to the AC'97 codec on the Maestro. It is | ||
46 | worth noting that there are a variety of AC'97s that can be wired to | ||
47 | the Maestro. Which is used is entirely up to the hardware implementor. | ||
48 | This should only be visible to the user by the presence, or lack, of | ||
49 | 'Bass' and 'Treble' sliders in the mixer. Not all AC'97s have them. | ||
50 | |||
51 | The driver doesn't support MIDI or FM playback at the moment. Typically | ||
52 | the Maestro is wired to an MPU MIDI chip, but some hardware implementations | ||
53 | don't. We need to assemble a white list of hardware implementations that | ||
54 | have MIDI wired properly before we can claim to support it safely. | ||
55 | |||
56 | Compiling and Installing | ||
57 | ------------------------ | ||
58 | |||
59 | With the drivers inclusion into the kernel, compiling and installing | ||
60 | is the same as most OSS/Lite modular sound drivers. Compilation | ||
61 | of the driver is enabled through the CONFIG_SOUND_MAESTRO variable | ||
62 | in the config system. | ||
63 | |||
64 | It may be modular or statically linked. If it is modular it should be | ||
65 | installed with the rest of the modules for the kernel on the system. | ||
66 | Typically this will be in /lib/modules/ somewhere. 'alias sound maestro' | ||
67 | should also be added to your module configs (typically /etc/conf.modules) | ||
68 | if you're using modular OSS/Lite sound and want to default to using a | ||
69 | maestro chip. | ||
70 | |||
71 | As this is a PCI device, the module does not need to be informed of | ||
72 | any IO or IRQ resources it should use, it devines these from the | ||
73 | system. Sometimes, on sucky PCs, the BIOS fails to allocated resources | ||
74 | for the maestro. This will result in a message like: | ||
75 | maestro: PCI subsystem reports IRQ 0, this might not be correct. | ||
76 | from the kernel. Should this happen the sound chip most likely will | ||
77 | not operate correctly. To solve this one has to dig through their BIOS | ||
78 | (typically entered by hitting a hot key at boot time) and figure out | ||
79 | what magic needs to happen so that the BIOS will reward the maestro with | ||
80 | an IRQ. This operation is incredibly system specific, so you're on your | ||
81 | own. Sometimes the magic lies in 'PNP Capable Operating System' settings. | ||
82 | |||
83 | There are very few options to the driver. One is 'debug' which will | ||
84 | tell the driver to print minimal debugging information as it runs. This | ||
85 | can be collected with 'dmesg' or through the klogd daemon. | ||
86 | |||
87 | The other, more interesting option, is 'dsps_order'. Typically at | ||
88 | install time the driver will only register one available /dev/dsp device | ||
89 | for its use. The 'dsps_order' module parameter allows for more devices | ||
90 | to be allocated, as a power of two. Up to 4 devices can be registered | ||
91 | ( dsps_order=2 ). These devices act as fully distinct units and use | ||
92 | separate channels in the maestro. | ||
93 | |||
94 | Power Management | ||
95 | ---------------- | ||
96 | |||
97 | As of version 0.14, this driver has a minimal understanding of PCI | ||
98 | Power Management. If it finds a valid power management capability | ||
99 | on the PCI device it will attempt to use the power management | ||
100 | functions of the maestro. It will only do this on Maestro 2Es and | ||
101 | only on machines that are known to function well. You can | ||
102 | force the use of power management by setting the 'use_pm' module | ||
103 | option to 1, or can disable it entirely by setting it to 0. | ||
104 | |||
105 | When using power management, the driver does a few things | ||
106 | differently. It will keep the chip in a lower power mode | ||
107 | when the module is inserted but /dev/dsp is not open. This | ||
108 | allows the mixer to function but turns off the clocks | ||
109 | on other parts of the chip. When /dev/dsp is opened the chip | ||
110 | is brought into full power mode, and brought back down | ||
111 | when it is closed. It also powers down the chip entirely | ||
112 | when the module is removed or the machine is shutdown. This | ||
113 | can have nonobvious consequences. CD audio may not work | ||
114 | after a power managing driver is removed. Also, software that | ||
115 | doesn't understand power management may not be able to talk | ||
116 | to the powered down chip until the machine goes through a hard | ||
117 | reboot to bring it back. | ||
118 | |||
119 | .. more details .. | ||
120 | ------------------ | ||
121 | |||
122 | drivers/sound/maestro.c contains comments that hopefully explain | ||
123 | the maestro implementation. | ||
diff --git a/Documentation/sound/oss/Maestro3 b/Documentation/sound/oss/Maestro3 new file mode 100644 index 000000000000..a113718e8034 --- /dev/null +++ b/Documentation/sound/oss/Maestro3 | |||
@@ -0,0 +1,92 @@ | |||
1 | An OSS/Lite Driver for the ESS Maestro3 family of sound chips | ||
2 | |||
3 | Zach Brown, January 2001 | ||
4 | |||
5 | Driver Status and Availability | ||
6 | ------------------------------ | ||
7 | |||
8 | The most recent version of this driver will hopefully always be available at | ||
9 | http://www.zabbo.net/maestro3/ | ||
10 | |||
11 | I will try and maintain the most recent stable version of the driver | ||
12 | in both the stable and development kernel lines. | ||
13 | |||
14 | Historically I've sucked pretty hard at actually doing that, however. | ||
15 | |||
16 | ESS Maestro3 Chip Family | ||
17 | ----------------------- | ||
18 | |||
19 | The 'Maestro3' is much like the Maestro2 chip. The noted improvement | ||
20 | is the removal of the silicon in the '2' that did PCM mixing. All that | ||
21 | work is now done through a custom DSP called the ASSP, the Asynchronus | ||
22 | Specific Signal Processor. | ||
23 | |||
24 | The 'Allegro' is a baby version of the Maestro3. I'm not entirely clear | ||
25 | on the extent of the differences, but the driver supports them both :) | ||
26 | |||
27 | The 'Allegro' shows up as PCI ID 0x1988 and the Maestro3 as 0x1998, | ||
28 | both under ESS's vendor ID of 0x125D. The Maestro3 can also show up as | ||
29 | 0x199a when hardware strapping is used. | ||
30 | |||
31 | The chip can also act as a multi function device. The modem IDs follow | ||
32 | the audio multimedia device IDs. (so the modem part of an Allegro shows | ||
33 | up as 0x1989) | ||
34 | |||
35 | Driver OSS Behavior | ||
36 | -------------------- | ||
37 | |||
38 | This OSS driver exports /dev/mixer and /dev/dsp to applications, which | ||
39 | mostly adhere to the OSS spec. This driver doesn't register itself | ||
40 | with /dev/sndstat, so don't expect information to appear there. | ||
41 | |||
42 | The /dev/dsp device exported behaves as expected. Playback is | ||
43 | supported in all the various lovely formats. 8/16bit stereo/mono from | ||
44 | 8khz to 48khz, with both read()/write(), and mmap(). | ||
45 | |||
46 | /dev/mixer is an interface to the AC'97 codec on the Maestro3. It is | ||
47 | worth noting that there are a variety of AC'97s that can be wired to | ||
48 | the Maestro3. Which is used is entirely up to the hardware implementor. | ||
49 | This should only be visible to the user by the presence, or lack, of | ||
50 | 'Bass' and 'Treble' sliders in the mixer. Not all AC'97s have them. | ||
51 | The Allegro has an onchip AC'97. | ||
52 | |||
53 | The driver doesn't support MIDI or FM playback at the moment. | ||
54 | |||
55 | Compiling and Installing | ||
56 | ------------------------ | ||
57 | |||
58 | With the drivers inclusion into the kernel, compiling and installing | ||
59 | is the same as most OSS/Lite modular sound drivers. Compilation | ||
60 | of the driver is enabled through the CONFIG_SOUND_MAESTRO3 variable | ||
61 | in the config system. | ||
62 | |||
63 | It may be modular or statically linked. If it is modular it should be | ||
64 | installed with the rest of the modules for the kernel on the system. | ||
65 | Typically this will be in /lib/modules/ somewhere. 'alias sound-slot-0 | ||
66 | maestro3' should also be added to your module configs (typically | ||
67 | /etc/modprobe.conf) if you're using modular OSS/Lite sound and want to | ||
68 | default to using a maestro3 chip. | ||
69 | |||
70 | There are very few options to the driver. One is 'debug' which will | ||
71 | tell the driver to print minimal debugging information as it runs. This | ||
72 | can be collected with 'dmesg' or through the klogd daemon. | ||
73 | |||
74 | One is 'external_amp', which tells the driver to attempt to enable | ||
75 | an external amplifier. This defaults to '1', you can tell the driver | ||
76 | not to bother enabling such an amplifier by setting it to '0'. | ||
77 | |||
78 | And the last is 'gpio_pin', which tells the driver which GPIO pin number | ||
79 | the external amp uses (0-15), The Allegro uses 8 by default, all others 1. | ||
80 | If everything loads correctly and seems to be working but you get no sound, | ||
81 | try tweaking this value. | ||
82 | |||
83 | Systems known to need a different value | ||
84 | Panasonic ToughBook CF-72: gpio_pin=13 | ||
85 | |||
86 | Power Management | ||
87 | ---------------- | ||
88 | |||
89 | This driver has a minimal understanding of PCI Power Management. It will | ||
90 | try and power down the chip when the system is suspended, and power | ||
91 | it up with it is resumed. It will also try and power down the chip | ||
92 | when the machine is shut down. | ||
diff --git a/Documentation/sound/oss/MultiSound b/Documentation/sound/oss/MultiSound new file mode 100644 index 000000000000..e4a18bb7f73a --- /dev/null +++ b/Documentation/sound/oss/MultiSound | |||
@@ -0,0 +1,1137 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # Turtle Beach MultiSound Driver Notes | ||
4 | # -- Andrew Veliath <andrewtv@usa.net> | ||
5 | # | ||
6 | # Last update: September 10, 1998 | ||
7 | # Corresponding msnd driver: 0.8.3 | ||
8 | # | ||
9 | # ** This file is a README (top part) and shell archive (bottom part). | ||
10 | # The corresponding archived utility sources can be unpacked by | ||
11 | # running `sh MultiSound' (the utilities are only needed for the | ||
12 | # Pinnacle and Fiji cards). ** | ||
13 | # | ||
14 | # | ||
15 | # -=-=- Getting Firmware -=-=- | ||
16 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
17 | # | ||
18 | # See the section `Obtaining and Creating Firmware Files' in this | ||
19 | # document for instructions on obtaining the necessary firmware | ||
20 | # files. | ||
21 | # | ||
22 | # | ||
23 | # Supported Features | ||
24 | # ~~~~~~~~~~~~~~~~~~ | ||
25 | # | ||
26 | # Currently, full-duplex digital audio (/dev/dsp only, /dev/audio is | ||
27 | # not currently available) and mixer functionality (/dev/mixer) are | ||
28 | # supported (memory mapped digital audio is not yet supported). | ||
29 | # Digital transfers and monitoring can be done as well if you have | ||
30 | # the digital daughterboard (see the section on using the S/PDIF port | ||
31 | # for more information). | ||
32 | # | ||
33 | # Support for the Turtle Beach MultiSound Hurricane architecture is | ||
34 | # composed of the following modules (these can also operate compiled | ||
35 | # into the kernel): | ||
36 | # | ||
37 | # msnd - MultiSound base (requires soundcore) | ||
38 | # | ||
39 | # msnd_classic - Base audio/mixer support for Classic, Monetery and | ||
40 | # Tahiti cards | ||
41 | # | ||
42 | # msnd_pinnacle - Base audio/mixer support for Pinnacle and Fiji cards | ||
43 | # | ||
44 | # | ||
45 | # Important Notes - Read Before Using | ||
46 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
47 | # | ||
48 | # The firmware files are not included (may change in future). You | ||
49 | # must obtain these images from Turtle Beach (they are included in | ||
50 | # the MultiSound Development Kits), and place them in /etc/sound for | ||
51 | # example, and give the full paths in the Linux configuration. If | ||
52 | # you are compiling in support for the MultiSound driver rather than | ||
53 | # using it as a module, these firmware files must be accessible | ||
54 | # during kernel compilation. | ||
55 | # | ||
56 | # Please note these files must be binary files, not assembler. See | ||
57 | # the section later in this document for instructions to obtain these | ||
58 | # files. | ||
59 | # | ||
60 | # | ||
61 | # Configuring Card Resources | ||
62 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
63 | # | ||
64 | # ** This section is very important, as your card may not work at all | ||
65 | # or your machine may crash if you do not do this correctly. ** | ||
66 | # | ||
67 | # * Classic/Monterey/Tahiti | ||
68 | # | ||
69 | # These cards are configured through the driver msnd_classic. You must | ||
70 | # know the io port, then the driver will select the irq and memory resources | ||
71 | # on the card. It is up to you to know if these are free locations or now, | ||
72 | # a conflict can lock the machine up. | ||
73 | # | ||
74 | # * Pinnacle/Fiji | ||
75 | # | ||
76 | # The Pinnacle and Fiji cards have an extra config port, either | ||
77 | # 0x250, 0x260 or 0x270. This port can be disabled to have the card | ||
78 | # configured strictly through PnP, however you lose the ability to | ||
79 | # access the IDE controller and joystick devices on this card when | ||
80 | # using PnP. The included pinnaclecfg program in this shell archive | ||
81 | # can be used to configure the card in non-PnP mode, and in PnP mode | ||
82 | # you can use isapnptools. These are described briefly here. | ||
83 | # | ||
84 | # pinnaclecfg is not required; you can use the msnd_pinnacle module | ||
85 | # to fully configure the card as well. However, pinnaclecfg can be | ||
86 | # used to change the resource values of a particular device after the | ||
87 | # msnd_pinnacle module has been loaded. If you are compiling the | ||
88 | # driver into the kernel, you must set these values during compile | ||
89 | # time, however other peripheral resource values can be changed with | ||
90 | # the pinnaclecfg program after the kernel is loaded. | ||
91 | # | ||
92 | # | ||
93 | # *** PnP mode | ||
94 | # | ||
95 | # Use pnpdump to obtain a sample configuration if you can; I was able | ||
96 | # to obtain one with the command `pnpdump 1 0x203' -- this may vary | ||
97 | # for you (running pnpdump by itself did not work for me). Then, | ||
98 | # edit this file and use isapnp to uncomment and set the card values. | ||
99 | # Use these values when inserting the msnd_pinnacle module. Using | ||
100 | # this method, you can set the resources for the DSP and the Kurzweil | ||
101 | # synth (Pinnacle). Since Linux does not directly support PnP | ||
102 | # devices, you may have difficulty when using the card in PnP mode | ||
103 | # when it the driver is compiled into the kernel. Using non-PnP mode | ||
104 | # is preferable in this case. | ||
105 | # | ||
106 | # Here is an example mypinnacle.conf for isapnp that sets the card to | ||
107 | # io base 0x210, irq 5 and mem 0xd8000, and also sets the Kurzweil | ||
108 | # synth to 0x330 and irq 9 (may need editing for your system): | ||
109 | # | ||
110 | # (READPORT 0x0203) | ||
111 | # (CSN 2) | ||
112 | # (IDENTIFY *) | ||
113 | # | ||
114 | # # DSP | ||
115 | # (CONFIGURE BVJ0440/-1 (LD 0 | ||
116 | # (INT 0 (IRQ 5 (MODE +E))) (IO 0 (BASE 0x0210)) (MEM 0 (BASE 0x0d8000)) | ||
117 | # (ACT Y))) | ||
118 | # | ||
119 | # # Kurzweil Synth (Pinnacle Only) | ||
120 | # (CONFIGURE BVJ0440/-1 (LD 1 | ||
121 | # (IO 0 (BASE 0x0330)) (INT 0 (IRQ 9 (MODE +E))) | ||
122 | # (ACT Y))) | ||
123 | # | ||
124 | # (WAITFORKEY) | ||
125 | # | ||
126 | # | ||
127 | # *** Non-PnP mode | ||
128 | # | ||
129 | # The second way is by running the card in non-PnP mode. This | ||
130 | # actually has some advantages in that you can access some other | ||
131 | # devices on the card, such as the joystick and IDE controller. To | ||
132 | # configure the card, unpack this shell archive and build the | ||
133 | # pinnaclecfg program. Using this program, you can assign the | ||
134 | # resource values to the card's devices, or disable the devices. As | ||
135 | # an alternative to using pinnaclecfg, you can specify many of the | ||
136 | # configuration values when loading the msnd_pinnacle module (or | ||
137 | # during kernel configuration when compiling the driver into the | ||
138 | # kernel). | ||
139 | # | ||
140 | # If you specify cfg=0x250 for the msnd_pinnacle module, it | ||
141 | # automatically configure the card to the given io, irq and memory | ||
142 | # values using that config port (the config port is jumper selectable | ||
143 | # on the card to 0x250, 0x260 or 0x270). | ||
144 | # | ||
145 | # See the `msnd_pinnacle Additional Options' section below for more | ||
146 | # information on these parameters (also, if you compile the driver | ||
147 | # directly into the kernel, these extra parameters can be useful | ||
148 | # here). | ||
149 | # | ||
150 | # | ||
151 | # ** It is very easy to cause problems in your machine if you choose a | ||
152 | # resource value which is incorrect. ** | ||
153 | # | ||
154 | # | ||
155 | # Examples | ||
156 | # ~~~~~~~~ | ||
157 | # | ||
158 | # * MultiSound Classic/Monterey/Tahiti: | ||
159 | # | ||
160 | # modprobe soundcore | ||
161 | # insmod msnd | ||
162 | # insmod msnd_classic io=0x290 irq=7 mem=0xd0000 | ||
163 | # | ||
164 | # * MultiSound Pinnacle in PnP mode: | ||
165 | # | ||
166 | # modprobe soundcore | ||
167 | # insmod msnd | ||
168 | # isapnp mypinnacle.conf | ||
169 | # insmod msnd_pinnacle io=0x210 irq=5 mem=0xd8000 <-- match mypinnacle.conf values | ||
170 | # | ||
171 | # * MultiSound Pinnacle in non-PnP mode (replace 0x250 with your configuration port, | ||
172 | # one of 0x250, 0x260 or 0x270): | ||
173 | # | ||
174 | # insmod soundcore | ||
175 | # insmod msnd | ||
176 | # insmod msnd_pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 | ||
177 | # | ||
178 | # * To use the MPU-compatible Kurzweil synth on the Pinnacle in PnP | ||
179 | # mode, add the following (assumes you did `isapnp mypinnacle.conf'): | ||
180 | # | ||
181 | # insmod sound | ||
182 | # insmod mpu401 io=0x330 irq=9 <-- match mypinnacle.conf values | ||
183 | # | ||
184 | # * To use the MPU-compatible Kurzweil synth on the Pinnacle in non-PnP | ||
185 | # mode, add the following. Note how we first configure the peripheral's | ||
186 | # resources, _then_ install a Linux driver for it: | ||
187 | # | ||
188 | # insmod sound | ||
189 | # pinnaclecfg 0x250 mpu 0x330 9 | ||
190 | # insmod mpu401 io=0x330 irq=9 | ||
191 | # | ||
192 | # -- OR you can use the following sequence without pinnaclecfg in non-PnP mode: | ||
193 | # | ||
194 | # insmod soundcore | ||
195 | # insmod msnd | ||
196 | # insmod msnd_pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 mpu_io=0x330 mpu_irq=9 | ||
197 | # insmod sound | ||
198 | # insmod mpu401 io=0x330 irq=9 | ||
199 | # | ||
200 | # * To setup the joystick port on the Pinnacle in non-PnP mode (though | ||
201 | # you have to find the actual Linux joystick driver elsewhere), you | ||
202 | # can use pinnaclecfg: | ||
203 | # | ||
204 | # pinnaclecfg 0x250 joystick 0x200 | ||
205 | # | ||
206 | # -- OR you can configure this using msnd_pinnacle with the following: | ||
207 | # | ||
208 | # insmod soundcore | ||
209 | # insmod msnd | ||
210 | # insmod msnd_pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 joystick_io=0x200 | ||
211 | # | ||
212 | # | ||
213 | # msnd_classic, msnd_pinnacle Required Options | ||
214 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
215 | # | ||
216 | # If the following options are not given, the module will not load. | ||
217 | # Examine the kernel message log for informative error messages. | ||
218 | # WARNING--probing isn't supported so try to make sure you have the | ||
219 | # correct shared memory area, otherwise you may experience problems. | ||
220 | # | ||
221 | # io I/O base of DSP, e.g. io=0x210 | ||
222 | # irq IRQ number, e.g. irq=5 | ||
223 | # mem Shared memory area, e.g. mem=0xd8000 | ||
224 | # | ||
225 | # | ||
226 | # msnd_classic, msnd_pinnacle Additional Options | ||
227 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
228 | # | ||
229 | # fifosize The digital audio FIFOs, in kilobytes. If not | ||
230 | # specified, the default will be used. Increasing | ||
231 | # this value will reduce the chance of a FIFO | ||
232 | # underflow at the expense of increasing overall | ||
233 | # latency. For example, fifosize=512 will | ||
234 | # allocate 512kB read and write FIFOs (1MB total). | ||
235 | # While this may reduce dropouts, a heavy machine | ||
236 | # load will undoubtedly starve the FIFO of data | ||
237 | # and you will eventually get dropouts. One | ||
238 | # option is to alter the scheduling priority of | ||
239 | # the playback process, using `nice' or some form | ||
240 | # of POSIX soft real-time scheduling. | ||
241 | # | ||
242 | # calibrate_signal Setting this to one calibrates the ADCs to the | ||
243 | # signal, zero calibrates to the card (defaults | ||
244 | # to zero). | ||
245 | # | ||
246 | # | ||
247 | # msnd_pinnacle Additional Options | ||
248 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
249 | # | ||
250 | # digital Specify digital=1 to enable the S/PDIF input | ||
251 | # if you have the digital daughterboard | ||
252 | # adapter. This will enable access to the | ||
253 | # DIGITAL1 input for the soundcard in the mixer. | ||
254 | # Some mixer programs might have trouble setting | ||
255 | # the DIGITAL1 source as an input. If you have | ||
256 | # trouble, you can try the setdigital.c program | ||
257 | # at the bottom of this document. | ||
258 | # | ||
259 | # cfg Non-PnP configuration port for the Pinnacle | ||
260 | # and Fiji (typically 0x250, 0x260 or 0x270, | ||
261 | # depending on the jumper configuration). If | ||
262 | # this option is omitted, then it is assumed | ||
263 | # that the card is in PnP mode, and that the | ||
264 | # specified DSP resource values are already | ||
265 | # configured with PnP (i.e. it won't attempt to | ||
266 | # do any sort of configuration). | ||
267 | # | ||
268 | # When the Pinnacle is in non-PnP mode, you can use the following | ||
269 | # options to configure particular devices. If a full specification | ||
270 | # for a device is not given, then the device is not configured. Note | ||
271 | # that you still must use a Linux driver for any of these devices | ||
272 | # once their resources are setup (such as the Linux joystick driver, | ||
273 | # or the MPU401 driver from OSS for the Kurzweil synth). | ||
274 | # | ||
275 | # mpu_io I/O port of MPU (on-board Kurzweil synth) | ||
276 | # mpu_irq IRQ of MPU (on-board Kurzweil synth) | ||
277 | # ide_io0 First I/O port of IDE controller | ||
278 | # ide_io1 Second I/O port of IDE controller | ||
279 | # ide_irq IRQ IDE controller | ||
280 | # joystick_io I/O port of joystick | ||
281 | # | ||
282 | # | ||
283 | # Obtaining and Creating Firmware Files | ||
284 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
285 | # | ||
286 | # For the Classic/Tahiti/Monterey | ||
287 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
288 | # | ||
289 | # Download to /tmp and unzip the following file from Turtle Beach: | ||
290 | # | ||
291 | # ftp://ftp.voyetra.com/pub/tbs/msndcl/msndvkit.zip | ||
292 | # | ||
293 | # When unzipped, unzip the file named MsndFiles.zip. Then copy the | ||
294 | # following firmware files to /etc/sound (note the file renaming): | ||
295 | # | ||
296 | # cp DSPCODE/MSNDINIT.BIN /etc/sound/msndinit.bin | ||
297 | # cp DSPCODE/MSNDPERM.REB /etc/sound/msndperm.bin | ||
298 | # | ||
299 | # When configuring the Linux kernel, specify /etc/sound/msndinit.bin and | ||
300 | # /etc/sound/msndperm.bin for the two firmware files (Linux kernel | ||
301 | # versions older than 2.2 do not ask for firmware paths, and are | ||
302 | # hardcoded to /etc/sound). | ||
303 | # | ||
304 | # If you are compiling the driver into the kernel, these files must | ||
305 | # be accessible during compilation, but will not be needed later. | ||
306 | # The files must remain, however, if the driver is used as a module. | ||
307 | # | ||
308 | # | ||
309 | # For the Pinnacle/Fiji | ||
310 | # ~~~~~~~~~~~~~~~~~~~~~ | ||
311 | # | ||
312 | # Download to /tmp and unzip the following file from Turtle Beach (be | ||
313 | # sure to use the entire URL; some have had trouble navigating to the | ||
314 | # URL): | ||
315 | # | ||
316 | # ftp://ftp.voyetra.com/pub/tbs/pinn/pnddk100.zip | ||
317 | # | ||
318 | # Unpack this shell archive, and run make in the created directory | ||
319 | # (you need a C compiler and flex to build the utilities). This | ||
320 | # should give you the executables conv, pinnaclecfg and setdigital. | ||
321 | # conv is only used temporarily here to create the firmware files, | ||
322 | # while pinnaclecfg is used to configure the Pinnacle or Fiji card in | ||
323 | # non-PnP mode, and setdigital can be used to set the S/PDIF input on | ||
324 | # the mixer (pinnaclecfg and setdigital should be copied to a | ||
325 | # convenient place, possibly run during system initialization). | ||
326 | # | ||
327 | # To generating the firmware files with the `conv' program, we create | ||
328 | # the binary firmware files by doing the following conversion | ||
329 | # (assuming the archive unpacked into a directory named PINNDDK): | ||
330 | # | ||
331 | # ./conv < PINNDDK/dspcode/pndspini.asm > /etc/sound/pndspini.bin | ||
332 | # ./conv < PINNDDK/dspcode/pndsperm.asm > /etc/sound/pndsperm.bin | ||
333 | # | ||
334 | # The conv (and conv.l) program is not needed after conversion and can | ||
335 | # be safely deleted. Then, when configuring the Linux kernel, specify | ||
336 | # /etc/sound/pndspini.bin and /etc/sound/pndsperm.bin for the two | ||
337 | # firmware files (Linux kernel versions older than 2.2 do not ask for | ||
338 | # firmware paths, and are hardcoded to /etc/sound). | ||
339 | # | ||
340 | # If you are compiling the driver into the kernel, these files must | ||
341 | # be accessible during compilation, but will not be needed later. | ||
342 | # The files must remain, however, if the driver is used as a module. | ||
343 | # | ||
344 | # | ||
345 | # Using Digital I/O with the S/PDIF Port | ||
346 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
347 | # | ||
348 | # If you have a Pinnacle or Fiji with the digital daughterboard and | ||
349 | # want to set it as the input source, you can use this program if you | ||
350 | # have trouble trying to do it with a mixer program (be sure to | ||
351 | # insert the module with the digital=1 option, or say Y to the option | ||
352 | # during compiled-in kernel operation). Upon selection of the S/PDIF | ||
353 | # port, you should be able monitor and record from it. | ||
354 | # | ||
355 | # There is something to note about using the S/PDIF port. Digital | ||
356 | # timing is taken from the digital signal, so if a signal is not | ||
357 | # connected to the port and it is selected as recording input, you | ||
358 | # will find PCM playback to be distorted in playback rate. Also, | ||
359 | # attempting to record at a sampling rate other than the DAT rate may | ||
360 | # be problematic (i.e. trying to record at 8000Hz when the DAT signal | ||
361 | # is 44100Hz). If you have a problem with this, set the recording | ||
362 | # input to analog if you need to record at a rate other than that of | ||
363 | # the DAT rate. | ||
364 | # | ||
365 | # | ||
366 | # -- Shell archive attached below, just run `sh MultiSound' to extract. | ||
367 | # Contains Pinnacle/Fiji utilities to convert firmware, configure | ||
368 | # in non-PnP mode, and select the DIGITAL1 input for the mixer. | ||
369 | # | ||
370 | # | ||
371 | #!/bin/sh | ||
372 | # This is a shell archive (produced by GNU sharutils 4.2). | ||
373 | # To extract the files from this archive, save it to some FILE, remove | ||
374 | # everything before the `!/bin/sh' line above, then type `sh FILE'. | ||
375 | # | ||
376 | # Made on 1998-12-04 10:07 EST by <andrewtv@ztransform.velsoft.com>. | ||
377 | # Source directory was `/home/andrewtv/programming/pinnacle/pinnacle'. | ||
378 | # | ||
379 | # Existing files will *not* be overwritten unless `-c' is specified. | ||
380 | # | ||
381 | # This shar contains: | ||
382 | # length mode name | ||
383 | # ------ ---------- ------------------------------------------ | ||
384 | # 2046 -rw-rw-r-- MultiSound.d/setdigital.c | ||
385 | # 10235 -rw-rw-r-- MultiSound.d/pinnaclecfg.c | ||
386 | # 106 -rw-rw-r-- MultiSound.d/Makefile | ||
387 | # 141 -rw-rw-r-- MultiSound.d/conv.l | ||
388 | # 1472 -rw-rw-r-- MultiSound.d/msndreset.c | ||
389 | # | ||
390 | save_IFS="${IFS}" | ||
391 | IFS="${IFS}:" | ||
392 | gettext_dir=FAILED | ||
393 | locale_dir=FAILED | ||
394 | first_param="$1" | ||
395 | for dir in $PATH | ||
396 | do | ||
397 | if test "$gettext_dir" = FAILED && test -f $dir/gettext \ | ||
398 | && ($dir/gettext --version >/dev/null 2>&1) | ||
399 | then | ||
400 | set `$dir/gettext --version 2>&1` | ||
401 | if test "$3" = GNU | ||
402 | then | ||
403 | gettext_dir=$dir | ||
404 | fi | ||
405 | fi | ||
406 | if test "$locale_dir" = FAILED && test -f $dir/shar \ | ||
407 | && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) | ||
408 | then | ||
409 | locale_dir=`$dir/shar --print-text-domain-dir` | ||
410 | fi | ||
411 | done | ||
412 | IFS="$save_IFS" | ||
413 | if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED | ||
414 | then | ||
415 | echo=echo | ||
416 | else | ||
417 | TEXTDOMAINDIR=$locale_dir | ||
418 | export TEXTDOMAINDIR | ||
419 | TEXTDOMAIN=sharutils | ||
420 | export TEXTDOMAIN | ||
421 | echo="$gettext_dir/gettext -s" | ||
422 | fi | ||
423 | touch -am 1231235999 $$.touch >/dev/null 2>&1 | ||
424 | if test ! -f 1231235999 && test -f $$.touch; then | ||
425 | shar_touch=touch | ||
426 | else | ||
427 | shar_touch=: | ||
428 | echo | ||
429 | $echo 'WARNING: not restoring timestamps. Consider getting and' | ||
430 | $echo "installing GNU \`touch', distributed in GNU File Utilities..." | ||
431 | echo | ||
432 | fi | ||
433 | rm -f 1231235999 $$.touch | ||
434 | # | ||
435 | if mkdir _sh01426; then | ||
436 | $echo 'x -' 'creating lock directory' | ||
437 | else | ||
438 | $echo 'failed to create lock directory' | ||
439 | exit 1 | ||
440 | fi | ||
441 | # ============= MultiSound.d/setdigital.c ============== | ||
442 | if test ! -d 'MultiSound.d'; then | ||
443 | $echo 'x -' 'creating directory' 'MultiSound.d' | ||
444 | mkdir 'MultiSound.d' | ||
445 | fi | ||
446 | if test -f 'MultiSound.d/setdigital.c' && test "$first_param" != -c; then | ||
447 | $echo 'x -' SKIPPING 'MultiSound.d/setdigital.c' '(file already exists)' | ||
448 | else | ||
449 | $echo 'x -' extracting 'MultiSound.d/setdigital.c' '(text)' | ||
450 | sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/setdigital.c' && | ||
451 | /********************************************************************* | ||
452 | X * | ||
453 | X * setdigital.c - sets the DIGITAL1 input for a mixer | ||
454 | X * | ||
455 | X * Copyright (C) 1998 Andrew Veliath | ||
456 | X * | ||
457 | X * This program is free software; you can redistribute it and/or modify | ||
458 | X * it under the terms of the GNU General Public License as published by | ||
459 | X * the Free Software Foundation; either version 2 of the License, or | ||
460 | X * (at your option) any later version. | ||
461 | X * | ||
462 | X * This program is distributed in the hope that it will be useful, | ||
463 | X * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
464 | X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
465 | X * GNU General Public License for more details. | ||
466 | X * | ||
467 | X * You should have received a copy of the GNU General Public License | ||
468 | X * along with this program; if not, write to the Free Software | ||
469 | X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
470 | X * | ||
471 | X ********************************************************************/ | ||
472 | X | ||
473 | #include <stdio.h> | ||
474 | #include <unistd.h> | ||
475 | #include <fcntl.h> | ||
476 | #include <sys/types.h> | ||
477 | #include <sys/stat.h> | ||
478 | #include <sys/ioctl.h> | ||
479 | #include <sys/soundcard.h> | ||
480 | X | ||
481 | int main(int argc, char *argv[]) | ||
482 | { | ||
483 | X int fd; | ||
484 | X unsigned long recmask, recsrc; | ||
485 | X | ||
486 | X if (argc != 2) { | ||
487 | X fprintf(stderr, "usage: setdigital <mixer device>\n"); | ||
488 | X exit(1); | ||
489 | X } | ||
490 | X | ||
491 | X if ((fd = open(argv[1], O_RDWR)) < 0) { | ||
492 | X perror(argv[1]); | ||
493 | X exit(1); | ||
494 | X } | ||
495 | X | ||
496 | X if (ioctl(fd, SOUND_MIXER_READ_RECMASK, &recmask) < 0) { | ||
497 | X fprintf(stderr, "error: ioctl read recording mask failed\n"); | ||
498 | X perror("ioctl"); | ||
499 | X close(fd); | ||
500 | X exit(1); | ||
501 | X } | ||
502 | X | ||
503 | X if (!(recmask & SOUND_MASK_DIGITAL1)) { | ||
504 | X fprintf(stderr, "error: cannot find DIGITAL1 device in mixer\n"); | ||
505 | X close(fd); | ||
506 | X exit(1); | ||
507 | X } | ||
508 | X | ||
509 | X if (ioctl(fd, SOUND_MIXER_READ_RECSRC, &recsrc) < 0) { | ||
510 | X fprintf(stderr, "error: ioctl read recording source failed\n"); | ||
511 | X perror("ioctl"); | ||
512 | X close(fd); | ||
513 | X exit(1); | ||
514 | X } | ||
515 | X | ||
516 | X recsrc |= SOUND_MASK_DIGITAL1; | ||
517 | X | ||
518 | X if (ioctl(fd, SOUND_MIXER_WRITE_RECSRC, &recsrc) < 0) { | ||
519 | X fprintf(stderr, "error: ioctl write recording source failed\n"); | ||
520 | X perror("ioctl"); | ||
521 | X close(fd); | ||
522 | X exit(1); | ||
523 | X } | ||
524 | X | ||
525 | X close(fd); | ||
526 | X | ||
527 | X return 0; | ||
528 | } | ||
529 | SHAR_EOF | ||
530 | $shar_touch -am 1204092598 'MultiSound.d/setdigital.c' && | ||
531 | chmod 0664 'MultiSound.d/setdigital.c' || | ||
532 | $echo 'restore of' 'MultiSound.d/setdigital.c' 'failed' | ||
533 | if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ | ||
534 | && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then | ||
535 | md5sum -c << SHAR_EOF >/dev/null 2>&1 \ | ||
536 | || $echo 'MultiSound.d/setdigital.c:' 'MD5 check failed' | ||
537 | e87217fc3e71288102ba41fd81f71ec4 MultiSound.d/setdigital.c | ||
538 | SHAR_EOF | ||
539 | else | ||
540 | shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/setdigital.c'`" | ||
541 | test 2046 -eq "$shar_count" || | ||
542 | $echo 'MultiSound.d/setdigital.c:' 'original size' '2046,' 'current size' "$shar_count!" | ||
543 | fi | ||
544 | fi | ||
545 | # ============= MultiSound.d/pinnaclecfg.c ============== | ||
546 | if test -f 'MultiSound.d/pinnaclecfg.c' && test "$first_param" != -c; then | ||
547 | $echo 'x -' SKIPPING 'MultiSound.d/pinnaclecfg.c' '(file already exists)' | ||
548 | else | ||
549 | $echo 'x -' extracting 'MultiSound.d/pinnaclecfg.c' '(text)' | ||
550 | sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/pinnaclecfg.c' && | ||
551 | /********************************************************************* | ||
552 | X * | ||
553 | X * pinnaclecfg.c - Pinnacle/Fiji Device Configuration Program | ||
554 | X * | ||
555 | X * This is for NON-PnP mode only. For PnP mode, use isapnptools. | ||
556 | X * | ||
557 | X * This is Linux-specific, and must be run with root permissions. | ||
558 | X * | ||
559 | X * Part of the Turtle Beach MultiSound Sound Card Driver for Linux | ||
560 | X * | ||
561 | X * Copyright (C) 1998 Andrew Veliath | ||
562 | X * | ||
563 | X * This program is free software; you can redistribute it and/or modify | ||
564 | X * it under the terms of the GNU General Public License as published by | ||
565 | X * the Free Software Foundation; either version 2 of the License, or | ||
566 | X * (at your option) any later version. | ||
567 | X * | ||
568 | X * This program is distributed in the hope that it will be useful, | ||
569 | X * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
570 | X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
571 | X * GNU General Public License for more details. | ||
572 | X * | ||
573 | X * You should have received a copy of the GNU General Public License | ||
574 | X * along with this program; if not, write to the Free Software | ||
575 | X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
576 | X * | ||
577 | X ********************************************************************/ | ||
578 | X | ||
579 | #include <stdio.h> | ||
580 | #include <stdlib.h> | ||
581 | #include <string.h> | ||
582 | #include <errno.h> | ||
583 | #include <unistd.h> | ||
584 | #include <asm/io.h> | ||
585 | #include <asm/types.h> | ||
586 | X | ||
587 | #define IREG_LOGDEVICE 0x07 | ||
588 | #define IREG_ACTIVATE 0x30 | ||
589 | #define LD_ACTIVATE 0x01 | ||
590 | #define LD_DISACTIVATE 0x00 | ||
591 | #define IREG_EECONTROL 0x3F | ||
592 | #define IREG_MEMBASEHI 0x40 | ||
593 | #define IREG_MEMBASELO 0x41 | ||
594 | #define IREG_MEMCONTROL 0x42 | ||
595 | #define IREG_MEMRANGEHI 0x43 | ||
596 | #define IREG_MEMRANGELO 0x44 | ||
597 | #define MEMTYPE_8BIT 0x00 | ||
598 | #define MEMTYPE_16BIT 0x02 | ||
599 | #define MEMTYPE_RANGE 0x00 | ||
600 | #define MEMTYPE_HIADDR 0x01 | ||
601 | #define IREG_IO0_BASEHI 0x60 | ||
602 | #define IREG_IO0_BASELO 0x61 | ||
603 | #define IREG_IO1_BASEHI 0x62 | ||
604 | #define IREG_IO1_BASELO 0x63 | ||
605 | #define IREG_IRQ_NUMBER 0x70 | ||
606 | #define IREG_IRQ_TYPE 0x71 | ||
607 | #define IRQTYPE_HIGH 0x02 | ||
608 | #define IRQTYPE_LOW 0x00 | ||
609 | #define IRQTYPE_LEVEL 0x01 | ||
610 | #define IRQTYPE_EDGE 0x00 | ||
611 | X | ||
612 | #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) | ||
613 | #define LOBYTE(w) ((BYTE)(w)) | ||
614 | #define MAKEWORD(low,hi) ((WORD)(((BYTE)(low))|(((WORD)((BYTE)(hi)))<<8))) | ||
615 | X | ||
616 | typedef __u8 BYTE; | ||
617 | typedef __u16 USHORT; | ||
618 | typedef __u16 WORD; | ||
619 | X | ||
620 | static int config_port = -1; | ||
621 | X | ||
622 | static int msnd_write_cfg(int cfg, int reg, int value) | ||
623 | { | ||
624 | X outb(reg, cfg); | ||
625 | X outb(value, cfg + 1); | ||
626 | X if (value != inb(cfg + 1)) { | ||
627 | X fprintf(stderr, "error: msnd_write_cfg: I/O error\n"); | ||
628 | X return -EIO; | ||
629 | X } | ||
630 | X return 0; | ||
631 | } | ||
632 | X | ||
633 | static int msnd_read_cfg(int cfg, int reg) | ||
634 | { | ||
635 | X outb(reg, cfg); | ||
636 | X return inb(cfg + 1); | ||
637 | } | ||
638 | X | ||
639 | static int msnd_write_cfg_io0(int cfg, int num, WORD io) | ||
640 | { | ||
641 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
642 | X return -EIO; | ||
643 | X if (msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io))) | ||
644 | X return -EIO; | ||
645 | X if (msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io))) | ||
646 | X return -EIO; | ||
647 | X return 0; | ||
648 | } | ||
649 | X | ||
650 | static int msnd_read_cfg_io0(int cfg, int num, WORD *io) | ||
651 | { | ||
652 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
653 | X return -EIO; | ||
654 | X | ||
655 | X *io = MAKEWORD(msnd_read_cfg(cfg, IREG_IO0_BASELO), | ||
656 | X msnd_read_cfg(cfg, IREG_IO0_BASEHI)); | ||
657 | X | ||
658 | X return 0; | ||
659 | } | ||
660 | X | ||
661 | static int msnd_write_cfg_io1(int cfg, int num, WORD io) | ||
662 | { | ||
663 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
664 | X return -EIO; | ||
665 | X if (msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io))) | ||
666 | X return -EIO; | ||
667 | X if (msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io))) | ||
668 | X return -EIO; | ||
669 | X return 0; | ||
670 | } | ||
671 | X | ||
672 | static int msnd_read_cfg_io1(int cfg, int num, WORD *io) | ||
673 | { | ||
674 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
675 | X return -EIO; | ||
676 | X | ||
677 | X *io = MAKEWORD(msnd_read_cfg(cfg, IREG_IO1_BASELO), | ||
678 | X msnd_read_cfg(cfg, IREG_IO1_BASEHI)); | ||
679 | X | ||
680 | X return 0; | ||
681 | } | ||
682 | X | ||
683 | static int msnd_write_cfg_irq(int cfg, int num, WORD irq) | ||
684 | { | ||
685 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
686 | X return -EIO; | ||
687 | X if (msnd_write_cfg(cfg, IREG_IRQ_NUMBER, LOBYTE(irq))) | ||
688 | X return -EIO; | ||
689 | X if (msnd_write_cfg(cfg, IREG_IRQ_TYPE, IRQTYPE_EDGE)) | ||
690 | X return -EIO; | ||
691 | X return 0; | ||
692 | } | ||
693 | X | ||
694 | static int msnd_read_cfg_irq(int cfg, int num, WORD *irq) | ||
695 | { | ||
696 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
697 | X return -EIO; | ||
698 | X | ||
699 | X *irq = msnd_read_cfg(cfg, IREG_IRQ_NUMBER); | ||
700 | X | ||
701 | X return 0; | ||
702 | } | ||
703 | X | ||
704 | static int msnd_write_cfg_mem(int cfg, int num, int mem) | ||
705 | { | ||
706 | X WORD wmem; | ||
707 | X | ||
708 | X mem >>= 8; | ||
709 | X mem &= 0xfff; | ||
710 | X wmem = (WORD)mem; | ||
711 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
712 | X return -EIO; | ||
713 | X if (msnd_write_cfg(cfg, IREG_MEMBASEHI, HIBYTE(wmem))) | ||
714 | X return -EIO; | ||
715 | X if (msnd_write_cfg(cfg, IREG_MEMBASELO, LOBYTE(wmem))) | ||
716 | X return -EIO; | ||
717 | X if (wmem && msnd_write_cfg(cfg, IREG_MEMCONTROL, (MEMTYPE_HIADDR | MEMTYPE_16BIT))) | ||
718 | X return -EIO; | ||
719 | X return 0; | ||
720 | } | ||
721 | X | ||
722 | static int msnd_read_cfg_mem(int cfg, int num, int *mem) | ||
723 | { | ||
724 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
725 | X return -EIO; | ||
726 | X | ||
727 | X *mem = MAKEWORD(msnd_read_cfg(cfg, IREG_MEMBASELO), | ||
728 | X msnd_read_cfg(cfg, IREG_MEMBASEHI)); | ||
729 | X *mem <<= 8; | ||
730 | X | ||
731 | X return 0; | ||
732 | } | ||
733 | X | ||
734 | static int msnd_activate_logical(int cfg, int num) | ||
735 | { | ||
736 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
737 | X return -EIO; | ||
738 | X if (msnd_write_cfg(cfg, IREG_ACTIVATE, LD_ACTIVATE)) | ||
739 | X return -EIO; | ||
740 | X return 0; | ||
741 | } | ||
742 | X | ||
743 | static int msnd_write_cfg_logical(int cfg, int num, WORD io0, WORD io1, WORD irq, int mem) | ||
744 | { | ||
745 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
746 | X return -EIO; | ||
747 | X if (msnd_write_cfg_io0(cfg, num, io0)) | ||
748 | X return -EIO; | ||
749 | X if (msnd_write_cfg_io1(cfg, num, io1)) | ||
750 | X return -EIO; | ||
751 | X if (msnd_write_cfg_irq(cfg, num, irq)) | ||
752 | X return -EIO; | ||
753 | X if (msnd_write_cfg_mem(cfg, num, mem)) | ||
754 | X return -EIO; | ||
755 | X if (msnd_activate_logical(cfg, num)) | ||
756 | X return -EIO; | ||
757 | X return 0; | ||
758 | } | ||
759 | X | ||
760 | static int msnd_read_cfg_logical(int cfg, int num, WORD *io0, WORD *io1, WORD *irq, int *mem) | ||
761 | { | ||
762 | X if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) | ||
763 | X return -EIO; | ||
764 | X if (msnd_read_cfg_io0(cfg, num, io0)) | ||
765 | X return -EIO; | ||
766 | X if (msnd_read_cfg_io1(cfg, num, io1)) | ||
767 | X return -EIO; | ||
768 | X if (msnd_read_cfg_irq(cfg, num, irq)) | ||
769 | X return -EIO; | ||
770 | X if (msnd_read_cfg_mem(cfg, num, mem)) | ||
771 | X return -EIO; | ||
772 | X return 0; | ||
773 | } | ||
774 | X | ||
775 | static void usage(void) | ||
776 | { | ||
777 | X fprintf(stderr, | ||
778 | X "\n" | ||
779 | X "pinnaclecfg 1.0\n" | ||
780 | X "\n" | ||
781 | X "usage: pinnaclecfg <config port> [device config]\n" | ||
782 | X "\n" | ||
783 | X "This is for use with the card in NON-PnP mode only.\n" | ||
784 | X "\n" | ||
785 | X "Available devices (not all available for Fiji):\n" | ||
786 | X "\n" | ||
787 | X " Device Description\n" | ||
788 | X " -------------------------------------------------------------------\n" | ||
789 | X " reset Reset all devices (i.e. disable)\n" | ||
790 | X " show Display current device configurations\n" | ||
791 | X "\n" | ||
792 | X " dsp <io> <irq> <mem> Audio device\n" | ||
793 | X " mpu <io> <irq> Internal Kurzweil synth\n" | ||
794 | X " ide <io0> <io1> <irq> On-board IDE controller\n" | ||
795 | X " joystick <io> Joystick port\n" | ||
796 | X "\n"); | ||
797 | X exit(1); | ||
798 | } | ||
799 | X | ||
800 | static int cfg_reset(void) | ||
801 | { | ||
802 | X int i; | ||
803 | X | ||
804 | X for (i = 0; i < 4; ++i) | ||
805 | X msnd_write_cfg_logical(config_port, i, 0, 0, 0, 0); | ||
806 | X | ||
807 | X return 0; | ||
808 | } | ||
809 | X | ||
810 | static int cfg_show(void) | ||
811 | { | ||
812 | X int i; | ||
813 | X int count = 0; | ||
814 | X | ||
815 | X for (i = 0; i < 4; ++i) { | ||
816 | X WORD io0, io1, irq; | ||
817 | X int mem; | ||
818 | X msnd_read_cfg_logical(config_port, i, &io0, &io1, &irq, &mem); | ||
819 | X switch (i) { | ||
820 | X case 0: | ||
821 | X if (io0 || irq || mem) { | ||
822 | X printf("dsp 0x%x %d 0x%x\n", io0, irq, mem); | ||
823 | X ++count; | ||
824 | X } | ||
825 | X break; | ||
826 | X case 1: | ||
827 | X if (io0 || irq) { | ||
828 | X printf("mpu 0x%x %d\n", io0, irq); | ||
829 | X ++count; | ||
830 | X } | ||
831 | X break; | ||
832 | X case 2: | ||
833 | X if (io0 || io1 || irq) { | ||
834 | X printf("ide 0x%x 0x%x %d\n", io0, io1, irq); | ||
835 | X ++count; | ||
836 | X } | ||
837 | X break; | ||
838 | X case 3: | ||
839 | X if (io0) { | ||
840 | X printf("joystick 0x%x\n", io0); | ||
841 | X ++count; | ||
842 | X } | ||
843 | X break; | ||
844 | X } | ||
845 | X } | ||
846 | X | ||
847 | X if (count == 0) | ||
848 | X fprintf(stderr, "no devices configured\n"); | ||
849 | X | ||
850 | X return 0; | ||
851 | } | ||
852 | X | ||
853 | static int cfg_dsp(int argc, char *argv[]) | ||
854 | { | ||
855 | X int io, irq, mem; | ||
856 | X | ||
857 | X if (argc < 3 || | ||
858 | X sscanf(argv[0], "0x%x", &io) != 1 || | ||
859 | X sscanf(argv[1], "%d", &irq) != 1 || | ||
860 | X sscanf(argv[2], "0x%x", &mem) != 1) | ||
861 | X usage(); | ||
862 | X | ||
863 | X if (!(io == 0x290 || | ||
864 | X io == 0x260 || | ||
865 | X io == 0x250 || | ||
866 | X io == 0x240 || | ||
867 | X io == 0x230 || | ||
868 | X io == 0x220 || | ||
869 | X io == 0x210 || | ||
870 | X io == 0x3e0)) { | ||
871 | X fprintf(stderr, "error: io must be one of " | ||
872 | X "210, 220, 230, 240, 250, 260, 290, or 3E0\n"); | ||
873 | X usage(); | ||
874 | X } | ||
875 | X | ||
876 | X if (!(irq == 5 || | ||
877 | X irq == 7 || | ||
878 | X irq == 9 || | ||
879 | X irq == 10 || | ||
880 | X irq == 11 || | ||
881 | X irq == 12)) { | ||
882 | X fprintf(stderr, "error: irq must be one of " | ||
883 | X "5, 7, 9, 10, 11 or 12\n"); | ||
884 | X usage(); | ||
885 | X } | ||
886 | X | ||
887 | X if (!(mem == 0xb0000 || | ||
888 | X mem == 0xc8000 || | ||
889 | X mem == 0xd0000 || | ||
890 | X mem == 0xd8000 || | ||
891 | X mem == 0xe0000 || | ||
892 | X mem == 0xe8000)) { | ||
893 | X fprintf(stderr, "error: mem must be one of " | ||
894 | X "0xb0000, 0xc8000, 0xd0000, 0xd8000, 0xe0000 or 0xe8000\n"); | ||
895 | X usage(); | ||
896 | X } | ||
897 | X | ||
898 | X return msnd_write_cfg_logical(config_port, 0, io, 0, irq, mem); | ||
899 | } | ||
900 | X | ||
901 | static int cfg_mpu(int argc, char *argv[]) | ||
902 | { | ||
903 | X int io, irq; | ||
904 | X | ||
905 | X if (argc < 2 || | ||
906 | X sscanf(argv[0], "0x%x", &io) != 1 || | ||
907 | X sscanf(argv[1], "%d", &irq) != 1) | ||
908 | X usage(); | ||
909 | X | ||
910 | X return msnd_write_cfg_logical(config_port, 1, io, 0, irq, 0); | ||
911 | } | ||
912 | X | ||
913 | static int cfg_ide(int argc, char *argv[]) | ||
914 | { | ||
915 | X int io0, io1, irq; | ||
916 | X | ||
917 | X if (argc < 3 || | ||
918 | X sscanf(argv[0], "0x%x", &io0) != 1 || | ||
919 | X sscanf(argv[0], "0x%x", &io1) != 1 || | ||
920 | X sscanf(argv[1], "%d", &irq) != 1) | ||
921 | X usage(); | ||
922 | X | ||
923 | X return msnd_write_cfg_logical(config_port, 2, io0, io1, irq, 0); | ||
924 | } | ||
925 | X | ||
926 | static int cfg_joystick(int argc, char *argv[]) | ||
927 | { | ||
928 | X int io; | ||
929 | X | ||
930 | X if (argc < 1 || | ||
931 | X sscanf(argv[0], "0x%x", &io) != 1) | ||
932 | X usage(); | ||
933 | X | ||
934 | X return msnd_write_cfg_logical(config_port, 3, io, 0, 0, 0); | ||
935 | } | ||
936 | X | ||
937 | int main(int argc, char *argv[]) | ||
938 | { | ||
939 | X char *device; | ||
940 | X int rv = 0; | ||
941 | X | ||
942 | X --argc; ++argv; | ||
943 | X | ||
944 | X if (argc < 2) | ||
945 | X usage(); | ||
946 | X | ||
947 | X sscanf(argv[0], "0x%x", &config_port); | ||
948 | X if (config_port != 0x250 && config_port != 0x260 && config_port != 0x270) { | ||
949 | X fprintf(stderr, "error: <config port> must be 0x250, 0x260 or 0x270\n"); | ||
950 | X exit(1); | ||
951 | X } | ||
952 | X if (ioperm(config_port, 2, 1)) { | ||
953 | X perror("ioperm"); | ||
954 | X fprintf(stderr, "note: pinnaclecfg must be run as root\n"); | ||
955 | X exit(1); | ||
956 | X } | ||
957 | X device = argv[1]; | ||
958 | X | ||
959 | X argc -= 2; argv += 2; | ||
960 | X | ||
961 | X if (strcmp(device, "reset") == 0) | ||
962 | X rv = cfg_reset(); | ||
963 | X else if (strcmp(device, "show") == 0) | ||
964 | X rv = cfg_show(); | ||
965 | X else if (strcmp(device, "dsp") == 0) | ||
966 | X rv = cfg_dsp(argc, argv); | ||
967 | X else if (strcmp(device, "mpu") == 0) | ||
968 | X rv = cfg_mpu(argc, argv); | ||
969 | X else if (strcmp(device, "ide") == 0) | ||
970 | X rv = cfg_ide(argc, argv); | ||
971 | X else if (strcmp(device, "joystick") == 0) | ||
972 | X rv = cfg_joystick(argc, argv); | ||
973 | X else { | ||
974 | X fprintf(stderr, "error: unknown device %s\n", device); | ||
975 | X usage(); | ||
976 | X } | ||
977 | X | ||
978 | X if (rv) | ||
979 | X fprintf(stderr, "error: device configuration failed\n"); | ||
980 | X | ||
981 | X return 0; | ||
982 | } | ||
983 | SHAR_EOF | ||
984 | $shar_touch -am 1204092598 'MultiSound.d/pinnaclecfg.c' && | ||
985 | chmod 0664 'MultiSound.d/pinnaclecfg.c' || | ||
986 | $echo 'restore of' 'MultiSound.d/pinnaclecfg.c' 'failed' | ||
987 | if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ | ||
988 | && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then | ||
989 | md5sum -c << SHAR_EOF >/dev/null 2>&1 \ | ||
990 | || $echo 'MultiSound.d/pinnaclecfg.c:' 'MD5 check failed' | ||
991 | 366bdf27f0db767a3c7921d0a6db20fe MultiSound.d/pinnaclecfg.c | ||
992 | SHAR_EOF | ||
993 | else | ||
994 | shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/pinnaclecfg.c'`" | ||
995 | test 10235 -eq "$shar_count" || | ||
996 | $echo 'MultiSound.d/pinnaclecfg.c:' 'original size' '10235,' 'current size' "$shar_count!" | ||
997 | fi | ||
998 | fi | ||
999 | # ============= MultiSound.d/Makefile ============== | ||
1000 | if test -f 'MultiSound.d/Makefile' && test "$first_param" != -c; then | ||
1001 | $echo 'x -' SKIPPING 'MultiSound.d/Makefile' '(file already exists)' | ||
1002 | else | ||
1003 | $echo 'x -' extracting 'MultiSound.d/Makefile' '(text)' | ||
1004 | sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/Makefile' && | ||
1005 | CC = gcc | ||
1006 | CFLAGS = -O | ||
1007 | PROGS = setdigital msndreset pinnaclecfg conv | ||
1008 | X | ||
1009 | all: $(PROGS) | ||
1010 | X | ||
1011 | clean: | ||
1012 | X rm -f $(PROGS) | ||
1013 | SHAR_EOF | ||
1014 | $shar_touch -am 1204092398 'MultiSound.d/Makefile' && | ||
1015 | chmod 0664 'MultiSound.d/Makefile' || | ||
1016 | $echo 'restore of' 'MultiSound.d/Makefile' 'failed' | ||
1017 | if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ | ||
1018 | && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then | ||
1019 | md5sum -c << SHAR_EOF >/dev/null 2>&1 \ | ||
1020 | || $echo 'MultiSound.d/Makefile:' 'MD5 check failed' | ||
1021 | 76ca8bb44e3882edcf79c97df6c81845 MultiSound.d/Makefile | ||
1022 | SHAR_EOF | ||
1023 | else | ||
1024 | shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/Makefile'`" | ||
1025 | test 106 -eq "$shar_count" || | ||
1026 | $echo 'MultiSound.d/Makefile:' 'original size' '106,' 'current size' "$shar_count!" | ||
1027 | fi | ||
1028 | fi | ||
1029 | # ============= MultiSound.d/conv.l ============== | ||
1030 | if test -f 'MultiSound.d/conv.l' && test "$first_param" != -c; then | ||
1031 | $echo 'x -' SKIPPING 'MultiSound.d/conv.l' '(file already exists)' | ||
1032 | else | ||
1033 | $echo 'x -' extracting 'MultiSound.d/conv.l' '(text)' | ||
1034 | sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/conv.l' && | ||
1035 | %% | ||
1036 | [ \n\t,\r] | ||
1037 | \;.* | ||
1038 | DB | ||
1039 | [0-9A-Fa-f]+H { int n; sscanf(yytext, "%xH", &n); printf("%c", n); } | ||
1040 | %% | ||
1041 | int yywrap() { return 1; } | ||
1042 | main() { yylex(); } | ||
1043 | SHAR_EOF | ||
1044 | $shar_touch -am 0828231798 'MultiSound.d/conv.l' && | ||
1045 | chmod 0664 'MultiSound.d/conv.l' || | ||
1046 | $echo 'restore of' 'MultiSound.d/conv.l' 'failed' | ||
1047 | if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ | ||
1048 | && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then | ||
1049 | md5sum -c << SHAR_EOF >/dev/null 2>&1 \ | ||
1050 | || $echo 'MultiSound.d/conv.l:' 'MD5 check failed' | ||
1051 | d2411fc32cd71a00dcdc1f009e858dd2 MultiSound.d/conv.l | ||
1052 | SHAR_EOF | ||
1053 | else | ||
1054 | shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/conv.l'`" | ||
1055 | test 141 -eq "$shar_count" || | ||
1056 | $echo 'MultiSound.d/conv.l:' 'original size' '141,' 'current size' "$shar_count!" | ||
1057 | fi | ||
1058 | fi | ||
1059 | # ============= MultiSound.d/msndreset.c ============== | ||
1060 | if test -f 'MultiSound.d/msndreset.c' && test "$first_param" != -c; then | ||
1061 | $echo 'x -' SKIPPING 'MultiSound.d/msndreset.c' '(file already exists)' | ||
1062 | else | ||
1063 | $echo 'x -' extracting 'MultiSound.d/msndreset.c' '(text)' | ||
1064 | sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/msndreset.c' && | ||
1065 | /********************************************************************* | ||
1066 | X * | ||
1067 | X * msndreset.c - resets the MultiSound card | ||
1068 | X * | ||
1069 | X * Copyright (C) 1998 Andrew Veliath | ||
1070 | X * | ||
1071 | X * This program is free software; you can redistribute it and/or modify | ||
1072 | X * it under the terms of the GNU General Public License as published by | ||
1073 | X * the Free Software Foundation; either version 2 of the License, or | ||
1074 | X * (at your option) any later version. | ||
1075 | X * | ||
1076 | X * This program is distributed in the hope that it will be useful, | ||
1077 | X * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1078 | X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1079 | X * GNU General Public License for more details. | ||
1080 | X * | ||
1081 | X * You should have received a copy of the GNU General Public License | ||
1082 | X * along with this program; if not, write to the Free Software | ||
1083 | X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
1084 | X * | ||
1085 | X ********************************************************************/ | ||
1086 | X | ||
1087 | #include <stdio.h> | ||
1088 | #include <unistd.h> | ||
1089 | #include <fcntl.h> | ||
1090 | #include <sys/types.h> | ||
1091 | #include <sys/stat.h> | ||
1092 | #include <sys/ioctl.h> | ||
1093 | #include <sys/soundcard.h> | ||
1094 | X | ||
1095 | int main(int argc, char *argv[]) | ||
1096 | { | ||
1097 | X int fd; | ||
1098 | X | ||
1099 | X if (argc != 2) { | ||
1100 | X fprintf(stderr, "usage: msndreset <mixer device>\n"); | ||
1101 | X exit(1); | ||
1102 | X } | ||
1103 | X | ||
1104 | X if ((fd = open(argv[1], O_RDWR)) < 0) { | ||
1105 | X perror(argv[1]); | ||
1106 | X exit(1); | ||
1107 | X } | ||
1108 | X | ||
1109 | X if (ioctl(fd, SOUND_MIXER_PRIVATE1, 0) < 0) { | ||
1110 | X fprintf(stderr, "error: msnd ioctl reset failed\n"); | ||
1111 | X perror("ioctl"); | ||
1112 | X close(fd); | ||
1113 | X exit(1); | ||
1114 | X } | ||
1115 | X | ||
1116 | X close(fd); | ||
1117 | X | ||
1118 | X return 0; | ||
1119 | } | ||
1120 | SHAR_EOF | ||
1121 | $shar_touch -am 1204100698 'MultiSound.d/msndreset.c' && | ||
1122 | chmod 0664 'MultiSound.d/msndreset.c' || | ||
1123 | $echo 'restore of' 'MultiSound.d/msndreset.c' 'failed' | ||
1124 | if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ | ||
1125 | && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then | ||
1126 | md5sum -c << SHAR_EOF >/dev/null 2>&1 \ | ||
1127 | || $echo 'MultiSound.d/msndreset.c:' 'MD5 check failed' | ||
1128 | c52f876521084e8eb25e12e01dcccb8a MultiSound.d/msndreset.c | ||
1129 | SHAR_EOF | ||
1130 | else | ||
1131 | shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/msndreset.c'`" | ||
1132 | test 1472 -eq "$shar_count" || | ||
1133 | $echo 'MultiSound.d/msndreset.c:' 'original size' '1472,' 'current size' "$shar_count!" | ||
1134 | fi | ||
1135 | fi | ||
1136 | rm -fr _sh01426 | ||
1137 | exit 0 | ||
diff --git a/Documentation/sound/oss/NEWS b/Documentation/sound/oss/NEWS new file mode 100644 index 000000000000..a81e0ef72ae9 --- /dev/null +++ b/Documentation/sound/oss/NEWS | |||
@@ -0,0 +1,42 @@ | |||
1 | Linux 2.4 Sound Changes | ||
2 | 2000-September-25 | ||
3 | Christoph Hellwig, <hch@infradead.org> | ||
4 | |||
5 | |||
6 | |||
7 | === isapnp support | ||
8 | |||
9 | The Linux 2.4 Kernel does have reliable in-kernel isapnp support. | ||
10 | Some drivers (sb.o, ad1816.o awe_wave.o) do now support automatically | ||
11 | detecting and configuring isapnp devices. | ||
12 | If you have a not yet supported isapnp soundcard, mail me the content | ||
13 | of '/proc/isapnp' on your system and some information about your card | ||
14 | and its driver(s) so I can try to get isapnp working for it. | ||
15 | |||
16 | |||
17 | |||
18 | === soundcard resources on kernel commandline | ||
19 | |||
20 | Before Linux 2.4 you had to specify the resources for sounddrivers | ||
21 | statically linked into the kernel at compile time | ||
22 | (in make config/menuconfig/xconfig). In Linux 2.4 the resources are | ||
23 | now specified at the boot-time kernel commandline (e.g. the lilo | ||
24 | 'append=' line or everything that's after the kernel name in grub). | ||
25 | Read the Configure.help entry for your card for the parameters. | ||
26 | |||
27 | |||
28 | === softoss is gone | ||
29 | |||
30 | In Linux 2.4 the softoss in-kernel software synthesizer is no more aviable. | ||
31 | Use a user space software synthesizer like timidity instead. | ||
32 | |||
33 | |||
34 | |||
35 | === /dev/sndstat and /proc/sound are gone | ||
36 | |||
37 | In older Linux versions those files exported some information about the | ||
38 | OSS/Free configuration to userspace. In Linux 2.3 they were removed because | ||
39 | they did not support the growing number of pci soundcards and there were | ||
40 | some general problems with this interface. | ||
41 | |||
42 | |||
diff --git a/Documentation/sound/oss/NM256 b/Documentation/sound/oss/NM256 new file mode 100644 index 000000000000..b503217488b3 --- /dev/null +++ b/Documentation/sound/oss/NM256 | |||
@@ -0,0 +1,280 @@ | |||
1 | ======================================================= | ||
2 | Documentation for the NeoMagic 256AV/256ZX sound driver | ||
3 | ======================================================= | ||
4 | |||
5 | You're looking at version 1.1 of the driver. (Woohoo!) It has been | ||
6 | successfully tested against the following laptop models: | ||
7 | |||
8 | Sony Z505S/Z505SX/Z505DX/Z505RX | ||
9 | Sony F150, F160, F180, F250, F270, F280, PCG-F26 | ||
10 | Dell Latitude CPi, CPt (various submodels) | ||
11 | |||
12 | There are a few caveats, which is why you should read the entirety of | ||
13 | this document first. | ||
14 | |||
15 | This driver was developed without any support or assistance from | ||
16 | NeoMagic. There is no warranty, expressed, implied, or otherwise. It | ||
17 | is free software in the public domain; feel free to use it, sell it, | ||
18 | give it to your best friends, even claim that you wrote it (but why?!) | ||
19 | but don't go whining to me, NeoMagic, Sony, Dell, or anyone else | ||
20 | when it blows up your computer. | ||
21 | |||
22 | Version 1.1 contains a change to try and detect non-AC97 versions of | ||
23 | the hardware, and not install itself appropriately. It should also | ||
24 | reinitialize the hardware on an APM resume event, assuming that APM | ||
25 | was configured into your kernel. | ||
26 | |||
27 | ============ | ||
28 | Installation | ||
29 | ============ | ||
30 | |||
31 | Enable the sound drivers, the OSS sound drivers, and then the NM256 | ||
32 | driver. The NM256 driver *must* be configured as a module (it won't | ||
33 | give you any other choice). | ||
34 | |||
35 | Next, do the usual "make modules" and "make modules_install". | ||
36 | Finally, insmod the soundcore, sound and nm256 modules. | ||
37 | |||
38 | When the nm256 driver module is loaded, you should see a couple of | ||
39 | confirmation messages in the kernel logfile indicating that it found | ||
40 | the device (the device does *not* use any I/O ports or DMA channels). | ||
41 | Now try playing a wav file, futz with the CD-ROM if you have one, etc. | ||
42 | |||
43 | The NM256 is entirely a PCI-based device, and all the necessary | ||
44 | information is automatically obtained from the card. It can only be | ||
45 | configured as a module in a vain attempt to prevent people from | ||
46 | hurting themselves. It works correctly if it shares an IRQ with | ||
47 | another device (it normally shares IRQ 9 with the builtin eepro100 | ||
48 | ethernet on the Sony Z505 laptops). | ||
49 | |||
50 | It does not run the card in any sort of compatibility mode. It will | ||
51 | not work on laptops that have the SB16-compatible, AD1848-compatible | ||
52 | or CS4232-compatible codec/mixer; you will want to use the appropriate | ||
53 | compatible OSS driver with these chipsets. I cannot provide any | ||
54 | assistance with machines using the SB16, AD1848 or CS4232 compatible | ||
55 | versions. (The driver now attempts to detect the mixer version, and | ||
56 | will refuse to load if it believes the hardware is not | ||
57 | AC97-compatible.) | ||
58 | |||
59 | The sound support is very basic, but it does include simultaneous | ||
60 | playback and record capability. The mixer support is also quite | ||
61 | simple, although this is in keeping with the rather limited | ||
62 | functionality of the chipset. | ||
63 | |||
64 | There is no hardware synthesizer available, as the Losedows OPL-3 and | ||
65 | MIDI support is done via hardware emulation. | ||
66 | |||
67 | Only three recording devices are available on the Sony: the | ||
68 | microphone, the CD-ROM input, and the volume device (which corresponds | ||
69 | to the stereo output). (Other devices may be available on other | ||
70 | models of laptops.) The Z505 series does not have a builtin CD-ROM, | ||
71 | so of course the CD-ROM input doesn't work. It does work on laptops | ||
72 | with a builtin CD-ROM drive. | ||
73 | |||
74 | The mixer device does not appear to have any tone controls, at least | ||
75 | on the Z505 series. The mixer module checks for tone controls in the | ||
76 | AC97 mixer, and will enable them if they are available. | ||
77 | |||
78 | ============== | ||
79 | Known problems | ||
80 | ============== | ||
81 | |||
82 | * There are known problems with PCMCIA cards and the eepro100 ethernet | ||
83 | driver on the Z505S/Z505SX/Z505DX. Keep reading. | ||
84 | |||
85 | * There are also potential problems with using a virtual X display, and | ||
86 | also problems loading the module after the X server has been started. | ||
87 | Keep reading. | ||
88 | |||
89 | * The volume control isn't anywhere near linear. Sorry. This will be | ||
90 | fixed eventually, when I get sufficiently annoyed with it. (I doubt | ||
91 | it will ever be fixed now, since I've never gotten sufficiently | ||
92 | annoyed with it and nobody else seems to care.) | ||
93 | |||
94 | * There are reports that the CD-ROM volume is very low. Since I do not | ||
95 | have a CD-ROM equipped laptop, I cannot test this (it's kinda hard to | ||
96 | do remotely). | ||
97 | |||
98 | * Only 8 fixed-rate speeds are supported. This is mainly a chipset | ||
99 | limitation. It may be possible to support other speeds in the future. | ||
100 | |||
101 | * There is no support for the telephone mixer/codec. There is support | ||
102 | for a phonein/phoneout device in the mixer driver; whether or not | ||
103 | it does anything is anyone's guess. (Reports on this would be | ||
104 | appreciated. You'll have to figure out how to get the phone to | ||
105 | go off-hook before it'll work, tho.) | ||
106 | |||
107 | * This driver was not written with any cooperation or support from | ||
108 | NeoMagic. If you have any questions about this, see their website | ||
109 | for their official stance on supporting open source drivers. | ||
110 | |||
111 | ============ | ||
112 | Video memory | ||
113 | ============ | ||
114 | |||
115 | The NeoMagic sound engine uses a portion of the display memory to hold | ||
116 | the sound buffer. (Crazy, eh?) The NeoMagic video BIOS sets up a | ||
117 | special pointer at the top of video RAM to indicate where the top of | ||
118 | the audio buffer should be placed. | ||
119 | |||
120 | At the present time XFree86 is apparently not aware of this. It will | ||
121 | thus write over either the pointer or the sound buffer with abandon. | ||
122 | (Accelerated-X seems to do a better job here.) | ||
123 | |||
124 | This implies a few things: | ||
125 | |||
126 | * Sometimes the NM256 driver has to guess at where the buffer | ||
127 | should be placed, especially if the module is loaded after the | ||
128 | X server is started. It's usually correct, but it will consistently | ||
129 | fail on the Sony F250. | ||
130 | |||
131 | * Virtual screens greater than 1024x768x16 under XFree86 are | ||
132 | problematic on laptops with only 2.5MB of screen RAM. This | ||
133 | includes all of the 256AV-equipped laptops. (Virtual displays | ||
134 | may or may not work on the 256ZX, which has at least 4MB of | ||
135 | video RAM.) | ||
136 | |||
137 | If you start having problems with random noise being output either | ||
138 | constantly (this is the usual symptom on the F250), or when windows | ||
139 | are moved around (this is the usual symptom when using a virtual | ||
140 | screen), the best fix is to | ||
141 | |||
142 | * Don't use a virtual frame buffer. | ||
143 | * Make sure you load the NM256 module before the X server is | ||
144 | started. | ||
145 | |||
146 | On the F250, it is possible to force the driver to load properly even | ||
147 | after the XFree86 server is started by doing: | ||
148 | |||
149 | insmod nm256 buffertop=0x25a800 | ||
150 | |||
151 | This forces the audio buffers to the correct offset in screen RAM. | ||
152 | |||
153 | One user has reported a similar problem on the Sony F270, although | ||
154 | others apparently aren't seeing any problems. His suggested command | ||
155 | is | ||
156 | |||
157 | insmod nm256 buffertop=0x272800 | ||
158 | |||
159 | ================= | ||
160 | Official WWW site | ||
161 | ================= | ||
162 | |||
163 | The official site for the NM256 driver is: | ||
164 | |||
165 | http://www.uglx.org/sony.html | ||
166 | |||
167 | You should always be able to get the latest version of the driver there, | ||
168 | and the driver will be supported for the foreseeable future. | ||
169 | |||
170 | ============== | ||
171 | Z505RX and IDE | ||
172 | ============== | ||
173 | |||
174 | There appears to be a problem with the IDE chipset on the Z505RX; one | ||
175 | of the symptoms is that sound playback periodically hangs (when the | ||
176 | disk is accessed). The user reporting the problem also reported that | ||
177 | enabling all of the IDE chipset workarounds in the kernel solved the | ||
178 | problem, tho obviously only one of them should be needed--if someone | ||
179 | can give me more details I would appreciate it. | ||
180 | |||
181 | ============================== | ||
182 | Z505S/Z505SX on-board Ethernet | ||
183 | ============================== | ||
184 | |||
185 | If you're using the on-board Ethernet Pro/100 ethernet support on the Z505 | ||
186 | series, I strongly encourage you to download the latest eepro100 driver from | ||
187 | Donald Becker's site: | ||
188 | |||
189 | ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/test/eepro100.c | ||
190 | |||
191 | There was a reported problem on the Z505SX that if the ethernet | ||
192 | interface is disabled and reenabled while the sound driver is loaded, | ||
193 | the machine would lock up. I have included a workaround that is | ||
194 | working satisfactorily. However, you may occasionally see a message | ||
195 | about "Releasing interrupts, over 1000 bad interrupts" which indicates | ||
196 | that the workaround is doing its job. | ||
197 | |||
198 | ================================== | ||
199 | PCMCIA and the Z505S/Z505SX/Z505DX | ||
200 | ================================== | ||
201 | |||
202 | There is also a known problem with the Sony Z505S and Z505SX hanging | ||
203 | if a PCMCIA card is inserted while the ethernet driver is loaded, or | ||
204 | in some cases if the laptop is suspended. This is caused by tons of | ||
205 | spurious IRQ 9s, probably generated from the PCMCIA or ACPI bridges. | ||
206 | |||
207 | There is currently no fix for the problem that works in every case. | ||
208 | The only known workarounds are to disable the ethernet interface | ||
209 | before inserting or removing a PCMCIA card, or with some cards | ||
210 | disabling the PCMCIA card before ejecting it will also help the | ||
211 | problem with the laptop hanging when the card is ejected. | ||
212 | |||
213 | One user has reported that setting the tcic's cs_irq to some value | ||
214 | other than 9 (like 11) fixed the problem. This doesn't work on my | ||
215 | Z505S, however--changing the value causes the cardmgr to stop seeing | ||
216 | card insertions and removals, cards don't seem to work correctly, and | ||
217 | I still get hangs if a card is inserted when the kernel is booted. | ||
218 | |||
219 | Using the latest ethernet driver and pcmcia package allows me to | ||
220 | insert an Adaptec 1480A SlimScsi card without the laptop hanging, | ||
221 | although I still have to shut down the card before ejecting or | ||
222 | powering down the laptop. However, similar experiments with a DE-660 | ||
223 | ethernet card still result in hangs when the card is inserted. I am | ||
224 | beginning to think that the interrupts are CardBus-related, since the | ||
225 | Adaptec card is a CardBus card, and the DE-660 is not; however, I | ||
226 | don't have any other CardBus cards to test with. | ||
227 | |||
228 | ====== | ||
229 | Thanks | ||
230 | ====== | ||
231 | |||
232 | First, I want to thank everyone (except NeoMagic of course) for their | ||
233 | generous support and encouragement. I'd like to list everyone's name | ||
234 | here that replied during the development phase, but the list is | ||
235 | amazingly long. | ||
236 | |||
237 | I will be rather unfair and single out a few people, however: | ||
238 | |||
239 | Justin Maurer, for being the first random net.person to try it, | ||
240 | and for letting me login to his Z505SX to get it working there | ||
241 | |||
242 | Edi Weitz for trying out several different versions, and giving | ||
243 | me a lot of useful feedback | ||
244 | |||
245 | Greg Rumple for letting me login remotely to get the driver | ||
246 | functional on the 256ZX, for his assistance on tracking | ||
247 | down all sorts of random stuff, and for trying out Accel-X | ||
248 | |||
249 | Zach Brown, for the initial AC97 mixer interface design | ||
250 | |||
251 | Jeff Garzik, for various helpful suggestions on the AC97 | ||
252 | interface | ||
253 | |||
254 | "Mr. Bumpy" for feedback on the Z505RX | ||
255 | |||
256 | Bill Nottingham, for generous assistance in getting the mixer ID | ||
257 | code working | ||
258 | |||
259 | ================= | ||
260 | Previous versions | ||
261 | ================= | ||
262 | |||
263 | Versions prior to 0.3 (aka `noname') had problems with weird artifacts | ||
264 | in the output and failed to set the recording rate properly. These | ||
265 | problems have long since been fixed. | ||
266 | |||
267 | Versions prior to 0.5 had problems with clicks in the output when | ||
268 | anything other than 16-bit stereo sound was being played, and also had | ||
269 | periodic clicks when recording. | ||
270 | |||
271 | Version 0.7 first incorporated support for the NM256ZX chipset, which | ||
272 | is found on some Dell Latitude laptops (the CPt, and apparently | ||
273 | some CPi models as well). It also included the generic AC97 | ||
274 | mixer module. | ||
275 | |||
276 | Version 0.75 renamed all the functions and files with slightly more | ||
277 | generic names. | ||
278 | |||
279 | Note that previous versions of this document claimed that recording was | ||
280 | 8-bit only; it actually has been working for 16-bits all along. | ||
diff --git a/Documentation/sound/oss/OPL3 b/Documentation/sound/oss/OPL3 new file mode 100644 index 000000000000..2468ff827688 --- /dev/null +++ b/Documentation/sound/oss/OPL3 | |||
@@ -0,0 +1,6 @@ | |||
1 | A pure OPL3 card is nice and easy to configure. Simply do | ||
2 | |||
3 | insmod opl3 io=0x388 | ||
4 | |||
5 | Change the I/O address in the very unlikely case this card is differently | ||
6 | configured | ||
diff --git a/Documentation/sound/oss/OPL3-SA b/Documentation/sound/oss/OPL3-SA new file mode 100644 index 000000000000..66a91835d918 --- /dev/null +++ b/Documentation/sound/oss/OPL3-SA | |||
@@ -0,0 +1,52 @@ | |||
1 | OPL3-SA1 sound driver (opl3sa.o) | ||
2 | |||
3 | --- | ||
4 | Note: This howto only describes how to setup the OPL3-SA1 chip; this info | ||
5 | does not apply to the SA2, SA3, or SA4. | ||
6 | --- | ||
7 | |||
8 | The Yamaha OPL3-SA1 sound chip is usually found built into motherboards, and | ||
9 | it's a decent little chip offering a WSS mode, a SB Pro emulation mode, MPU401 | ||
10 | and OPL3 FM Synth capabilities. | ||
11 | |||
12 | You can enable inclusion of the driver via CONFIG_SOUND_OPL3SA1=m, or | ||
13 | CONFIG_SOUND_OPL3SA1=y through 'make config/xconfig/menuconfig'. | ||
14 | |||
15 | You'll need to know all of the relevant info (irq, dma, and io port) for the | ||
16 | chip's WSS mode, since that is the mode the kernel sound driver uses, and of | ||
17 | course you'll also need to know about where the MPU401 and OPL3 ports and | ||
18 | IRQs are if you want to use those. | ||
19 | |||
20 | Here's the skinny on how to load it as a module: | ||
21 | |||
22 | modprobe opl3sa io=0x530 irq=11 dma=0 dma2=1 mpu_io=0x330 mpu_irq=5 | ||
23 | |||
24 | Module options in detail: | ||
25 | |||
26 | io: This is the WSS's port base. | ||
27 | irq: This is the WSS's IRQ. | ||
28 | dma: This is the WSS's DMA line. In my BIOS setup screen this was | ||
29 | listed as "WSS Play DMA" | ||
30 | dma2: This is the WSS's secondary DMA line. My BIOS calls it the | ||
31 | "WSS capture DMA" | ||
32 | |||
33 | mpu_io: This is the MPU401's port base. | ||
34 | mpu_irq: This is the MPU401's IRQ. | ||
35 | |||
36 | If you'd like to use the OPL3 FM Synthesizer, make sure you enable | ||
37 | CONFIG_SOUND_YM3812 (in 'make config'). That'll build the opl3.o module. | ||
38 | |||
39 | Then a simple 'insmod opl3 io=0x388', and you now have FM Synth. | ||
40 | |||
41 | You can also use the SoftOSS software synthesizer instead of the builtin OPL3. | ||
42 | Here's how: | ||
43 | |||
44 | Say 'y' or 'm' to "SoftOSS software wave table engine" in make config. | ||
45 | |||
46 | If you said yes, the software synth is available once you boot your new | ||
47 | kernel. | ||
48 | |||
49 | If you chose to build it as a module, just insmod the resulting softoss2.o | ||
50 | |||
51 | Questions? Comments? | ||
52 | <stiker@northlink.com> | ||
diff --git a/Documentation/sound/oss/OPL3-SA2 b/Documentation/sound/oss/OPL3-SA2 new file mode 100644 index 000000000000..d8b6d2bbada6 --- /dev/null +++ b/Documentation/sound/oss/OPL3-SA2 | |||
@@ -0,0 +1,210 @@ | |||
1 | Documentation for the OPL3-SA2, SA3, and SAx driver (opl3sa2.o) | ||
2 | --------------------------------------------------------------- | ||
3 | |||
4 | Scott Murray, scott@spiteful.org | ||
5 | January 7, 2001 | ||
6 | |||
7 | NOTE: All trade-marked terms mentioned below are properties of their | ||
8 | respective owners. | ||
9 | |||
10 | |||
11 | Supported Devices | ||
12 | ----------------- | ||
13 | |||
14 | This driver is for PnP soundcards based on the following Yamaha audio | ||
15 | controller chipsets: | ||
16 | |||
17 | YMF711 aka OPL3-SA2 | ||
18 | YMF715 and YMF719 aka OPL3-SA3 | ||
19 | |||
20 | Up until recently (December 2000), I'd thought the 719 to be a | ||
21 | different chipset, the OPL3-SAx. After an email exhange with | ||
22 | Yamaha, however, it turns out that the 719 is just a re-badged | ||
23 | 715, and the chipsets are identical. The chipset detection code | ||
24 | has been updated to reflect this. | ||
25 | |||
26 | Anyways, all of these chipsets implement the following devices: | ||
27 | |||
28 | OPL3 FM synthesizer | ||
29 | Soundblaster Pro | ||
30 | Microsoft/Windows Sound System | ||
31 | MPU401 MIDI interface | ||
32 | |||
33 | Note that this driver uses the MSS device, and to my knowledge these | ||
34 | chipsets enforce an either/or situation with the Soundblaster Pro | ||
35 | device and the MSS device. Since the MSS device has better | ||
36 | capabilities, I have implemented the driver to use it. | ||
37 | |||
38 | |||
39 | Mixer Channels | ||
40 | -------------- | ||
41 | |||
42 | Older versions of this driver (pre-December 2000) had two mixers, | ||
43 | an OPL3-SA2 or SA3 mixer and a MSS mixer. The OPL3-SA[23] mixer | ||
44 | device contained a superset of mixer channels consisting of its own | ||
45 | channels and all of the MSS mixer channels. To simplify the driver | ||
46 | considerably, and to partition functionality better, the OPL3-SA[23] | ||
47 | mixer device now contains has its own specific mixer channels. They | ||
48 | are: | ||
49 | |||
50 | Volume - Hardware master volume control | ||
51 | Bass - SA3 only, now supports left and right channels | ||
52 | Treble - SA3 only, now supports left and right channels | ||
53 | Microphone - Hardware microphone input volume control | ||
54 | Digital1 - Yamaha 3D enhancement "Wide" mixer | ||
55 | |||
56 | All other mixer channels (e.g. "PCM", "CD", etc.) now have to be | ||
57 | controlled via the "MS Sound System (CS4231)" mixer. To facilitate | ||
58 | this, the mixer device creation order has been switched so that | ||
59 | the MSS mixer is created first. This allows accessing the majority | ||
60 | of the useful mixer channels even via single mixer-aware tools | ||
61 | such as "aumix". | ||
62 | |||
63 | |||
64 | Plug 'n Play | ||
65 | ------------ | ||
66 | |||
67 | In previous kernels (2.2.x), some configuration was required to | ||
68 | get the driver to talk to the card. Being the new millennium and | ||
69 | all, the 2.4.x kernels now support auto-configuration if ISA PnP | ||
70 | support is configured in. Theoretically, the driver even supports | ||
71 | having more than one card in this case. | ||
72 | |||
73 | With the addition of PnP support to the driver, two new parameters | ||
74 | have been added to control it: | ||
75 | |||
76 | isapnp - set to 0 to disable ISA PnP card detection | ||
77 | |||
78 | multiple - set to 0 to disable multiple PnP card detection | ||
79 | |||
80 | |||
81 | Optional Parameters | ||
82 | ------------------- | ||
83 | |||
84 | Recent (December 2000) additions to the driver (based on a patch | ||
85 | provided by Peter Englmaier) are two new parameters: | ||
86 | |||
87 | ymode - Set Yamaha 3D enhancement mode: | ||
88 | 0 = Desktop/Normal 5-12 cm speakers | ||
89 | 1 = Notebook PC (1) 3 cm speakers | ||
90 | 2 = Notebook PC (2) 1.5 cm speakers | ||
91 | 3 = Hi-Fi 16-38 cm speakers | ||
92 | |||
93 | loopback - Set A/D input source. Useful for echo cancellation: | ||
94 | 0 = Mic Right channel (default) | ||
95 | 1 = Mono output loopback | ||
96 | |||
97 | The ymode parameter has been tested and does work. The loopback | ||
98 | parameter, however, is untested. Any feedback on its usefulness | ||
99 | would be appreciated. | ||
100 | |||
101 | |||
102 | Manual Configuration | ||
103 | -------------------- | ||
104 | |||
105 | If for some reason you decide not to compile ISA PnP support into | ||
106 | your kernel, or disabled the driver's usage of it by setting the | ||
107 | isapnp parameter as discussed above, then you will need to do some | ||
108 | manual configuration. There are two ways of doing this. The most | ||
109 | common is to use the isapnptools package to initialize the card, and | ||
110 | use the kernel module form of the sound subsystem and sound drivers. | ||
111 | Alternatively, some BIOS's allow manual configuration of installed | ||
112 | PnP devices in a BIOS menu, which should allow using the non-modular | ||
113 | sound drivers, i.e. built into the kernel. | ||
114 | |||
115 | I personally use isapnp and modules, and do not have access to a PnP | ||
116 | BIOS machine to test. If you have such a beast, configuring the | ||
117 | driver to be built into the kernel should just work (thanks to work | ||
118 | done by David Luyer <luyer@ucs.uwa.edu.au>). You will still need | ||
119 | to specify settings, which can be done by adding: | ||
120 | |||
121 | opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio> | ||
122 | |||
123 | to the kernel command line. For example: | ||
124 | |||
125 | opl3sa2=0x370,5,0,1,0x530,0x330 | ||
126 | |||
127 | If you are instead using the isapnp tools (as most people have been | ||
128 | before Linux 2.4.x), follow the directions in their documentation to | ||
129 | produce a configuration file. Here is the relevant excerpt I used to | ||
130 | use for my SA3 card from my isapnp.conf: | ||
131 | |||
132 | (CONFIGURE YMH0800/-1 (LD 0 | ||
133 | |||
134 | # NOTE: IO 0 is for the unused SoundBlaster part of the chipset. | ||
135 | (IO 0 (BASE 0x0220)) | ||
136 | (IO 1 (BASE 0x0530)) | ||
137 | (IO 2 (BASE 0x0388)) | ||
138 | (IO 3 (BASE 0x0330)) | ||
139 | (IO 4 (BASE 0x0370)) | ||
140 | (INT 0 (IRQ 5 (MODE +E))) | ||
141 | (DMA 0 (CHANNEL 0)) | ||
142 | (DMA 1 (CHANNEL 1)) | ||
143 | |||
144 | Here, note that: | ||
145 | |||
146 | Port Acceptable Range Purpose | ||
147 | ---- ---------------- ------- | ||
148 | IO 0 0x0220 - 0x0280 SB base address, unused. | ||
149 | IO 1 0x0530 - 0x0F48 MSS base address | ||
150 | IO 2 0x0388 - 0x03F8 OPL3 base address | ||
151 | IO 3 0x0300 - 0x0334 MPU base address | ||
152 | IO 4 0x0100 - 0x0FFE card's own base address for its control I/O ports | ||
153 | |||
154 | The IRQ and DMA values can be any that are considered acceptable for a | ||
155 | MSS. Assuming you've got isapnp all happy, then you should be able to | ||
156 | do something like the following (which matches up with the isapnp | ||
157 | configuration above): | ||
158 | |||
159 | modprobe mpu401 | ||
160 | modprobe ad1848 | ||
161 | modprobe opl3sa2 io=0x370 mss_io=0x530 mpu_io=0x330 irq=5 dma=0 dma2=1 | ||
162 | modprobe opl3 io=0x388 | ||
163 | |||
164 | See the section "Automatic Module Loading" below for how to set up | ||
165 | /etc/modprobe.conf to automate this. | ||
166 | |||
167 | An important thing to remember that the opl3sa2 module's io argument is | ||
168 | for it's own control port, which handles the card's master mixer for | ||
169 | volume (on all cards), and bass and treble (on SA3 cards). | ||
170 | |||
171 | |||
172 | Troubleshooting | ||
173 | --------------- | ||
174 | |||
175 | If all goes well and you see no error messages, you should be able to | ||
176 | start using the sound capabilities of your system. If you get an | ||
177 | error message while trying to insert the opl3sa2 module, then make | ||
178 | sure that the values of the various arguments match what you specified | ||
179 | in your isapnp configuration file, and that there is no conflict with | ||
180 | another device for an I/O port or interrupt. Checking the contents of | ||
181 | /proc/ioports and /proc/interrupts can be useful to see if you're | ||
182 | butting heads with another device. | ||
183 | |||
184 | If you still cannot get the module to load, look at the contents of | ||
185 | your system log file, usually /var/log/messages. If you see the | ||
186 | message "opl3sa2: Unknown Yamaha audio controller version", then you | ||
187 | have a different chipset version than I've encountered so far. Look | ||
188 | for all messages in the log file that start with "opl3sa2: " and see | ||
189 | if they provide any clues. If you do not see the chipset version | ||
190 | message, and none of the other messages present in the system log are | ||
191 | helpful, email me some details and I'll try my best to help. | ||
192 | |||
193 | |||
194 | Automatic Module Loading | ||
195 | ------------------------ | ||
196 | |||
197 | Lastly, if you're using modules and want to set up automatic module | ||
198 | loading with kmod, the kernel module loader, here is the section I | ||
199 | currently use in my modprobe.conf file: | ||
200 | |||
201 | # Sound | ||
202 | alias sound-slot-0 opl3sa2 | ||
203 | options opl3sa2 io=0x370 mss_io=0x530 mpu_io=0x330 irq=7 dma=0 dma2=3 | ||
204 | options opl3 io=0x388 | ||
205 | |||
206 | That's all it currently takes to get an OPL3-SA3 card working on my | ||
207 | system. Once again, if you have any other problems, email me at the | ||
208 | address listed above. | ||
209 | |||
210 | Scott | ||
diff --git a/Documentation/sound/oss/Opti b/Documentation/sound/oss/Opti new file mode 100644 index 000000000000..c15af3c07d46 --- /dev/null +++ b/Documentation/sound/oss/Opti | |||
@@ -0,0 +1,222 @@ | |||
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 | |||
6 | Some items in this README file are based on features | ||
7 | added to the sound driver after Linux-2.1.91 was out. | ||
8 | By the time of writing this I do not know which official | ||
9 | kernel release will include these features. | ||
10 | Please do not report inconsistencies on older Linux | ||
11 | kernels. | ||
12 | |||
13 | The OPTi 82C931 is supported in its non-PnP mode. | ||
14 | Usually you do not need to set jumpers, etc. The sound driver | ||
15 | will check the card status and if it is required it will | ||
16 | force the card into a mode in which it can be programmed. | ||
17 | |||
18 | If you have another OS installed on your computer it is recommended | ||
19 | that Linux and the other OS use the same resources. | ||
20 | |||
21 | Also, it is recommended that resources specified in /etc/modprobe.conf | ||
22 | and resources specified in /etc/isapnp.conf agree. | ||
23 | |||
24 | Compiling the sound driver | ||
25 | -------------------------- | ||
26 | I highly recommend that you build a modularized sound driver. | ||
27 | This document does not cover a sound-driver which is built in | ||
28 | the kernel. | ||
29 | |||
30 | Sound card support should be enabled as a module (chose m). | ||
31 | Answer '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 | |||
37 | The configuration menu may ask for addresses, IRQ lines or DMA | ||
38 | channels. If the card is used as a module the module loading | ||
39 | options will override these values. | ||
40 | |||
41 | For the OPTi 931 you can answer 'n' to: | ||
42 | Support MIDI in older MAD16 based cards (requires SB) (CONFIG_SOUND_MAD16_OLDCARD) | ||
43 | If you do need MIDI support in a Mozart or C928 based card you | ||
44 | need to answer 'm' to the above question. In that case you will | ||
45 | also need to answer 'm' to: | ||
46 | '100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support' (CONFIG_SOUND_SB) | ||
47 | |||
48 | Go on and compile your kernel and modules. Install the modules. Run depmod -a. | ||
49 | |||
50 | Using isapnptools | ||
51 | ----------------- | ||
52 | In most systems with a PnP BIOS you do not need to use isapnp. The | ||
53 | initialization provided by the BIOS is sufficient for the driver | ||
54 | to pick up the card and continue initialization. | ||
55 | |||
56 | If that fails, or if you have other PnP cards, you need to use isapnp | ||
57 | to initialize the card. | ||
58 | This was tested with isapnptools-1.11 but I recommend that you use | ||
59 | isapnptools-1.13 (or newer). Run pnpdump to dump the information | ||
60 | about your PnP cards. Then edit the resulting file and select | ||
61 | the options of your choice. This file is normally installed as | ||
62 | /etc/isapnp.conf. | ||
63 | |||
64 | The driver has one limitation with respect to I/O port resources: | ||
65 | IO3 base must be 0x0E0C. Although isapnp allows other ports, this | ||
66 | address is hard-coded into the driver. | ||
67 | |||
68 | Using kmod and autoloading the sound driver | ||
69 | ------------------------------------------- | ||
70 | Comment: as of linux-2.1.90 kmod is replacing kerneld. | ||
71 | The config file '/etc/modprobe.conf' is used as before. | ||
72 | |||
73 | This is the sound part of my /etc/modprobe.conf file. | ||
74 | Following that I will explain each line. | ||
75 | |||
76 | alias mixer0 mad16 | ||
77 | alias audio0 mad16 | ||
78 | alias midi0 mad16 | ||
79 | alias synth0 opl3 | ||
80 | options sb mad16=1 | ||
81 | options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0 | ||
82 | options opl3 io=0x388 | ||
83 | install mad16 /sbin/modprobe -i mad16 && /sbin/ad1848_mixer_reroute 14 8 15 3 16 6 | ||
84 | |||
85 | If you have an MPU daughtercard or onboard MPU you will want to add to the | ||
86 | "options mad16" line - eg | ||
87 | |||
88 | options mad16 irq=5 dma=0 dma16=3 io=0x530 mpu_io=0x330 mpu_irq=9 | ||
89 | |||
90 | To set the I/O and IRQ of the MPU. | ||
91 | |||
92 | |||
93 | Explain: | ||
94 | |||
95 | alias mixer0 mad16 | ||
96 | alias audio0 mad16 | ||
97 | alias midi0 mad16 | ||
98 | alias synth0 opl3 | ||
99 | |||
100 | When any sound device is opened the kernel requests auto-loading | ||
101 | of char-major-14. There is a built-in alias that translates this | ||
102 | request to loading the main sound module. | ||
103 | |||
104 | The sound module in its turn will request loading of a sub-driver | ||
105 | for mixer, audio, midi or synthesizer device. The first 3 are | ||
106 | supported by the mad16 driver. The synth device is supported | ||
107 | by the opl3 driver. | ||
108 | |||
109 | There is currently no way to autoload the sound device driver | ||
110 | if more than one card is installed. | ||
111 | |||
112 | options sb mad16=1 | ||
113 | |||
114 | This is left for historical reasons. If you enable the | ||
115 | config option 'Support MIDI in older MAD16 based cards (requires SB)' | ||
116 | or if you use an older mad16 driver it will force loading of the | ||
117 | SoundBlaster driver. This option tells the SB driver not to look | ||
118 | for a SB card but to wait for the mad16 driver. | ||
119 | |||
120 | options mad16 irq=10 dma=0 dma16=1 io=0x530 joystick=1 cdtype=0 | ||
121 | options opl3 io=0x388 | ||
122 | |||
123 | post-install mad16 /sbin/ad1848_mixer_reroute 14 8 15 3 16 6 | ||
124 | |||
125 | This sets resources and options for the mad16 and opl3 drivers. | ||
126 | I use two DMA channels (only one is required) to enable full duplex. | ||
127 | joystick=1 enables the joystick port. cdtype=0 disables the cd port. | ||
128 | You can also set mpu_io and mpu_irq in the mad16 options for the | ||
129 | uart401 driver. | ||
130 | |||
131 | This tells modprobe to run /sbin/ad1848_mixer_reroute after | ||
132 | mad16 is successfully loaded and initialized. The source | ||
133 | for ad1848_mixer_reroute is appended to the end of this readme | ||
134 | file. It is impossible for the sound driver to know the actual | ||
135 | connections to the mixer. The 3 inputs intended for cd, synth | ||
136 | and line-in are mapped to the generic inputs line1, line2 and | ||
137 | line3. This program reroutes these mixer channels to their | ||
138 | right names (note the right mapping depends on the actual sound | ||
139 | card that you use). | ||
140 | The 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. | ||
144 | For reference on other input names look at the file | ||
145 | /usr/include/linux/soundcard.h. | ||
146 | |||
147 | Using a joystick | ||
148 | ----------------- | ||
149 | You must enable a joystick in the mad16 options. (also | ||
150 | in /etc/isapnp.conf if you use it). | ||
151 | Tested with regular analog joysticks. | ||
152 | |||
153 | A CDROM drive connected to the sound card | ||
154 | ----------------------------------------- | ||
155 | The 82C931 chip has support only for secondary ATAPI cdrom. | ||
156 | (cdtype=8). Loading the mad16 driver resets the C931 chip | ||
157 | and if a cdrom was already mounted it may cause a complete | ||
158 | system hang. Do not use the sound card if you have an alternative. | ||
159 | If you do use the sound card it is important that you load | ||
160 | the mad16 driver (use "modprobe mad16" to prevent auto-unloading) | ||
161 | before the cdrom is accessed the first time. | ||
162 | |||
163 | Using the sound driver built-in to the kernel may help here, but... | ||
164 | Most new systems have a PnP BIOS and also two IDE controllers. | ||
165 | The IDE controller on the sound card may be needed only on older | ||
166 | systems (which have only one IDE controller) but these systems | ||
167 | also do not have a PnP BIOS - requiring isapnptools and a modularized | ||
168 | driver. | ||
169 | |||
170 | Known problems | ||
171 | -------------- | ||
172 | 1. See the section on "A CDROM drive connected to the sound card". | ||
173 | |||
174 | 2. 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 | |||
181 | Source for ad1848_mixer_reroute.c | ||
182 | --------------------------------- | ||
183 | #include <stdio.h> | ||
184 | #include <fcntl.h> | ||
185 | #include <linux/soundcard.h> | ||
186 | |||
187 | static char *mixer_names[SOUND_MIXER_NRDEVICES] = | ||
188 | SOUND_DEVICE_LABELS; | ||
189 | |||
190 | int | ||
191 | main(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 | |||
diff --git a/Documentation/sound/oss/PAS16 b/Documentation/sound/oss/PAS16 new file mode 100644 index 000000000000..951b3dce51b4 --- /dev/null +++ b/Documentation/sound/oss/PAS16 | |||
@@ -0,0 +1,163 @@ | |||
1 | Pro Audio Spectrum 16 for 2.3.99 and later | ||
2 | ========================================= | ||
3 | by Thomas Molina (tmolina@home.com) | ||
4 | last modified 3 Mar 2001 | ||
5 | Acknowledgement to Axel Boldt (boldt@math.ucsb.edu) for stuff taken | ||
6 | from Configure.help, Riccardo Facchetti for stuff from README.OSS, | ||
7 | and others whose names I could not find. | ||
8 | |||
9 | This documentation is relevant for the PAS16 driver (pas2_card.c and | ||
10 | friends) under kernel version 2.3.99 and later. If you are | ||
11 | unfamiliar with configuring sound under Linux, please read the | ||
12 | Sound-HOWTO, Documentation/sound/oss/Introduction and other | ||
13 | relevant docs first. | ||
14 | |||
15 | The following information is relevant information from README.OSS | ||
16 | and legacy docs for the Pro Audio Spectrum 16 (PAS16): | ||
17 | ================================================================== | ||
18 | |||
19 | The pas2_card.c driver supports the following cards -- | ||
20 | Pro Audio Spectrum 16 (PAS16) and compatibles: | ||
21 | Pro Audio Spectrum 16 | ||
22 | Pro Audio Studio 16 | ||
23 | Logitech Sound Man 16 | ||
24 | NOTE! The original Pro Audio Spectrum as well as the PAS+ are not | ||
25 | and will not be supported by the driver. | ||
26 | |||
27 | The sound driver configuration dialog | ||
28 | ------------------------------------- | ||
29 | |||
30 | Sound configuration starts by making some yes/no questions. Be careful | ||
31 | when answering to these questions since answering y to a question may | ||
32 | prevent some later ones from being asked. For example don't answer y to | ||
33 | the question about (PAS16) if you don't really have a PAS16. Sound | ||
34 | configuration may also be made modular by answering m to configuration | ||
35 | options presented. | ||
36 | |||
37 | Note also that all questions may not be asked. The configuration program | ||
38 | may disable some questions depending on the earlier choices. It may also | ||
39 | select some options automatically as well. | ||
40 | |||
41 | "ProAudioSpectrum 16 support", | ||
42 | - Answer 'y'_ONLY_ if you have a Pro Audio Spectrum _16_, | ||
43 | Pro Audio Studio 16 or Logitech SoundMan 16 (be sure that | ||
44 | you read the above list correctly). Don't answer 'y' if you | ||
45 | have some other card made by Media Vision or Logitech since they | ||
46 | are not PAS16 compatible. | ||
47 | NOTE! Since 3.5-beta10 you need to enable SB support (next question) | ||
48 | if you want to use the SB emulation of PAS16. It's also possible to | ||
49 | the emulation if you want to use a true SB card together with PAS16 | ||
50 | (there is another question about this that is asked later). | ||
51 | |||
52 | "Generic OPL2/OPL3 FM synthesizer support", | ||
53 | - Answer 'y' if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). | ||
54 | The PAS16 has an OPL3-compatible FM chip. | ||
55 | |||
56 | With PAS16 you can use two audio device files at the same time. /dev/dsp (and | ||
57 | /dev/audio) is connected to the 8/16 bit native codec and the /dev/dsp1 (and | ||
58 | /dev/audio1) is connected to the SB emulation (8 bit mono only). | ||
59 | |||
60 | |||
61 | The new stuff for 2.3.99 and later | ||
62 | ============================================================================ | ||
63 | The following configuration options from Documentation/Configure.help | ||
64 | are relevant to configuring the PAS16: | ||
65 | |||
66 | Sound card support | ||
67 | CONFIG_SOUND | ||
68 | If you have a sound card in your computer, i.e. if it can say more | ||
69 | than an occasional beep, say Y. Be sure to have all the information | ||
70 | about your sound card and its configuration down (I/O port, | ||
71 | interrupt and DMA channel), because you will be asked for it. | ||
72 | |||
73 | You want to read the Sound-HOWTO, available from | ||
74 | http://www.tldp.org/docs.html#howto . General information | ||
75 | about the modular sound system is contained in the files | ||
76 | Documentation/sound/oss/Introduction. The file | ||
77 | Documentation/sound/oss/README.OSS contains some slightly outdated but | ||
78 | still useful information as well. | ||
79 | |||
80 | OSS sound modules | ||
81 | CONFIG_SOUND_OSS | ||
82 | OSS is the Open Sound System suite of sound card drivers. They make | ||
83 | sound programming easier since they provide a common API. Say Y or M | ||
84 | here (the module will be called sound.o) if you haven't found a | ||
85 | driver for your sound card above, then pick your driver from the | ||
86 | list below. | ||
87 | |||
88 | Persistent DMA buffers | ||
89 | CONFIG_SOUND_DMAP | ||
90 | Linux can often have problems allocating DMA buffers for ISA sound | ||
91 | cards on machines with more than 16MB of RAM. This is because ISA | ||
92 | DMA buffers must exist below the 16MB boundary and it is quite | ||
93 | possible that a large enough free block in this region cannot be | ||
94 | found after the machine has been running for a while. If you say Y | ||
95 | here the DMA buffers (64Kb) will be allocated at boot time and kept | ||
96 | until the shutdown. This option is only useful if you said Y to | ||
97 | "OSS sound modules", above. If you said M to "OSS sound modules" | ||
98 | then you can get the persistent DMA buffer functionality by passing | ||
99 | the command-line argument "dmabuf=1" to the sound.o module. | ||
100 | |||
101 | Say y here for PAS16. | ||
102 | |||
103 | ProAudioSpectrum 16 support | ||
104 | CONFIG_SOUND_PAS | ||
105 | Answer Y only if you have a Pro Audio Spectrum 16, ProAudio Studio | ||
106 | 16 or Logitech SoundMan 16 sound card. Don't answer Y if you have | ||
107 | some other card made by Media Vision or Logitech since they are not | ||
108 | PAS16 compatible. It is not necessary to enable the separate | ||
109 | Sound Blaster support; it is included in the PAS driver. | ||
110 | |||
111 | If you compile the driver into the kernel, you have to add | ||
112 | "pas2=<io>,<irq>,<dma>,<dma2>,<sbio>,<sbirq>,<sbdma>,<sbdma2> | ||
113 | to the kernel command line. | ||
114 | |||
115 | FM Synthesizer (YM3812/OPL-3) support | ||
116 | CONFIG_SOUND_YM3812 | ||
117 | Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). | ||
118 | Answering Y is usually a safe and recommended choice, however some | ||
119 | cards may have software (TSR) FM emulation. Enabling FM support with | ||
120 | these cards may cause trouble (I don't currently know of any such | ||
121 | cards, however). | ||
122 | Please read the file Documentation/sound/oss/OPL3 if your card has an | ||
123 | OPL3 chip. | ||
124 | If you compile the driver into the kernel, you have to add | ||
125 | "opl3=<io>" to the kernel command line. | ||
126 | |||
127 | If you compile your drivers into the kernel, you MUST configure | ||
128 | OPL3 support as a module for PAS16 support to work properly. | ||
129 | You can then get OPL3 functionality by issuing the command: | ||
130 | insmod opl3 | ||
131 | In addition, you must either add the following line to | ||
132 | /etc/modprobe.conf: | ||
133 | options opl3 io=0x388 | ||
134 | or else add the following line to /etc/lilo.conf: | ||
135 | opl3=0x388 | ||
136 | |||
137 | |||
138 | EXAMPLES | ||
139 | =================================================================== | ||
140 | To use the PAS16 in my computer I have enabled the following sound | ||
141 | configuration options: | ||
142 | |||
143 | CONFIG_SOUND=y | ||
144 | CONFIG_SOUND_OSS=y | ||
145 | CONFIG_SOUND_TRACEINIT=y | ||
146 | CONFIG_SOUND_DMAP=y | ||
147 | CONFIG_SOUND_PAS=y | ||
148 | CONFIG_SOUND_SB=n | ||
149 | CONFIG_SOUND_YM3812=m | ||
150 | |||
151 | I have also included the following append line in /etc/lilo.conf: | ||
152 | append="pas2=0x388,10,3,-1,0x220,5,1,-1 sb=0x220,5,1,-1 opl3=0x388" | ||
153 | |||
154 | The io address of 0x388 is default configuration on the PAS16. The | ||
155 | irq of 10 and dma of 3 may not match your installation. The above | ||
156 | configuration enables PAS16, 8-bit Soundblaster and OPL3 | ||
157 | functionality. If Soundblaster functionality is not desired, the | ||
158 | following line would be appropriate: | ||
159 | append="pas2=0x388,10,3,-1,0,-1,-1,-1 opl3=0x388" | ||
160 | |||
161 | If sound is built totally modular, the above options may be | ||
162 | specified in /etc/modprobe.conf for pas2, sb and opl3 | ||
163 | respectively. | ||
diff --git a/Documentation/sound/oss/PSS b/Documentation/sound/oss/PSS new file mode 100644 index 000000000000..187b9525e1f6 --- /dev/null +++ b/Documentation/sound/oss/PSS | |||
@@ -0,0 +1,41 @@ | |||
1 | The PSS cards and other ECHO based cards provide an onboard DSP with | ||
2 | downloadable programs and also has an AD1848 "Microsoft Sound System" | ||
3 | device. The PSS driver enables MSS and MPU401 modes of the card. SB | ||
4 | is not enabled since it doesn't work concurrently with MSS. | ||
5 | |||
6 | If you build this driver as a module then the driver takes the following | ||
7 | parameters | ||
8 | |||
9 | pss_io. The I/O base the PSS card is configured at (normally 0x220 | ||
10 | or 0x240) | ||
11 | |||
12 | mss_io The base address of the Microsoft Sound System interface. | ||
13 | This is normally 0x530, but may be 0x604 or other addresses. | ||
14 | |||
15 | mss_irq The interrupt assigned to the Microsoft Sound System | ||
16 | emulation. IRQ's 3,5,7,9,10,11 and 12 are available. If you | ||
17 | get IRQ errors be sure to check the interrupt is set to | ||
18 | "ISA/Legacy" in the BIOS on modern machines. | ||
19 | |||
20 | mss_dma The DMA channel used by the Microsoft Sound System. | ||
21 | This can be 0, 1, or 3. DMA 0 is not available on older | ||
22 | machines and will cause a crash on them. | ||
23 | |||
24 | mpu_io The MPU emulation base address. This sets the base of the | ||
25 | synthesizer. It is typically 0x330 but can be altered. | ||
26 | |||
27 | mpu_irq The interrupt to use for the synthesizer. It must differ | ||
28 | from the IRQ used by the Microsoft Sound System port. | ||
29 | |||
30 | |||
31 | The mpu_io/mpu_irq fields are optional. If they are not specified the | ||
32 | synthesizer parts are not configured. | ||
33 | |||
34 | When the module is loaded it looks for a file called | ||
35 | /etc/sound/pss_synth. This is the firmware file from the DOS install disks. | ||
36 | This fil holds a general MIDI emulation. The file expected is called | ||
37 | genmidi.ld on newer DOS driver install disks and synth.ld on older ones. | ||
38 | |||
39 | You can also load alternative DSP algorithms into the card if you wish. One | ||
40 | alternative driver can be found at http://www.mpg123.de/ | ||
41 | |||
diff --git a/Documentation/sound/oss/PSS-updates b/Documentation/sound/oss/PSS-updates new file mode 100644 index 000000000000..c84dd7597e64 --- /dev/null +++ b/Documentation/sound/oss/PSS-updates | |||
@@ -0,0 +1,88 @@ | |||
1 | This file contains notes for users of PSS sound cards who wish to use the | ||
2 | newly added features of the newest version of this driver. | ||
3 | |||
4 | The major enhancements present in this new revision of this driver is the | ||
5 | addition of two new module parameters that allow you to take full advantage of | ||
6 | all the features present on your PSS sound card. These features include the | ||
7 | ability to enable both the builtin CDROM and joystick ports. | ||
8 | |||
9 | pss_enable_joystick | ||
10 | |||
11 | This parameter is basically a flag. A 0 will leave the joystick port | ||
12 | disabled, while a non-zero value would enable the joystick port. The default | ||
13 | setting is pss_enable_joystick=0 as this keeps this driver fully compatible | ||
14 | with systems that were using previous versions of this driver. If you wish to | ||
15 | enable the joystick port you will have to add pss_enable_joystick=1 as an | ||
16 | argument to the driver. To actually use the joystick port you will then have | ||
17 | to load the joystick driver itself. Just remember to load the joystick driver | ||
18 | AFTER the pss sound driver. | ||
19 | |||
20 | pss_cdrom_port | ||
21 | |||
22 | This parameter takes a port address as its parameter. Any available port | ||
23 | address can be specified to enable the CDROM port, except for 0x0 and -1 as | ||
24 | these values would leave the port disabled. Like the joystick port, the cdrom | ||
25 | port will require that an appropriate CDROM driver be loaded before you can make | ||
26 | use of the newly enabled CDROM port. Like the joystick port option above, | ||
27 | remember to load the CDROM driver AFTER the pss sound driver. While it may | ||
28 | differ on some PSS sound cards, all the PSS sound cards that I have seen have a | ||
29 | builtin Wearnes CDROM port. If this is the case with your PSS sound card you | ||
30 | should load aztcd with the appropriate port option that matches the port you | ||
31 | assigned to the CDROM port when you loaded your pss sound driver. (ex. | ||
32 | modprobe pss pss_cdrom_port=0x340 && modprobe aztcd aztcd=0x340) The default | ||
33 | setting of this parameter leaves the CDROM port disabled to maintain full | ||
34 | compatibility with systems using previous versions of this driver. | ||
35 | |||
36 | Other options have also been added for the added convenience and utility | ||
37 | of the user. These options are only available if this driver is loaded as a | ||
38 | module. | ||
39 | |||
40 | pss_no_sound | ||
41 | |||
42 | This module parameter is a flag that can be used to tell the driver to | ||
43 | just configure non-sound components. 0 configures all components, a non-0 | ||
44 | value will only attept to configure the CDROM and joystick ports. This | ||
45 | parameter can be used by a user who only wished to use the builtin joystick | ||
46 | and/or CDROM port(s) of his PSS sound card. If this driver is loaded with this | ||
47 | parameter and with the parameter below set to true then a user can safely unload | ||
48 | this driver with the following command "rmmod pss && rmmod ad1848 && rmmod | ||
49 | mpu401 && rmmod sound && rmmod soundcore" and retain the full functionality of | ||
50 | his CDROM and/or joystick port(s) while gaining back the memory previously used | ||
51 | by the sound drivers. This default setting of this parameter is 0 to retain | ||
52 | full behavioral compatibility with previous versions of this driver. | ||
53 | |||
54 | pss_keep_settings | ||
55 | |||
56 | This parameter can be used to specify whether you want the driver to reset | ||
57 | all emulations whenever its unloaded. This can be useful for those who are | ||
58 | sharing resources (io ports, IRQ's, DMA's) between different ISA cards. This | ||
59 | flag can also be useful in that future versions of this driver may reset all | ||
60 | emulations by default on the driver's unloading (as it probably should), so | ||
61 | specifying it now will ensure that all future versions of this driver will | ||
62 | continue to work as expected. The default value of this parameter is 1 to | ||
63 | retain full behavioral compatibility with previous versions of this driver. | ||
64 | |||
65 | pss_firmware | ||
66 | |||
67 | This parameter can be used to specify the file containing the firmware | ||
68 | code so that a user could tell the driver where that file is located instead | ||
69 | of having to put it in a predefined location with a predefined name. The | ||
70 | default setting of this parameter is "/etc/sound/pss_synth" as this was the | ||
71 | path and filename the hardcoded value in the previous versions of this driver. | ||
72 | |||
73 | Examples: | ||
74 | |||
75 | # Normal PSS sound card system, loading of drivers. | ||
76 | # Should be specified in an rc file (ex. Slackware uses /etc/rc.d/rc.modules). | ||
77 | |||
78 | /sbin/modprobe pss pss_io=0x220 mpu_io=0x338 mpu_irq=9 mss_io=0x530 mss_irq=10 mss_dma=1 pss_cdrom_port=0x340 pss_enable_joystick=1 | ||
79 | /sbin/modprobe aztcd aztcd=0x340 | ||
80 | /sbin/modprobe joystick | ||
81 | |||
82 | # System using the PSS sound card just for its CDROM and joystick ports. | ||
83 | # Should be specified in an rc file (ex. Slackware uses /etc/rc.d/rc.modules). | ||
84 | |||
85 | /sbin/modprobe pss pss_io=0x220 pss_cdrom_port=0x340 pss_enable_joystick=1 pss_no_sound=1 | ||
86 | /sbin/rmmod pss && /sbin/rmmod ad1848 && /sbin/rmmod mpu401 && /sbin/rmmod sound && /sbin/rmmod soundcore # This line not needed, but saves memory. | ||
87 | /sbin/modprobe aztcd aztcd=0x340 | ||
88 | /sbin/modprobe joystick | ||
diff --git a/Documentation/sound/oss/README.OSS b/Documentation/sound/oss/README.OSS new file mode 100644 index 000000000000..fd42b05b2f55 --- /dev/null +++ b/Documentation/sound/oss/README.OSS | |||
@@ -0,0 +1,1456 @@ | |||
1 | Introduction | ||
2 | ------------ | ||
3 | |||
4 | This file is a collection of all the old Readme files distributed with | ||
5 | OSS/Lite by Hannu Savolainen. Since the new Linux sound driver is founded | ||
6 | on it I think these information may still be interesting for users that | ||
7 | have to configure their sound system. | ||
8 | |||
9 | Be warned: Alan Cox is the current maintainer of the Linux sound driver so if | ||
10 | you have problems with it, please contact him or the current device-specific | ||
11 | driver maintainer (e.g. for aedsp16 specific problems contact me). If you have | ||
12 | patches, contributions or suggestions send them to Alan: I'm sure they are | ||
13 | welcome. | ||
14 | |||
15 | In this document you will find a lot of references about OSS/Lite or ossfree: | ||
16 | they are gone forever. Keeping this in mind and with a grain of salt this | ||
17 | document can be still interesting and very helpful. | ||
18 | |||
19 | [ File edited 17.01.1999 - Riccardo Facchetti ] | ||
20 | [ Edited miroSOUND section 19.04.2001 - Robert Siemer ] | ||
21 | |||
22 | OSS/Free version 3.8 release notes | ||
23 | ---------------------------------- | ||
24 | |||
25 | Please read the SOUND-HOWTO (available from sunsite.unc.edu and other Linux FTP | ||
26 | sites). It gives instructions about using sound with Linux. It's bit out of | ||
27 | date but still very useful. Information about bug fixes and such things | ||
28 | is available from the web page (see above). | ||
29 | |||
30 | Please check http://www.opensound.com/pguide for more info about programming | ||
31 | with OSS API. | ||
32 | |||
33 | ==================================================== | ||
34 | - THIS VERSION ____REQUIRES____ Linux 2.1.57 OR LATER. | ||
35 | ==================================================== | ||
36 | |||
37 | Packages "snd-util-3.8.tar.gz" and "snd-data-0.1.tar.Z" | ||
38 | contain useful utilities to be used with this driver. | ||
39 | See http://www.opensound.com/ossfree/getting.html for | ||
40 | download instructions. | ||
41 | |||
42 | If you are looking for the installation instructions, please | ||
43 | look forward into this document. | ||
44 | |||
45 | Supported sound cards | ||
46 | --------------------- | ||
47 | |||
48 | See below. | ||
49 | |||
50 | Contributors | ||
51 | ------------ | ||
52 | |||
53 | This driver contains code by several contributors. In addition several other | ||
54 | persons have given useful suggestions. The following is a list of major | ||
55 | contributors. (I could have forgotten some names.) | ||
56 | |||
57 | Craig Metz 1/2 of the PAS16 Mixer and PCM support | ||
58 | Rob Hooft Volume computation algorithm for the FM synth. | ||
59 | Mika Liljeberg uLaw encoding and decoding routines | ||
60 | Jeff Tranter Linux SOUND HOWTO document | ||
61 | Greg Lee Volume computation algorithm for the GUS and | ||
62 | lots of valuable suggestions. | ||
63 | Andy Warner ISC port | ||
64 | Jim Lowe, | ||
65 | Amancio Hasty Jr FreeBSD/NetBSD port | ||
66 | Anders Baekgaard Bug hunting and valuable suggestions. | ||
67 | Joerg Schubert SB16 DSP support (initial version). | ||
68 | Andrew Robinson Improvements to the GUS driver | ||
69 | Megens SA MIDI recording for SB and SB Pro (initial version). | ||
70 | Mikael Nordqvist Linear volume support for GUS and | ||
71 | nonblocking /dev/sequencer. | ||
72 | Ian Hartas SVR4.2 port | ||
73 | Markus Aroharju and | ||
74 | Risto Kankkunen Major contributions to the mixer support | ||
75 | of GUS v3.7. | ||
76 | Hunyue Yau Mixer support for SG NX Pro. | ||
77 | Marc Hoffman PSS support (initial version). | ||
78 | Rainer Vranken Initialization for Jazz16 (initial version). | ||
79 | Peter Trattler Initial version of loadable module support for Linux. | ||
80 | JRA Gibson 16 bit mode for Jazz16 (initial version) | ||
81 | Davor Jadrijevic MAD16 support (initial version) | ||
82 | Gregor Hoffleit Mozart support (initial version) | ||
83 | Riccardo Facchetti Audio Excel DSP 16 (aedsp16) support | ||
84 | James Hightower Spotting a tiny but important bug in CS423x support. | ||
85 | Denis Sablic OPTi 82C924 specific enhancements (non PnP mode) | ||
86 | Tim MacKenzie Full duplex support for OPTi 82C930. | ||
87 | |||
88 | Please look at lowlevel/README for more contributors. | ||
89 | |||
90 | There are probably many other names missing. If you have sent me some | ||
91 | patches and your name is not in the above list, please inform me. | ||
92 | |||
93 | Sending your contributions or patches | ||
94 | ------------------------------------- | ||
95 | |||
96 | First of all it's highly recommended to contact me before sending anything | ||
97 | or before even starting to do any work. Tell me what you suggest to be | ||
98 | changed or what you have planned to do. Also ensure you are using the | ||
99 | very latest (development) version of OSS/Free since the change may already be | ||
100 | implemented there. In general it's a major waste of time to try to improve a | ||
101 | several months old version. Information about the latest version can be found | ||
102 | from http://www.opensound.com/ossfree. In general there is no point in | ||
103 | sending me patches relative to production kernels. | ||
104 | |||
105 | Sponsors etc. | ||
106 | ------------- | ||
107 | |||
108 | The following companies have greatly helped development of this driver | ||
109 | in form of a free copy of their product: | ||
110 | |||
111 | Novell, Inc. UnixWare personal edition + SDK | ||
112 | The Santa Cruz Operation, Inc. A SCO OpenServer + SDK | ||
113 | Ensoniq Corp, a SoundScape card and extensive amount of assistance | ||
114 | MediaTrix Peripherals Inc, a AudioTrix Pro card + SDK | ||
115 | Acer, Inc. a pair of AcerMagic S23 cards. | ||
116 | |||
117 | In addition the following companies have provided me sufficient amount | ||
118 | of technical information at least some of their products (free or $$$): | ||
119 | |||
120 | Advanced Gravis Computer Technology Ltd. | ||
121 | Media Vision Inc. | ||
122 | Analog Devices Inc. | ||
123 | Logitech Inc. | ||
124 | Aztech Labs Inc. | ||
125 | Crystal Semiconductor Corporation, | ||
126 | Integrated Circuit Systems Inc. | ||
127 | OAK Technology | ||
128 | OPTi | ||
129 | Turtle Beach | ||
130 | miro | ||
131 | Ad Lib Inc. ($$) | ||
132 | Music Quest Inc. ($$) | ||
133 | Creative Labs ($$$) | ||
134 | |||
135 | If you have some problems | ||
136 | ========================= | ||
137 | |||
138 | Read the sound HOWTO (sunsite.unc.edu:/pub/Linux/docs/...?). | ||
139 | Also look at the home page (http://www.opensound.com/ossfree). It may | ||
140 | contain info about some recent bug fixes. | ||
141 | |||
142 | It's likely that you have some problems when trying to use the sound driver | ||
143 | first time. Sound cards don't have standard configuration so there are no | ||
144 | good default configuration to use. Please try to use same I/O, DMA and IRQ | ||
145 | values for the sound card than with DOS. | ||
146 | |||
147 | If you get an error message when trying to use the driver, please look | ||
148 | at /var/adm/messages for more verbose error message. | ||
149 | |||
150 | |||
151 | The following errors are likely with /dev/dsp and /dev/audio. | ||
152 | |||
153 | - "No such device or address". | ||
154 | This error indicates that there are no suitable hardware for the | ||
155 | device file or the sound driver has been compiled without support for | ||
156 | this particular device. For example /dev/audio and /dev/dsp will not | ||
157 | work if "digitized voice support" was not enabled during "make config". | ||
158 | |||
159 | - "Device or resource busy". Probably the IRQ (or DMA) channel | ||
160 | required by the sound card is in use by some other device/driver. | ||
161 | |||
162 | - "I/O error". Almost certainly (99%) it's an IRQ or DMA conflict. | ||
163 | Look at the kernel messages in /var/adm/notice for more info. | ||
164 | |||
165 | - "Invalid argument". The application is calling ioctl() | ||
166 | with impossible parameters. Check that the application is | ||
167 | for sound driver version 2.X or later. | ||
168 | |||
169 | Linux installation | ||
170 | ================== | ||
171 | |||
172 | IMPORTANT! Read this if you are installing a separately | ||
173 | distributed version of this driver. | ||
174 | |||
175 | Check that your kernel version works with this | ||
176 | release of the driver (see Readme). Also verify | ||
177 | that your current kernel version doesn't have more | ||
178 | recent sound driver version than this one. IT'S HIGHLY | ||
179 | RECOMMENDED THAT YOU USE THE SOUND DRIVER VERSION THAT | ||
180 | IS DISTRIBUTED WITH KERNEL SOURCES. | ||
181 | |||
182 | - When installing separately distributed sound driver you should first | ||
183 | read the above notice. Then try to find proper directory where and how | ||
184 | to install the driver sources. You should not try to install a separately | ||
185 | distributed driver version if you are not able to find the proper way | ||
186 | yourself (in this case use the version that is distributed with kernel | ||
187 | sources). Remove old version of linux/drivers/sound directory before | ||
188 | installing new files. | ||
189 | |||
190 | - To build the device files you need to run the enclosed shell script | ||
191 | (see below). You need to do this only when installing sound driver | ||
192 | first time or when upgrading to much recent version than the earlier | ||
193 | one. | ||
194 | |||
195 | - Configure and compile Linux as normally (remember to include the | ||
196 | sound support during "make config"). Please refer to kernel documentation | ||
197 | for instructions about configuring and compiling kernel. File Readme.cards | ||
198 | contains card specific instructions for configuring this driver for | ||
199 | use with various sound cards. | ||
200 | |||
201 | Boot time configuration (using lilo and insmod) | ||
202 | ----------------------------------------------- | ||
203 | |||
204 | This information has been removed. Too many users didn't believe | ||
205 | that it's really not necessary to use this method. Please look at | ||
206 | Readme of sound driver version 3.0.1 if you still want to use this method. | ||
207 | |||
208 | Problems | ||
209 | -------- | ||
210 | |||
211 | Common error messages: | ||
212 | |||
213 | - /dev/???????: No such file or directory. | ||
214 | Run the script at the end of this file. | ||
215 | |||
216 | - /dev/???????: No such device. | ||
217 | You are not running kernel which contains the sound driver. When using | ||
218 | modularized sound driver this error means that the sound driver is not | ||
219 | loaded. | ||
220 | |||
221 | - /dev/????: No such device or address. | ||
222 | Sound driver didn't detect suitable card when initializing. Please look at | ||
223 | Readme.cards for info about configuring the driver with your card. Also | ||
224 | check for possible boot (insmod) time error messages in /var/adm/messages. | ||
225 | |||
226 | - Other messages or problems | ||
227 | Please check http://www.opensound.com/ossfree for more info. | ||
228 | |||
229 | Configuring version 3.8 (for Linux) with some common sound cards | ||
230 | ================================================================ | ||
231 | |||
232 | This document describes configuring sound cards with the freeware version of | ||
233 | Open Sound Systems (OSS/Free). Information about the commercial version | ||
234 | (OSS/Linux) and its configuration is available from | ||
235 | http://www.opensound.com/linux.html. Information presented here is | ||
236 | not valid for OSS/Linux. | ||
237 | |||
238 | If you are unsure about how to configure OSS/Free | ||
239 | you can download the free evaluation version of OSS/Linux from the above | ||
240 | address. There is a chance that it can autodetect your sound card. In this case | ||
241 | you can use the information included in soundon.log when configuring OSS/Free. | ||
242 | |||
243 | |||
244 | IMPORTANT! This document covers only cards that were "known" when | ||
245 | this driver version was released. Please look at | ||
246 | http://www.opensound.com/ossfree for info about | ||
247 | cards introduced recently. | ||
248 | |||
249 | When configuring the sound driver, you should carefully | ||
250 | check each sound configuration option (particularly | ||
251 | "Support for /dev/dsp and /dev/audio"). The default values | ||
252 | offered by these programs are not necessarily valid. | ||
253 | |||
254 | |||
255 | THE BIGGEST MISTAKES YOU CAN MAKE | ||
256 | ================================= | ||
257 | |||
258 | 1. Assuming that the card is Sound Blaster compatible when it's not. | ||
259 | -------------------------------------------------------------------- | ||
260 | |||
261 | The number one mistake is to assume that your card is compatible with | ||
262 | Sound Blaster. Only the cards made by Creative Technology or which have | ||
263 | one or more chips labeled by Creative are SB compatible. In addition there | ||
264 | are few sound chipsets which are SB compatible in Linux such as ESS1688 or | ||
265 | Jazz16. Note that SB compatibility in DOS/Windows does _NOT_ mean anything | ||
266 | in Linux. | ||
267 | |||
268 | IF YOU REALLY ARE 150% SURE YOU HAVE A SOUND BLASTER YOU CAN SKIP THE REST OF | ||
269 | THIS CHAPTER. | ||
270 | |||
271 | For most other "supposed to be SB compatible" cards you have to use other | ||
272 | than SB drivers (see below). It is possible to get most sound cards to work | ||
273 | in SB mode but in general it's a complete waste of time. There are several | ||
274 | problems which you will encounter by using SB mode with cards that are not | ||
275 | truly SB compatible: | ||
276 | |||
277 | - The SB emulation is at most SB Pro (DSP version 3.x) which means that | ||
278 | you get only 8 bit audio (there is always an another ("native") mode which | ||
279 | gives the 16 bit capability). The 8 bit only operation is the reason why | ||
280 | many users claim that sound quality in Linux is much worse than in DOS. | ||
281 | In addition some applications require 16 bit mode and they produce just | ||
282 | noise with a 8 bit only device. | ||
283 | - The card may work only in some cases but refuse to work most of the | ||
284 | time. The SB compatible mode always requires special initialization which is | ||
285 | done by the DOS/Windows drivers. This kind of cards work in Linux after | ||
286 | you have warm booted it after DOS but they don't work after cold boot | ||
287 | (power on or reset). | ||
288 | - You get the famous "DMA timed out" messages. Usually all SB clones have | ||
289 | software selectable IRQ and DMA settings. If the (power on default) values | ||
290 | currently used by the card don't match configuration of the driver you will | ||
291 | get the above error message whenever you try to record or play. There are | ||
292 | few other reasons to the DMA timeout message but using the SB mode seems | ||
293 | to be the most common cause. | ||
294 | |||
295 | 2. Trying to use a PnP (Plug & Play) card just like an ordinary sound card | ||
296 | -------------------------------------------------------------------------- | ||
297 | |||
298 | Plug & Play is a protocol defined by Intel and Microsoft. It lets operating | ||
299 | systems to easily identify and reconfigure I/O ports, IRQs and DMAs of ISA | ||
300 | cards. The problem with PnP cards is that the standard Linux doesn't currently | ||
301 | (versions 2.1.x and earlier) don't support PnP. This means that you will have | ||
302 | to use some special tricks (see later) to get a PnP card alive. Many PnP cards | ||
303 | work after they have been initialized but this is not always the case. | ||
304 | |||
305 | There are sometimes both PnP and non-PnP versions of the same sound card. | ||
306 | The non-PnP version is the original model which usually has been discontinued | ||
307 | more than an year ago. The PnP version has the same name but with "PnP" | ||
308 | appended to it (sometimes not). This causes major confusion since the non-PnP | ||
309 | model works with Linux but the PnP one doesn't. | ||
310 | |||
311 | You should carefully check if "Plug & Play" or "PnP" is mentioned in the name | ||
312 | of the card or in the documentation or package that came with the card. | ||
313 | Everything described in the rest of this document is not necessarily valid for | ||
314 | PnP models of sound cards even you have managed to wake up the card properly. | ||
315 | Many PnP cards are simply too different from their non-PnP ancestors which are | ||
316 | covered by this document. | ||
317 | |||
318 | |||
319 | Cards that are not (fully) supported by this driver | ||
320 | =================================================== | ||
321 | |||
322 | See http://www.opensound.com/ossfree for information about sound cards | ||
323 | to be supported in future. | ||
324 | |||
325 | |||
326 | How to use sound without recompiling kernel and/or sound driver | ||
327 | =============================================================== | ||
328 | |||
329 | There is a commercial sound driver which comes in precompiled form and doesn't | ||
330 | require recompiling of the kernel. See http://www.4Front-tech.com/oss.html for | ||
331 | more info. | ||
332 | |||
333 | |||
334 | Configuring PnP cards | ||
335 | ===================== | ||
336 | |||
337 | New versions of most sound cards use the so-called ISA PnP protocol for | ||
338 | soft configuring their I/O, IRQ, DMA and shared memory resources. | ||
339 | Currently at least cards made by Creative Technology (SB32 and SB32AWE | ||
340 | PnP), Gravis (GUS PnP and GUS PnP Pro), Ensoniq (Soundscape PnP) and | ||
341 | Aztech (some Sound Galaxy models) use PnP technology. The CS4232/4236 audio | ||
342 | chip by Crystal Semiconductor (Intel Atlantis, HP Pavilion and many other | ||
343 | motherboards) is also based on PnP technology but there is a "native" driver | ||
344 | available for it (see information about CS4232 later in this document). | ||
345 | |||
346 | PnP sound cards (as well as most other PnP ISA cards) are not supported | ||
347 | by this version of the driver . Proper | ||
348 | support for them should be released during 97 once the kernel level | ||
349 | PnP support is available. | ||
350 | |||
351 | There is a method to get most of the PnP cards to work. The basic method | ||
352 | is the following: | ||
353 | |||
354 | 1) Boot DOS so the card's DOS drivers have a chance to initialize it. | ||
355 | 2) _Cold_ boot to Linux by using "loadlin.exe". Hitting ctrl-alt-del | ||
356 | works with older machines but causes a hard reset of all cards on recent | ||
357 | (Pentium) machines. | ||
358 | 3) If you have the sound driver in Linux configured properly, the card should | ||
359 | work now. "Proper" means that I/O, IRQ and DMA settings are the same as in | ||
360 | DOS. The hard part is to find which settings were used. See the documentation of | ||
361 | your card for more info. | ||
362 | |||
363 | Windows 95 could work as well as DOS but running loadlin may be difficult. | ||
364 | Probably you should "shut down" your machine to MS-DOS mode before running it. | ||
365 | |||
366 | Some machines have a BIOS utility for setting PnP resources. This is a good | ||
367 | way to configure some cards. In this case you don't need to boot DOS/Win95 | ||
368 | before starting Linux. | ||
369 | |||
370 | Another way to initialize PnP cards without DOS/Win95 is a Linux based | ||
371 | PnP isolation tool. When writing this there is a pre alpha test version | ||
372 | of such a tool available from ftp://ftp.demon.co.uk/pub/unix/linux/utils. The | ||
373 | file is called isapnptools-*. Please note that this tool is just a temporary | ||
374 | solution which may be incompatible with future kernel versions having proper | ||
375 | support for PnP cards. There are bugs in setting DMA channels in earlier | ||
376 | versions of isapnptools so at least version 1.6 is required with sound cards. | ||
377 | |||
378 | Yet another way to use PnP cards is to use (commercial) OSS/Linux drivers. See | ||
379 | http://www.opensound.com/linux.html for more info. This is probably the way you | ||
380 | should do it if you don't want to spend time recompiling the kernel and | ||
381 | required tools. | ||
382 | |||
383 | |||
384 | Read this before trying to configure the driver | ||
385 | =============================================== | ||
386 | |||
387 | There are currently many cards that work with this driver. Some of the cards | ||
388 | have native support while others work since they emulate some other | ||
389 | card (usually SB, MSS/WSS and/or MPU401). The following cards have native | ||
390 | support in the driver. Detailed instructions for configuring these cards | ||
391 | will be given later in this document. | ||
392 | |||
393 | Pro Audio Spectrum 16 (PAS16) and compatibles: | ||
394 | Pro Audio Spectrum 16 | ||
395 | Pro Audio Studio 16 | ||
396 | Logitech Sound Man 16 | ||
397 | NOTE! The original Pro Audio Spectrum as well as the PAS+ are not | ||
398 | and will not be supported by the driver. | ||
399 | |||
400 | Media Vision Jazz16 based cards | ||
401 | Pro Sonic 16 | ||
402 | Logitech SoundMan Wave | ||
403 | (Other Jazz based cards should work but I don't have any reports | ||
404 | about them). | ||
405 | |||
406 | Sound Blasters | ||
407 | SB 1.0 to 2.0 | ||
408 | SB Pro | ||
409 | SB 16 | ||
410 | SB32/64/AWE | ||
411 | Configure SB32/64/AWE just like SB16. See lowlevel/README.awe | ||
412 | for information about using the wave table synth. | ||
413 | NOTE! AWE63/Gold and 16/32/AWE "PnP" cards need to be activated | ||
414 | using isapnptools before they work with OSS/Free. | ||
415 | SB16 compatible cards by other manufacturers than Creative. | ||
416 | You have been fooled since there are _no_ SB16 compatible | ||
417 | cards on the market (as of May 1997). It's likely that your card | ||
418 | is compatible just with SB Pro but there is also a non-SB- | ||
419 | compatible 16 bit mode. Usually it's MSS/WSS but it could also | ||
420 | be a proprietary one like MV Jazz16 or ESS ES688. OPTi | ||
421 | MAD16 chips are very common in so called "SB 16 bit cards" | ||
422 | (try with the MAD16 driver). | ||
423 | |||
424 | ====================================================================== | ||
425 | "Supposed to be SB compatible" cards. | ||
426 | Forget the SB compatibility and check for other alternatives | ||
427 | first. The only cards that work with the SB driver in | ||
428 | Linux have been made by Creative Technology (there is at least | ||
429 | one chip on the card with "CREATIVE" printed on it). The | ||
430 | only other SB compatible chips are ESS and Jazz16 chips | ||
431 | (maybe ALSxxx chips too but they probably don't work). | ||
432 | Most other "16 bit SB compatible" cards such as "OPTi/MAD16" or | ||
433 | "Crystal" are _NOT_ SB compatible in Linux. | ||
434 | |||
435 | Practically all sound cards have some kind of SB emulation mode | ||
436 | in addition to their native (16 bit) mode. In most cases this | ||
437 | (8 bit only) SB compatible mode doesn't work with Linux. If | ||
438 | you get it working it may cause problems with games and | ||
439 | applications which require 16 bit audio. Some 16 bit only | ||
440 | applications don't check if the card actually supports 16 bits. | ||
441 | They just dump 16 bit data to a 8 bit card which produces just | ||
442 | noise. | ||
443 | |||
444 | In most cases the 16 bit native mode is supported by Linux. | ||
445 | Use the SB mode with "clones" only if you don't find anything | ||
446 | better from the rest of this doc. | ||
447 | ====================================================================== | ||
448 | |||
449 | Gravis Ultrasound (GUS) | ||
450 | GUS | ||
451 | GUS + the 16 bit option | ||
452 | GUS MAX | ||
453 | GUS ACE (No MIDI port and audio recording) | ||
454 | GUS PnP (with RAM) | ||
455 | |||
456 | MPU-401 and compatibles | ||
457 | The driver works both with the full (intelligent mode) MPU-401 | ||
458 | cards (such as MPU IPC-T and MQX-32M) and with the UART only | ||
459 | dumb MIDI ports. MPU-401 is currently the most common MIDI | ||
460 | interface. Most sound cards are compatible with it. However, | ||
461 | don't enable MPU401 mode blindly. Many cards with native support | ||
462 | in the driver have their own MPU401 driver. Enabling the standard one | ||
463 | will cause a conflict with these cards. So check if your card is | ||
464 | in the list of supported cards before enabling MPU401. | ||
465 | |||
466 | Windows Sound System (MSS/WSS) | ||
467 | Even when Microsoft has discontinued their own Sound System card | ||
468 | they managed to make it a standard. MSS compatible cards are based on | ||
469 | a codec chip which is easily available from at least two manufacturers | ||
470 | (AD1848 by Analog Devices and CS4231/CS4248 by Crystal Semiconductor). | ||
471 | Currently most sound cards are based on one of the MSS compatible codec | ||
472 | chips. The CS4231 is used in the high quality cards such as GUS MAX, | ||
473 | MediaTrix AudioTrix Pro and TB Tropez (GUS MAX is not MSS compatible). | ||
474 | |||
475 | Having a AD1848, CS4248 or CS4231 codec chip on the card is a good | ||
476 | sign. Even if the card is not MSS compatible, it could be easy to write | ||
477 | support for it. Note also that most MSS compatible cards | ||
478 | require special boot time initialization which may not be present | ||
479 | in the driver. Also, some MSS compatible cards have native support. | ||
480 | Enabling the MSS support with these cards is likely to | ||
481 | cause a conflict. So check if your card is listed in this file before | ||
482 | enabling the MSS support. | ||
483 | |||
484 | Yamaha FM synthesizers (OPL2, OPL3 (not OPL3-SA) and OPL4) | ||
485 | Most sound cards have a FM synthesizer chip. The OPL2 is a 2 | ||
486 | operator chip used in the original AdLib card. Currently it's used | ||
487 | only in the cheapest (8 bit mono) cards. The OPL3 is a 4 operator | ||
488 | FM chip which provides better sound quality and/or more available | ||
489 | voices than the OPL2. The OPL4 is a new chip that has an OPL3 and | ||
490 | a wave table synthesizer packed onto the same chip. The driver supports | ||
491 | just the OPL3 mode directly. Most cards with an OPL4 (like | ||
492 | SM Wave and AudioTrix Pro) support the OPL4 mode using MPU401 | ||
493 | emulation. Writing a native OPL4 support is difficult | ||
494 | since Yamaha doesn't give information about their sample ROM chip. | ||
495 | |||
496 | Enable the generic OPL2/OPL3 FM synthesizer support if your | ||
497 | card has a FM chip made by Yamaha. Don't enable it if your card | ||
498 | has a software (TRS) based FM emulator. | ||
499 | |||
500 | ---------------------------------------------------------------- | ||
501 | NOTE! OPL3-SA is different chip than the ordinary OPL3. In addition | ||
502 | to the FM synth this chip has also digital audio (WSS) and | ||
503 | MIDI (MPU401) capabilities. Support for OPL3-SA is described below. | ||
504 | ---------------------------------------------------------------- | ||
505 | |||
506 | Yamaha OPL3-SA1 | ||
507 | |||
508 | Yamaha OPL3-SA1 (YMF701) is an audio controller chip used on some | ||
509 | (Intel) motherboards and on cheap sound cards. It should not be | ||
510 | confused with the original OPL3 chip (YMF278) which is entirely | ||
511 | different chip. OPL3-SA1 has support for MSS, MPU401 and SB Pro | ||
512 | (not used in OSS/Free) in addition to the OPL3 FM synth. | ||
513 | |||
514 | There are also chips called OPL3-SA2, OPL3-SA3, ..., OPL3SA-N. They | ||
515 | are PnP chips and will not work with the OPL3-SA1 driver. You should | ||
516 | use the standard MSS, MPU401 and OPL3 options with these chips and to | ||
517 | activate the card using isapnptools. | ||
518 | |||
519 | 4Front Technologies SoftOSS | ||
520 | |||
521 | SoftOSS is a software based wave table emulation which works with | ||
522 | any 16 bit stereo sound card. Due to its nature a fast CPU is | ||
523 | required (P133 is minimum). Although SoftOSS does _not_ use MMX | ||
524 | instructions it has proven out that recent processors (which appear | ||
525 | to have MMX) perform significantly better with SoftOSS than earlier | ||
526 | ones. For example a P166MMX beats a PPro200. SoftOSS should not be used | ||
527 | on 486 or 386 machines. | ||
528 | |||
529 | The amount of CPU load caused by SoftOSS can be controlled by | ||
530 | selecting the CONFIG_SOFTOSS_RATE and CONFIG_SOFTOSS_VOICES | ||
531 | parameters properly (they will be prompted by make config). It's | ||
532 | recommended to set CONFIG_SOFTOSS_VOICES to 32. If you have a | ||
533 | P166MMX or faster (PPro200 is not faster) you can set | ||
534 | CONFIG_SOFTOSS_RATE to 44100 (kHz). However with slower systems it | ||
535 | recommended to use sampling rates around 22050 or even 16000 kHz. | ||
536 | Selecting too high values for these parameters may hang your | ||
537 | system when playing MIDI files with hight degree of polyphony | ||
538 | (number of concurrently playing notes). It's also possible to | ||
539 | decrease CONFIG_SOFTOSS_VOICES. This makes it possible to use | ||
540 | higher sampling rates. However using fewer voices decreases | ||
541 | playback quality more than decreasing the sampling rate. | ||
542 | |||
543 | SoftOSS keeps the samples loaded on the system's RAM so much RAM is | ||
544 | required. SoftOSS should never be used on machines with less than 16 MB | ||
545 | of RAM since this is potentially dangerous (you may accidentally run out | ||
546 | of memory which probably crashes the machine). | ||
547 | |||
548 | SoftOSS implements the wave table API originally designed for GUS. For | ||
549 | this reason all applications designed for GUS should work (at least | ||
550 | after minor modifications). For example gmod/xgmod and playmidi -g are | ||
551 | known to work. | ||
552 | |||
553 | To work SoftOSS will require GUS compatible | ||
554 | patch files to be installed on the system (in /dos/ultrasnd/midi). You | ||
555 | can use the public domain MIDIA patchset available from several ftp | ||
556 | sites. | ||
557 | |||
558 | ********************************************************************* | ||
559 | IMPORTANT NOTICE! The original patch set distributed with the Gravis | ||
560 | Ultrasound card is not in public domain (even though it's available from | ||
561 | some FTP sites). You should contact Voice Crystal (www.voicecrystal.com) | ||
562 | if you like to use these patches with SoftOSS included in OSS/Free. | ||
563 | ********************************************************************* | ||
564 | |||
565 | PSS based cards (AD1848 + ADSP-2115 + Echo ESC614 ASIC) | ||
566 | Analog Devices and Echo Speech have together defined a sound card | ||
567 | architecture based on the above chips. The DSP chip is used | ||
568 | for emulation of SB Pro, FM and General MIDI/MT32. | ||
569 | |||
570 | There are several cards based on this architecture. The most known | ||
571 | ones are Orchid SW32 and Cardinal DSP16. | ||
572 | |||
573 | The driver supports downloading DSP algorithms to these cards. | ||
574 | |||
575 | NOTE! You will have to use the "old" config script when configuring | ||
576 | PSS cards. | ||
577 | |||
578 | MediaTrix AudioTrix Pro | ||
579 | The ATP card is built around a CS4231 codec and an OPL4 synthesizer | ||
580 | chips. The OPL4 mode is supported by a microcontroller running a | ||
581 | General MIDI emulator. There is also a SB 1.5 compatible playback mode. | ||
582 | |||
583 | Ensoniq SoundScape and compatibles | ||
584 | Ensoniq has designed a sound card architecture based on the | ||
585 | OTTO synthesizer chip used in their professional MIDI synthesizers. | ||
586 | Several companies (including Ensoniq, Reveal and Spea) are selling | ||
587 | cards based on this architecture. | ||
588 | |||
589 | NOTE! The SoundScape PnP is not supported by OSS/Free. Ensoniq VIVO and | ||
590 | VIVO90 cards are not compatible with Soundscapes so the Soundscape | ||
591 | driver will not work with them. You may want to use OSS/Linux with these | ||
592 | cards. | ||
593 | |||
594 | OPTi MAD16 and Mozart based cards | ||
595 | The Mozart (OAK OTI-601), MAD16 (OPTi 82C928), MAD16 Pro (OPTi 82C929), | ||
596 | OPTi 82C924/82C925 (in _non_ PnP mode) and OPTi 82C930 interface | ||
597 | chips are used in many different sound cards, including some | ||
598 | cards by Reveal miro and Turtle Beach (Tropez). The purpose of these | ||
599 | chips is to connect other audio components to the PC bus. The | ||
600 | interface chip performs address decoding for the other chips. | ||
601 | NOTE! Tropez Plus is not MAD16 but CS4232 based. | ||
602 | NOTE! MAD16 PnP cards (82C924, 82C925, 82C931) are not MAD16 compatible | ||
603 | in the PnP mode. You will have to use them in MSS mode after having | ||
604 | initialized them using isapnptools or DOS. 82C931 probably requires | ||
605 | initialization using DOS/Windows (running isapnptools is not enough). | ||
606 | It's possible to use 82C931 with OSS/Free by jumpering it to non-PnP | ||
607 | mode (provided that the card has a jumper for this). In non-PnP mode | ||
608 | 82C931 is compatible with 82C930 and should work with the MAD16 driver | ||
609 | (without need to use isapnptools or DOS to initialize it). All OPTi | ||
610 | chips are supported by OSS/Linux (both in PnP and non-PnP modes). | ||
611 | |||
612 | Audio Excel DSP16 | ||
613 | Support for this card was written by Riccardo Faccetti | ||
614 | (riccardo@cdc8g5.cdc.polimi.it). The AEDSP16 driver included in | ||
615 | the lowlevel/ directory. To use it you should enable the | ||
616 | "Additional low level drivers" option. | ||
617 | |||
618 | Crystal CS4232 and CS4236 based cards such as AcerMagic S23, TB Tropez _Plus_ and | ||
619 | many PC motherboards (Compaq, HP, Intel, ...) | ||
620 | CS4232 is a PnP multimedia chip which contains a CS3231A codec, | ||
621 | SB and MPU401 emulations. There is support for OPL3 too. | ||
622 | Unfortunately the MPU401 mode doesn't work (I don't know how to | ||
623 | initialize it). CS4236 is an enhanced (compatible) version of CS4232. | ||
624 | NOTE! Don't ever try to use isapnptools with CS4232 since this will just | ||
625 | freeze your machine (due to chip bugs). If you have problems in getting | ||
626 | CS4232 working you could try initializing it with DOS (CS4232C.EXE) and | ||
627 | then booting Linux using loadlin. CS4232C.EXE loads a secret firmware | ||
628 | patch which is not documented by Crystal. | ||
629 | |||
630 | Turtle Beach Maui and Tropez "classic" | ||
631 | This driver version supports sample, patch and program loading commands | ||
632 | described in the Maui/Tropez User's manual. | ||
633 | There is now full initialization support too. The audio side of | ||
634 | the Tropez is based on the MAD16 chip (see above). | ||
635 | NOTE! Tropez Plus is different card than Tropez "classic" and will not | ||
636 | work fully in Linux. You can get audio features working by configuring | ||
637 | the card as a CS4232 based card (above). | ||
638 | |||
639 | |||
640 | Jumpers and software configuration | ||
641 | ================================== | ||
642 | |||
643 | Some of the earliest sound cards were jumper configurable. You have to | ||
644 | configure the driver use I/O, IRQ and DMA settings | ||
645 | that match the jumpers. Just few 8 bit cards are fully jumper | ||
646 | configurable (SB 1.x/2.x, SB Pro and clones). | ||
647 | Some cards made by Aztech have an EEPROM which contains the | ||
648 | config info. These cards behave much like hardware jumpered cards. | ||
649 | |||
650 | Most cards have jumper for the base I/O address but other parameters | ||
651 | are software configurable. Sometimes there are few other jumpers too. | ||
652 | |||
653 | Latest cards are fully software configurable or they are PnP ISA | ||
654 | compatible. There are no jumpers on the board. | ||
655 | |||
656 | The driver handles software configurable cards automatically. Just configure | ||
657 | the driver to use I/O, IRQ and DMA settings which are known to work. | ||
658 | You could usually use the same values than with DOS and/or Windows. | ||
659 | Using different settings is possible but not recommended since it may cause | ||
660 | some trouble (for example when warm booting from an OS to another or | ||
661 | when installing new hardware to the machine). | ||
662 | |||
663 | Sound driver sets the soft configurable parameters of the card automatically | ||
664 | during boot. Usually you don't need to run any extra initialization | ||
665 | programs when booting Linux but there are some exceptions. See the | ||
666 | card-specific instructions below for more info. | ||
667 | |||
668 | The drawback of software configuration is that the driver needs to know | ||
669 | how the card must be initialized. It cannot initialize unknown cards | ||
670 | even if they are otherwise compatible with some other cards (like SB, | ||
671 | MPU401 or Windows Sound System). | ||
672 | |||
673 | |||
674 | What if your card was not listed above? | ||
675 | ======================================= | ||
676 | |||
677 | The first thing to do is to look at the major IC chips on the card. | ||
678 | Many of the latest sound cards are based on some standard chips. If you | ||
679 | are lucky, all of them could be supported by the driver. The most common ones | ||
680 | are the OPTi MAD16, Mozart, SoundScape (Ensoniq) and the PSS architectures | ||
681 | listed above. Also look at the end of this file for list of unsupported | ||
682 | cards and the ones which could be supported later. | ||
683 | |||
684 | The last resort is to send _exact_ name and model information of the card | ||
685 | to me together with a list of the major IC chips (manufactured, model) to | ||
686 | me. I could then try to check if your card looks like something familiar. | ||
687 | |||
688 | There are many more cards in the world than listed above. The first thing to | ||
689 | do with these cards is to check if they emulate some other card or interface | ||
690 | such as SB, MSS and/or MPU401. In this case there is a chance to get the | ||
691 | card to work by booting DOS before starting Linux (boot DOS, hit ctrl-alt-del | ||
692 | and boot Linux without hard resetting the machine). In this method the | ||
693 | DOS based driver initializes the hardware to use known I/O, IRQ and DMA | ||
694 | settings. If sound driver is configured to use the same settings, everything | ||
695 | should work OK. | ||
696 | |||
697 | |||
698 | Configuring sound driver (with Linux) | ||
699 | ===================================== | ||
700 | |||
701 | The sound driver is currently distributed as part of the Linux kernel. The | ||
702 | files are in /usr/src/linux/drivers/sound/. | ||
703 | |||
704 | **************************************************************************** | ||
705 | * ALWAYS USE THE SOUND DRIVER VERSION WHICH IS DISTRIBUTED WITH * | ||
706 | * THE KERNEL SOURCE PACKAGE YOU ARE USING. SOME ALPHA AND BETA TEST * | ||
707 | * VERSIONS CAN BE INSTALLED FROM A SEPARATELY DISTRIBUTED PACKAGE * | ||
708 | * BUT CHECK THAT THE PACKAGE IS NOT MUCH OLDER (OR NEWER) THAN THE * | ||
709 | * KERNEL YOU ARE USING. IT'S POSSIBLE THAT THE KERNEL/DRIVER * | ||
710 | * INTERFACE CHANGES BETWEEN KERNEL RELEASES WHICH MAY CAUSE SOME * | ||
711 | * INCOMPATIBILITY PROBLEMS. * | ||
712 | * * | ||
713 | * IN CASE YOU INSTALL A SEPARATELY DISTRIBUTED SOUND DRIVER VERSION, * | ||
714 | * BE SURE TO REMOVE OR RENAME THE OLD SOUND DRIVER DIRECTORY BEFORE * | ||
715 | * INSTALLING THE NEW ONE. LEAVING OLD FILES TO THE SOUND DRIVER * | ||
716 | * DIRECTORY _WILL_ CAUSE PROBLEMS WHEN THE DRIVER IS USED OR * | ||
717 | * COMPILED. * | ||
718 | **************************************************************************** | ||
719 | |||
720 | To configure the driver, run "make config" in the kernel source directory | ||
721 | (/usr/src/linux). Answer "y" or "m" to the question about Sound card support | ||
722 | (after the questions about mouse, CD-ROM, ftape, etc. support). Questions | ||
723 | about options for sound will then be asked. | ||
724 | |||
725 | After configuring the kernel and sound driver and compile the kernel | ||
726 | following instructions in the kernel README. | ||
727 | |||
728 | The sound driver configuration dialog | ||
729 | ------------------------------------- | ||
730 | |||
731 | Sound configuration starts by making some yes/no questions. Be careful | ||
732 | when answering to these questions since answering y to a question may | ||
733 | prevent some later ones from being asked. For example don't answer y to | ||
734 | the first question (PAS16) if you don't really have a PAS16. Don't enable | ||
735 | more cards than you really need since they just consume memory. Also | ||
736 | some drivers (like MPU401) may conflict with your SCSI controller and | ||
737 | prevent kernel from booting. If you card was in the list of supported | ||
738 | cards (above), please look at the card specific config instructions | ||
739 | (later in this file) before starting to configure. Some cards must be | ||
740 | configured in way which is not obvious. | ||
741 | |||
742 | So here is the beginning of the config dialog. Answer 'y' or 'n' to these | ||
743 | questions. The default answer is shown so that (y/n) means 'y' by default and | ||
744 | (n/y) means 'n'. To use the default value, just hit ENTER. But be careful | ||
745 | since using the default _doesn't_ guarantee anything. | ||
746 | |||
747 | Note also that all questions may not be asked. The configuration program | ||
748 | may disable some questions depending on the earlier choices. It may also | ||
749 | select some options automatically as well. | ||
750 | |||
751 | "ProAudioSpectrum 16 support", | ||
752 | - Answer 'y'_ONLY_ if you have a Pro Audio Spectrum _16_, | ||
753 | Pro Audio Studio 16 or Logitech SoundMan 16 (be sure that | ||
754 | you read the above list correctly). Don't answer 'y' if you | ||
755 | have some other card made by Media Vision or Logitech since they | ||
756 | are not PAS16 compatible. | ||
757 | NOTE! Since 3.5-beta10 you need to enable SB support (next question) | ||
758 | if you want to use the SB emulation of PAS16. It's also possible to | ||
759 | the emulation if you want to use a true SB card together with PAS16 | ||
760 | (there is another question about this that is asked later). | ||
761 | "Sound Blaster support", | ||
762 | - Answer 'y' if you have an original SB card made by Creative Labs | ||
763 | or a full 100% hardware compatible clone (like Thunderboard or | ||
764 | SM Games). If your card was in the list of supported cards (above), | ||
765 | please look at the card specific instructions later in this file | ||
766 | before answering this question. For an unknown card you may answer | ||
767 | 'y' if the card claims to be SB compatible. | ||
768 | Enable this option also with PAS16 (changed since v3.5-beta9). | ||
769 | |||
770 | Don't enable SB if you have a MAD16 or Mozart compatible card. | ||
771 | |||
772 | "Generic OPL2/OPL3 FM synthesizer support", | ||
773 | - Answer 'y' if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). | ||
774 | Answering 'y' is usually a safe and recommended choice. However some | ||
775 | cards may have software (TSR) FM emulation. Enabling FM support | ||
776 | with these cards may cause trouble. However I don't currently know | ||
777 | such cards. | ||
778 | "Gravis Ultrasound support", | ||
779 | - Answer 'y' if you have GUS or GUS MAX. Answer 'n' if you don't | ||
780 | have GUS since the GUS driver consumes much memory. | ||
781 | Currently I don't have experiences with the GUS ACE so I don't | ||
782 | know what to answer with it. | ||
783 | "MPU-401 support (NOT for SB16)", | ||
784 | - Be careful with this question. The MPU401 interface is supported | ||
785 | by almost any sound card today. However some natively supported cards | ||
786 | have their own driver for MPU401. Enabling the MPU401 option with | ||
787 | these cards will cause a conflict. Also enabling MPU401 on a system | ||
788 | that doesn't really have a MPU401 could cause some trouble. If your | ||
789 | card was in the list of supported cards (above), please look at | ||
790 | the card specific instructions later in this file. | ||
791 | |||
792 | In MOST cases this MPU401 driver should only be used with "true" | ||
793 | MIDI-only MPU401 professional cards. In most other cases there | ||
794 | is another way to get the MPU401 compatible interface of a | ||
795 | sound card to work. | ||
796 | Support for the MPU401 compatible MIDI port of SB16, ESS1688 | ||
797 | and MV Jazz16 cards is included in the SB driver. Use it instead | ||
798 | of this separate MPU401 driver with these cards. As well | ||
799 | Soundscape, PSS and Maui drivers include their own MPU401 | ||
800 | options. | ||
801 | |||
802 | It's safe to answer 'y' if you have a true MPU401 MIDI interface | ||
803 | card. | ||
804 | "6850 UART Midi support", | ||
805 | - It's safe to answer 'n' to this question in all cases. The 6850 | ||
806 | UART interface is so rarely used. | ||
807 | "PSS (ECHO-ADI2111) support", | ||
808 | - Answer 'y' only if you have Orchid SW32, Cardinal DSP16 or some | ||
809 | other card based on the PSS chipset (AD1848 codec + ADSP-2115 | ||
810 | DSP chip + Echo ESC614 ASIC CHIP). | ||
811 | "16 bit sampling option of GUS (_NOT_ GUS MAX)", | ||
812 | - Answer 'y' if you have installed the 16 bit sampling daughtercard | ||
813 | to your GUS. Answer 'n' if you have GUS MAX. Enabling this option | ||
814 | disables GUS MAX support. | ||
815 | "GUS MAX support", | ||
816 | - Answer 'y' only if you have a GUS MAX. | ||
817 | "Microsoft Sound System support", | ||
818 | - Again think carefully before answering 'y' to this question. It's | ||
819 | safe to answer 'y' in case you have the original Windows Sound | ||
820 | System card made by Microsoft or Aztech SG 16 Pro (or NX16 Pro). | ||
821 | Also you may answer 'y' in case your card was not listed earlier | ||
822 | in this file. For cards having native support in the driver, consult | ||
823 | the card specific instructions later in this file. Some drivers | ||
824 | have their own MSS support and enabling this option will cause a | ||
825 | conflict. | ||
826 | Note! The MSS driver permits configuring two DMA channels. This is a | ||
827 | "nonstandard" feature and works only with very few cards (if any). | ||
828 | In most cases the second DMA channel should be disabled or set to | ||
829 | the same channel than the first one. Trying to configure two separate | ||
830 | channels with cards that don't support this feature will prevent | ||
831 | audio (at least recording) from working. | ||
832 | "Ensoniq Soundscape support", | ||
833 | - Answer 'y' if you have a sound card based on the Ensoniq SoundScape | ||
834 | chipset. Such cards are being manufactured at least by Ensoniq, | ||
835 | Spea and Reveal (note that Reveal makes other cards also). The oldest | ||
836 | cards made by Spea don't work properly with Linux. | ||
837 | Soundscape PnP as well as Ensoniq VIVO work only with the commercial | ||
838 | OSS/Linux version. | ||
839 | "MediaTrix AudioTrix Pro support", | ||
840 | - Answer 'y' if you have the AudioTrix Pro. | ||
841 | "Support for MAD16 and/or Mozart based cards", | ||
842 | - Answer y if your card has a Mozart (OAK OTI-601) or MAD16 | ||
843 | (OPTi 82C928, 82C929, 82C924/82C925 or 82C930) audio interface chip. | ||
844 | These chips are | ||
845 | currently quite common so it's possible that many no-name cards | ||
846 | have one of them. In addition the MAD16 chip is used in some | ||
847 | cards made by known manufacturers such as Turtle Beach (Tropez), | ||
848 | Reveal (some models) and Diamond (some recent models). | ||
849 | Note OPTi 82C924 and 82C925 are MAD16 compatible only in non PnP | ||
850 | mode (jumper selectable on many cards). | ||
851 | "Support for TB Maui" | ||
852 | - This enables TB Maui specific initialization. Works with TB Maui | ||
853 | and TB Tropez (may not work with Tropez Plus). | ||
854 | |||
855 | |||
856 | Then the configuration program asks some y/n questions about the higher | ||
857 | level services. It's recommended to answer 'y' to each of these questions. | ||
858 | Answer 'n' only if you know you will not need the option. | ||
859 | |||
860 | "MIDI interface support", | ||
861 | - Answering 'n' disables /dev/midi## devices and access to any | ||
862 | MIDI ports using /dev/sequencer and /dev/music. This option | ||
863 | also affects any MPU401 and/or General MIDI compatible devices. | ||
864 | "FM synthesizer (YM3812/OPL-3) support", | ||
865 | - Answer 'y' here. | ||
866 | "/dev/sequencer support", | ||
867 | - Answering 'n' disables /dev/sequencer and /dev/music. | ||
868 | |||
869 | Entering the I/O, IRQ and DMA config parameters | ||
870 | ----------------------------------------------- | ||
871 | |||
872 | After the above questions the configuration program prompts for the | ||
873 | card specific configuration information. Usually just a set of | ||
874 | I/O address, IRQ and DMA numbers are asked. With some cards the program | ||
875 | asks for some files to be used during initialization of the card. For example | ||
876 | many cards have a DSP chip or microprocessor which must be initialized by | ||
877 | downloading a program (microcode) file to the card. | ||
878 | |||
879 | Instructions for answering these questions are given in the next section. | ||
880 | |||
881 | |||
882 | Card specific information | ||
883 | ========================= | ||
884 | |||
885 | This section gives additional instructions about configuring some cards. | ||
886 | Please refer manual of your card for valid I/O, IRQ and DMA numbers. Using | ||
887 | the same settings with DOS/Windows and Linux is recommended. Using | ||
888 | different values could cause some problems when switching between | ||
889 | different operating systems. | ||
890 | |||
891 | Sound Blasters (the original ones by Creative) | ||
892 | --------------------------------------------- | ||
893 | |||
894 | NOTE! Check if you have a PnP Sound Blaster (cards sold after summer 1995 | ||
895 | are almost certainly PnP ones). With PnP cards you should use isapnptools | ||
896 | to activate them (see above). | ||
897 | |||
898 | It's possible to configure these cards to use different I/O, IRQ and | ||
899 | DMA settings. Since the possible/default settings have changed between various | ||
900 | models, you have to consult manual of your card for the proper ones. It's | ||
901 | a good idea to use the same values than with DOS/Windows. With SB and SB Pro | ||
902 | it's the only choice. SB16 has software selectable IRQ and DMA channels but | ||
903 | using different values with DOS and Linux is likely to cause troubles. The | ||
904 | DOS driver is not able to reset the card properly after warm boot from Linux | ||
905 | if Linux has used different IRQ or DMA values. | ||
906 | |||
907 | The original (steam) Sound Blaster (versions 1.x and 2.x) use always | ||
908 | DMA1. There is no way to change it. | ||
909 | |||
910 | The SB16 needs two DMA channels. A 8 bit one (1 or 3) is required for | ||
911 | 8 bit operation and a 16 bit one (5, 6 or 7) for the 16 bit mode. In theory | ||
912 | it's possible to use just one (8 bit) DMA channel by answering the 8 bit | ||
913 | one when the configuration program asks for the 16 bit one. This may work | ||
914 | in some systems but is likely to cause terrible noise on some other systems. | ||
915 | |||
916 | It's possible to use two SB16/32/64 at the same time. To do this you should | ||
917 | first configure OSS/Free for one card. Then edit local.h manually and define | ||
918 | SB2_BASE, SB2_IRQ, SB2_DMA and SB2_DMA2 for the second one. You can't get | ||
919 | the OPL3, MIDI and EMU8000 devices of the second card to work. If you are | ||
920 | going to use two PnP Sound Blasters, ensure that they are of different model | ||
921 | and have different PnP IDs. There is no way to get two cards with the same | ||
922 | card ID and serial number to work. The easiest way to check this is trying | ||
923 | if isapnptools can see both cards or just one. | ||
924 | |||
925 | NOTE! Don't enable the SM Games option (asked by the configuration program) | ||
926 | if you are not 101% sure that your card is a Logitech Soundman Games | ||
927 | (not a SM Wave or SM16). | ||
928 | |||
929 | SB Clones | ||
930 | --------- | ||
931 | |||
932 | First of all: There are no SB16 clones. There are SB Pro clones with a | ||
933 | 16 bit mode which is not SB16 compatible. The most likely alternative is that | ||
934 | the 16 bit mode means MSS/WSS. | ||
935 | |||
936 | There are just a few fully 100% hardware SB or SB Pro compatible cards. | ||
937 | I know just Thunderboard and SM Games. Other cards require some kind of | ||
938 | hardware initialization before they become SB compatible. Check if your card | ||
939 | was listed in the beginning of this file. In this case you should follow | ||
940 | instructions for your card later in this file. | ||
941 | |||
942 | For other not fully SB clones you may try initialization using DOS in | ||
943 | the following way: | ||
944 | |||
945 | - Boot DOS so that the card specific driver gets run. | ||
946 | - Hit ctrl-alt-del (or use loadlin) to boot Linux. Don't | ||
947 | switch off power or press the reset button. | ||
948 | - If you use the same I/O, IRQ and DMA settings in Linux, the | ||
949 | card should work. | ||
950 | |||
951 | If your card is both SB and MSS compatible, I recommend using the MSS mode. | ||
952 | Most cards of this kind are not able to work in the SB and the MSS mode | ||
953 | simultaneously. Using the MSS mode provides 16 bit recording and playback. | ||
954 | |||
955 | ProAudioSpectrum 16 and compatibles | ||
956 | ----------------------------------- | ||
957 | |||
958 | PAS16 has a SB emulation chip which can be used together with the native | ||
959 | (16 bit) mode of the card. To enable this emulation you should configure | ||
960 | the driver to have SB support too (this has been changed since version | ||
961 | 3.5-beta9 of this driver). | ||
962 | |||
963 | With current driver versions it's also possible to use PAS16 together with | ||
964 | another SB compatible card. In this case you should configure SB support | ||
965 | for the other card and to disable the SB emulation of PAS16 (there is a | ||
966 | separate questions about this). | ||
967 | |||
968 | With PAS16 you can use two audio device files at the same time. /dev/dsp (and | ||
969 | /dev/audio) is connected to the 8/16 bit native codec and the /dev/dsp1 (and | ||
970 | /dev/audio1) is connected to the SB emulation (8 bit mono only). | ||
971 | |||
972 | Gravis Ultrasound | ||
973 | ----------------- | ||
974 | |||
975 | There are many different revisions of the Ultrasound card (GUS). The | ||
976 | earliest ones (pre 3.7) don't have a hardware mixer. With these cards | ||
977 | the driver uses a software emulation for synth and pcm playbacks. It's | ||
978 | also possible to switch some of the inputs (line in, mic) off by setting | ||
979 | mixer volume of the channel level below 10%. For recording you have | ||
980 | to select the channel as a recording source and to use volume above 10%. | ||
981 | |||
982 | GUS 3.7 has a hardware mixer. | ||
983 | |||
984 | GUS MAX and the 16 bit sampling daughtercard have a CS4231 codec chip which | ||
985 | also contains a mixer. | ||
986 | |||
987 | Configuring GUS is simple. Just enable the GUS support and GUS MAX or | ||
988 | the 16 bit daughtercard if you have them. Note that enabling the daughter | ||
989 | card disables GUS MAX driver. | ||
990 | |||
991 | NOTE for owners of the 16 bit daughtercard: By default the daughtercard | ||
992 | uses /dev/dsp (and /dev/audio). Command "ln -sf /dev/dsp1 /dev/dsp" | ||
993 | selects the daughter card as the default device. | ||
994 | |||
995 | With just the standard GUS enabled the configuration program prompts | ||
996 | for the I/O, IRQ and DMA numbers for the card. Use the same values than | ||
997 | with DOS. | ||
998 | |||
999 | With the daughter card option enabled you will be prompted for the I/O, | ||
1000 | IRQ and DMA numbers for the daughter card. You have to use different I/O | ||
1001 | and DMA values than for the standard GUS. The daughter card permits | ||
1002 | simultaneous recording and playback. Use /dev/dsp (the daughtercard) for | ||
1003 | recording and /dev/dsp1 (GUS GF1) for playback. | ||
1004 | |||
1005 | GUS MAX uses the same I/O address and IRQ settings than the original GUS | ||
1006 | (GUS MAX = GUS + a CS4231 codec). In addition an extra DMA channel may be used. | ||
1007 | Using two DMA channels permits simultaneous playback using two devices | ||
1008 | (dev/dsp0 and /dev/dsp1). The second DMA channel is required for | ||
1009 | full duplex audio. | ||
1010 | To enable the second DMA channels, give a valid DMA channel when the config | ||
1011 | program asks for the GUS MAX DMA (entering -1 disables the second DMA). | ||
1012 | Using 16 bit DMA channels (5,6 or 7) is recommended. | ||
1013 | |||
1014 | If you have problems in recording with GUS MAX, you could try to use | ||
1015 | just one 8 bit DMA channel. Recording will not work with one DMA | ||
1016 | channel if it's a 16 bit one. | ||
1017 | |||
1018 | Microphone input of GUS MAX is connected to mixer in little bit nonstandard | ||
1019 | way. There is actually two microphone volume controls. Normal "mic" controls | ||
1020 | only recording level. Mixer control "speaker" is used to control volume of | ||
1021 | microphone signal connected directly to line/speaker out. So just decrease | ||
1022 | volume of "speaker" if you have problems with microphone feedback. | ||
1023 | |||
1024 | GUS ACE works too but any attempt to record or to use the MIDI port | ||
1025 | will fail. | ||
1026 | |||
1027 | GUS PnP (with RAM) is partially supported but it needs to be initialized using | ||
1028 | DOS or isapnptools before starting the driver. | ||
1029 | |||
1030 | MPU401 and Windows Sound System | ||
1031 | ------------------------------- | ||
1032 | |||
1033 | Again. Don't enable these options in case your card is listed | ||
1034 | somewhere else in this file. | ||
1035 | |||
1036 | Configuring these cards is obvious (or it should be). With MSS | ||
1037 | you should probably enable the OPL3 synth also since | ||
1038 | most MSS compatible cards have it. However check that this is true | ||
1039 | before enabling OPL3. | ||
1040 | |||
1041 | Sound driver supports more than one MPU401 compatible cards at the same time | ||
1042 | but the config program asks config info for just the first of them. | ||
1043 | Adding the second or third MPU interfaces must be done manually by | ||
1044 | editing sound/local.h (after running the config program). Add defines for | ||
1045 | MPU2_BASE & MPU2_IRQ (and MPU3_BASE & MPU3_IRQ) to the file. | ||
1046 | |||
1047 | CAUTION! | ||
1048 | |||
1049 | The default I/O base of Adaptec AHA-1542 SCSI controller is 0x330 which | ||
1050 | is also the default of the MPU401 driver. Don't configure the sound driver to | ||
1051 | use 0x330 as the MPU401 base if you have a AHA1542. The kernel will not boot | ||
1052 | if you make this mistake. | ||
1053 | |||
1054 | PSS | ||
1055 | --- | ||
1056 | |||
1057 | Even the PSS cards are compatible with SB, MSS and MPU401, you must not | ||
1058 | enable these options when configuring the driver. The configuration | ||
1059 | program handles these options itself. (You may use the SB, MPU and MSS options | ||
1060 | together with PSS if you have another card on the system). | ||
1061 | |||
1062 | The PSS driver enables MSS and MPU401 modes of the card. SB is not enabled | ||
1063 | since it doesn't work concurrently with MSS. The driver loads also a | ||
1064 | DSP algorithm which is used to for the general MIDI emulation. The | ||
1065 | algorithm file (.ld) is read by the config program and written to a | ||
1066 | file included when the pss.c is compiled. For this reason the config | ||
1067 | program asks if you want to download the file. Use the genmidi.ld file | ||
1068 | distributed with the DOS/Windows drivers of the card (don't use the mt32.ld). | ||
1069 | With some cards the file is called 'synth.ld'. You must have access to | ||
1070 | the file when configuring the driver. The easiest way is to mount the DOS | ||
1071 | partition containing the file with Linux. | ||
1072 | |||
1073 | It's possible to load your own DSP algorithms and run them with the card. | ||
1074 | Look at the directory pss_test of snd-util-3.0.tar.gz for more info. | ||
1075 | |||
1076 | AudioTrix Pro | ||
1077 | ------------- | ||
1078 | |||
1079 | You have to enable the OPL3 and SB (not SB Pro or SB16) drivers in addition | ||
1080 | to the native AudioTrix driver. Don't enable MSS or MPU drivers. | ||
1081 | |||
1082 | Configuring ATP is little bit tricky since it uses so many I/O, IRQ and | ||
1083 | DMA numbers. Using the same values than with DOS/Win is a good idea. Don't | ||
1084 | attempt to use the same IRQ or DMA channels twice. | ||
1085 | |||
1086 | The SB mode of ATP is implemented so the ATP driver just enables SB | ||
1087 | in the proper address. The SB driver handles the rest. You have to configure | ||
1088 | both the SB driver and the SB mode of ATP to use the same IRQ, DMA and I/O | ||
1089 | settings. | ||
1090 | |||
1091 | Also the ATP has a microcontroller for the General MIDI emulation (OPL4). | ||
1092 | For this reason the driver asks for the name of a file containing the | ||
1093 | microcode (TRXPRO.HEX). This file is usually located in the directory | ||
1094 | where the DOS drivers were installed. You must have access to this file | ||
1095 | when configuring the driver. | ||
1096 | |||
1097 | If you have the effects daughtercard, it must be initialized by running | ||
1098 | the setfx program of snd-util-3.0.tar.gz package. This step is not required | ||
1099 | when using the (future) binary distribution version of the driver. | ||
1100 | |||
1101 | Ensoniq SoundScape | ||
1102 | ------------------ | ||
1103 | |||
1104 | NOTE! The new PnP SoundScape is not supported yet. Soundscape compatible | ||
1105 | cards made by Reveal don't work with Linux. They use older revision | ||
1106 | of the Soundscape chipset which is not fully compatible with | ||
1107 | newer cards made by Ensoniq. | ||
1108 | |||
1109 | The SoundScape driver handles initialization of MSS and MPU supports | ||
1110 | itself so you don't need to enable other drivers than SoundScape | ||
1111 | (enable also the /dev/dsp, /dev/sequencer and MIDI supports). | ||
1112 | |||
1113 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
1114 | !!!!! !!!! | ||
1115 | !!!!! NOTE! Before version 3.5-beta6 there WERE two sets of audio !!!! | ||
1116 | !!!!! device files (/dev/dsp0 and /dev/dsp1). The first one WAS !!!! | ||
1117 | !!!!! used only for card initialization and the second for audio !!!! | ||
1118 | !!!!! purposes. It WAS required to change /dev/dsp (a symlink) to !!!! | ||
1119 | !!!!! point to /dev/dsp1. !!!! | ||
1120 | !!!!! !!!! | ||
1121 | !!!!! This is not required with OSS versions 3.5-beta6 and later !!!! | ||
1122 | !!!!! since there is now just one audio device file. Please !!!! | ||
1123 | !!!!! change /dev/dsp to point back to /dev/dsp0 if you are !!!! | ||
1124 | !!!!! upgrading from an earlier driver version using !!!! | ||
1125 | !!!!! (cd /dev;rm dsp;ln -s dsp0 dsp). !!!! | ||
1126 | !!!!! !!!! | ||
1127 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
1128 | |||
1129 | The configuration program asks one DMA channel and two interrupts. One IRQ | ||
1130 | and one DMA is used by the MSS codec. The second IRQ is required for the | ||
1131 | MPU401 mode (you have to use different IRQs for both purposes). | ||
1132 | There were earlier two DMA channels for SoundScape but the current driver | ||
1133 | version requires just one. | ||
1134 | |||
1135 | The SoundScape card has a Motorola microcontroller which must initialized | ||
1136 | _after_ boot (the driver doesn't initialize it during boot). | ||
1137 | The initialization is done by running the 'ssinit' program which is | ||
1138 | distributed in the snd-util-3.0.tar.gz package. You have to edit two | ||
1139 | defines in the ssinit.c and then compile the program. You may run ssinit | ||
1140 | manually (after each boot) or add it to /etc/rc.d/rc.local. | ||
1141 | |||
1142 | The ssinit program needs the microcode file that comes with the DOS/Windows | ||
1143 | driver of the card. You will need to use version 1.30.00 or later | ||
1144 | of the microcode file (sndscape.co0 or sndscape.co1 depending on | ||
1145 | your card model). THE OLD sndscape.cod WILL NOT WORK. IT WILL HANG YOUR | ||
1146 | MACHINE. The only way to get the new microcode file is to download | ||
1147 | and install the DOS/Windows driver from ftp://ftp.ensoniq.com/pub. | ||
1148 | |||
1149 | Then you have to select the proper microcode file to use: soundscape.co0 | ||
1150 | is the right one for most cards and sndscape.co1 is for few (older) cards | ||
1151 | made by Reveal and/or Spea. The driver has capability to detect the card | ||
1152 | version during boot. Look at the boot log messages in /var/adm/messages | ||
1153 | and locate the sound driver initialization message for the SoundScape | ||
1154 | card. If the driver displays string <Ensoniq Soundscape (old)>, you have | ||
1155 | an old card and you will need to use sndscape.co1. For other cards use | ||
1156 | soundscape.co0. New Soundscape revisions such as Elite and PnP use | ||
1157 | code files with higher numbers (.co2, .co3, etc.). | ||
1158 | |||
1159 | NOTE! Ensoniq Soundscape VIVO is not compatible with other Soundscape cards. | ||
1160 | Currently it's possible to use it in Linux only with OSS/Linux | ||
1161 | drivers. | ||
1162 | |||
1163 | Check /var/adm/messages after running ssinit. The driver prints | ||
1164 | the board version after downloading the microcode file. That version | ||
1165 | number must match the number in the name of the microcode file (extension). | ||
1166 | |||
1167 | Running ssinit with a wrong version of the sndscape.co? file is not | ||
1168 | dangerous as long as you don't try to use a file called sndscape.cod. | ||
1169 | If you have initialized the card using a wrong microcode file (sounds | ||
1170 | are terrible), just modify ssinit.c to use another microcode file and try | ||
1171 | again. It's possible to use an earlier version of sndscape.co[01] but it | ||
1172 | may sound weird. | ||
1173 | |||
1174 | MAD16 (Pro) and Mozart | ||
1175 | ---------------------- | ||
1176 | |||
1177 | You need to enable just the MAD16 /Mozart support when configuring | ||
1178 | the driver. _Don't_ enable SB, MPU401 or MSS. However you will need the | ||
1179 | /dev/audio, /dev/sequencer and MIDI supports. | ||
1180 | |||
1181 | Mozart and OPTi 82C928 (the original MAD16) chips don't support | ||
1182 | MPU401 mode so enter just 0 when the configuration program asks the | ||
1183 | MPU/MIDI I/O base. The MAD16 Pro (OPTi 82C929) and 82C930 chips have MPU401 | ||
1184 | mode. | ||
1185 | |||
1186 | TB Tropez is based on the 82C929 chip. It has two MIDI ports. | ||
1187 | The one connected to the MAD16 chip is the second one (there is a second | ||
1188 | MIDI connector/pins somewhere??). If you have not connected the second MIDI | ||
1189 | port, just disable the MIDI port of MAD16. The 'Maui' compatible synth of | ||
1190 | Tropez is jumper configurable and not connected to the MAD16 chip (the | ||
1191 | Maui driver can be used with it). | ||
1192 | |||
1193 | Some MAD16 based cards may cause feedback, whistle or terrible noise if the | ||
1194 | line3 mixer channel is turned too high. This happens at least with Shuttle | ||
1195 | Sound System. Current driver versions set volume of line3 low enough so | ||
1196 | this should not be a problem. | ||
1197 | |||
1198 | If you have a MAD16 card which have an OPL4 (FM + Wave table) synthesizer | ||
1199 | chip (_not_ an OPL3), you have to append a line containing #define MAD16_OPL4 | ||
1200 | to the file linux/drivers/sound/local.h (after running make config). | ||
1201 | |||
1202 | MAD16 cards having a CS4231 codec support full duplex mode. This mode | ||
1203 | can be enabled by configuring the card to use two DMA channels. Possible | ||
1204 | DMA channel pairs are: 0&1, 1&0 and 3&0. | ||
1205 | |||
1206 | NOTE! Cards having an OPTi 82C924/82C925 chip work with OSS/Free only in | ||
1207 | non-PnP mode (usually jumper selectable). The PnP mode is supported only | ||
1208 | by OSS/Linux. | ||
1209 | |||
1210 | MV Jazz (ProSonic) | ||
1211 | ------------------ | ||
1212 | |||
1213 | The Jazz16 driver is just a hack made to the SB Pro driver. However it works | ||
1214 | fairly well. You have to enable SB, SB Pro (_not_ SB16) and MPU401 supports | ||
1215 | when configuring the driver. The configuration program asks later if you | ||
1216 | want support for MV Jazz16 based cards (after asking SB base address). Answer | ||
1217 | 'y' here and the driver asks the second (16 bit) DMA channel. | ||
1218 | |||
1219 | The Jazz16 driver uses the MPU401 driver in a way which will cause | ||
1220 | problems if you have another MPU401 compatible card. In this case you must | ||
1221 | give address of the Jazz16 based MPU401 interface when the config | ||
1222 | program prompts for the MPU401 information. Then look at the MPU401 | ||
1223 | specific section for instructions about configuring more than one MPU401 cards. | ||
1224 | |||
1225 | Logitech Soundman Wave | ||
1226 | ---------------------- | ||
1227 | |||
1228 | Read the above MV Jazz specific instructions first. | ||
1229 | |||
1230 | The Logitech SoundMan Wave (don't confuse this with the SM16 or SM Games) is | ||
1231 | a MV Jazz based card which has an additional OPL4 based wave table | ||
1232 | synthesizer. The OPL4 chip is handled by an on board microcontroller | ||
1233 | which must be initialized during boot. The config program asks if | ||
1234 | you have a SM Wave immediately after asking the second DMA channel of jazz16. | ||
1235 | If you answer 'y', the config program will ask name of the file containing | ||
1236 | code to be loaded to the microcontroller. The file is usually called | ||
1237 | MIDI0001.BIN and it's located in the DOS/Windows driver directory. The file | ||
1238 | may also be called as TSUNAMI.BIN or something else (older cards?). | ||
1239 | |||
1240 | The OPL4 synth will be inaccessible without loading the microcontroller code. | ||
1241 | |||
1242 | Also remember to enable SB MPU401 support if you want to use the OPL4 mode. | ||
1243 | (Don't enable the 'normal' MPU401 device as with some earlier driver | ||
1244 | versions (pre 3.5-alpha8)). | ||
1245 | |||
1246 | NOTE! Don't answer 'y' when the driver asks about SM Games support | ||
1247 | (the next question after the MIDI0001.BIN name). However | ||
1248 | answering 'y' doesn't cause damage your computer so don't panic. | ||
1249 | |||
1250 | Sound Galaxies | ||
1251 | -------------- | ||
1252 | |||
1253 | There are many different Sound Galaxy cards made by Aztech. The 8 bit | ||
1254 | ones are fully SB or SB Pro compatible and there should be no problems | ||
1255 | with them. | ||
1256 | |||
1257 | The older 16 bit cards (SG Pro16, SG NX Pro16, Nova and Lyra) have | ||
1258 | an EEPROM chip for storing the configuration data. There is a microcontroller | ||
1259 | which initializes the card to match the EEPROM settings when the machine | ||
1260 | is powered on. These cards actually behave just like they have jumpers | ||
1261 | for all of the settings. Configure driver for MSS, MPU, SB/SB Pro and OPL3 | ||
1262 | supports with these cards. | ||
1263 | |||
1264 | There are some new Sound Galaxies in the market. I have no experience with | ||
1265 | them so read the card's manual carefully. | ||
1266 | |||
1267 | ESS ES1688 and ES688 'AudioDrive' based cards | ||
1268 | --------------------------------------------- | ||
1269 | |||
1270 | Support for these two ESS chips is embedded in the SB driver. | ||
1271 | Configure these cards just like SB. Enable the 'SB MPU401 MIDI port' | ||
1272 | if you want to use MIDI features of ES1688. ES688 doesn't have MPU mode | ||
1273 | so you don't need to enable it (the driver uses normal SB MIDI automatically | ||
1274 | with ES688). | ||
1275 | |||
1276 | NOTE! ESS cards are not compatible with MSS/WSS so don't worry if MSS support | ||
1277 | of OSS doesn't work with it. | ||
1278 | |||
1279 | There are some ES1688/688 based sound cards and (particularly) motherboards | ||
1280 | which use software configurable I/O port relocation feature of the chip. | ||
1281 | This ESS proprietary feature is supported only by OSS/Linux. | ||
1282 | |||
1283 | There are ES1688 based cards which use different interrupt pin assignment than | ||
1284 | recommended by ESS (5, 7, 9/2 and 10). In this case all IRQs don't work. | ||
1285 | At least a card called (Pearl?) Hypersound 16 supports IRQ 15 but it doesn't | ||
1286 | work. | ||
1287 | |||
1288 | ES1868 is a PnP chip which is (supposed to be) compatible with ESS1688 | ||
1289 | probably works with OSS/Free after initialization using isapnptools. | ||
1290 | |||
1291 | Reveal cards | ||
1292 | ------------ | ||
1293 | |||
1294 | There are several different cards made/marketed by Reveal. Some of them | ||
1295 | are compatible with SoundScape and some use the MAD16 chip. You may have | ||
1296 | to look at the card and try to identify its origin. | ||
1297 | |||
1298 | Diamond | ||
1299 | ------- | ||
1300 | |||
1301 | The oldest (Sierra Aria based) sound cards made by Diamond are not supported | ||
1302 | (they may work if the card is initialized using DOS). The recent (LX?) | ||
1303 | models are based on the MAD16 chip which is supported by the driver. | ||
1304 | |||
1305 | Audio Excel DSP16 | ||
1306 | ----------------- | ||
1307 | |||
1308 | Support for this card is currently not functional. A new driver for it | ||
1309 | should be available later this year. | ||
1310 | |||
1311 | PCMCIA cards | ||
1312 | ------------ | ||
1313 | |||
1314 | Sorry, can't help. Some cards may work and some don't. | ||
1315 | |||
1316 | TI TM4000M notebooks | ||
1317 | -------------------- | ||
1318 | |||
1319 | These computers have a built in sound support based on the Jazz chipset. | ||
1320 | Look at the instructions for MV Jazz (above). It's also important to note | ||
1321 | that there is something wrong with the mouse port and sound at least on | ||
1322 | some TM models. Don't enable the "C&T 82C710 mouse port support" when | ||
1323 | configuring Linux. Having it enabled is likely to cause mysterious problems | ||
1324 | and kernel failures when sound is used. | ||
1325 | |||
1326 | miroSOUND | ||
1327 | --------- | ||
1328 | |||
1329 | The miroSOUND PCM1-pro, PCM12 and PCM20 radio has been used | ||
1330 | successfully. These cards are based on the MAD16, OPL4, and CS4231A chips | ||
1331 | and everything said in the section about MAD16 cards applies here, | ||
1332 | too. The only major difference between the PCMxx and other MAD16 cards | ||
1333 | is that instead of the mixer in the CS4231 codec a separate mixer | ||
1334 | controlled by an on-board 80C32 microcontroller is used. Control of | ||
1335 | the mixer takes place via the ACI (miro's audio control interface) | ||
1336 | protocol that is implemented in a separate lowlevel driver. Make sure | ||
1337 | you compile this ACI driver together with the normal MAD16 support | ||
1338 | when you use a miroSOUND PCMxx card. The ACI mixer is controlled by | ||
1339 | /dev/mixer and the CS4231 mixer by /dev/mixer1 (depends on load | ||
1340 | time). Only in special cases you want to change something regularly on | ||
1341 | the CS4231 mixer. | ||
1342 | |||
1343 | The miroSOUND PCM12 and PCM20 radio is capable of full duplex | ||
1344 | operation (simultaneous PCM replay and recording), which allows you to | ||
1345 | implement nice real-time signal processing audio effect software and | ||
1346 | network telephones. The ACI mixer has to be switched into the "solo" | ||
1347 | mode for duplex operation in order to avoid feedback caused by the | ||
1348 | mixer (input hears output signal). You can de-/activate this mode | ||
1349 | through toggleing the record button for the wave controller with an | ||
1350 | OSS-mixer. | ||
1351 | |||
1352 | The PCM20 contains a radio tuner, which is also controlled by | ||
1353 | ACI. This radio tuner is supported by the ACI driver together with the | ||
1354 | miropcm20.o module. Also the 7-band equalizer is integrated | ||
1355 | (limited by the OSS-design). Developement has started and maybe | ||
1356 | finished for the RDS decoder on this card, too. You will be able to | ||
1357 | read RadioText, the Programme Service name, Programme TYpe and | ||
1358 | others. Even the v4l radio module benefits from it with a refined | ||
1359 | strength value. See aci.[ch] and miropcm20*.[ch] for more details. | ||
1360 | |||
1361 | The following configuration parameters have worked fine for the PCM12 | ||
1362 | in Markus Kuhn's system, many other configurations might work, too: | ||
1363 | CONFIG_MAD16_BASE=0x530, CONFIG_MAD16_IRQ=11, CONFIG_MAD16_DMA=3, | ||
1364 | CONFIG_MAD16_DMA2=0, CONFIG_MAD16_MPU_BASE=0x330, CONFIG_MAD16_MPU_IRQ=10, | ||
1365 | DSP_BUFFSIZE=65536, SELECTED_SOUND_OPTIONS=0x00281000. | ||
1366 | |||
1367 | Bas van der Linden is using his PCM1-pro with a configuration that | ||
1368 | differs in: CONFIG_MAD16_IRQ=7, CONFIG_MAD16_DMA=1, CONFIG_MAD16_MPU_IRQ=9 | ||
1369 | |||
1370 | Compaq Deskpro XL | ||
1371 | ----------------- | ||
1372 | |||
1373 | The builtin sound hardware of Compaq Deskpro XL is now supported. | ||
1374 | You need to configure the driver with MSS and OPL3 supports enabled. | ||
1375 | In addition you need to manually edit linux/drivers/sound/local.h and | ||
1376 | to add a line containing "#define DESKPROXL" if you used | ||
1377 | make menuconfig/xconfig. | ||
1378 | |||
1379 | Others? | ||
1380 | ------- | ||
1381 | |||
1382 | Since there are so many different sound cards, it's likely that I have | ||
1383 | forgotten to mention many of them. Please inform me if you know yet another | ||
1384 | card which works with Linux, please inform me (or is anybody else | ||
1385 | willing to maintain a database of supported cards (just like in XF86)?). | ||
1386 | |||
1387 | Cards not supported yet | ||
1388 | ======================= | ||
1389 | |||
1390 | Please check the version of sound driver you are using before | ||
1391 | complaining that your card is not supported. It's possible you are | ||
1392 | using a driver version which was released months before your card was | ||
1393 | introduced. | ||
1394 | |||
1395 | First of all, there is an easy way to make most sound cards work with Linux. | ||
1396 | Just use the DOS based driver to initialize the card to a known state, then use | ||
1397 | loadlin.exe to boot Linux. If Linux is configured to use the same I/O, IRQ and | ||
1398 | DMA numbers as DOS, the card could work. | ||
1399 | (ctrl-alt-del can be used in place of loadlin.exe but it doesn't work with | ||
1400 | new motherboards). This method works also with all/most PnP sound cards. | ||
1401 | |||
1402 | Don't get fooled with SB compatibility. Most cards are compatible with | ||
1403 | SB but that may require a TSR which is not possible with Linux. If | ||
1404 | the card is compatible with MSS, it's a better choice. Some cards | ||
1405 | don't work in the SB and MSS modes at the same time. | ||
1406 | |||
1407 | Then there are cards which are no longer manufactured and/or which | ||
1408 | are relatively rarely used (such as the 8 bit ProAudioSpectrum | ||
1409 | models). It's extremely unlikely that such cards ever get supported. | ||
1410 | Adding support for a new card requires much work and increases time | ||
1411 | required in maintaining the driver (some changes need to be done | ||
1412 | to all low level drivers and be tested too, maybe with multiple | ||
1413 | operating systems). For this reason I have made a decision to not support | ||
1414 | obsolete cards. It's possible that someone else makes a separately | ||
1415 | distributed driver (diffs) for the card. | ||
1416 | |||
1417 | Writing a driver for a new card is not possible if there are no | ||
1418 | programming information available about the card. If you don't | ||
1419 | find your new card from this file, look from the home page | ||
1420 | (http://www.opensound.com/ossfree). Then please contact | ||
1421 | manufacturer of the card and ask if they have (or are willing to) | ||
1422 | released technical details of the card. Do this before contacting me. I | ||
1423 | can only answer 'no' if there are no programming information available. | ||
1424 | |||
1425 | I have made decision to not accept code based on reverse engineering | ||
1426 | to the driver. There are three main reasons: First I don't want to break | ||
1427 | relationships to sound card manufacturers. The second reason is that | ||
1428 | maintaining and supporting a driver without any specs will be a pain. | ||
1429 | The third reason is that companies have freedom to refuse selling their | ||
1430 | products to other than Windows users. | ||
1431 | |||
1432 | Some companies don't give low level technical information about their | ||
1433 | products to public or at least their require signing a NDA. It's not | ||
1434 | possible to implement a freeware driver for them. However it's possible | ||
1435 | that support for such cards become available in the commercial version | ||
1436 | of this driver (see http://www.4Front-tech.com/oss.html for more info). | ||
1437 | |||
1438 | There are some common audio chipsets that are not supported yet. For example | ||
1439 | Sierra Aria and IBM Mwave. It's possible that these architectures | ||
1440 | get some support in future but I can't make any promises. Just look | ||
1441 | at the home page (http://www.opensound.com/ossfree/new_cards.html) | ||
1442 | for latest info. | ||
1443 | |||
1444 | Information about unsupported sound cards and chipsets is welcome as well | ||
1445 | as free copies of sound cards, SDKs and operating systems. | ||
1446 | |||
1447 | If you have any corrections and/or comments, please contact me. | ||
1448 | |||
1449 | Hannu Savolainen | ||
1450 | hannu@opensound.com | ||
1451 | |||
1452 | Personal home page: http://www.compusonic.fi/~hannu | ||
1453 | home page of OSS/Free: http://www.opensound.com/ossfree | ||
1454 | |||
1455 | home page of commercial OSS | ||
1456 | (Open Sound System) drivers: http://www.opensound.com/oss.html | ||
diff --git a/Documentation/sound/oss/README.awe b/Documentation/sound/oss/README.awe new file mode 100644 index 000000000000..80054cd8fcde --- /dev/null +++ b/Documentation/sound/oss/README.awe | |||
@@ -0,0 +1,218 @@ | |||
1 | ================================================================ | ||
2 | AWE32 Sound Driver for Linux / FreeBSD | ||
3 | version 0.4.3; Nov. 1, 1998 | ||
4 | |||
5 | Takashi Iwai <iwai@ww.uni-erlangen.de> | ||
6 | ================================================================ | ||
7 | |||
8 | * GENERAL NOTES | ||
9 | |||
10 | This is a sound driver extension for SoundBlaster AWE32 and other | ||
11 | compatible cards (AWE32-PnP, SB32, SB32-PnP, AWE64 & etc) to enable | ||
12 | the wave synth operations. The driver is provided for Linux 1.2.x | ||
13 | and 2.[012].x kernels, as well as FreeBSD, on Intel x86 and DEC | ||
14 | Alpha systems. | ||
15 | |||
16 | This driver was written by Takashi Iwai <iwai@ww.uni-erlangen.de>, | ||
17 | and provided "as is". The original source (awedrv-0.4.3.tar.gz) and | ||
18 | binary packages are available on the following URL: | ||
19 | http://bahamut.mm.t.u-tokyo.ac.jp/~iwai/awedrv/ | ||
20 | Note that since the author is apart from this web site, the update is | ||
21 | not frequent now. | ||
22 | |||
23 | |||
24 | * NOTE TO LINUX USERS | ||
25 | |||
26 | To enable this driver on linux-2.[01].x kernels, you need turn on | ||
27 | "AWE32 synth" options in sound menu when configure your linux kernel | ||
28 | and modules. The precise installation procedure is described in the | ||
29 | AWE64-Mini-HOWTO and linux-kernel/Documetation/sound/AWE32. | ||
30 | |||
31 | If you're using PnP cards, the card must be initialized before loading | ||
32 | the sound driver. There're several options to do this: | ||
33 | - Initialize the card via ISA PnP tools, and load the sound module. | ||
34 | - Initialize the card on DOS, and load linux by loadlin.exe | ||
35 | - Use PnP kernel driver (for Linux-2.x.x) | ||
36 | The detailed instruction for the solution using isapnp tools is found | ||
37 | in many documents like above. A brief instruction is also included in | ||
38 | the installation document of this package. | ||
39 | For PnP driver project, please refer to the following URL: | ||
40 | http://www-jcr.lmh.ox.ac.uk/~pnp/ | ||
41 | |||
42 | |||
43 | * USING THE DRIVER | ||
44 | |||
45 | The awedrv has several different playing modes to realize easy channel | ||
46 | allocation for MIDI songs. To hear the exact sound quality, you need | ||
47 | to obtain the extended sequencer program, drvmidi or playmidi-2.5. | ||
48 | |||
49 | For playing MIDI files, you *MUST* load the soundfont file on the | ||
50 | driver previously by sfxload utility. Otherwise you'll here no sounds | ||
51 | at all! All the utilities and driver source packages are found in the | ||
52 | above URL. The sfxload program is included in the package | ||
53 | awesfx-0.4.3.tgz. Binary packages are available there, too. See the | ||
54 | instruction in each package for installation. | ||
55 | |||
56 | Loading a soundfont file is very simple. Just execute the command | ||
57 | |||
58 | % sfxload synthgm.sbk | ||
59 | |||
60 | Then, sfxload transfers the file "synthgm.sbk" to the driver. | ||
61 | Both SF1 and SF2 formats are accepted. | ||
62 | |||
63 | Now you can hear midi musics by a midi player. | ||
64 | |||
65 | % drvmidi foo.mid | ||
66 | |||
67 | If you run MIDI player after MOD player, you need to load soundfont | ||
68 | files again, since MOD player programs clear the previous loaded | ||
69 | samples by their own data. | ||
70 | |||
71 | If you have only 512kb on the sound card, I recommend to use dynamic | ||
72 | sample loading via -L option of drvmidi. 2MB GM/GS soundfont file is | ||
73 | available in most midi files. | ||
74 | |||
75 | % sfxload synthgm | ||
76 | % drvmidi -L 2mbgmgs foo.mid | ||
77 | |||
78 | This makes a big difference (believe me)! For more details, please | ||
79 | refer to the FAQ list which is available on the URL above. | ||
80 | |||
81 | The current chorus, reverb and equalizer status can be changed by | ||
82 | aweset utility program (included in awesfx package). Note that | ||
83 | some awedrv-native programs (like drvmidi and xmp) will change the | ||
84 | current settings by themselves. The aweset program is effective | ||
85 | only for other programs like playmidi. | ||
86 | |||
87 | Enjoy. | ||
88 | |||
89 | |||
90 | * COMPILE FLAGS | ||
91 | |||
92 | Compile conditions are defined in awe_config.h. | ||
93 | |||
94 | [Compatibility Conditions] | ||
95 | The following flags are defined automatically when using installation | ||
96 | shell script. | ||
97 | |||
98 | - AWE_MODULE_SUPPORT | ||
99 | indicates your Linux kernel supports module for each sound card | ||
100 | (in recent 2.1 or 2.2 kernels and unofficial patched 2.0 kernels | ||
101 | as distributed in the RH5.0 package). | ||
102 | This flag is automatically set when you're using 2.1.x kernels. | ||
103 | You can pass the base address and memory size via the following | ||
104 | module options, | ||
105 | io = base I/O port address (eg. 0x620) | ||
106 | memsize = DRAM size in kilobytes (eg. 512) | ||
107 | As default, AWE driver probes these values automatically. | ||
108 | |||
109 | |||
110 | [Hardware Conditions] | ||
111 | You DON'T have to define the following two values. | ||
112 | Define them only when the driver couldn't detect the card properly. | ||
113 | |||
114 | - AWE_DEFAULT_BASE_ADDR (default: not defined) | ||
115 | specifies the base port address of your AWE32 card. | ||
116 | 0 means to autodetect the address. | ||
117 | |||
118 | - AWE_DEFAULT_MEM_SIZE (default: not defined) | ||
119 | specifies the memory size of your AWE32 card in kilobytes. | ||
120 | -1 means to autodetect its size. | ||
121 | |||
122 | |||
123 | [Sample Table Size] | ||
124 | From ver.0.4.0, sample tables are allocated dynamically (except | ||
125 | Linux-1.2.x system), so you need NOT to touch these parameters. | ||
126 | Linux-1.2.x users may need to increase these values to appropriate size | ||
127 | if the sound card is equipped with more DRAM. | ||
128 | |||
129 | - AWE_MAX_SF_LISTS, AWE_MAX_SAMPLES, AWE_MAX_INFOS | ||
130 | |||
131 | |||
132 | [Other Conditions] | ||
133 | |||
134 | - AWE_ALWAYS_INIT_FM (default: not defined) | ||
135 | indicates the AWE driver always initialize FM passthrough even | ||
136 | without DRAM on board. Emu8000 chip has a restriction for playing | ||
137 | samples on DRAM that at least two channels must be occupied as | ||
138 | passthrough channels. | ||
139 | |||
140 | - AWE_DEBUG_ON (default: defined) | ||
141 | turns on debugging messages if defined. | ||
142 | |||
143 | - AWE_HAS_GUS_COMPATIBILITY (default: defined) | ||
144 | Enables GUS compatibility mode if defined, reading GUS patches and | ||
145 | GUS control commands. Define this option to use GMOD or other | ||
146 | GUS module players. | ||
147 | |||
148 | - CONFIG_AWE32_MIDIEMU (default: defined) | ||
149 | Adds a MIDI emulation device by Emu8000 wavetable. The emulation | ||
150 | device can be accessed as an external MIDI, and sends the MIDI | ||
151 | control codes directly. XG and GS sysex/NRPN are accepted. | ||
152 | No MIDI input is supported. | ||
153 | |||
154 | - CONFIG_AWE32_MIXER (default: not defined) | ||
155 | Adds a mixer device for AWE32 bass/treble equalizer control. | ||
156 | You can access this device using /dev/mixer?? (usually mixer01). | ||
157 | |||
158 | - AWE_USE_NEW_VOLUME_CALC (default: defined) | ||
159 | Use the new method to calculate the volume change as compatible | ||
160 | with DOS/Win drivers. This option can be toggled via aweset | ||
161 | program, or drvmidi player. | ||
162 | |||
163 | - AWE_CHECK_VTARGET (default: defined) | ||
164 | Check the current volume target value when searching for an | ||
165 | empty channel to allocate a new voice. This is experimentally | ||
166 | implemented in this version. (probably, this option doesn't | ||
167 | affect the sound quality severely...) | ||
168 | |||
169 | - AWE_ALLOW_SAMPLE_SHARING (default: defined) | ||
170 | Allow sample sharing for differently loaded patches. | ||
171 | This function is available only together with awesfx-0.4.3p3. | ||
172 | Note that this is still an experimental option. | ||
173 | |||
174 | - DEF_FM_CHORUS_DEPTH (default: 0x10) | ||
175 | The default strength to be sent to the chorus effect engine. | ||
176 | From 0 to 0xff. Larger numbers may often cause weird sounds. | ||
177 | |||
178 | - DEF_FM_REVERB_DEPTH (default: 0x10) | ||
179 | The default strength to be sent to the reverb effect engine. | ||
180 | From 0 to 0xff. Larger numbers may often cause weird sounds. | ||
181 | |||
182 | |||
183 | * ACKNOWLEDGMENTS | ||
184 | |||
185 | Thanks to Witold Jachimczyk (witek@xfactor.wpi.edu) for much advice | ||
186 | on programming of AWE32. Much code is brought from his AWE32-native | ||
187 | MOD player, ALMP. | ||
188 | The port of awedrv to FreeBSD is done by Randall Hopper | ||
189 | (rhh@ct.picker.com). | ||
190 | The new volume calculation routine was derived from Mark Weaver's | ||
191 | ADIP compatible routines. | ||
192 | I also thank linux-awe-ml members for their efforts | ||
193 | to reboot their system many times :-) | ||
194 | |||
195 | |||
196 | * TODO'S | ||
197 | |||
198 | - Complete DOS/Win compatibility | ||
199 | - DSP-like output | ||
200 | |||
201 | |||
202 | * COPYRIGHT | ||
203 | |||
204 | Copyright (C) 1996-1998 Takashi Iwai | ||
205 | |||
206 | This program is free software; you can redistribute it and/or modify | ||
207 | it under the terms of the GNU General Public License as published by | ||
208 | the Free Software Foundation; either version 2 of the License, or | ||
209 | (at your option) any later version. | ||
210 | |||
211 | This program is distributed in the hope that it will be useful, | ||
212 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
213 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
214 | GNU General Public License for more details. | ||
215 | |||
216 | You should have received a copy of the GNU General Public License | ||
217 | along with this program; if not, write to the Free Software | ||
218 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
diff --git a/Documentation/sound/oss/README.modules b/Documentation/sound/oss/README.modules new file mode 100644 index 000000000000..e691d74e1e5e --- /dev/null +++ b/Documentation/sound/oss/README.modules | |||
@@ -0,0 +1,106 @@ | |||
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 | ||
63 | look at function referred to by module_init() for the card to see what | ||
64 | args are expected. | ||
65 | |||
66 | Note that at present there is no way to configure the io, irq and other | ||
67 | parameters for the modular drivers as one does for the wired drivers.. One | ||
68 | needs to pass the modules the necessary parameters as arguments, either | ||
69 | with /etc/modprobe.conf or with command-line args to modprobe, e.g. | ||
70 | |||
71 | modprobe sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330 | ||
72 | modprobe adlib_card io=0x388 | ||
73 | |||
74 | recommend using /etc/modprobe.conf. | ||
75 | |||
76 | Persistent DMA Buffers: | ||
77 | |||
78 | The sound modules normally allocate DMA buffers during open() and | ||
79 | deallocate them during close(). Linux can often have problems allocating | ||
80 | DMA buffers for ISA cards on machines with more than 16MB RAM. This is | ||
81 | because ISA DMA buffers must exist below the 16MB boundary and it is quite | ||
82 | possible that we can't find a large enough free block in this region after | ||
83 | the machine has been running for any amount of time. The way to avoid this | ||
84 | problem is to allocate the DMA buffers during module load and deallocate | ||
85 | them when the module is unloaded. For this to be effective we need to load | ||
86 | the sound modules right after the kernel boots, either manually or by an | ||
87 | init script, and keep them around until we shut down. This is a little | ||
88 | wasteful of RAM, but it guarantees that sound always works. | ||
89 | |||
90 | To make the sound driver use persistent DMA buffers we need to pass the | ||
91 | sound.o module a "dmabuf=1" command-line argument. This is normally done | ||
92 | in /etc/modprobe.conf like so: | ||
93 | |||
94 | options sound dmabuf=1 | ||
95 | |||
96 | If you have 16MB or less RAM or a PCI sound card, this is wasteful and | ||
97 | unnecessary. It is possible that machine with 16MB or less RAM will find | ||
98 | this option useful, but if your machine is so memory-starved that it | ||
99 | cannot find a 64K block free, you will be wasting even more RAM by keeping | ||
100 | the sound modules loaded and the DMA buffers allocated when they are not | ||
101 | needed. The proper solution is to upgrade your RAM. But you do also have | ||
102 | this improper solution as well. Use it wisely. | ||
103 | |||
104 | I'm afraid I know nothing about anything but my setup, being more of a | ||
105 | text-mode guy anyway. If you have options for other cards or other helpful | ||
106 | hints, send them to me, Jim Bray, jb@as220.org, http://as220.org/jb. | ||
diff --git a/Documentation/sound/oss/README.ymfsb b/Documentation/sound/oss/README.ymfsb new file mode 100644 index 000000000000..af8a7d3a4e8e --- /dev/null +++ b/Documentation/sound/oss/README.ymfsb | |||
@@ -0,0 +1,107 @@ | |||
1 | Legacy audio driver for YMF7xx PCI cards. | ||
2 | |||
3 | |||
4 | FIRST OF ALL | ||
5 | ============ | ||
6 | |||
7 | This code references YAMAHA's sample codes and data sheets. | ||
8 | I respect and thank for all people they made open the informations | ||
9 | about YMF7xx cards. | ||
10 | |||
11 | And this codes heavily based on Jeff Garzik <jgarzik@pobox.com>'s | ||
12 | old VIA 82Cxxx driver (via82cxxx.c). I also respect him. | ||
13 | |||
14 | |||
15 | DISCLIMER | ||
16 | ========= | ||
17 | |||
18 | This driver is currently at early ALPHA stage. It may cause serious | ||
19 | damage to your computer when used. | ||
20 | PLEASE USE IT AT YOUR OWN RISK. | ||
21 | |||
22 | |||
23 | ABOUT THIS DRIVER | ||
24 | ================= | ||
25 | |||
26 | This code enables you to use your YMF724[A-F], YMF740[A-C], YMF744, YMF754 | ||
27 | cards. When enabled, your card acts as "SoundBlaster Pro" compatible card. | ||
28 | It can only play 22.05kHz / 8bit / Stereo samples, control external MIDI | ||
29 | port. | ||
30 | If you want to use your card as recent "16-bit" card, you should use | ||
31 | Alsa or OSS/Linux driver. Of course you can write native PCI driver for | ||
32 | your cards :) | ||
33 | |||
34 | |||
35 | USAGE | ||
36 | ===== | ||
37 | |||
38 | # modprobe ymfsb (options) | ||
39 | |||
40 | |||
41 | OPTIONS FOR MODULE | ||
42 | ================== | ||
43 | |||
44 | io : SB base address (0x220, 0x240, 0x260, 0x280) | ||
45 | synth_io : OPL3 base address (0x388, 0x398, 0x3a0, 0x3a8) | ||
46 | dma : DMA number (0,1,3) | ||
47 | master_volume: AC'97 PCM out Vol (0-100) | ||
48 | spdif_out : SPDIF-out flag (0:disable 1:enable) | ||
49 | |||
50 | These options will change in future... | ||
51 | |||
52 | |||
53 | FREQUENCY | ||
54 | ========= | ||
55 | |||
56 | When playing sounds via this driver, you will hear its pitch is slightly | ||
57 | lower than original sounds. Since this driver recognizes your card acts | ||
58 | with 21.739kHz sample rates rather than 22.050kHz (I think it must be | ||
59 | hardware restriction). So many players become tone deafness. | ||
60 | To prevent this, you should express some options to your sound player | ||
61 | that specify correct sample frequency. For example, to play your MP3 file | ||
62 | correctly with mpg123, specify the frequency like following: | ||
63 | |||
64 | % mpg123 -r 21739 foo.mp3 | ||
65 | |||
66 | |||
67 | SPDIF OUT | ||
68 | ========= | ||
69 | |||
70 | With installing modules with option 'spdif_out=1', you can enjoy your | ||
71 | sounds from SPDIF-out of your card (if it had). | ||
72 | Its Fs is fixed to 48kHz (It never means the sample frequency become | ||
73 | up to 48kHz. All sounds via SPDIF-out also 22kHz samples). So your | ||
74 | digital-in capable components has to be able to handle 48kHz Fs. | ||
75 | |||
76 | |||
77 | COPYING | ||
78 | ======= | ||
79 | |||
80 | This program is free software; you can redistribute it and/or modify | ||
81 | it under the terms of the GNU General Public License as published by | ||
82 | the Free Software Foundation; either version 2, or (at your option) | ||
83 | any later version. | ||
84 | |||
85 | This program is distributed in the hope that it will be useful, but | ||
86 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
87 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
88 | General Public License for more details. | ||
89 | |||
90 | You should have received a copy of the GNU General Public License | ||
91 | along with this program; if not, write to the Free Software | ||
92 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
93 | |||
94 | |||
95 | TODO | ||
96 | ==== | ||
97 | * support for multiple cards | ||
98 | (set the different SB_IO,MPU_IO,OPL_IO for each cards) | ||
99 | |||
100 | * support for OPL (dmfm) : There will be no requirements... :-< | ||
101 | |||
102 | |||
103 | AUTHOR | ||
104 | ====== | ||
105 | |||
106 | Daisuke Nagano <breeze.nagano@nifty.ne.jp> | ||
107 | |||
diff --git a/Documentation/sound/oss/SoundPro b/Documentation/sound/oss/SoundPro new file mode 100644 index 000000000000..9d4db1f29d3c --- /dev/null +++ b/Documentation/sound/oss/SoundPro | |||
@@ -0,0 +1,105 @@ | |||
1 | Documentation for the SoundPro CMI8330 extensions in the WSS driver (ad1848.o) | ||
2 | ------------------------------------------------------------------------------ | ||
3 | |||
4 | ( Be sure to read Documentation/sound/oss/CMI8330 too ) | ||
5 | |||
6 | Ion Badulescu, ionut@cs.columbia.edu | ||
7 | February 24, 1999 | ||
8 | |||
9 | (derived from the OPL3-SA2 documentation by Scott Murray) | ||
10 | |||
11 | The SoundPro CMI8330 (ISA) is a chip usually found on some Taiwanese | ||
12 | motherboards. The official name in the documentation is CMI8330, SoundPro | ||
13 | is the nickname and the big inscription on the chip itself. | ||
14 | |||
15 | The chip emulates a WSS as well as a SB16, but it has certain differences | ||
16 | in the mixer section which require separate support. It also emulates an | ||
17 | MPU401 and an OPL3 synthesizer, so you probably want to enable support | ||
18 | for these, too. | ||
19 | |||
20 | The chip identifies itself as an AD1848, but its mixer is significantly | ||
21 | more advanced than the original AD1848 one. If your system works with | ||
22 | either WSS or SB16 and you are having problems with some mixer controls | ||
23 | (no CD audio, no line-in, etc), you might want to give this driver a try. | ||
24 | Detection should work, but it hasn't been widely tested, so it might still | ||
25 | mis-identify the chip. You can still force soundpro=1 in the modprobe | ||
26 | parameters for ad1848. Please let me know if it happens to you, so I can | ||
27 | adjust the detection routine. | ||
28 | |||
29 | The chip is capable of doing full-duplex, but since the driver sees it as an | ||
30 | AD1848, it cannot take advantage of this. Moreover, the full-duplex mode is | ||
31 | not achievable through the WSS interface, b/c it needs a dma16 line which is | ||
32 | assigned only to the SB16 subdevice (with isapnp). Windows documentation | ||
33 | says the user must use WSS Playback and SB16 Recording for full-duplex, so | ||
34 | it might be possible to do the same thing under Linux. You can try loading | ||
35 | up both ad1848 and sb then use one for playback and the other for | ||
36 | recording. I don't know if this works, b/c I haven't tested it. Anyway, if | ||
37 | you try it, be very careful: the SB16 mixer *mostly* works, but certain | ||
38 | settings can have unexpected effects. Use the WSS mixer for best results. | ||
39 | |||
40 | There is also a PCI SoundPro chip. I have not seen this chip, so I have | ||
41 | no idea if the driver will work with it. I suspect it won't. | ||
42 | |||
43 | As with PnP cards, some configuration is required. There are two ways | ||
44 | of doing this. The most common is to use the isapnptools package to | ||
45 | initialize the card, and use the kernel module form of the sound | ||
46 | subsystem and sound drivers. Alternatively, some BIOS's allow manual | ||
47 | configuration of installed PnP devices in a BIOS menu, which should | ||
48 | allow using the non-modular sound drivers, i.e. built into the kernel. | ||
49 | Since in this latter case you cannot use module parameters, you will | ||
50 | have to enable support for the SoundPro at compile time. | ||
51 | |||
52 | The IRQ and DMA values can be any that are considered acceptable for a | ||
53 | WSS. Assuming you've got isapnp all happy, then you should be able to | ||
54 | do something like the following (which *must* match the isapnp/BIOS | ||
55 | configuration): | ||
56 | |||
57 | modprobe ad1848 io=0x530 irq=11 dma=0 soundpro=1 | ||
58 | -and maybe- | ||
59 | modprobe sb io=0x220 irq=5 dma=1 dma16=5 | ||
60 | |||
61 | -then- | ||
62 | modprobe mpu401 io=0x330 irq=9 | ||
63 | modprobe opl3 io=0x388 | ||
64 | |||
65 | If all goes well and you see no error messages, you should be able to | ||
66 | start using the sound capabilities of your system. If you get an | ||
67 | error message while trying to insert the module(s), then make | ||
68 | sure that the values of the various arguments match what you specified | ||
69 | in your isapnp configuration file, and that there is no conflict with | ||
70 | another device for an I/O port or interrupt. Checking the contents of | ||
71 | /proc/ioports and /proc/interrupts can be useful to see if you're | ||
72 | butting heads with another device. | ||
73 | |||
74 | If you do not see the chipset version message, and none of the other | ||
75 | messages present in the system log are helpful, try adding 'debug=1' | ||
76 | to the ad1848 parameters, email me the syslog results and I'll do | ||
77 | my best to help. | ||
78 | |||
79 | Lastly, if you're using modules and want to set up automatic module | ||
80 | loading with kmod, the kernel module loader, here is the section I | ||
81 | currently use in my conf.modules file: | ||
82 | |||
83 | # Sound | ||
84 | post-install sound modprobe -k ad1848; modprobe -k mpu401; modprobe -k opl3 | ||
85 | options ad1848 io=0x530 irq=11 dma=0 | ||
86 | options sb io=0x220 irq=5 dma=1 dma16=5 | ||
87 | options mpu401 io=0x330 irq=9 | ||
88 | options opl3 io=0x388 | ||
89 | |||
90 | The above ensures that ad1848 will be loaded whenever the sound system | ||
91 | is being used. | ||
92 | |||
93 | Good luck. | ||
94 | |||
95 | Ion | ||
96 | |||
97 | NOT REALLY TESTED: | ||
98 | - recording | ||
99 | - recording device selection | ||
100 | - full-duplex | ||
101 | |||
102 | TODO: | ||
103 | - implement mixer support for surround, loud, digital CD switches. | ||
104 | - come up with a scheme which allows recording volumes for each subdevice. | ||
105 | This is a major OSS API change. | ||
diff --git a/Documentation/sound/oss/Soundblaster b/Documentation/sound/oss/Soundblaster new file mode 100644 index 000000000000..b288d464ba8b --- /dev/null +++ b/Documentation/sound/oss/Soundblaster | |||
@@ -0,0 +1,53 @@ | |||
1 | modprobe sound | ||
2 | insmod uart401 | ||
3 | insmod sb ... | ||
4 | |||
5 | This loads the driver for the Sound Blaster and assorted clones. Cards that | ||
6 | are covered by other drivers should not be using this driver. | ||
7 | |||
8 | The Sound Blaster module takes the following arguments | ||
9 | |||
10 | io I/O address of the Sound Blaster chip (0x220,0x240,0x260,0x280) | ||
11 | irq IRQ of the Sound Blaster chip (5,7,9,10) | ||
12 | dma 8-bit DMA channel for the Sound Blaster (0,1,3) | ||
13 | dma16 16-bit DMA channel for SB16 and equivalent cards (5,6,7) | ||
14 | mpu_io I/O for MPU chip if present (0x300,0x330) | ||
15 | |||
16 | sm_games=1 Set if you have a Logitech soundman games | ||
17 | acer=1 Set this to detect cards in some ACER notebooks | ||
18 | mwave_bug=1 Set if you are trying to use this driver with mwave (see on) | ||
19 | type Use this to specify a specific card type | ||
20 | |||
21 | The following arguments are taken if ISAPnP support is compiled in | ||
22 | |||
23 | isapnp=0 Set this to disable ISAPnP detection (use io=0xXXX etc. above) | ||
24 | multiple=0 Set to disable detection of multiple Soundblaster cards. | ||
25 | Consider it a bug if this option is needed, and send in a | ||
26 | report. | ||
27 | pnplegacy=1 Set this to be able to use a PnP card(s) along with a single | ||
28 | non-PnP (legacy) card. Above options for io, irq, etc. are | ||
29 | needed, and will apply only to the legacy card. | ||
30 | reverse=1 Reverses the order of the search in the PnP table. | ||
31 | uart401=1 Set to enable detection of mpu devices on some clones. | ||
32 | isapnpjump=n Jumps to slot n in the driver's PnP table. Use the source, | ||
33 | Luke. | ||
34 | |||
35 | You may well want to load the opl3 driver for synth music on most SB and | ||
36 | clone SB devices | ||
37 | |||
38 | insmod opl3 io=0x388 | ||
39 | |||
40 | Using Mwave | ||
41 | |||
42 | To make this driver work with Mwave you must set mwave_bug. You also need | ||
43 | to warm boot from DOS/Windows with the required firmware loaded under this | ||
44 | OS. IBM are being difficult about documenting how to load this firmware. | ||
45 | |||
46 | Avance Logic ALS007 | ||
47 | |||
48 | This card is supported; see the separate file ALS007 for full details. | ||
49 | |||
50 | Avance Logic ALS100 | ||
51 | |||
52 | This card is supported; setup should be as for a standard Sound Blaster 16. | ||
53 | The driver will identify the audio device as a "Sound Blaster 16 (ALS-100)". | ||
diff --git a/Documentation/sound/oss/Tropez+ b/Documentation/sound/oss/Tropez+ new file mode 100644 index 000000000000..b93a6b734fc0 --- /dev/null +++ b/Documentation/sound/oss/Tropez+ | |||
@@ -0,0 +1,26 @@ | |||
1 | From: Paul Barton-Davis <pbd@op.net> | ||
2 | |||
3 | Here is the configuration I use with a Tropez+ and my modular | ||
4 | driver: | ||
5 | |||
6 | alias char-major-14 wavefront | ||
7 | alias synth0 wavefront | ||
8 | alias mixer0 cs4232 | ||
9 | alias audio0 cs4232 | ||
10 | pre-install wavefront modprobe "-k" "cs4232" | ||
11 | post-install wavefront modprobe "-k" "opl3" | ||
12 | options wavefront io=0x200 irq=9 | ||
13 | options cs4232 synthirq=9 synthio=0x200 io=0x530 irq=5 dma=1 dma2=0 | ||
14 | options opl3 io=0x388 | ||
15 | |||
16 | Things to note: | ||
17 | |||
18 | the wavefront options "io" and "irq" ***MUST*** match the "synthio" | ||
19 | and "synthirq" cs4232 options. | ||
20 | |||
21 | you can do without the opl3 module if you don't | ||
22 | want to use the OPL/[34] synth on the soundcard | ||
23 | |||
24 | the opl3 io parameter is conventionally not adjustable. | ||
25 | |||
26 | Please see drivers/sound/README.wavefront for more details. | ||
diff --git a/Documentation/sound/oss/VIA-chipset b/Documentation/sound/oss/VIA-chipset new file mode 100644 index 000000000000..37865234e54d --- /dev/null +++ b/Documentation/sound/oss/VIA-chipset | |||
@@ -0,0 +1,43 @@ | |||
1 | Running sound cards on VIA chipsets | ||
2 | |||
3 | o There are problems with VIA chipsets and sound cards that appear to | ||
4 | lock the hardware solidly. Test programs under DOS have verified the | ||
5 | problem exists on at least some (but apparently not all) VIA boards | ||
6 | |||
7 | o VIA have so far failed to bother to answer support mail on the subject | ||
8 | so if you are a VIA engineer feeling aggrieved as you read this | ||
9 | document go chase your own people. If there is a workaround please | ||
10 | let us know so we can implement it. | ||
11 | |||
12 | |||
13 | Certain patterns of ISA DMA access used for most PC sound cards cause the | ||
14 | VIA chipsets to lock up. From the collected reports this appears to cover a | ||
15 | wide range of boards. Some also lock up with sound cards under Win* as well. | ||
16 | |||
17 | Linux implements a workaround providing your chipset is PCI and you compiled | ||
18 | with PCI Quirks enabled. If so you will see a message | ||
19 | "Activating ISA DMA bug workarounds" | ||
20 | |||
21 | during booting. If you have a VIA PCI chipset that hangs when you use the | ||
22 | sound and is not generating this message even with PCI quirks enabled | ||
23 | please report the information to the linux-kernel list (see REPORTING-BUGS). | ||
24 | |||
25 | If you are one of the tiny number of unfortunates with a 486 ISA/VLB VIA | ||
26 | chipset board you need to do the following to build a special kernel for | ||
27 | your board | ||
28 | |||
29 | edit linux/include/asm-i386/dma.h | ||
30 | |||
31 | change | ||
32 | |||
33 | #define isa_dma_bridge_buggy (0) | ||
34 | |||
35 | to | ||
36 | |||
37 | #define isa_dma_bridge_buggy (1) | ||
38 | |||
39 | and rebuild a kernel without PCI quirk support. | ||
40 | |||
41 | |||
42 | Other than this particular glitch the VIA [M]VP* chipsets appear to work | ||
43 | perfectly with Linux. | ||
diff --git a/Documentation/sound/oss/VIBRA16 b/Documentation/sound/oss/VIBRA16 new file mode 100644 index 000000000000..68a5a46beb88 --- /dev/null +++ b/Documentation/sound/oss/VIBRA16 | |||
@@ -0,0 +1,80 @@ | |||
1 | Sound Blaster 16X Vibra addendum | ||
2 | -------------------------------- | ||
3 | by Marius Ilioaea <mariusi@protv.ro> | ||
4 | Stefan Laudat <stefan@asit.ro> | ||
5 | |||
6 | Sat Mar 6 23:55:27 EET 1999 | ||
7 | |||
8 | Hello again, | ||
9 | |||
10 | Playing with a SB Vibra 16x soundcard we found it very difficult | ||
11 | to setup because the kernel reported a lot of DMA errors and wouldn't | ||
12 | simply play any sound. | ||
13 | A good starting point is that the vibra16x chip full-duplex facility | ||
14 | is neither still exploited by the sb driver found in the linux kernel | ||
15 | (tried it with a 2.2.2-ac7), nor in the commercial OSS package (it reports | ||
16 | it as half-duplex soundcard). Oh, I almost forgot, the RedHat sndconfig | ||
17 | failed detecting it ;) | ||
18 | So, the big problem still remains, because the sb module wants a | ||
19 | 8-bit and a 16-bit dma, which we could not allocate for vibra... it supports | ||
20 | only two 8-bit dma channels, the second one will be passed to the module | ||
21 | as a 16 bit channel, the kernel will yield about that but everything will | ||
22 | be okay, trust us. | ||
23 | The only inconvenient you may find is that you will have | ||
24 | some sound playing jitters if you have HDD dma support enabled - but this | ||
25 | will happen with almost all soundcards... | ||
26 | |||
27 | A fully working isapnp.conf is just here: | ||
28 | |||
29 | <snip here> | ||
30 | |||
31 | (READPORT 0x0203) | ||
32 | (ISOLATE PRESERVE) | ||
33 | (IDENTIFY *) | ||
34 | (VERBOSITY 2) | ||
35 | (CONFLICT (IO FATAL)(IRQ FATAL)(DMA FATAL)(MEM FATAL)) # or WARNING | ||
36 | # SB 16 and OPL3 devices | ||
37 | (CONFIGURE CTL00f0/-1 (LD 0 | ||
38 | (INT 0 (IRQ 5 (MODE +E))) | ||
39 | (DMA 0 (CHANNEL 1)) | ||
40 | (DMA 1 (CHANNEL 3)) | ||
41 | (IO 0 (SIZE 16) (BASE 0x0220)) | ||
42 | (IO 2 (SIZE 4) (BASE 0x0388)) | ||
43 | (NAME "CTL00f0/-1[0]{Audio }") | ||
44 | (ACT Y) | ||
45 | )) | ||
46 | |||
47 | # Joystick device - only if you need it :-/ | ||
48 | |||
49 | (CONFIGURE CTL00f0/-1 (LD 1 | ||
50 | (IO 0 (SIZE 1) (BASE 0x0200)) | ||
51 | (NAME "CTL00f0/-1[1]{Game }") | ||
52 | (ACT Y) | ||
53 | )) | ||
54 | (WAITFORKEY) | ||
55 | |||
56 | <end of snipping> | ||
57 | |||
58 | So, after a good kernel modules compilation and a 'depmod -a kernel_ver' | ||
59 | you may want to: | ||
60 | |||
61 | modprobe sb io=0x220 irq=5 dma=1 dma16=3 | ||
62 | |||
63 | Or, take the hard way: | ||
64 | |||
65 | modprobe soundcore | ||
66 | modprobe sound | ||
67 | modprobe uart401 | ||
68 | modprobe sb io=0x220 irq=5 dma=1 dma16=3 | ||
69 | # do you need MIDI? | ||
70 | modprobe opl3=0x388 | ||
71 | |||
72 | Just in case, the kernel sound support should be: | ||
73 | |||
74 | CONFIG_SOUND=m | ||
75 | CONFIG_SOUND_OSS=m | ||
76 | CONFIG_SOUND_SB=m | ||
77 | |||
78 | Enjoy your new noisy Linux box! ;) | ||
79 | |||
80 | |||
diff --git a/Documentation/sound/oss/WaveArtist b/Documentation/sound/oss/WaveArtist new file mode 100644 index 000000000000..f4f3407cd818 --- /dev/null +++ b/Documentation/sound/oss/WaveArtist | |||
@@ -0,0 +1,170 @@ | |||
1 | |||
2 | (the following is from the armlinux CVS) | ||
3 | |||
4 | WaveArtist mixer and volume levels can be accessed via these commands: | ||
5 | |||
6 | nn30 read registers nn, where nn = 00 - 09 for mixer settings | ||
7 | 0a - 13 for channel volumes | ||
8 | mm31 write the volume setting in pairs, where mm = (nn - 10) / 2 | ||
9 | rr32 write the mixer settings in pairs, where rr = nn/2 | ||
10 | xx33 reset all settings to default | ||
11 | 0y34 select mono source, y=0 = left, y=1 = right | ||
12 | |||
13 | bits | ||
14 | nn 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | ||
15 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
16 | 00 | 0 | 0 0 1 1 | left line mixer gain | left aux1 mixer gain |lmute| | ||
17 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
18 | 01 | 0 | 0 1 0 1 | left aux2 mixer gain | right 2 left mic gain |mmute| | ||
19 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
20 | 02 | 0 | 0 1 1 1 | left mic mixer gain | left mic | left mixer gain |dith | | ||
21 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
22 | 03 | 0 | 1 0 0 1 | left mixer input select |lrfg | left ADC gain | | ||
23 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
24 | 04 | 0 | 1 0 1 1 | right line mixer gain | right aux1 mixer gain |rmute| | ||
25 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
26 | 05 | 0 | 1 1 0 1 | right aux2 mixer gain | left 2 right mic gain |test | | ||
27 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
28 | 06 | 0 | 1 1 1 1 | right mic mixer gain | right mic |right mixer gain |rbyps| | ||
29 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
30 | 07 | 1 | 0 0 0 1 | right mixer select |rrfg | right ADC gain | | ||
31 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
32 | 08 | 1 | 0 0 1 1 | mono mixer gain |right ADC mux sel|left ADC mux sel | | ||
33 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
34 | 09 | 1 | 0 1 0 1 |loopb|left linout|loop|ADCch|TxFch|OffCD|test |loopb|loopb|osamp| | ||
35 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
36 | 0a | 0 | left PCM channel volume | | ||
37 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
38 | 0b | 0 | right PCM channel volume | | ||
39 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
40 | 0c | 0 | left FM channel volume | | ||
41 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
42 | 0d | 0 | right FM channel volume | | ||
43 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
44 | 0e | 0 | left wavetable channel volume | | ||
45 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
46 | 0f | 0 | right wavetable channel volume | | ||
47 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
48 | 10 | 0 | left PCM expansion channel volume | | ||
49 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
50 | 11 | 0 | right PCM expansion channel volume | | ||
51 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
52 | 12 | 0 | left FM expansion channel volume | | ||
53 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
54 | 13 | 0 | right FM expansion channel volume | | ||
55 | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ | ||
56 | |||
57 | lmute: left mute | ||
58 | mmute: mono mute | ||
59 | dith: dithds | ||
60 | lrfg: | ||
61 | rmute: right mute | ||
62 | rbyps: right bypass | ||
63 | rrfg: | ||
64 | ADCch: | ||
65 | TxFch: | ||
66 | OffCD: | ||
67 | osamp: | ||
68 | |||
69 | And the following diagram is derived from the description in the CVS archive: | ||
70 | |||
71 | MIC L (mouthpiece) | ||
72 | +------+ | ||
73 | -->PreAmp>-\ | ||
74 | +--^---+ | | ||
75 | | | | ||
76 | r2b4-5 | +--------+ | ||
77 | /----*-------------------------------->5 | | ||
78 | | | | | ||
79 | | /----------------------------------->4 | | ||
80 | | | | | | ||
81 | | | /--------------------------------->3 1of5 | +---+ | ||
82 | | | | | mux >-->AMP>--> ADC L | ||
83 | | | | /------------------------------->2 | +-^-+ | ||
84 | | | | | | | | | ||
85 | Line | | | | +----+ +------+ +---+ /---->1 | r3b3-0 | ||
86 | ------------*->mute>--> Gain >--> | | | | | ||
87 | L | | | +----+ +------+ | | | *->0 | | ||
88 | | | | | | | +---^----+ | ||
89 | Aux2 | | | +----+ +------+ | | | | | ||
90 | ----------*--->mute>--> Gain >--> M | | r8b0-2 | ||
91 | L | | +----+ +------+ | | | | ||
92 | | | | | \------\ | ||
93 | Aux1 | | +----+ +------+ | | | | ||
94 | --------*----->mute>--> Gain >--> I | | | ||
95 | L | +----+ +------+ | | | | ||
96 | | | | | | ||
97 | | +----+ +------+ | | +---+ | | ||
98 | *------->mute>--> Gain >--> X >-->AMP>--* | ||
99 | | +----+ +------+ | | +-^-+ | | ||
100 | | | | | | | ||
101 | | +----+ +------+ | | r2b1-3 | | ||
102 | | /----->mute>--> Gain >--> E | | | ||
103 | | | +----+ +------+ | | | | ||
104 | | | | | | | ||
105 | | | +----+ +------+ | | | | ||
106 | | | /--->mute>--> Gain >--> R | | | ||
107 | | | | +----+ +------+ | | | | ||
108 | | | | | | | r9b8-9 | ||
109 | | | | +----+ +------+ | | | | | ||
110 | | | | /->mute>--> Gain >--> | | +---v---+ | ||
111 | | | | | +----+ +------+ +---+ /-*->0 | | ||
112 | DAC | | | | | | | | ||
113 | ------------*----------------------------------->? | +----+ | ||
114 | L | | | | | Mux >-->mute>--> L output | ||
115 | | | | | /->? | +--^-+ | ||
116 | | | | | | | | | | ||
117 | | | | /--------->? | r0b0 | ||
118 | | | | | | | +-------+ | ||
119 | | | | | | | | ||
120 | Mono | | | | | | +-------+ | ||
121 | ----------* | \---> | +----+ | ||
122 | | | | | | | Mix >-->mute>--> Mono output | ||
123 | | | | | *-> | +--^-+ | ||
124 | | | | | | +-------+ | | ||
125 | | | | | | r1b0 | ||
126 | DAC | | | | | +-------+ | ||
127 | ------------*-------------------------*--------->1 | +----+ | ||
128 | R | | | | | | Mux >-->mute>--> R output | ||
129 | | | | | +----+ +------+ +---+ *->0 | +--^-+ | ||
130 | | | | \->mute>--> Gain >--> | | +---^---+ | | ||
131 | | | | +----+ +------+ | | | | r5b0 | ||
132 | | | | | | | r6b0 | ||
133 | | | | +----+ +------+ | | | | ||
134 | | | \--->mute>--> Gain >--> M | | | ||
135 | | | +----+ +------+ | | | | ||
136 | | | | | | | ||
137 | | | +----+ +------+ | | | | ||
138 | | *----->mute>--> Gain >--> I | | | ||
139 | | | +----+ +------+ | | | | ||
140 | | | | | | | ||
141 | | | +----+ +------+ | | +---+ | | ||
142 | \------->mute>--> Gain >--> X >-->AMP>--* | ||
143 | | +----+ +------+ | | +-^-+ | | ||
144 | /--/ | | | | | ||
145 | Aux1 | +----+ +------+ | | r6b1-3 | | ||
146 | -------*------>mute>--> Gain >--> E | | | ||
147 | R | | +----+ +------+ | | | | ||
148 | | | | | | | ||
149 | Aux2 | | +----+ +------+ | | /------/ | ||
150 | ---------*---->mute>--> Gain >--> R | | | ||
151 | R | | | +----+ +------+ | | | | ||
152 | | | | | | | +--------+ | ||
153 | Line | | | +----+ +------+ | | | *->0 | | ||
154 | -----------*-->mute>--> Gain >--> | | | | | ||
155 | R | | | | +----+ +------+ +---+ \---->1 | | ||
156 | | | | | | | | ||
157 | | | | \-------------------------------->2 | +---+ | ||
158 | | | | | Mux >-->AMP>--> ADC R | ||
159 | | | \---------------------------------->3 | +-^-+ | ||
160 | | | | | | | ||
161 | | \------------------------------------>4 | r7b3-0 | ||
162 | | | | | ||
163 | \-----*-------------------------------->5 | | ||
164 | | +---^----+ | ||
165 | r6b4-5 | | | ||
166 | | | r8b3-5 | ||
167 | +--v---+ | | ||
168 | -->PreAmp>-/ | ||
169 | +------+ | ||
170 | MIC R (electret mic) | ||
diff --git a/Documentation/sound/oss/Wavefront b/Documentation/sound/oss/Wavefront new file mode 100644 index 000000000000..16f57ea43052 --- /dev/null +++ b/Documentation/sound/oss/Wavefront | |||
@@ -0,0 +1,339 @@ | |||
1 | An OSS/Free Driver for WaveFront soundcards | ||
2 | (Turtle Beach Maui, Tropez, Tropez Plus) | ||
3 | |||
4 | Paul Barton-Davis, July 1998 | ||
5 | |||
6 | VERSION 0.2.5 | ||
7 | |||
8 | Driver Status | ||
9 | ------------- | ||
10 | |||
11 | Requires: Kernel 2.1.106 or later (the driver is included with kernels | ||
12 | 2.1.109 and above) | ||
13 | |||
14 | As of 7/22/1998, this driver is currently in *BETA* state. This means | ||
15 | that it compiles and runs, and that I use it on my system (Linux | ||
16 | 2.1.106) with some reasonably demanding applications and uses. I | ||
17 | believe the code is approaching an initial "finished" state that | ||
18 | provides bug-free support for the Tropez Plus. | ||
19 | |||
20 | Please note that to date, the driver has ONLY been tested on a Tropez | ||
21 | Plus. I would very much like to hear (and help out) people with Tropez | ||
22 | and Maui cards, since I think the driver can support those cards as | ||
23 | well. | ||
24 | |||
25 | Finally, the driver has not been tested (or even compiled) as a static | ||
26 | (non-modular) part of the kernel. Alan Cox's good work in modularizing | ||
27 | OSS/Free for Linux makes this rather unnecessary. | ||
28 | |||
29 | Some Questions | ||
30 | -------------- | ||
31 | |||
32 | ********************************************************************** | ||
33 | 0) What does this driver do that the maui driver did not ? | ||
34 | ********************************************************************** | ||
35 | |||
36 | * can fully initialize a WaveFront card from cold boot - no DOS | ||
37 | utilities needed | ||
38 | * working patch/sample/program loading and unloading (the maui | ||
39 | driver didn't document how to make this work, and assumed | ||
40 | user-level preparation of the patch data for writing | ||
41 | to the board. ick.) | ||
42 | * full user-level access to all WaveFront commands | ||
43 | * for the Tropez Plus, (primitive) control of the YSS225 FX processor | ||
44 | * Virtual MIDI mode supported - 2 MIDI devices accessible via the | ||
45 | WaveFront's MPU401/UART emulation. One | ||
46 | accesses the WaveFront synth, the other accesses the | ||
47 | external MIDI connector. Full MIDI read/write semantics | ||
48 | for both devices. | ||
49 | * OSS-compliant /dev/sequencer interface for the WaveFront synth, | ||
50 | including native and GUS-format patch downloading. | ||
51 | * semi-intelligent patch management (prototypical at this point) | ||
52 | |||
53 | ********************************************************************** | ||
54 | 1) What to do about MIDI interfaces ? | ||
55 | ********************************************************************** | ||
56 | |||
57 | The Tropez Plus (and perhaps other WF cards) can in theory support up | ||
58 | to 2 physical MIDI interfaces. One of these is connected to the | ||
59 | ICS2115 chip (the WaveFront synth itself) and is controlled by | ||
60 | MPU/UART-401 emulation code running as part of the WaveFront OS. The | ||
61 | other is controlled by the CS4232 chip present on the board. However, | ||
62 | physical access to the CS4232 connector is difficult, and it is | ||
63 | unlikely (though not impossible) that you will want to use it. | ||
64 | |||
65 | An older version of this driver introduced an additional kernel config | ||
66 | variable which controlled whether or not the CS4232 MIDI interface was | ||
67 | configured. Because of Alan Cox's work on modularizing the sound | ||
68 | drivers, and now backporting them to 2.0.34 kernels, there seems to be | ||
69 | little reason to support "static" configuration variables, and so this | ||
70 | has been abandoned in favor of *only* module parameters. Specifying | ||
71 | "mpuio" and "mpuirq" for the cs4232 parameter will result in the | ||
72 | CS4232 MIDI interface being configured; leaving them unspecified will | ||
73 | leave it unconfigured (and thus unusable). | ||
74 | |||
75 | BTW, I have heard from one Tropez+ user that the CS4232 interface is | ||
76 | more reliable than the ICS2115 one. I have had no problems with the | ||
77 | latter, and I don't have the right cable to test the former one | ||
78 | out. Reports welcome. | ||
79 | |||
80 | ********************************************************************** | ||
81 | 2) Why does line XXX of the code look like this .... ? | ||
82 | ********************************************************************** | ||
83 | |||
84 | Either because it's not finished yet, or because you're a better coder | ||
85 | than I am, or because you don't understand some aspect of how the card | ||
86 | or the code works. | ||
87 | |||
88 | I absolutely welcome comments, criticisms and suggestions about the | ||
89 | design and implementation of the driver. | ||
90 | |||
91 | ********************************************************************** | ||
92 | 3) What files are included ? | ||
93 | ********************************************************************** | ||
94 | |||
95 | drivers/sound/README.wavefront -- this file | ||
96 | |||
97 | drivers/sound/wavefront.patch -- patches for the 2.1.106 sound drivers | ||
98 | needed to make the rest of this work | ||
99 | DO NOT USE IF YOU'VE APPLIED THEM | ||
100 | BEFORE, OR HAVE 2.1.109 OR ABOVE | ||
101 | |||
102 | drivers/sound/wavfront.c -- the driver | ||
103 | drivers/sound/ys225.h -- data declarations for FX config | ||
104 | drivers/sound/ys225.c -- data definitions for FX config | ||
105 | drivers/sound/wf_midi.c -- the "uart401" driver | ||
106 | to support virtual MIDI mode. | ||
107 | include/wavefront.h -- the header file | ||
108 | Documentation/sound/oss/Tropez+ -- short docs on configuration | ||
109 | |||
110 | ********************************************************************** | ||
111 | 4) How do I compile/install/use it ? | ||
112 | ********************************************************************** | ||
113 | |||
114 | PART ONE: install the source code into your sound driver directory | ||
115 | |||
116 | cd <top-of-your-2.1.106-code-base-e.g.-/usr/src/linux> | ||
117 | tar -zxvf <where-you-put/wavefront.tar.gz> | ||
118 | |||
119 | PART TWO: apply the patches | ||
120 | |||
121 | DO THIS ONLY IF YOU HAVE A KERNEL VERSION BELOW 2.1.109 | ||
122 | AND HAVE NOT ALREADY INSTALLED THE PATCH(ES). | ||
123 | |||
124 | cd drivers/sound | ||
125 | patch < wavefront.patch | ||
126 | |||
127 | PART THREE: configure your kernel | ||
128 | |||
129 | cd <top of your kernel tree> | ||
130 | make xconfig (or whichever config option you use) | ||
131 | |||
132 | - choose YES for Sound Support | ||
133 | - choose MODULE (M) for OSS Sound Modules | ||
134 | - choose MODULE(M) to YM3812/OPL3 support | ||
135 | - choose MODULE(M) for WaveFront support | ||
136 | - choose MODULE(M) for CS4232 support | ||
137 | |||
138 | - choose "N" for everything else (unless you have other | ||
139 | soundcards you want support for) | ||
140 | |||
141 | |||
142 | make boot | ||
143 | . | ||
144 | . | ||
145 | . | ||
146 | <whatever you normally do for a kernel install> | ||
147 | make modules | ||
148 | . | ||
149 | . | ||
150 | . | ||
151 | make modules_install | ||
152 | |||
153 | Here's my autoconf.h SOUND section: | ||
154 | |||
155 | /* | ||
156 | * Sound | ||
157 | */ | ||
158 | #define CONFIG_SOUND 1 | ||
159 | #undef CONFIG_SOUND_OSS | ||
160 | #define CONFIG_SOUND_OSS_MODULE 1 | ||
161 | #undef CONFIG_SOUND_PAS | ||
162 | #undef CONFIG_SOUND_SB | ||
163 | #undef CONFIG_SOUND_ADLIB | ||
164 | #undef CONFIG_SOUND_GUS | ||
165 | #undef CONFIG_SOUND_MPU401 | ||
166 | #undef CONFIG_SOUND_PSS | ||
167 | #undef CONFIG_SOUND_MSS | ||
168 | #undef CONFIG_SOUND_SSCAPE | ||
169 | #undef CONFIG_SOUND_TRIX | ||
170 | #undef CONFIG_SOUND_MAD16 | ||
171 | #undef CONFIG_SOUND_WAVEFRONT | ||
172 | #define CONFIG_SOUND_WAVEFRONT_MODULE 1 | ||
173 | #undef CONFIG_SOUND_CS4232 | ||
174 | #define CONFIG_SOUND_CS4232_MODULE 1 | ||
175 | #undef CONFIG_SOUND_MAUI | ||
176 | #undef CONFIG_SOUND_SGALAXY | ||
177 | #undef CONFIG_SOUND_OPL3SA1 | ||
178 | #undef CONFIG_SOUND_SOFTOSS | ||
179 | #undef CONFIG_SOUND_YM3812 | ||
180 | #define CONFIG_SOUND_YM3812_MODULE 1 | ||
181 | #undef CONFIG_SOUND_VMIDI | ||
182 | #undef CONFIG_SOUND_UART6850 | ||
183 | /* | ||
184 | * Additional low level sound drivers | ||
185 | */ | ||
186 | #undef CONFIG_LOWLEVEL_SOUND | ||
187 | |||
188 | ************************************************************ | ||
189 | 6) How do I configure my card ? | ||
190 | ************************************************************ | ||
191 | |||
192 | You need to edit /etc/modprobe.conf. Here's mine (edited to show the | ||
193 | relevant details): | ||
194 | |||
195 | # Sound system | ||
196 | alias char-major-14-* wavefront | ||
197 | alias synth0 wavefront | ||
198 | alias mixer0 cs4232 | ||
199 | alias audio0 cs4232 | ||
200 | install wavefront /sbin/modprobe cs4232 && /sbin/modprobe -i wavefront && /sbin/modprobe opl3 | ||
201 | options wavefront io=0x200 irq=9 | ||
202 | options cs4232 synthirq=9 synthio=0x200 io=0x530 irq=5 dma=1 dma2=0 | ||
203 | options opl3 io=0x388 | ||
204 | |||
205 | Things to note: | ||
206 | |||
207 | the wavefront options "io" and "irq" ***MUST*** match the "synthio" | ||
208 | and "synthirq" cs4232 options. | ||
209 | |||
210 | you can do without the opl3 module if you don't | ||
211 | want to use the OPL/[34] FM synth on the soundcard | ||
212 | |||
213 | the opl3 io parameter is conventionally not adjustable. | ||
214 | In theory, any not-in-use IO port address would work, but | ||
215 | just use 0x388 and stick with the crowd. | ||
216 | |||
217 | ********************************************************************** | ||
218 | 7) What about firmware ? | ||
219 | ********************************************************************** | ||
220 | |||
221 | Turtle Beach have not given me permission to distribute their firmware | ||
222 | for the ICS2115. However, if you have a WaveFront card, then you | ||
223 | almost certainly have the firmware, and if not, its freely available | ||
224 | on their website, at: | ||
225 | |||
226 | http://www.tbeach.com/tbs/downloads/scardsdown.htm#tropezplus | ||
227 | |||
228 | The file is called WFOS2001.MOT (for the Tropez+). | ||
229 | |||
230 | This driver, however, doesn't use the pure firmware as distributed, | ||
231 | but instead relies on a somewhat processed form of it. You can | ||
232 | generate this very easily. Following an idea from Andrew Veliath's | ||
233 | Pinnacle driver, the following flex program will generate the | ||
234 | processed version: | ||
235 | |||
236 | ---- cut here ------------------------- | ||
237 | %option main | ||
238 | %% | ||
239 | ^S[28].*\r$ printf ("%c%.*s", yyleng-1,yyleng-1,yytext); | ||
240 | <<EOF>> { fputc ('\0', stdout); return; } | ||
241 | \n {} | ||
242 | . {} | ||
243 | ---- cut here ------------------------- | ||
244 | |||
245 | To use it, put the above in file (say, ws.l) compile it like this: | ||
246 | |||
247 | shell> flex -ows.c ws.l | ||
248 | shell> cc -o ws ws.c | ||
249 | |||
250 | and then use it like this: | ||
251 | |||
252 | ws < my-copy-of-the-oswf.mot-file > /etc/sound/wavefront.os | ||
253 | |||
254 | If you put it somewhere else, you'll always have to use the wf_ospath | ||
255 | module parameter (see below) or alter the source code. | ||
256 | |||
257 | ********************************************************************** | ||
258 | 7) How do I get it working ? | ||
259 | ********************************************************************** | ||
260 | |||
261 | Optionally, you can reboot with the "new" kernel (even though the only | ||
262 | changes have really been made to a module). | ||
263 | |||
264 | Then, as root do: | ||
265 | |||
266 | modprobe wavefront | ||
267 | |||
268 | You should get something like this in /var/log/messages: | ||
269 | |||
270 | WaveFront: firmware 1.20 already loaded. | ||
271 | |||
272 | or | ||
273 | |||
274 | WaveFront: no response to firmware probe, assume raw. | ||
275 | |||
276 | then: | ||
277 | |||
278 | WaveFront: waiting for memory configuration ... | ||
279 | WaveFront: hardware version 1.64 | ||
280 | WaveFront: available DRAM 8191k | ||
281 | WaveFront: 332 samples used (266 real, 13 aliases, 53 multi), 180 empty | ||
282 | WaveFront: 128 programs slots in use | ||
283 | WaveFront: 256 patch slots filled, 142 in use | ||
284 | |||
285 | The whole process takes about 16 seconds, the longest waits being | ||
286 | after reporting the hardware version (during the firmware download), | ||
287 | and after reporting program status (during patch status inquiry). Its | ||
288 | shorter (about 10 secs) if the firmware is already loaded (i.e. only | ||
289 | warm reboots since the last firmware load). | ||
290 | |||
291 | The "available DRAM" line will vary depending on how much added RAM | ||
292 | your card has. Mine has 8MB. | ||
293 | |||
294 | To check basically functionality, use play(1) or splay(1) to send a | ||
295 | .WAV or other audio file through the audio portion. Then use playmidi | ||
296 | to play a General MIDI file. Try the "-D 0" to hear the | ||
297 | difference between sending MIDI to the WaveFront and using the OPL/3, | ||
298 | which is the default (I think ...). If you have an external synth(s) | ||
299 | hooked to the soundcard, you can use "-e" to route to the | ||
300 | external synth(s) (in theory, -D 1 should work as well, but I think | ||
301 | there is a bug in playmidi which prevents this from doing what it | ||
302 | should). | ||
303 | |||
304 | ********************************************************************** | ||
305 | 8) What are the module parameters ? | ||
306 | ********************************************************************** | ||
307 | |||
308 | Its best to read wavefront.c for this, but here is a summary: | ||
309 | |||
310 | integers: | ||
311 | wf_raw - if set, ignore apparent presence of firmware | ||
312 | loaded onto the ICS2115, reset the whole | ||
313 | board, and initialize it from scratch. (default = 0) | ||
314 | |||
315 | fx_raw - if set, always initialize the YSS225 processor | ||
316 | on the Tropez plus. (default = 1) | ||
317 | |||
318 | < The next 4 are basically for kernel hackers to allow | ||
319 | tweaking the driver for testing purposes. > | ||
320 | |||
321 | wait_usecs - loop timer used when waiting for | ||
322 | status conditions on the board. | ||
323 | The default is 150. | ||
324 | |||
325 | debug_default - debugging flags. See sound/wavefront.h | ||
326 | for WF_DEBUG_* values. Default is zero. | ||
327 | Setting this allows you to debug the | ||
328 | driver during module installation. | ||
329 | strings: | ||
330 | ospath - path to get to the pre-processed OS firmware. | ||
331 | (default: /etc/sound/wavefront.os) | ||
332 | |||
333 | ********************************************************************** | ||
334 | 9) Who should I contact if I have problems? | ||
335 | ********************************************************************** | ||
336 | |||
337 | Just me: Paul Barton-Davis <pbd@op.net> | ||
338 | |||
339 | |||
diff --git a/Documentation/sound/oss/btaudio b/Documentation/sound/oss/btaudio new file mode 100644 index 000000000000..1a693e69d44b --- /dev/null +++ b/Documentation/sound/oss/btaudio | |||
@@ -0,0 +1,92 @@ | |||
1 | |||
2 | Intro | ||
3 | ===== | ||
4 | |||
5 | people start bugging me about this with questions, looks like I | ||
6 | should write up some documentation for this beast. That way I | ||
7 | don't have to answer that much mails I hope. Yes, I'm lazy... | ||
8 | |||
9 | |||
10 | You might have noticed that the bt878 grabber cards have actually | ||
11 | _two_ PCI functions: | ||
12 | |||
13 | $ lspci | ||
14 | [ ... ] | ||
15 | 00:0a.0 Multimedia video controller: Brooktree Corporation Bt878 (rev 02) | ||
16 | 00:0a.1 Multimedia controller: Brooktree Corporation Bt878 (rev 02) | ||
17 | [ ... ] | ||
18 | |||
19 | The first does video, it is backward compatible to the bt848. The second | ||
20 | does audio. btaudio is a driver for the second function. It's a sound | ||
21 | driver which can be used for recording sound (and _only_ recording, no | ||
22 | playback). As most TV cards come with a short cable which can be plugged | ||
23 | into your sound card's line-in you probably don't need this driver if all | ||
24 | you want to do is just watching TV... | ||
25 | |||
26 | |||
27 | Driver Status | ||
28 | ============= | ||
29 | |||
30 | Still somewhat experimental. The driver should work stable, i.e. it | ||
31 | should'nt crash your box. It might not work as expected, have bugs, | ||
32 | not being fully OSS API compilant, ... | ||
33 | |||
34 | Latest versions are available from http://bytesex.org/bttv/, the | ||
35 | driver is in the bttv tarball. Kernel patches might be available too, | ||
36 | have a look at http://bytesex.org/bttv/listing.html. | ||
37 | |||
38 | The chip knows two different modes. btaudio registers two dsp | ||
39 | devices, one for each mode. They can not be used at the same time. | ||
40 | |||
41 | |||
42 | Digital audio mode | ||
43 | ================== | ||
44 | |||
45 | The chip gives you 16 bit stereo sound. The sample rate depends on | ||
46 | the external source which feeds the bt878 with digital sound via I2S | ||
47 | interface. There is a insmod option (rate) to tell the driver which | ||
48 | sample rate the hardware uses (32000 is the default). | ||
49 | |||
50 | One possible source for digital sound is the msp34xx audio processor | ||
51 | chip which provides digital sound via I2S with 32 kHz sample rate. My | ||
52 | Hauppauge board works this way. | ||
53 | |||
54 | The Osprey-200 reportly gives you digital sound with 44100 Hz sample | ||
55 | rate. It is also possible that you get no sound at all. | ||
56 | |||
57 | |||
58 | analog mode (A/D) | ||
59 | ================= | ||
60 | |||
61 | You can tell the driver to use this mode with the insmod option "analog=1". | ||
62 | The chip has three analog inputs. Consequently you'll get a mixer device | ||
63 | to control these. | ||
64 | |||
65 | The analog mode supports mono only. Both 8 + 16 bit. Both are _signed_ | ||
66 | int, which is uncommon for the 8 bit case. Sample rate range is 119 kHz | ||
67 | to 448 kHz. Yes, the number of digits is correct. The driver supports | ||
68 | downsampling by powers of two, so you can ask for more usual sample rates | ||
69 | like 44 kHz too. | ||
70 | |||
71 | With my Hauppauge I get noisy sound on the second input (mapped to line2 | ||
72 | by the mixer device). Others get a useable signal on line1. | ||
73 | |||
74 | |||
75 | some examples | ||
76 | ============= | ||
77 | |||
78 | * read audio data from btaudio (dsp2), send to es1730 (dsp,dsp1): | ||
79 | $ sox -w -r 32000 -t ossdsp /dev/dsp2 -t ossdsp /dev/dsp | ||
80 | |||
81 | * read audio data from btaudio, send to esound daemon (which might be | ||
82 | running on another host): | ||
83 | $ sox -c 2 -w -r 32000 -t ossdsp /dev/dsp2 -t sw - | esdcat -r 32000 | ||
84 | $ sox -c 1 -w -r 32000 -t ossdsp /dev/dsp2 -t sw - | esdcat -m -r 32000 | ||
85 | |||
86 | |||
87 | Have fun, | ||
88 | |||
89 | Gerd | ||
90 | |||
91 | -- | ||
92 | Gerd Knorr <kraxel@bytesex.org> | ||
diff --git a/Documentation/sound/oss/cs46xx b/Documentation/sound/oss/cs46xx new file mode 100644 index 000000000000..88d6cf8b39f3 --- /dev/null +++ b/Documentation/sound/oss/cs46xx | |||
@@ -0,0 +1,138 @@ | |||
1 | |||
2 | Documentation for the Cirrus Logic/Crystal SoundFusion cs46xx/cs4280 audio | ||
3 | controller chips (2001/05/11) | ||
4 | |||
5 | The cs46xx audio driver supports the DSP line of Cirrus controllers. | ||
6 | Specifically, the cs4610, cs4612, cs4614, cs4622, cs4624, cs4630 and the cs4280 | ||
7 | products. This driver uses the generic ac97_codec driver for AC97 codec | ||
8 | support. | ||
9 | |||
10 | |||
11 | Features: | ||
12 | |||
13 | Full Duplex Playback/Capture supported from 8k-48k. | ||
14 | 16Bit Signed LE & 8Bit Unsigned, with Mono or Stereo supported. | ||
15 | |||
16 | APM/PM - 2.2.x PM is enabled and functional. APM can also | ||
17 | be enabled for 2.4.x by modifying the CS46XX_ACPI_SUPPORT macro | ||
18 | definition. | ||
19 | |||
20 | DMA playback buffer size is configurable from 16k (defaultorder=2) up to 2Meg | ||
21 | (defaultorder=11). DMA capture buffer size is fixed at a single 4k page as | ||
22 | two 2k fragments. | ||
23 | |||
24 | MMAP seems to work well with QuakeIII, and test XMMS plugin. | ||
25 | |||
26 | Myth2 works, but the polling logic is not fully correct, but is functional. | ||
27 | |||
28 | The 2.4.4-ac6 gameport code in the cs461x joystick driver has been tested | ||
29 | with a Microsoft Sidewinder joystick (cs461x.o and sidewinder.o). This | ||
30 | audio driver must be loaded prior to the joystick driver to enable the | ||
31 | DSP task image supporting the joystick device. | ||
32 | |||
33 | |||
34 | Limitations: | ||
35 | |||
36 | SPDIF is currently not supported. | ||
37 | |||
38 | Primary codec support only. No secondary codec support is implemented. | ||
39 | |||
40 | |||
41 | |||
42 | NOTES: | ||
43 | |||
44 | Hercules Game Theatre XP - the EGPIO2 pin controls the external Amp, | ||
45 | and has been tested. | ||
46 | Module parameter hercules_egpio_disable set to 1, will force a 0 to EGPIODR | ||
47 | to disable the external amplifier. | ||
48 | |||
49 | VTB Santa Cruz - the GPIO7/GPIO8 on the Secondary Codec control | ||
50 | the external amplifier for the "back" speakers, since we do not | ||
51 | support the secondary codec then this external amp is not | ||
52 | turned on. The primary codec external amplifier is supported but | ||
53 | note that the AC97 EAPD bit is inverted logic (amp_voyetra()). | ||
54 | |||
55 | DMA buffer size - there are issues with many of the Linux applications | ||
56 | concerning the optimal buffer size. Several applications request a | ||
57 | certain fragment size and number and then do not verify that the driver | ||
58 | has the ability to support the requested configuration. | ||
59 | SNDCTL_DSP_SETFRAGMENT ioctl is used to request a fragment size and | ||
60 | number of fragments. Some applications exit if an error is returned | ||
61 | on this particular ioctl. Therefore, in alignment with the other OSS audio | ||
62 | drivers, no error is returned when a SETFRAGs IOCTL is received, but the | ||
63 | values passed from the app are not used in any buffer calculation | ||
64 | (ossfragshift/ossmaxfrags are not used). | ||
65 | Use the "defaultorder=N" module parameter to change the buffer size if | ||
66 | you have an application that requires a specific number of fragments | ||
67 | or a specific buffer size (see below). | ||
68 | |||
69 | Debug Interface | ||
70 | --------------- | ||
71 | There is an ioctl debug interface to allow runtime modification of the | ||
72 | debug print levels. This debug interface code can be disabled from the | ||
73 | compilation process with commenting the following define: | ||
74 | #define CSDEBUG_INTERFACE 1 | ||
75 | There is also a debug print methodolgy to select printf statements from | ||
76 | different areas of the driver. A debug print level is also used to allow | ||
77 | additional printfs to be active. Comment out the following line in the | ||
78 | driver to disable compilation of the CS_DBGOUT print statements: | ||
79 | #define CSDEBUG 1 | ||
80 | |||
81 | Please see the definitions for cs_debuglevel and cs_debugmask for additional | ||
82 | information on the debug levels and sections. | ||
83 | |||
84 | There is also a csdbg executable to allow runtime manipulation of these | ||
85 | parameters. for a copy email: twoller@crystal.cirrus.com | ||
86 | |||
87 | |||
88 | |||
89 | MODULE_PARMS definitions | ||
90 | ------------------------ | ||
91 | MODULE_PARM(defaultorder, "i"); | ||
92 | defaultorder=N | ||
93 | where N is a value from 1 to 12 | ||
94 | The buffer order determines the size of the dma buffer for the driver. | ||
95 | under Linux, a smaller buffer allows more responsiveness from many of the | ||
96 | applications (e.g. games). A larger buffer allows some of the apps (esound) | ||
97 | to not underrun the dma buffer as easily. As default, use 32k (order=3) | ||
98 | rather than 64k as some of the games work more responsively. | ||
99 | (2^N) * PAGE_SIZE = allocated buffer size | ||
100 | |||
101 | MODULE_PARM(cs_debuglevel, "i"); | ||
102 | MODULE_PARM(cs_debugmask, "i"); | ||
103 | cs_debuglevel=N | ||
104 | cs_debugmask=0xMMMMMMMM | ||
105 | where N is a value from 0 (no debug printfs), to 9 (maximum) | ||
106 | 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). | ||
107 | |||
108 | MODULE_PARM(hercules_egpio_disable, "i"); | ||
109 | hercules_egpio_disable=N | ||
110 | where N is a 0 (enable egpio), or a 1 (disable egpio support) | ||
111 | |||
112 | MODULE_PARM(initdelay, "i"); | ||
113 | initdelay=N | ||
114 | This value is used to determine the millescond delay during the initialization | ||
115 | code prior to powering up the PLL. On laptops this value can be used to | ||
116 | assist with errors on resume, mostly with IBM laptops. Basically, if the | ||
117 | system is booted under battery power then the mdelay()/udelay() functions fail to | ||
118 | properly delay the required time. Also, if the system is booted under AC power | ||
119 | and then the power removed, the mdelay()/udelay() functions will not delay properly. | ||
120 | |||
121 | MODULE_PARM(powerdown, "i"); | ||
122 | powerdown=N | ||
123 | where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) | ||
124 | |||
125 | |||
126 | MODULE_PARM(external_amp, "i"); | ||
127 | external_amp=1 | ||
128 | if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. | ||
129 | override the detection logic and force the external amp bit in the AC97 0x26 register | ||
130 | to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz | ||
131 | card has inverted logic, so there is a special function for these cards. | ||
132 | |||
133 | MODULE_PARM(thinkpad, "i"); | ||
134 | thinkpad=1 | ||
135 | if N is set to 1, then force enabling the clkrun functionality. | ||
136 | Currently, when the part is being used, then clkrun is disabled for the entire system, | ||
137 | but re-enabled when the driver is released or there is no outstanding open count. | ||
138 | |||
diff --git a/Documentation/sound/oss/es1370 b/Documentation/sound/oss/es1370 new file mode 100644 index 000000000000..7b38b1a096a3 --- /dev/null +++ b/Documentation/sound/oss/es1370 | |||
@@ -0,0 +1,70 @@ | |||
1 | /proc/sound, /dev/sndstat | ||
2 | ------------------------- | ||
3 | |||
4 | /proc/sound and /dev/sndstat is not supported by the | ||
5 | driver. To find out whether the driver succeeded loading, | ||
6 | check the kernel log (dmesg). | ||
7 | |||
8 | |||
9 | ALaw/uLaw sample formats | ||
10 | ------------------------ | ||
11 | |||
12 | This driver does not support the ALaw/uLaw sample formats. | ||
13 | ALaw is the default mode when opening a sound device | ||
14 | using OSS/Free. The reason for the lack of support is | ||
15 | that the hardware does not support these formats, and adding | ||
16 | conversion routines to the kernel would lead to very ugly | ||
17 | code in the presence of the mmap interface to the driver. | ||
18 | And since xquake uses mmap, mmap is considered important :-) | ||
19 | and no sane application uses ALaw/uLaw these days anyway. | ||
20 | In short, playing a Sun .au file as follows: | ||
21 | |||
22 | cat my_file.au > /dev/dsp | ||
23 | |||
24 | does not work. Instead, you may use the play script from | ||
25 | Chris Bagwell's sox-12.14 package (available from the URL | ||
26 | below) to play many different audio file formats. | ||
27 | The script automatically determines the audio format | ||
28 | and does do audio conversions if necessary. | ||
29 | http://home.sprynet.com/sprynet/cbagwell/projects.html | ||
30 | |||
31 | |||
32 | Blocking vs. nonblocking IO | ||
33 | --------------------------- | ||
34 | |||
35 | Unlike OSS/Free this driver honours the O_NONBLOCK file flag | ||
36 | not only during open, but also during read and write. | ||
37 | This is an effort to make the sound driver interface more | ||
38 | regular. Timidity has problems with this; a patch | ||
39 | is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html. | ||
40 | (Timidity patched will also run on OSS/Free). | ||
41 | |||
42 | |||
43 | MIDI UART | ||
44 | --------- | ||
45 | |||
46 | The driver supports a simple MIDI UART interface, with | ||
47 | no ioctl's supported. | ||
48 | |||
49 | |||
50 | MIDI synthesizer | ||
51 | ---------------- | ||
52 | |||
53 | This soundcard does not have any hardware MIDI synthesizer; | ||
54 | MIDI synthesis has to be done in software. To allow this | ||
55 | the driver/soundcard supports two PCM (/dev/dsp) interfaces. | ||
56 | The second one goes to the mixer "synth" setting and supports | ||
57 | only a limited set of sampling rates (44100, 22050, 11025, 5512). | ||
58 | By setting lineout to 1 on the driver command line | ||
59 | (eg. insmod es1370 lineout=1) it is even possible on some | ||
60 | cards to convert the LINEIN jack into a second LINEOUT jack, thus | ||
61 | making it possible to output four independent audio channels! | ||
62 | |||
63 | There is a freely available software package that allows | ||
64 | MIDI file playback on this soundcard called Timidity. | ||
65 | See http://www.cgs.fi/~tt/timidity/. | ||
66 | |||
67 | |||
68 | |||
69 | Thomas Sailer | ||
70 | t.sailer@alumni.ethz.ch | ||
diff --git a/Documentation/sound/oss/es1371 b/Documentation/sound/oss/es1371 new file mode 100644 index 000000000000..c3151266771c --- /dev/null +++ b/Documentation/sound/oss/es1371 | |||
@@ -0,0 +1,64 @@ | |||
1 | /proc/sound, /dev/sndstat | ||
2 | ------------------------- | ||
3 | |||
4 | /proc/sound and /dev/sndstat is not supported by the | ||
5 | driver. To find out whether the driver succeeded loading, | ||
6 | check the kernel log (dmesg). | ||
7 | |||
8 | |||
9 | ALaw/uLaw sample formats | ||
10 | ------------------------ | ||
11 | |||
12 | This driver does not support the ALaw/uLaw sample formats. | ||
13 | ALaw is the default mode when opening a sound device | ||
14 | using OSS/Free. The reason for the lack of support is | ||
15 | that the hardware does not support these formats, and adding | ||
16 | conversion routines to the kernel would lead to very ugly | ||
17 | code in the presence of the mmap interface to the driver. | ||
18 | And since xquake uses mmap, mmap is considered important :-) | ||
19 | and no sane application uses ALaw/uLaw these days anyway. | ||
20 | In short, playing a Sun .au file as follows: | ||
21 | |||
22 | cat my_file.au > /dev/dsp | ||
23 | |||
24 | does not work. Instead, you may use the play script from | ||
25 | Chris Bagwell's sox-12.14 package (available from the URL | ||
26 | below) to play many different audio file formats. | ||
27 | The script automatically determines the audio format | ||
28 | and does do audio conversions if necessary. | ||
29 | http://home.sprynet.com/sprynet/cbagwell/projects.html | ||
30 | |||
31 | |||
32 | Blocking vs. nonblocking IO | ||
33 | --------------------------- | ||
34 | |||
35 | Unlike OSS/Free this driver honours the O_NONBLOCK file flag | ||
36 | not only during open, but also during read and write. | ||
37 | This is an effort to make the sound driver interface more | ||
38 | regular. Timidity has problems with this; a patch | ||
39 | is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html. | ||
40 | (Timidity patched will also run on OSS/Free). | ||
41 | |||
42 | |||
43 | MIDI UART | ||
44 | --------- | ||
45 | |||
46 | The driver supports a simple MIDI UART interface, with | ||
47 | no ioctl's supported. | ||
48 | |||
49 | |||
50 | MIDI synthesizer | ||
51 | ---------------- | ||
52 | |||
53 | This soundcard does not have any hardware MIDI synthesizer; | ||
54 | MIDI synthesis has to be done in software. To allow this | ||
55 | the driver/soundcard supports two PCM (/dev/dsp) interfaces. | ||
56 | |||
57 | There is a freely available software package that allows | ||
58 | MIDI file playback on this soundcard called Timidity. | ||
59 | See http://www.cgs.fi/~tt/timidity/. | ||
60 | |||
61 | |||
62 | |||
63 | Thomas Sailer | ||
64 | t.sailer@alumni.ethz.ch | ||
diff --git a/Documentation/sound/oss/mwave b/Documentation/sound/oss/mwave new file mode 100644 index 000000000000..858334bb46b0 --- /dev/null +++ b/Documentation/sound/oss/mwave | |||
@@ -0,0 +1,185 @@ | |||
1 | How to try to survive an IBM Mwave under Linux SB drivers | ||
2 | |||
3 | |||
4 | + IBM have now released documentation of sorts and Torsten is busy | ||
5 | trying to make the Mwave work. This is not however a trivial task. | ||
6 | |||
7 | ---------------------------------------------------------------------------- | ||
8 | |||
9 | OK, first thing - the IRQ problem IS a problem, whether the test is bypassed or | ||
10 | not. It is NOT a Linux problem, but an MWAVE problem that is fixed with the | ||
11 | latest MWAVE patches. So, in other words, don't bypass the test for MWAVES! | ||
12 | |||
13 | I have Windows 95 on /dev/hda1, swap on /dev/hda2, and Red Hat 5 on /dev/hda3. | ||
14 | |||
15 | The steps, then: | ||
16 | |||
17 | Boot to Linux. | ||
18 | Mount Windows 95 file system (assume mount point = /dos95). | ||
19 | mkdir /dos95/linux | ||
20 | mkdir /dos95/linux/boot | ||
21 | mkdir /dos95/linux/boot/parms | ||
22 | |||
23 | Copy the kernel, any initrd image, and loadlin to /dos95/linux/boot/. | ||
24 | |||
25 | Reboot to Windows 95. | ||
26 | |||
27 | Edit C:/msdos.sys and add or change the following: | ||
28 | |||
29 | Logo=0 | ||
30 | BootGUI=0 | ||
31 | |||
32 | Note that msdos.sys is a text file but it needs to be made 'unhidden', | ||
33 | readable and writable before it can be edited. This can be done with | ||
34 | DOS' "attrib" command. | ||
35 | |||
36 | Edit config.sys to have multiple config menus. I have one for windows 95 and | ||
37 | five for Linux, like this: | ||
38 | ------------ | ||
39 | [menu] | ||
40 | menuitem=W95, Windows 95 | ||
41 | menuitem=LINTP, Linux - ThinkPad | ||
42 | menuitem=LINTP3, Linux - ThinkPad Console | ||
43 | menuitem=LINDOC, Linux - Docked | ||
44 | menuitem=LINDOC3, Linux - Docked Console | ||
45 | menuitem=LIN1, Linux - Single User Mode | ||
46 | REM menudefault=W95,10 | ||
47 | |||
48 | [W95] | ||
49 | |||
50 | [LINTP] | ||
51 | |||
52 | [LINDOC] | ||
53 | |||
54 | [LINTP3] | ||
55 | |||
56 | [LINDOC3] | ||
57 | |||
58 | [LIN1] | ||
59 | |||
60 | [COMMON] | ||
61 | FILES=30 | ||
62 | REM Please read README.TXT in C:\MWW subdirectory before changing the DOS= statement. | ||
63 | DOS=HIGH,UMB | ||
64 | DEVICE=C:\MWW\MANAGER\MWD50430.EXE | ||
65 | SHELL=c:\command.com /e:2048 | ||
66 | ------------------- | ||
67 | |||
68 | The important things are the SHELL and DEVICE statements. | ||
69 | |||
70 | Then change autoexec.bat. Basically everything in there originally should be | ||
71 | done ONLY when Windows 95 is booted. Then you add new things specifically | ||
72 | for Linux. Mine is as follows | ||
73 | |||
74 | --------------- | ||
75 | @ECHO OFF | ||
76 | if "%CONFIG%" == "W95" goto W95 | ||
77 | |||
78 | REM | ||
79 | REM Linux stuff | ||
80 | REM | ||
81 | SET MWPATH=C:\MWW\DLL;C:\MWW\MWGAMES;C:\MWW\DSP | ||
82 | SET BLASTER=A220 I5 D1 | ||
83 | SET MWROOT=C:\MWW | ||
84 | SET LIBPATH=C:\MWW\DLL | ||
85 | SET PATH=C:\WINDOWS;C:\MWW\DLL; | ||
86 | CALL MWAVE START NOSHOW | ||
87 | c:\linux\boot\loadlin.exe @c:\linux\boot\parms\%CONFIG%.par | ||
88 | |||
89 | :W95 | ||
90 | REM | ||
91 | REM Windows 95 stuff | ||
92 | REM | ||
93 | c:\toolkit\guard | ||
94 | SET MSINPUT=C:\MSINPUT | ||
95 | SET MWPATH=C:\MWW\DLL;C:\MWW\MWGAMES;C:\MWW\DSP | ||
96 | REM The following is used by DOS games to recognize Sound Blaster hardware. | ||
97 | REM If hardware settings are changed, please change this line as well. | ||
98 | REM See the Mwave README file for instructions. | ||
99 | SET BLASTER=A220 I5 D1 | ||
100 | SET MWROOT=C:\MWW | ||
101 | SET LIBPATH=C:\MWW\DLL | ||
102 | SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;E:\ORAWIN95\BIN;f:\msdev\bin;e:\v30\bin.dbg;v:\devt\v30\bin;c:\JavaSDK\Bin;C:\MWW\DLL; | ||
103 | SET INCLUDE=f:\MSDEV\INCLUDE;F:\MSDEV\MFC\INCLUDE | ||
104 | SET LIB=F:\MSDEV\LIB;F:\MSDEV\MFC\LIB | ||
105 | win | ||
106 | |||
107 | ------------------------ | ||
108 | |||
109 | Now build a file in c:\linux\boot\parms for each Linux config that you have. | ||
110 | |||
111 | For example, my LINDOC3 config is for a docked Thinkpad at runlevel 3 with no | ||
112 | initrd image, and has a parameter file named LINDOC3.PAR in c:\linux\boot\parms: | ||
113 | |||
114 | ----------------------- | ||
115 | # LOADLIN @param_file image=other_image root=/dev/other | ||
116 | # | ||
117 | # Linux Console in docking station | ||
118 | # | ||
119 | c:\linux\boot\zImage.krn # First value must be filename of Linux kernel. | ||
120 | root=/dev/hda3 # device which gets mounted as root FS | ||
121 | ro # Other kernel arguments go here. | ||
122 | apm=off | ||
123 | doc=yes | ||
124 | 3 | ||
125 | ----------------------- | ||
126 | |||
127 | The doc=yes parameter is an environment variable used by my init scripts, not | ||
128 | a kernel argument. | ||
129 | |||
130 | However, the apm=off parameter IS a kernel argument! APM, at least in my setup, | ||
131 | causes the kernel to crash when loaded via loadlin (but NOT when loaded via | ||
132 | LILO). The APM stuff COULD be forced out of the kernel via the kernel compile | ||
133 | options. Instead, I got an unofficial patch to the APM drivers that allows them | ||
134 | to be dynamically deactivated via kernel arguments. Whatever you chose to | ||
135 | document, APM, it seems, MUST be off for setups like mine. | ||
136 | |||
137 | Now make sure C:\MWW\MWCONFIG.REF looks like this: | ||
138 | |||
139 | ---------------------- | ||
140 | [NativeDOS] | ||
141 | Default=SB1.5 | ||
142 | SBInputSource=CD | ||
143 | SYNTH=FM | ||
144 | QSound=OFF | ||
145 | Reverb=OFF | ||
146 | Chorus=OFF | ||
147 | ReverbDepth=5 | ||
148 | ChorusDepth=5 | ||
149 | SBInputVolume=5 | ||
150 | SBMainVolume=10 | ||
151 | SBWaveVolume=10 | ||
152 | SBSynthVolume=10 | ||
153 | WaveTableVolume=10 | ||
154 | AudioPowerDriver=ON | ||
155 | |||
156 | [FastCFG] | ||
157 | Show=No | ||
158 | HideOption=Off | ||
159 | ----------------------------- | ||
160 | |||
161 | OR the Default= line COULD be | ||
162 | |||
163 | Default=SBPRO | ||
164 | |||
165 | Reboot to Windows 95 and choose Linux. When booted, use sndconfig to configure | ||
166 | the sound modules and voilà - ThinkPad sound with Linux. | ||
167 | |||
168 | Now the gotchas - you can either have CD sound OR Mixers but not both. That's a | ||
169 | problem with the SB1.5 (CD sound) or SBPRO (Mixers) settings. No one knows why | ||
170 | this is! | ||
171 | |||
172 | For some reason MPEG3 files, when played through mpg123, sound like they | ||
173 | are playing at 1/8th speed - not very useful! If you have ANY insight | ||
174 | on why this second thing might be happening, I would be grateful. | ||
175 | |||
176 | =========================================================== | ||
177 | _/ _/_/_/_/ | ||
178 | _/_/ _/_/ _/ | ||
179 | _/ _/_/ _/_/_/_/ Martin John Bartlett | ||
180 | _/ _/ _/ _/ (martin@nitram.demon.co.uk) | ||
181 | _/ _/_/_/_/ | ||
182 | _/ | ||
183 | _/ _/ | ||
184 | _/_/ | ||
185 | =========================================================== | ||
diff --git a/Documentation/sound/oss/rme96xx b/Documentation/sound/oss/rme96xx new file mode 100644 index 000000000000..87d7b7b65fa1 --- /dev/null +++ b/Documentation/sound/oss/rme96xx | |||
@@ -0,0 +1,767 @@ | |||
1 | Beta release of the rme96xx (driver for RME 96XX cards like the | ||
2 | "Hammerfall" and the "Hammerfall light") | ||
3 | |||
4 | Important: The driver module has to be installed on a freshly rebooted system, | ||
5 | otherwise the driver might not be able to acquire its buffers. | ||
6 | |||
7 | features: | ||
8 | |||
9 | - OSS programming interface (i.e. runs with standard OSS soundsoftware) | ||
10 | - OSS/Multichannel interface (OSS multichannel is done by just aquiring | ||
11 | more than 2 channels). The driver does not use more than one device | ||
12 | ( yet .. this feature may be implemented later ) | ||
13 | - more than one RME card supported | ||
14 | |||
15 | The driver uses a specific multichannel interface, which I will document | ||
16 | when the driver gets stable. (take a look at the defines in rme96xx.h, | ||
17 | which adds blocked multichannel formats i.e instead of | ||
18 | lrlrlrlr --> llllrrrr etc. | ||
19 | |||
20 | Use the "rmectrl" programm to look at the status of the card .. | ||
21 | or use xrmectrl, a GUI interface for the ctrl program. | ||
22 | |||
23 | What you can do with the rmectrl program is to set the stereo device for | ||
24 | OSS emulation (e.g. if you use SPDIF out). | ||
25 | |||
26 | You do: | ||
27 | |||
28 | ./ctrl offset 24 24 | ||
29 | |||
30 | which makes the stereo device use channels 25 and 26. | ||
31 | |||
32 | Guenter Geiger <geiger@epy.co.at> | ||
33 | |||
34 | copy the first part of the attached source code into rmectrl.c | ||
35 | and the second part into xrmectrl (or get the program from | ||
36 | http://gige.xdv.org/pages/soft/pages/rme) | ||
37 | |||
38 | to compile: gcc -o rmectrl rmectrl.c | ||
39 | ------------------------------ snip ------------------------------------ | ||
40 | |||
41 | #include <stdio.h> | ||
42 | #include <sys/types.h> | ||
43 | #include <sys/stat.h> | ||
44 | #include <sys/ioctl.h> | ||
45 | #include <fcntl.h> | ||
46 | #include <linux/soundcard.h> | ||
47 | #include <math.h> | ||
48 | #include <unistd.h> | ||
49 | #include <stdlib.h> | ||
50 | #include "rme96xx.h" | ||
51 | |||
52 | /* | ||
53 | remctrl.c | ||
54 | (C) 2000 Guenter Geiger <geiger@debian.org> | ||
55 | HP20020201 - Heiko Purnhagen <purnhage@tnt.uni-hannover.de> | ||
56 | */ | ||
57 | |||
58 | /* # define DEVICE_NAME "/dev/mixer" */ | ||
59 | # define DEVICE_NAME "/dev/mixer1" | ||
60 | |||
61 | |||
62 | void usage(void) | ||
63 | { | ||
64 | fprintf(stderr,"usage: rmectrl [/dev/mixer<n>] [command [options]]\n\n"); | ||
65 | fprintf(stderr,"where command is one of:\n"); | ||
66 | fprintf(stderr," help show this help\n"); | ||
67 | fprintf(stderr," status show status bits\n"); | ||
68 | fprintf(stderr," control show control bits\n"); | ||
69 | fprintf(stderr," mix show mixer/offset status\n"); | ||
70 | fprintf(stderr," master <n> set sync master\n"); | ||
71 | fprintf(stderr," pro <n> set spdif out pro\n"); | ||
72 | fprintf(stderr," emphasis <n> set spdif out emphasis\n"); | ||
73 | fprintf(stderr," dolby <n> set spdif out no audio\n"); | ||
74 | fprintf(stderr," optout <n> set spdif out optical\n"); | ||
75 | fprintf(stderr," wordclock <n> set sync wordclock\n"); | ||
76 | fprintf(stderr," spdifin <n> set spdif in (0=optical,1=coax,2=intern)\n"); | ||
77 | fprintf(stderr," syncref <n> set sync source (0=ADAT1,1=ADAT2,2=ADAT3,3=SPDIF)\n"); | ||
78 | fprintf(stderr," adat1cd <n> set ADAT1 on internal CD\n"); | ||
79 | fprintf(stderr," offset <devnr> <in> <out> set dev (0..3) offset (0..25)\n"); | ||
80 | exit(-1); | ||
81 | } | ||
82 | |||
83 | |||
84 | int main(int argc, char* argv[]) | ||
85 | { | ||
86 | int cards; | ||
87 | int ret; | ||
88 | int i; | ||
89 | double ft; | ||
90 | int fd, fdwr; | ||
91 | int param,orig; | ||
92 | rme_status_t stat; | ||
93 | rme_ctrl_t ctrl; | ||
94 | char *device; | ||
95 | int argidx; | ||
96 | |||
97 | if (argc < 2) | ||
98 | usage(); | ||
99 | |||
100 | if (*argv[1]=='/') { | ||
101 | device = argv[1]; | ||
102 | argidx = 2; | ||
103 | } | ||
104 | else { | ||
105 | device = DEVICE_NAME; | ||
106 | argidx = 1; | ||
107 | } | ||
108 | |||
109 | fprintf(stdout,"mixer device %s\n",device); | ||
110 | if ((fd = open(device,O_RDONLY)) < 0) { | ||
111 | fprintf(stdout,"opening device failed\n"); | ||
112 | exit(-1); | ||
113 | } | ||
114 | |||
115 | if ((fdwr = open(device,O_WRONLY)) < 0) { | ||
116 | fprintf(stdout,"opening device failed\n"); | ||
117 | exit(-1); | ||
118 | } | ||
119 | |||
120 | if (argc < argidx+1) | ||
121 | usage(); | ||
122 | |||
123 | if (!strcmp(argv[argidx],"help")) | ||
124 | usage(); | ||
125 | if (!strcmp(argv[argidx],"-h")) | ||
126 | usage(); | ||
127 | if (!strcmp(argv[argidx],"--help")) | ||
128 | usage(); | ||
129 | |||
130 | if (!strcmp(argv[argidx],"status")) { | ||
131 | ioctl(fd,SOUND_MIXER_PRIVATE2,&stat); | ||
132 | fprintf(stdout,"stat.irq %d\n",stat.irq); | ||
133 | fprintf(stdout,"stat.lockmask %d\n",stat.lockmask); | ||
134 | fprintf(stdout,"stat.sr48 %d\n",stat.sr48); | ||
135 | fprintf(stdout,"stat.wclock %d\n",stat.wclock); | ||
136 | fprintf(stdout,"stat.bufpoint %d\n",stat.bufpoint); | ||
137 | fprintf(stdout,"stat.syncmask %d\n",stat.syncmask); | ||
138 | fprintf(stdout,"stat.doublespeed %d\n",stat.doublespeed); | ||
139 | fprintf(stdout,"stat.tc_busy %d\n",stat.tc_busy); | ||
140 | fprintf(stdout,"stat.tc_out %d\n",stat.tc_out); | ||
141 | fprintf(stdout,"stat.crystalrate %d (0=64k 3=96k 4=88.2k 5=48k 6=44.1k 7=32k)\n",stat.crystalrate); | ||
142 | fprintf(stdout,"stat.spdif_error %d\n",stat.spdif_error); | ||
143 | fprintf(stdout,"stat.bufid %d\n",stat.bufid); | ||
144 | fprintf(stdout,"stat.tc_valid %d\n",stat.tc_valid); | ||
145 | exit (0); | ||
146 | } | ||
147 | |||
148 | if (!strcmp(argv[argidx],"control")) { | ||
149 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
150 | fprintf(stdout,"ctrl.start %d\n",ctrl.start); | ||
151 | fprintf(stdout,"ctrl.latency %d (0=64 .. 7=8192)\n",ctrl.latency); | ||
152 | fprintf(stdout,"ctrl.master %d\n",ctrl.master); | ||
153 | fprintf(stdout,"ctrl.ie %d\n",ctrl.ie); | ||
154 | fprintf(stdout,"ctrl.sr48 %d\n",ctrl.sr48); | ||
155 | fprintf(stdout,"ctrl.spare %d\n",ctrl.spare); | ||
156 | fprintf(stdout,"ctrl.doublespeed %d\n",ctrl.doublespeed); | ||
157 | fprintf(stdout,"ctrl.pro %d\n",ctrl.pro); | ||
158 | fprintf(stdout,"ctrl.emphasis %d\n",ctrl.emphasis); | ||
159 | fprintf(stdout,"ctrl.dolby %d\n",ctrl.dolby); | ||
160 | fprintf(stdout,"ctrl.opt_out %d\n",ctrl.opt_out); | ||
161 | fprintf(stdout,"ctrl.wordclock %d\n",ctrl.wordclock); | ||
162 | fprintf(stdout,"ctrl.spdif_in %d (0=optical,1=coax,2=intern)\n",ctrl.spdif_in); | ||
163 | fprintf(stdout,"ctrl.sync_ref %d (0=ADAT1,1=ADAT2,2=ADAT3,3=SPDIF)\n",ctrl.sync_ref); | ||
164 | fprintf(stdout,"ctrl.spdif_reset %d\n",ctrl.spdif_reset); | ||
165 | fprintf(stdout,"ctrl.spdif_select %d\n",ctrl.spdif_select); | ||
166 | fprintf(stdout,"ctrl.spdif_clock %d\n",ctrl.spdif_clock); | ||
167 | fprintf(stdout,"ctrl.spdif_write %d\n",ctrl.spdif_write); | ||
168 | fprintf(stdout,"ctrl.adat1_cd %d\n",ctrl.adat1_cd); | ||
169 | exit (0); | ||
170 | } | ||
171 | |||
172 | if (!strcmp(argv[argidx],"mix")) { | ||
173 | rme_mixer mix; | ||
174 | int i; | ||
175 | |||
176 | for (i=0; i<4; i++) { | ||
177 | mix.devnr = i; | ||
178 | ioctl(fd,SOUND_MIXER_PRIVATE1,&mix); | ||
179 | if (mix.devnr == i) { | ||
180 | fprintf(stdout,"devnr %d\n",mix.devnr); | ||
181 | fprintf(stdout,"mix.i_offset %2d (0-25)\n",mix.i_offset); | ||
182 | fprintf(stdout,"mix.o_offset %2d (0-25)\n",mix.o_offset); | ||
183 | } | ||
184 | } | ||
185 | exit (0); | ||
186 | } | ||
187 | |||
188 | /* the control flags */ | ||
189 | |||
190 | if (argc < argidx+2) | ||
191 | usage(); | ||
192 | |||
193 | if (!strcmp(argv[argidx],"master")) { | ||
194 | int val = atoi(argv[argidx+1]); | ||
195 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
196 | printf("master = %d\n",val); | ||
197 | ctrl.master = val; | ||
198 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
199 | exit (0); | ||
200 | } | ||
201 | |||
202 | if (!strcmp(argv[argidx],"pro")) { | ||
203 | int val = atoi(argv[argidx+1]); | ||
204 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
205 | printf("pro = %d\n",val); | ||
206 | ctrl.pro = val; | ||
207 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
208 | exit (0); | ||
209 | } | ||
210 | |||
211 | if (!strcmp(argv[argidx],"emphasis")) { | ||
212 | int val = atoi(argv[argidx+1]); | ||
213 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
214 | printf("emphasis = %d\n",val); | ||
215 | ctrl.emphasis = val; | ||
216 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
217 | exit (0); | ||
218 | } | ||
219 | |||
220 | if (!strcmp(argv[argidx],"dolby")) { | ||
221 | int val = atoi(argv[argidx+1]); | ||
222 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
223 | printf("dolby = %d\n",val); | ||
224 | ctrl.dolby = val; | ||
225 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
226 | exit (0); | ||
227 | } | ||
228 | |||
229 | if (!strcmp(argv[argidx],"optout")) { | ||
230 | int val = atoi(argv[argidx+1]); | ||
231 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
232 | printf("optout = %d\n",val); | ||
233 | ctrl.opt_out = val; | ||
234 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
235 | exit (0); | ||
236 | } | ||
237 | |||
238 | if (!strcmp(argv[argidx],"wordclock")) { | ||
239 | int val = atoi(argv[argidx+1]); | ||
240 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
241 | printf("wordclock = %d\n",val); | ||
242 | ctrl.wordclock = val; | ||
243 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
244 | exit (0); | ||
245 | } | ||
246 | |||
247 | if (!strcmp(argv[argidx],"spdifin")) { | ||
248 | int val = atoi(argv[argidx+1]); | ||
249 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
250 | printf("spdifin = %d\n",val); | ||
251 | ctrl.spdif_in = val; | ||
252 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
253 | exit (0); | ||
254 | } | ||
255 | |||
256 | if (!strcmp(argv[argidx],"syncref")) { | ||
257 | int val = atoi(argv[argidx+1]); | ||
258 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
259 | printf("syncref = %d\n",val); | ||
260 | ctrl.sync_ref = val; | ||
261 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
262 | exit (0); | ||
263 | } | ||
264 | |||
265 | if (!strcmp(argv[argidx],"adat1cd")) { | ||
266 | int val = atoi(argv[argidx+1]); | ||
267 | ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); | ||
268 | printf("adat1cd = %d\n",val); | ||
269 | ctrl.adat1_cd = val; | ||
270 | ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); | ||
271 | exit (0); | ||
272 | } | ||
273 | |||
274 | /* setting offset */ | ||
275 | |||
276 | if (argc < argidx+4) | ||
277 | usage(); | ||
278 | |||
279 | if (!strcmp(argv[argidx],"offset")) { | ||
280 | rme_mixer mix; | ||
281 | |||
282 | mix.devnr = atoi(argv[argidx+1]); | ||
283 | |||
284 | mix.i_offset = atoi(argv[argidx+2]); | ||
285 | mix.o_offset = atoi(argv[argidx+3]); | ||
286 | ioctl(fdwr,SOUND_MIXER_PRIVATE1,&mix); | ||
287 | fprintf(stdout,"devnr %d\n",mix.devnr); | ||
288 | fprintf(stdout,"mix.i_offset to %d\n",mix.i_offset); | ||
289 | fprintf(stdout,"mix.o_offset to %d\n",mix.o_offset); | ||
290 | exit (0); | ||
291 | } | ||
292 | |||
293 | usage(); | ||
294 | exit (0); /* to avoid warning */ | ||
295 | } | ||
296 | |||
297 | |||
298 | ---------------------------- <snip> -------------------------------- | ||
299 | #!/usr/bin/wish | ||
300 | |||
301 | # xrmectrl | ||
302 | # (C) 2000 Guenter Geiger <geiger@debian.org> | ||
303 | # HP20020201 - Heiko Purnhagen <purnhage@tnt.uni-hannover.de> | ||
304 | |||
305 | #set defaults "-relief ridged" | ||
306 | set CTRLPROG "./rmectrl" | ||
307 | if {$argc} { | ||
308 | set CTRLPROG "$CTRLPROG $argv" | ||
309 | } | ||
310 | puts "CTRLPROG $CTRLPROG" | ||
311 | |||
312 | frame .butts | ||
313 | button .butts.exit -text "Exit" -command "exit" -relief ridge | ||
314 | #button .butts.state -text "State" -command "get_all" | ||
315 | |||
316 | pack .butts.exit -side left | ||
317 | pack .butts -side bottom | ||
318 | |||
319 | |||
320 | # | ||
321 | # STATUS | ||
322 | # | ||
323 | |||
324 | frame .status | ||
325 | |||
326 | # Sampling Rate | ||
327 | |||
328 | frame .status.sr | ||
329 | label .status.sr.text -text "Sampling Rate" -justify left | ||
330 | radiobutton .status.sr.441 -selectcolor red -text "44.1 kHz" -width 10 -anchor nw -variable srate -value 44100 -font times | ||
331 | radiobutton .status.sr.480 -selectcolor red -text "48 kHz" -width 10 -anchor nw -variable srate -value 48000 -font times | ||
332 | radiobutton .status.sr.882 -selectcolor red -text "88.2 kHz" -width 10 -anchor nw -variable srate -value 88200 -font times | ||
333 | radiobutton .status.sr.960 -selectcolor red -text "96 kHz" -width 10 -anchor nw -variable srate -value 96000 -font times | ||
334 | |||
335 | pack .status.sr.text .status.sr.441 .status.sr.480 .status.sr.882 .status.sr.960 -side top -padx 3 | ||
336 | |||
337 | # Lock | ||
338 | |||
339 | frame .status.lock | ||
340 | label .status.lock.text -text "Lock" -justify left | ||
341 | checkbutton .status.lock.adat1 -selectcolor red -text "ADAT1" -anchor nw -width 10 -variable adatlock1 -font times | ||
342 | checkbutton .status.lock.adat2 -selectcolor red -text "ADAT2" -anchor nw -width 10 -variable adatlock2 -font times | ||
343 | checkbutton .status.lock.adat3 -selectcolor red -text "ADAT3" -anchor nw -width 10 -variable adatlock3 -font times | ||
344 | |||
345 | pack .status.lock.text .status.lock.adat1 .status.lock.adat2 .status.lock.adat3 -side top -padx 3 | ||
346 | |||
347 | # Sync | ||
348 | |||
349 | frame .status.sync | ||
350 | label .status.sync.text -text "Sync" -justify left | ||
351 | checkbutton .status.sync.adat1 -selectcolor red -text "ADAT1" -anchor nw -width 10 -variable adatsync1 -font times | ||
352 | checkbutton .status.sync.adat2 -selectcolor red -text "ADAT2" -anchor nw -width 10 -variable adatsync2 -font times | ||
353 | checkbutton .status.sync.adat3 -selectcolor red -text "ADAT3" -anchor nw -width 10 -variable adatsync3 -font times | ||
354 | |||
355 | pack .status.sync.text .status.sync.adat1 .status.sync.adat2 .status.sync.adat3 -side top -padx 3 | ||
356 | |||
357 | # Timecode | ||
358 | |||
359 | frame .status.tc | ||
360 | label .status.tc.text -text "Timecode" -justify left | ||
361 | checkbutton .status.tc.busy -selectcolor red -text "busy" -anchor nw -width 10 -variable tcbusy -font times | ||
362 | checkbutton .status.tc.out -selectcolor red -text "out" -anchor nw -width 10 -variable tcout -font times | ||
363 | checkbutton .status.tc.valid -selectcolor red -text "valid" -anchor nw -width 10 -variable tcvalid -font times | ||
364 | |||
365 | pack .status.tc.text .status.tc.busy .status.tc.out .status.tc.valid -side top -padx 3 | ||
366 | |||
367 | # SPDIF In | ||
368 | |||
369 | frame .status.spdif | ||
370 | label .status.spdif.text -text "SPDIF In" -justify left | ||
371 | label .status.spdif.sr -text "--.- kHz" -anchor n -width 10 -font times | ||
372 | checkbutton .status.spdif.error -selectcolor red -text "Input Lock" -anchor nw -width 10 -variable spdiferr -font times | ||
373 | |||
374 | pack .status.spdif.text .status.spdif.sr .status.spdif.error -side top -padx 3 | ||
375 | |||
376 | pack .status.sr .status.lock .status.sync .status.tc .status.spdif -side left -fill x -anchor n -expand 1 | ||
377 | |||
378 | |||
379 | # | ||
380 | # CONTROL | ||
381 | # | ||
382 | |||
383 | proc setprof {} { | ||
384 | global CTRLPROG | ||
385 | global spprof | ||
386 | exec $CTRLPROG pro $spprof | ||
387 | } | ||
388 | |||
389 | proc setemph {} { | ||
390 | global CTRLPROG | ||
391 | global spemph | ||
392 | exec $CTRLPROG emphasis $spemph | ||
393 | } | ||
394 | |||
395 | proc setnoaud {} { | ||
396 | global CTRLPROG | ||
397 | global spnoaud | ||
398 | exec $CTRLPROG dolby $spnoaud | ||
399 | } | ||
400 | |||
401 | proc setoptical {} { | ||
402 | global CTRLPROG | ||
403 | global spoptical | ||
404 | exec $CTRLPROG optout $spoptical | ||
405 | } | ||
406 | |||
407 | proc setspdifin {} { | ||
408 | global CTRLPROG | ||
409 | global spdifin | ||
410 | exec $CTRLPROG spdifin [expr $spdifin - 1] | ||
411 | } | ||
412 | |||
413 | proc setsyncsource {} { | ||
414 | global CTRLPROG | ||
415 | global syncsource | ||
416 | exec $CTRLPROG syncref [expr $syncsource -1] | ||
417 | } | ||
418 | |||
419 | |||
420 | proc setmaster {} { | ||
421 | global CTRLPROG | ||
422 | global master | ||
423 | exec $CTRLPROG master $master | ||
424 | } | ||
425 | |||
426 | proc setwordclock {} { | ||
427 | global CTRLPROG | ||
428 | global wordclock | ||
429 | exec $CTRLPROG wordclock $wordclock | ||
430 | } | ||
431 | |||
432 | proc setadat1cd {} { | ||
433 | global CTRLPROG | ||
434 | global adat1cd | ||
435 | exec $CTRLPROG adat1cd $adat1cd | ||
436 | } | ||
437 | |||
438 | |||
439 | frame .control | ||
440 | |||
441 | # SPDIF In & SPDIF Out | ||
442 | |||
443 | |||
444 | frame .control.spdif | ||
445 | |||
446 | frame .control.spdif.in | ||
447 | label .control.spdif.in.text -text "SPDIF In" -justify left | ||
448 | radiobutton .control.spdif.in.input1 -text "Optical" -anchor nw -width 13 -variable spdifin -value 1 -command setspdifin -selectcolor blue -font times | ||
449 | radiobutton .control.spdif.in.input2 -text "Coaxial" -anchor nw -width 13 -variable spdifin -value 2 -command setspdifin -selectcolor blue -font times | ||
450 | radiobutton .control.spdif.in.input3 -text "Intern " -anchor nw -width 13 -variable spdifin -command setspdifin -value 3 -selectcolor blue -font times | ||
451 | |||
452 | checkbutton .control.spdif.in.adat1cd -text "ADAT1 Intern" -anchor nw -width 13 -variable adat1cd -command setadat1cd -selectcolor blue -font times | ||
453 | |||
454 | pack .control.spdif.in.text .control.spdif.in.input1 .control.spdif.in.input2 .control.spdif.in.input3 .control.spdif.in.adat1cd | ||
455 | |||
456 | label .control.spdif.space | ||
457 | |||
458 | frame .control.spdif.out | ||
459 | label .control.spdif.out.text -text "SPDIF Out" -justify left | ||
460 | checkbutton .control.spdif.out.pro -text "Professional" -anchor nw -width 13 -variable spprof -command setprof -selectcolor blue -font times | ||
461 | checkbutton .control.spdif.out.emphasis -text "Emphasis" -anchor nw -width 13 -variable spemph -command setemph -selectcolor blue -font times | ||
462 | checkbutton .control.spdif.out.dolby -text "NoAudio" -anchor nw -width 13 -variable spnoaud -command setnoaud -selectcolor blue -font times | ||
463 | checkbutton .control.spdif.out.optout -text "Optical Out" -anchor nw -width 13 -variable spoptical -command setoptical -selectcolor blue -font times | ||
464 | |||
465 | pack .control.spdif.out.optout .control.spdif.out.dolby .control.spdif.out.emphasis .control.spdif.out.pro .control.spdif.out.text -side bottom | ||
466 | |||
467 | pack .control.spdif.in .control.spdif.space .control.spdif.out -side top -fill y -padx 3 -expand 1 | ||
468 | |||
469 | # Sync Mode & Sync Source | ||
470 | |||
471 | frame .control.sync | ||
472 | frame .control.sync.mode | ||
473 | label .control.sync.mode.text -text "Sync Mode" -justify left | ||
474 | checkbutton .control.sync.mode.master -text "Master" -anchor nw -width 13 -variable master -command setmaster -selectcolor blue -font times | ||
475 | checkbutton .control.sync.mode.wc -text "Wordclock" -anchor nw -width 13 -variable wordclock -command setwordclock -selectcolor blue -font times | ||
476 | |||
477 | pack .control.sync.mode.text .control.sync.mode.master .control.sync.mode.wc | ||
478 | |||
479 | label .control.sync.space | ||
480 | |||
481 | frame .control.sync.src | ||
482 | label .control.sync.src.text -text "Sync Source" -justify left | ||
483 | radiobutton .control.sync.src.input1 -text "ADAT1" -anchor nw -width 13 -variable syncsource -value 1 -command setsyncsource -selectcolor blue -font times | ||
484 | radiobutton .control.sync.src.input2 -text "ADAT2" -anchor nw -width 13 -variable syncsource -value 2 -command setsyncsource -selectcolor blue -font times | ||
485 | radiobutton .control.sync.src.input3 -text "ADAT3" -anchor nw -width 13 -variable syncsource -command setsyncsource -value 3 -selectcolor blue -font times | ||
486 | radiobutton .control.sync.src.input4 -text "SPDIF" -anchor nw -width 13 -variable syncsource -command setsyncsource -value 4 -selectcolor blue -font times | ||
487 | |||
488 | pack .control.sync.src.input4 .control.sync.src.input3 .control.sync.src.input2 .control.sync.src.input1 .control.sync.src.text -side bottom | ||
489 | |||
490 | pack .control.sync.mode .control.sync.space .control.sync.src -side top -fill y -padx 3 -expand 1 | ||
491 | |||
492 | label .control.space -text "" -width 10 | ||
493 | |||
494 | # Buffer Size | ||
495 | |||
496 | frame .control.buf | ||
497 | label .control.buf.text -text "Buffer Size (Latency)" -justify left | ||
498 | radiobutton .control.buf.b1 -selectcolor red -text "64 (1.5 ms)" -width 13 -anchor nw -variable ssrate -value 1 -font times | ||
499 | radiobutton .control.buf.b2 -selectcolor red -text "128 (3 ms)" -width 13 -anchor nw -variable ssrate -value 2 -font times | ||
500 | radiobutton .control.buf.b3 -selectcolor red -text "256 (6 ms)" -width 13 -anchor nw -variable ssrate -value 3 -font times | ||
501 | radiobutton .control.buf.b4 -selectcolor red -text "512 (12 ms)" -width 13 -anchor nw -variable ssrate -value 4 -font times | ||
502 | radiobutton .control.buf.b5 -selectcolor red -text "1024 (23 ms)" -width 13 -anchor nw -variable ssrate -value 5 -font times | ||
503 | radiobutton .control.buf.b6 -selectcolor red -text "2048 (46 ms)" -width 13 -anchor nw -variable ssrate -value 6 -font times | ||
504 | radiobutton .control.buf.b7 -selectcolor red -text "4096 (93 ms)" -width 13 -anchor nw -variable ssrate -value 7 -font times | ||
505 | radiobutton .control.buf.b8 -selectcolor red -text "8192 (186 ms)" -width 13 -anchor nw -variable ssrate -value 8 -font times | ||
506 | |||
507 | pack .control.buf.text .control.buf.b1 .control.buf.b2 .control.buf.b3 .control.buf.b4 .control.buf.b5 .control.buf.b6 .control.buf.b7 .control.buf.b8 -side top -padx 3 | ||
508 | |||
509 | # Offset | ||
510 | |||
511 | frame .control.offset | ||
512 | |||
513 | frame .control.offset.in | ||
514 | label .control.offset.in.text -text "Offset In" -justify left | ||
515 | label .control.offset.in.off0 -text "dev\#0: -" -anchor nw -width 10 -font times | ||
516 | label .control.offset.in.off1 -text "dev\#1: -" -anchor nw -width 10 -font times | ||
517 | label .control.offset.in.off2 -text "dev\#2: -" -anchor nw -width 10 -font times | ||
518 | label .control.offset.in.off3 -text "dev\#3: -" -anchor nw -width 10 -font times | ||
519 | |||
520 | pack .control.offset.in.text .control.offset.in.off0 .control.offset.in.off1 .control.offset.in.off2 .control.offset.in.off3 | ||
521 | |||
522 | label .control.offset.space | ||
523 | |||
524 | frame .control.offset.out | ||
525 | label .control.offset.out.text -text "Offset Out" -justify left | ||
526 | label .control.offset.out.off0 -text "dev\#0: -" -anchor nw -width 10 -font times | ||
527 | label .control.offset.out.off1 -text "dev\#1: -" -anchor nw -width 10 -font times | ||
528 | label .control.offset.out.off2 -text "dev\#2: -" -anchor nw -width 10 -font times | ||
529 | label .control.offset.out.off3 -text "dev\#3: -" -anchor nw -width 10 -font times | ||
530 | |||
531 | pack .control.offset.out.off3 .control.offset.out.off2 .control.offset.out.off1 .control.offset.out.off0 .control.offset.out.text -side bottom | ||
532 | |||
533 | pack .control.offset.in .control.offset.space .control.offset.out -side top -fill y -padx 3 -expand 1 | ||
534 | |||
535 | |||
536 | pack .control.spdif .control.sync .control.space .control.buf .control.offset -side left -fill both -anchor n -expand 1 | ||
537 | |||
538 | |||
539 | label .statustext -text Status -justify center -relief ridge | ||
540 | label .controltext -text Control -justify center -relief ridge | ||
541 | |||
542 | label .statusspace | ||
543 | label .controlspace | ||
544 | |||
545 | pack .statustext .status .statusspace .controltext .control .controlspace -side top -anchor nw -fill both -expand 1 | ||
546 | |||
547 | |||
548 | proc get_bit {output sstr} { | ||
549 | set idx1 [string last [concat $sstr 1] $output] | ||
550 | set idx1 [expr $idx1 != -1] | ||
551 | return $idx1 | ||
552 | } | ||
553 | |||
554 | proc get_val {output sstr} { | ||
555 | set val [string wordend $output [string last $sstr $output]] | ||
556 | set val [string range $output $val [expr $val+1]] | ||
557 | return $val | ||
558 | } | ||
559 | |||
560 | proc get_val2 {output sstr} { | ||
561 | set val [string wordend $output [string first $sstr $output]] | ||
562 | set val [string range $output $val [expr $val+2]] | ||
563 | return $val | ||
564 | } | ||
565 | |||
566 | proc get_control {} { | ||
567 | global spprof | ||
568 | global spemph | ||
569 | global spnoaud | ||
570 | global spoptical | ||
571 | global spdifin | ||
572 | global ssrate | ||
573 | global master | ||
574 | global wordclock | ||
575 | global syncsource | ||
576 | global CTRLPROG | ||
577 | |||
578 | set f [open "| $CTRLPROG control" r+] | ||
579 | set ooo [read $f 1000] | ||
580 | close $f | ||
581 | # puts $ooo | ||
582 | |||
583 | set spprof [ get_bit $ooo "pro"] | ||
584 | set spemph [ get_bit $ooo "emphasis"] | ||
585 | set spnoaud [ get_bit $ooo "dolby"] | ||
586 | set spoptical [ get_bit $ooo "opt_out"] | ||
587 | set spdifin [ expr [ get_val $ooo "spdif_in"] + 1] | ||
588 | set ssrate [ expr [ get_val $ooo "latency"] + 1] | ||
589 | set master [ expr [ get_val $ooo "master"]] | ||
590 | set wordclock [ expr [ get_val $ooo "wordclock"]] | ||
591 | set syncsource [ expr [ get_val $ooo "sync_ref"] + 1] | ||
592 | } | ||
593 | |||
594 | proc get_status {} { | ||
595 | global srate | ||
596 | global ctrlcom | ||
597 | |||
598 | global adatlock1 | ||
599 | global adatlock2 | ||
600 | global adatlock3 | ||
601 | |||
602 | global adatsync1 | ||
603 | global adatsync2 | ||
604 | global adatsync3 | ||
605 | |||
606 | global tcbusy | ||
607 | global tcout | ||
608 | global tcvalid | ||
609 | |||
610 | global spdiferr | ||
611 | global crystal | ||
612 | global .status.spdif.text | ||
613 | global CTRLPROG | ||
614 | |||
615 | |||
616 | set f [open "| $CTRLPROG status" r+] | ||
617 | set ooo [read $f 1000] | ||
618 | close $f | ||
619 | # puts $ooo | ||
620 | |||
621 | # samplerate | ||
622 | |||
623 | set idx1 [string last "sr48 1" $ooo] | ||
624 | set idx2 [string last "doublespeed 1" $ooo] | ||
625 | if {$idx1 >= 0} { | ||
626 | set fact1 48000 | ||
627 | } else { | ||
628 | set fact1 44100 | ||
629 | } | ||
630 | |||
631 | if {$idx2 >= 0} { | ||
632 | set fact2 2 | ||
633 | } else { | ||
634 | set fact2 1 | ||
635 | } | ||
636 | set srate [expr $fact1 * $fact2] | ||
637 | # ADAT lock | ||
638 | |||
639 | set val [get_val $ooo lockmask] | ||
640 | set adatlock1 0 | ||
641 | set adatlock2 0 | ||
642 | set adatlock3 0 | ||
643 | if {[expr $val & 1]} { | ||
644 | set adatlock3 1 | ||
645 | } | ||
646 | if {[expr $val & 2]} { | ||
647 | set adatlock2 1 | ||
648 | } | ||
649 | if {[expr $val & 4]} { | ||
650 | set adatlock1 1 | ||
651 | } | ||
652 | |||
653 | # ADAT sync | ||
654 | set val [get_val $ooo syncmask] | ||
655 | set adatsync1 0 | ||
656 | set adatsync2 0 | ||
657 | set adatsync3 0 | ||
658 | |||
659 | if {[expr $val & 1]} { | ||
660 | set adatsync3 1 | ||
661 | } | ||
662 | if {[expr $val & 2]} { | ||
663 | set adatsync2 1 | ||
664 | } | ||
665 | if {[expr $val & 4]} { | ||
666 | set adatsync1 1 | ||
667 | } | ||
668 | |||
669 | # TC busy | ||
670 | |||
671 | set tcbusy [get_bit $ooo "busy"] | ||
672 | set tcout [get_bit $ooo "out"] | ||
673 | set tcvalid [get_bit $ooo "valid"] | ||
674 | set spdiferr [expr [get_bit $ooo "spdif_error"] == 0] | ||
675 | |||
676 | # 000=64kHz, 100=88.2kHz, 011=96kHz | ||
677 | # 111=32kHz, 110=44.1kHz, 101=48kHz | ||
678 | |||
679 | set val [get_val $ooo crystalrate] | ||
680 | |||
681 | set crystal "--.- kHz" | ||
682 | if {$val == 0} { | ||
683 | set crystal "64 kHz" | ||
684 | } | ||
685 | if {$val == 4} { | ||
686 | set crystal "88.2 kHz" | ||
687 | } | ||
688 | if {$val == 3} { | ||
689 | set crystal "96 kHz" | ||
690 | } | ||
691 | if {$val == 7} { | ||
692 | set crystal "32 kHz" | ||
693 | } | ||
694 | if {$val == 6} { | ||
695 | set crystal "44.1 kHz" | ||
696 | } | ||
697 | if {$val == 5} { | ||
698 | set crystal "48 kHz" | ||
699 | } | ||
700 | .status.spdif.sr configure -text $crystal | ||
701 | } | ||
702 | |||
703 | proc get_offset {} { | ||
704 | global inoffset | ||
705 | global outoffset | ||
706 | global CTRLPROG | ||
707 | |||
708 | set f [open "| $CTRLPROG mix" r+] | ||
709 | set ooo [read $f 1000] | ||
710 | close $f | ||
711 | # puts $ooo | ||
712 | |||
713 | if { [string match "*devnr*" $ooo] } { | ||
714 | set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] | ||
715 | set val [get_val2 $ooo i_offset] | ||
716 | .control.offset.in.off0 configure -text "dev\#0: $val" | ||
717 | set val [get_val2 $ooo o_offset] | ||
718 | .control.offset.out.off0 configure -text "dev\#0: $val" | ||
719 | } else { | ||
720 | .control.offset.in.off0 configure -text "dev\#0: -" | ||
721 | .control.offset.out.off0 configure -text "dev\#0: -" | ||
722 | } | ||
723 | if { [string match "*devnr*" $ooo] } { | ||
724 | set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] | ||
725 | set val [get_val2 $ooo i_offset] | ||
726 | .control.offset.in.off1 configure -text "dev\#1: $val" | ||
727 | set val [get_val2 $ooo o_offset] | ||
728 | .control.offset.out.off1 configure -text "dev\#1: $val" | ||
729 | } else { | ||
730 | .control.offset.in.off1 configure -text "dev\#1: -" | ||
731 | .control.offset.out.off1 configure -text "dev\#1: -" | ||
732 | } | ||
733 | if { [string match "*devnr*" $ooo] } { | ||
734 | set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] | ||
735 | set val [get_val2 $ooo i_offset] | ||
736 | .control.offset.in.off2 configure -text "dev\#2: $val" | ||
737 | set val [get_val2 $ooo o_offset] | ||
738 | .control.offset.out.off2 configure -text "dev\#2: $val" | ||
739 | } else { | ||
740 | .control.offset.in.off2 configure -text "dev\#2: -" | ||
741 | .control.offset.out.off2 configure -text "dev\#2: -" | ||
742 | } | ||
743 | if { [string match "*devnr*" $ooo] } { | ||
744 | set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] | ||
745 | set val [get_val2 $ooo i_offset] | ||
746 | .control.offset.in.off3 configure -text "dev\#3: $val" | ||
747 | set val [get_val2 $ooo o_offset] | ||
748 | .control.offset.out.off3 configure -text "dev\#3: $val" | ||
749 | } else { | ||
750 | .control.offset.in.off3 configure -text "dev\#3: -" | ||
751 | .control.offset.out.off3 configure -text "dev\#3: -" | ||
752 | } | ||
753 | } | ||
754 | |||
755 | |||
756 | proc get_all {} { | ||
757 | get_status | ||
758 | get_control | ||
759 | get_offset | ||
760 | } | ||
761 | |||
762 | # main | ||
763 | while {1} { | ||
764 | after 200 | ||
765 | get_all | ||
766 | update | ||
767 | } | ||
diff --git a/Documentation/sound/oss/solo1 b/Documentation/sound/oss/solo1 new file mode 100644 index 000000000000..6f53d407d027 --- /dev/null +++ b/Documentation/sound/oss/solo1 | |||
@@ -0,0 +1,70 @@ | |||
1 | Recording | ||
2 | --------- | ||
3 | |||
4 | Recording does not work on the author's card, but there | ||
5 | is at least one report of it working on later silicon. | ||
6 | The chip behaves differently than described in the data sheet, | ||
7 | likely due to a chip bug. Working around this would require | ||
8 | the help of ESS (for example by publishing an errata sheet), | ||
9 | but ESS has not done so so far. | ||
10 | |||
11 | Also, the chip only supports 24 bit addresses for recording, | ||
12 | which means it cannot work on some Alpha mainboards. | ||
13 | |||
14 | |||
15 | /proc/sound, /dev/sndstat | ||
16 | ------------------------- | ||
17 | |||
18 | /proc/sound and /dev/sndstat is not supported by the | ||
19 | driver. To find out whether the driver succeeded loading, | ||
20 | check the kernel log (dmesg). | ||
21 | |||
22 | |||
23 | ALaw/uLaw sample formats | ||
24 | ------------------------ | ||
25 | |||
26 | This driver does not support the ALaw/uLaw sample formats. | ||
27 | ALaw is the default mode when opening a sound device | ||
28 | using OSS/Free. The reason for the lack of support is | ||
29 | that the hardware does not support these formats, and adding | ||
30 | conversion routines to the kernel would lead to very ugly | ||
31 | code in the presence of the mmap interface to the driver. | ||
32 | And since xquake uses mmap, mmap is considered important :-) | ||
33 | and no sane application uses ALaw/uLaw these days anyway. | ||
34 | In short, playing a Sun .au file as follows: | ||
35 | |||
36 | cat my_file.au > /dev/dsp | ||
37 | |||
38 | does not work. Instead, you may use the play script from | ||
39 | Chris Bagwell's sox-12.14 package (or later, available from the URL | ||
40 | below) to play many different audio file formats. | ||
41 | The script automatically determines the audio format | ||
42 | and does do audio conversions if necessary. | ||
43 | http://home.sprynet.com/sprynet/cbagwell/projects.html | ||
44 | |||
45 | |||
46 | Blocking vs. nonblocking IO | ||
47 | --------------------------- | ||
48 | |||
49 | Unlike OSS/Free this driver honours the O_NONBLOCK file flag | ||
50 | not only during open, but also during read and write. | ||
51 | This is an effort to make the sound driver interface more | ||
52 | regular. Timidity has problems with this; a patch | ||
53 | is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html. | ||
54 | (Timidity patched will also run on OSS/Free). | ||
55 | |||
56 | |||
57 | MIDI UART | ||
58 | --------- | ||
59 | |||
60 | The driver supports a simple MIDI UART interface, with | ||
61 | no ioctl's supported. | ||
62 | |||
63 | |||
64 | MIDI synthesizer | ||
65 | ---------------- | ||
66 | |||
67 | The card has an OPL compatible FM synthesizer. | ||
68 | |||
69 | Thomas Sailer | ||
70 | t.sailer@alumni.ethz.ch | ||
diff --git a/Documentation/sound/oss/sonicvibes b/Documentation/sound/oss/sonicvibes new file mode 100644 index 000000000000..84dee2e0b37d --- /dev/null +++ b/Documentation/sound/oss/sonicvibes | |||
@@ -0,0 +1,81 @@ | |||
1 | /proc/sound, /dev/sndstat | ||
2 | ------------------------- | ||
3 | |||
4 | /proc/sound and /dev/sndstat is not supported by the | ||
5 | driver. To find out whether the driver succeeded loading, | ||
6 | check the kernel log (dmesg). | ||
7 | |||
8 | |||
9 | ALaw/uLaw sample formats | ||
10 | ------------------------ | ||
11 | |||
12 | This driver does not support the ALaw/uLaw sample formats. | ||
13 | ALaw is the default mode when opening a sound device | ||
14 | using OSS/Free. The reason for the lack of support is | ||
15 | that the hardware does not support these formats, and adding | ||
16 | conversion routines to the kernel would lead to very ugly | ||
17 | code in the presence of the mmap interface to the driver. | ||
18 | And since xquake uses mmap, mmap is considered important :-) | ||
19 | and no sane application uses ALaw/uLaw these days anyway. | ||
20 | In short, playing a Sun .au file as follows: | ||
21 | |||
22 | cat my_file.au > /dev/dsp | ||
23 | |||
24 | does not work. Instead, you may use the play script from | ||
25 | Chris Bagwell's sox-12.14 package (available from the URL | ||
26 | below) to play many different audio file formats. | ||
27 | The script automatically determines the audio format | ||
28 | and does do audio conversions if necessary. | ||
29 | http://home.sprynet.com/sprynet/cbagwell/projects.html | ||
30 | |||
31 | |||
32 | Blocking vs. nonblocking IO | ||
33 | --------------------------- | ||
34 | |||
35 | Unlike OSS/Free this driver honours the O_NONBLOCK file flag | ||
36 | not only during open, but also during read and write. | ||
37 | This is an effort to make the sound driver interface more | ||
38 | regular. Timidity has problems with this; a patch | ||
39 | is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html. | ||
40 | (Timidity patched will also run on OSS/Free). | ||
41 | |||
42 | |||
43 | MIDI UART | ||
44 | --------- | ||
45 | |||
46 | The driver supports a simple MIDI UART interface, with | ||
47 | no ioctl's supported. | ||
48 | |||
49 | |||
50 | MIDI synthesizer | ||
51 | ---------------- | ||
52 | |||
53 | The card both has an OPL compatible FM synthesizer as well as | ||
54 | a wavetable synthesizer. | ||
55 | |||
56 | I haven't managed so far to get the OPL synth running. | ||
57 | |||
58 | Using the wavetable synthesizer requires allocating | ||
59 | 1-4MB of physically contiguous memory, which isn't possible | ||
60 | currently on Linux without ugly hacks like the bigphysarea | ||
61 | patch. Therefore, the driver doesn't support wavetable | ||
62 | synthesis. | ||
63 | |||
64 | |||
65 | No support from S3 | ||
66 | ------------------ | ||
67 | |||
68 | I do not get any support from S3. Therefore, the driver | ||
69 | still has many problems. For example, although the manual | ||
70 | states that the chip should be able to access the sample | ||
71 | buffer anywhere in 32bit address space, I haven't managed to | ||
72 | get it working with buffers above 16M. Therefore, the card | ||
73 | has the same disadvantages as ISA soundcards. | ||
74 | |||
75 | Given that the card is also very noisy, and if you haven't | ||
76 | already bought it, you should strongly opt for one of the | ||
77 | comparatively priced Ensoniq products. | ||
78 | |||
79 | |||
80 | Thomas Sailer | ||
81 | t.sailer@alumni.ethz.ch | ||
diff --git a/Documentation/sound/oss/ultrasound b/Documentation/sound/oss/ultrasound new file mode 100644 index 000000000000..32cd50478b36 --- /dev/null +++ b/Documentation/sound/oss/ultrasound | |||
@@ -0,0 +1,30 @@ | |||
1 | modprobe sound | ||
2 | insmod ad1848 | ||
3 | insmod gus io=* irq=* dma=* ... | ||
4 | |||
5 | This loads the driver for the Gravis Ultrasound family of sound cards. | ||
6 | |||
7 | The gus module takes the following arguments | ||
8 | |||
9 | io I/O address of the Ultrasound card (eg. io=0x220) | ||
10 | irq IRQ of the Sound Blaster card | ||
11 | dma DMA channel for the Sound Blaster | ||
12 | dma16 2nd DMA channel, only needed for full duplex operation | ||
13 | type 1 for PnP card | ||
14 | gus16 1 for using 16 bit sampling daughter board | ||
15 | no_wave_dma Set to disable DMA usage for wavetable (see note) | ||
16 | db16 ??? | ||
17 | |||
18 | |||
19 | no_wave_dma option | ||
20 | |||
21 | This option defaults to a value of 0, which allows the Ultrasound wavetable | ||
22 | DSP to use DMA for for playback and downloading samples. This is the same | ||
23 | as the old behaviour. If set to 1, no DMA is needed for downloading samples, | ||
24 | and allows owners of a GUS MAX to make use of simultaneous digital audio | ||
25 | (/dev/dsp), MIDI, and wavetable playback. | ||
26 | |||
27 | |||
28 | If you have problems in recording with GUS MAX, you could try to use | ||
29 | just one 8 bit DMA channel. Recording will not work with one DMA | ||
30 | channel if it's a 16 bit one. | ||
diff --git a/Documentation/sound/oss/vwsnd b/Documentation/sound/oss/vwsnd new file mode 100644 index 000000000000..a6ea0a1df9e4 --- /dev/null +++ b/Documentation/sound/oss/vwsnd | |||
@@ -0,0 +1,293 @@ | |||
1 | vwsnd - Sound driver for the Silicon Graphics 320 and 540 Visual | ||
2 | Workstations' onboard audio. | ||
3 | |||
4 | Copyright 1999 Silicon Graphics, Inc. All rights reserved. | ||
5 | |||
6 | |||
7 | At the time of this writing, March 1999, there are two models of | ||
8 | Visual Workstation, the 320 and the 540. This document only describes | ||
9 | those models. Future Visual Workstation models may have different | ||
10 | sound capabilities, and this driver will probably not work on those | ||
11 | boxes. | ||
12 | |||
13 | The Visual Workstation has an Analog Devices AD1843 "SoundComm" audio | ||
14 | codec chip. The AD1843 is accessed through the Cobalt I/O ASIC, also | ||
15 | known as Lithium. This driver programs both both chips. | ||
16 | |||
17 | ============================================================================== | ||
18 | QUICK CONFIGURATION | ||
19 | |||
20 | # insmod soundcore | ||
21 | # insmod vwsnd | ||
22 | |||
23 | ============================================================================== | ||
24 | I/O CONNECTIONS | ||
25 | |||
26 | On the Visual Workstation, only three of the AD1843 inputs are hooked | ||
27 | up. The analog line in jacks are connected to the AD1843's AUX1 | ||
28 | input. The CD audio lines are connected to the AD1843's AUX2 input. | ||
29 | The microphone jack is connected to the AD1843's MIC input. The mic | ||
30 | jack is mono, but the signal is delivered to both the left and right | ||
31 | MIC inputs. You can record in stereo from the mic input, but you will | ||
32 | get the same signal on both channels (within the limits of A/D | ||
33 | accuracy). Full scale on the Line input is +/- 2.0 V. Full scale on | ||
34 | the MIC input is 20 dB less, or +/- 0.2 V. | ||
35 | |||
36 | The AD1843's LOUT1 outputs are connected to the Line Out jacks. The | ||
37 | AD1843's HPOUT outputs are connected to the speaker/headphone jack. | ||
38 | LOUT2 is not connected. Line out's maximum level is +/- 2.0 V peak to | ||
39 | peak. The speaker/headphone out's maximum is +/- 4.0 V peak to peak. | ||
40 | |||
41 | The AD1843's PCM input channel and one of its output channels (DAC1) | ||
42 | are connected to Lithium. The other output channel (DAC2) is not | ||
43 | connected. | ||
44 | |||
45 | ============================================================================== | ||
46 | CAPABILITIES | ||
47 | |||
48 | The AD1843 has PCM input and output (Pulse Code Modulation, also known | ||
49 | as wavetable). PCM input and output can be mono or stereo in any of | ||
50 | four formats. The formats are 16 bit signed and 8 bit unsigned, | ||
51 | u-Law, and A-Law format. Any sample rate from 4 KHz to 49 KHz is | ||
52 | available, in 1 Hz increments. | ||
53 | |||
54 | The AD1843 includes an analog mixer that can mix all three input | ||
55 | signals (line, mic and CD) into the analog outputs. The mixer has a | ||
56 | separate gain control and mute switch for each input. | ||
57 | |||
58 | There are two outputs, line out and speaker/headphone out. They | ||
59 | always produce the same signal, and the speaker always has 3 dB more | ||
60 | gain than the line out. The speaker/headphone output can be muted, | ||
61 | but this driver does not export that function. | ||
62 | |||
63 | The hardware can sync audio to the video clock, but this driver does | ||
64 | not have a way to specify syncing to video. | ||
65 | |||
66 | ============================================================================== | ||
67 | PROGRAMMING | ||
68 | |||
69 | This section explains the API supported by the driver. Also see the | ||
70 | Open Sound Programming Guide at http://www.opensound.com/pguide/ . | ||
71 | This section assumes familiarity with that document. | ||
72 | |||
73 | The driver has two interfaces, an I/O interface and a mixer interface. | ||
74 | There is no MIDI or sequencer capability. | ||
75 | |||
76 | ============================================================================== | ||
77 | PROGRAMMING PCM I/O | ||
78 | |||
79 | The I/O interface is usually accessed as /dev/audio or /dev/dsp. | ||
80 | Using the standard Open Sound System (OSS) ioctl calls, the sample | ||
81 | rate, number of channels, and sample format may be set within the | ||
82 | limitations described above. The driver supports triggering. It also | ||
83 | supports getting the input and output pointers with one-sample | ||
84 | accuracy. | ||
85 | |||
86 | The SNDCTL_DSP_GETCAP ioctl returns these capabilities. | ||
87 | |||
88 | DSP_CAP_DUPLEX - driver supports full duplex. | ||
89 | |||
90 | DSP_CAP_TRIGGER - driver supports triggering. | ||
91 | |||
92 | DSP_CAP_REALTIME - values returned by SNDCTL_DSP_GETIPTR | ||
93 | and SNDCTL_DSP_GETOPTR are accurate to a few samples. | ||
94 | |||
95 | Memory mapping (mmap) is not implemented. | ||
96 | |||
97 | The driver permits subdivided fragment sizes from 64 to 4096 bytes. | ||
98 | The number of fragments can be anything from 3 fragments to however | ||
99 | many fragments fit into 124 kilobytes. It is up to the user to | ||
100 | determine how few/small fragments can be used without introducing | ||
101 | glitches with a given workload. Linux is not realtime, so we can't | ||
102 | promise anything. (sigh...) | ||
103 | |||
104 | When this driver is switched into or out of mu-Law or A-Law mode on | ||
105 | output, it may produce an audible click. This is unavoidable. To | ||
106 | prevent clicking, use signed 16-bit mode instead, and convert from | ||
107 | mu-Law or A-Law format in software. | ||
108 | |||
109 | ============================================================================== | ||
110 | PROGRAMMING THE MIXER INTERFACE | ||
111 | |||
112 | The mixer interface is usually accessed as /dev/mixer. It is accessed | ||
113 | through ioctls. The mixer allows the application to control gain or | ||
114 | mute several audio signal paths, and also allows selection of the | ||
115 | recording source. | ||
116 | |||
117 | Each of the constants described here can be read using the | ||
118 | MIXER_READ(SOUND_MIXER_xxx) ioctl. Those that are not read-only can | ||
119 | also be written using the MIXER_WRITE(SOUND_MIXER_xxx) ioctl. In most | ||
120 | cases, <sys/soundcard.h> defines constants SOUND_MIXER_READ_xxx and | ||
121 | SOUND_MIXER_WRITE_xxx which work just as well. | ||
122 | |||
123 | SOUND_MIXER_CAPS Read-only | ||
124 | |||
125 | This is a mask of optional driver capabilities that are implemented. | ||
126 | This driver's only capability is SOUND_CAP_EXCL_INPUT, which means | ||
127 | that only one recording source can be active at a time. | ||
128 | |||
129 | SOUND_MIXER_DEVMASK Read-only | ||
130 | |||
131 | This is a mask of the sound channels. This driver's channels are PCM, | ||
132 | LINE, MIC, CD, and RECLEV. | ||
133 | |||
134 | SOUND_MIXER_STEREODEVS Read-only | ||
135 | |||
136 | This is a mask of which sound channels are capable of stereo. All | ||
137 | channels are capable of stereo. (But see caveat on MIC input in I/O | ||
138 | CONNECTIONS section above). | ||
139 | |||
140 | SOUND_MIXER_OUTMASK Read-only | ||
141 | |||
142 | This is a mask of channels that route inputs through to outputs. | ||
143 | Those are LINE, MIC, and CD. | ||
144 | |||
145 | SOUND_MIXER_RECMASK Read-only | ||
146 | |||
147 | This is a mask of channels that can be recording sources. Those are | ||
148 | PCM, LINE, MIC, CD. | ||
149 | |||
150 | SOUND_MIXER_PCM Default: 0x5757 (0 dB) | ||
151 | |||
152 | This is the gain control for PCM output. The left and right channel | ||
153 | gain are controlled independently. This gain control has 64 levels, | ||
154 | which range from -82.5 dB to +12.0 dB in 1.5 dB steps. Those 64 | ||
155 | levels are mapped onto 100 levels at the ioctl, see below. | ||
156 | |||
157 | SOUND_MIXER_LINE Default: 0x4a4a (0 dB) | ||
158 | |||
159 | This is the gain control for mixing the Line In source into the | ||
160 | outputs. The left and right channel gain are controlled | ||
161 | independently. This gain control has 32 levels, which range from | ||
162 | -34.5 dB to +12.0 dB in 1.5 dB steps. Those 32 levels are mapped onto | ||
163 | 100 levels at the ioctl, see below. | ||
164 | |||
165 | SOUND_MIXER_MIC Default: 0x4a4a (0 dB) | ||
166 | |||
167 | This is the gain control for mixing the MIC source into the outputs. | ||
168 | The left and right channel gain are controlled independently. This | ||
169 | gain control has 32 levels, which range from -34.5 dB to +12.0 dB in | ||
170 | 1.5 dB steps. Those 32 levels are mapped onto 100 levels at the | ||
171 | ioctl, see below. | ||
172 | |||
173 | SOUND_MIXER_CD Default: 0x4a4a (0 dB) | ||
174 | |||
175 | This is the gain control for mixing the CD audio source into the | ||
176 | outputs. The left and right channel gain are controlled | ||
177 | independently. This gain control has 32 levels, which range from | ||
178 | -34.5 dB to +12.0 dB in 1.5 dB steps. Those 32 levels are mapped onto | ||
179 | 100 levels at the ioctl, see below. | ||
180 | |||
181 | SOUND_MIXER_RECLEV Default: 0 (0 dB) | ||
182 | |||
183 | This is the gain control for PCM input (RECording LEVel). The left | ||
184 | and right channel gain are controlled independently. This gain | ||
185 | control has 16 levels, which range from 0 dB to +22.5 dB in 1.5 dB | ||
186 | steps. Those 16 levels are mapped onto 100 levels at the ioctl, see | ||
187 | below. | ||
188 | |||
189 | SOUND_MIXER_RECSRC Default: SOUND_MASK_LINE | ||
190 | |||
191 | This is a mask of currently selected PCM input sources (RECording | ||
192 | SouRCes). Because the AD1843 can only have a single recording source | ||
193 | at a time, only one bit at a time can be set in this mask. The | ||
194 | allowable values are SOUND_MASK_PCM, SOUND_MASK_LINE, SOUND_MASK_MIC, | ||
195 | or SOUND_MASK_CD. Selecting SOUND_MASK_PCM sets up internal | ||
196 | resampling which is useful for loopback testing and for hardware | ||
197 | sample rate conversion. But software sample rate conversion is | ||
198 | probably faster, so I don't know how useful that is. | ||
199 | |||
200 | SOUND_MIXER_OUTSRC DEFAULT: SOUND_MASK_LINE|SOUND_MASK_MIC|SOUND_MASK_CD | ||
201 | |||
202 | This is a mask of sources that are currently passed through to the | ||
203 | outputs. Those sources whose bits are not set are muted. | ||
204 | |||
205 | ============================================================================== | ||
206 | GAIN CONTROL | ||
207 | |||
208 | There are five gain controls listed above. Each has 16, 32, or 64 | ||
209 | steps. Each control has 1.5 dB of gain per step. Each control is | ||
210 | stereo. | ||
211 | |||
212 | The OSS defines the argument to a channel gain ioctl as having two | ||
213 | components, left and right, each of which ranges from 0 to 100. The | ||
214 | two components are packed into the same word, with the left side gain | ||
215 | in the least significant byte, and the right side gain in the second | ||
216 | least significant byte. In C, we would say this. | ||
217 | |||
218 | #include <assert.h> | ||
219 | |||
220 | ... | ||
221 | |||
222 | assert(leftgain >= 0 && leftgain <= 100); | ||
223 | assert(rightgain >= 0 && rightgain <= 100); | ||
224 | arg = leftgain | rightgain << 8; | ||
225 | |||
226 | So each OSS gain control has 101 steps. But the hardware has 16, 32, | ||
227 | or 64 steps. The hardware steps are spread across the 101 OSS steps | ||
228 | nearly evenly. The conversion formulas are like this, given N equals | ||
229 | 16, 32, or 64. | ||
230 | |||
231 | int round = N/2 - 1; | ||
232 | OSS_gain_steps = (hw_gain_steps * 100 + round) / (N - 1); | ||
233 | hw_gain_steps = (OSS_gain_steps * (N - 1) + round) / 100; | ||
234 | |||
235 | Here is a snippet of C code that will return the left and right gain | ||
236 | of any channel in dB. Pass it one of the predefined gain_desc_t | ||
237 | structures to access any of the five channels' gains. | ||
238 | |||
239 | typedef struct gain_desc { | ||
240 | float min_gain; | ||
241 | float gain_step; | ||
242 | int nbits; | ||
243 | int chan; | ||
244 | } gain_desc_t; | ||
245 | |||
246 | const gain_desc_t gain_pcm = { -82.5, 1.5, 6, SOUND_MIXER_PCM }; | ||
247 | const gain_desc_t gain_line = { -34.5, 1.5, 5, SOUND_MIXER_LINE }; | ||
248 | const gain_desc_t gain_mic = { -34.5, 1.5, 5, SOUND_MIXER_MIC }; | ||
249 | const gain_desc_t gain_cd = { -34.5, 1.5, 5, SOUND_MIXER_CD }; | ||
250 | const gain_desc_t gain_reclev = { 0.0, 1.5, 4, SOUND_MIXER_RECLEV }; | ||
251 | |||
252 | int get_gain_dB(int fd, const gain_desc_t *gp, | ||
253 | float *left, float *right) | ||
254 | { | ||
255 | int word; | ||
256 | int lg, rg; | ||
257 | int mask = (1 << gp->nbits) - 1; | ||
258 | |||
259 | if (ioctl(fd, MIXER_READ(gp->chan), &word) != 0) | ||
260 | return -1; /* fail */ | ||
261 | lg = word & 0xFF; | ||
262 | rg = word >> 8 & 0xFF; | ||
263 | lg = (lg * mask + mask / 2) / 100; | ||
264 | rg = (rg * mask + mask / 2) / 100; | ||
265 | *left = gp->min_gain + gp->gain_step * lg; | ||
266 | *right = gp->min_gain + gp->gain_step * rg; | ||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | And here is the corresponding routine to set a channel's gain in dB. | ||
271 | |||
272 | int set_gain_dB(int fd, const gain_desc_t *gp, float left, float right) | ||
273 | { | ||
274 | float max_gain = | ||
275 | gp->min_gain + (1 << gp->nbits) * gp->gain_step; | ||
276 | float round = gp->gain_step / 2; | ||
277 | int mask = (1 << gp->nbits) - 1; | ||
278 | int word; | ||
279 | int lg, rg; | ||
280 | |||
281 | if (left < gp->min_gain || right < gp->min_gain) | ||
282 | return EINVAL; | ||
283 | lg = (left - gp->min_gain + round) / gp->gain_step; | ||
284 | rg = (right - gp->min_gain + round) / gp->gain_step; | ||
285 | if (lg >= (1 << gp->nbits) || rg >= (1 << gp->nbits)) | ||
286 | return EINVAL; | ||
287 | lg = (100 * lg + mask / 2) / mask; | ||
288 | rg = (100 * rg + mask / 2) / mask; | ||
289 | word = lg | rg << 8; | ||
290 | |||
291 | return ioctl(fd, MIXER_WRITE(gp->chan), &word); | ||
292 | } | ||
293 | |||