1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
3 <book id="ViaAudioGuide">
5 <title>Via 686 Audio Driver for Linux</title>
9 <firstname>Jeff</firstname>
10 <surname>Garzik</surname>
15 <year>1999-2001</year>
16 <holder>Jeff Garzik</holder>
21 This documentation is free software; you can redistribute
22 it and/or modify it under the terms of the GNU General Public
23 License as published by the Free Software Foundation; either
24 version 2 of the License, or (at your option) any later
29 This program is distributed in the hope that it will be
30 useful, but WITHOUT ANY WARRANTY; without even the implied
31 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
32 See the GNU General Public License for more details.
36 You should have received a copy of the GNU General Public
37 License along with this program; if not, write to the Free
38 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
43 For more details see the file COPYING in the source
44 distribution of Linux.
52 <title>Introduction</title>
54 The Via VT82C686A "super southbridge" chips contain
55 AC97-compatible audio logic which features dual 16-bit stereo
56 PCM sound channels (full duplex), plus a third PCM channel intended for use
57 in hardware-assisted FM synthesis.
60 The current Linux kernel audio driver for this family of chips
61 supports audio playback and recording, but hardware-assisted
62 FM features, and hardware buffer direct-access (mmap)
63 support are not yet available.
66 This driver supports any Linux kernel version after 2.4.10.
69 Please send bug reports to the mailing list <email>linux-via@gtf.org</email>.
70 To subscribe, e-mail <email>majordomo@gtf.org</email> with
76 in the body of the message.
80 <chapter id="install">
81 <title>Driver Installation</title>
83 To use this audio driver, select the
84 CONFIG_SOUND_VIA82CXXX option in the section Sound during kernel configuration.
85 Follow the usual kernel procedures for rebuilding the kernel,
86 or building and installing driver modules.
89 To make this driver the default audio driver, you can add the
90 following to your /etc/conf.modules file:
93 alias sound via82cxxx_audio
96 Note that soundcore and ac97_codec support modules
97 are also required for working audio, in addition to
98 the via82cxxx_audio module itself.
102 <chapter id="reportbug">
103 <title>Submitting a bug report</title>
104 <sect1 id="bugrepdesc"><title>Description of problem</title>
106 Describe the application you were using to play/record sound, and how
107 to reproduce the problem.
110 <sect1 id="bugrepdiag"><title>Diagnostic output</title>
112 Obtain the via-audio-diag diagnostics program from
113 http://sf.net/projects/gkernel/ and provide a dump of the
114 audio chip's registers while the problem is occurring. Sample command line:
117 ./via-audio-diag -aps > diag-output.txt
120 <sect1 id="bugrepdebug"><title>Driver debug output</title>
122 Define <constant>VIA_DEBUG</constant> at the beginning of the driver, then capture and email
123 the kernel log output. This can be viewed in the system kernel log (if
124 enabled), or via the dmesg program. Sample command line:
127 dmesg > /tmp/dmesg-output.txt
130 <sect1 id="bugrepprintk"><title>Bigger kernel message buffer</title>
132 If you wish to increase the size of the buffer displayed by dmesg, then
133 change the <constant>LOG_BUF_LEN</constant> macro at the top of linux/kernel/printk.c, recompile
134 your kernel, and pass the <constant>LOG_BUF_LEN</constant> value to dmesg. Sample command line with
135 <constant>LOG_BUF_LEN</constant> == 32768:
138 dmesg -s 32768 > /tmp/dmesg-output.txt
144 <title>Known Bugs And Assumptions</title>
147 <varlistentry><term>Low volume</term>
150 Volume too low on many systems. Workaround: use mixer program
151 such as xmixer to increase volume.
153 </listitem></varlistentry>
160 <chapter id="thanks">
161 <title>Thanks</title>
163 Via for providing e-mail support, specs, and NDA'd source code.
166 MandrakeSoft for providing hacking time.
169 AC97 mixer interface fixes and debugging by Ron Cemer <email>roncemer@gte.net</email>.
172 Rui Sousa <email>rui.sousa@conexant.com</email>, for bugfixing
173 MMAP support, and several other notable fixes that resulted from
174 his hard work and testing.
177 Adrian Cox <email>adrian@humboldt.co.uk</email>, for bugfixing
178 MMAP support, and several other notable fixes that resulted from
179 his hard work and testing.
182 Thomas Sailer for further bugfixes.
187 <title>Random Notes</title>
189 Two /proc pseudo-files provide diagnostic information. This is generally
190 not useful to most users. Power users can disable CONFIG_SOUND_VIA82CXXX_PROCFS,
191 and remove the /proc support code. Once
192 version 2.0.0 is released, the /proc support code will be disabled by
193 default. Available /proc pseudo-files:
196 /proc/driver/via/0/info
197 /proc/driver/via/0/ac97
200 This driver by default supports all PCI audio devices which report
201 a vendor id of 0x1106, and a device id of 0x3058. Subsystem vendor
202 and device ids are not examined.
205 GNU indent formatting options:
207 -kr -i8 -ts8 -br -ce -bap -sob -l80 -pcs -cs -ss -bs -di1 -nbc -lp -psl
211 Via has graciously donated e-mail support and source code to help further
212 the development of this driver. Their assistance has been invaluable
213 in the design and coding of the next major version of this driver.
216 The Via audio chip apparently provides a second PCM scatter-gather
217 DMA channel just for FM data, but does not have a full hardware MIDI
218 processor. I haven't put much thought towards a solution here, but it
219 might involve using SoftOSS midi wave table, or simply disabling MIDI
220 support altogether and using the FM PCM channel as a second (input? output?)
224 <chapter id="changelog">
225 <title>Driver ChangeLog</title>
227 <sect1 id="version191"><title>
230 <itemizedlist spacing="compact">
233 DSP read/write bugfixes from Thomas Sailer.
239 Add new PCI id for single-channel use of Via 8233.
245 Other bug fixes, tweaks, new ioctls.
252 <sect1 id="version1115"><title>
255 <itemizedlist spacing="compact">
258 Support for variable fragment size and variable fragment number (Rui
265 Fixes for the SPEED, STEREO, CHANNELS, FMT ioctls when in read &
266 write mode (Rui Sousa)
272 Mmaped sound is now fully functional. (Rui Sousa)
278 Make sure to enable PCI device before reading any of its PCI
279 config information. (fixes potential hotplug problems)
285 Clean up code a bit and add more internal function documentation.
291 AC97 codec access fixes (Adrian Cox)
297 Big endian fixes (Adrian Cox)
303 MIDI support (Adrian Cox)
309 Detect and report locked-rate AC97 codecs. If your hardware only
310 supports 48Khz (locked rate), then your recording/playback software
311 must upsample or downsample accordingly. The hardware cannot do it.
317 Use new pci_request_regions and pci_disable_device functions in
325 <sect1 id="version1114"><title>
328 <itemizedlist spacing="compact">
331 Use VM_RESERVE when available, to eliminate unnecessary page faults.
337 <sect1 id="version1112"><title>
340 <itemizedlist spacing="compact">
343 mmap bug fixes from Linus.
349 <sect1 id="version1111"><title>
352 <itemizedlist spacing="compact">
355 Many more bug fixes. mmap enabled by default, but may still be buggy.
361 Uses new and spiffy method of mmap'ing the DMA buffer, based
362 on a suggestion from Linus.
368 <sect1 id="version1110"><title>
371 <itemizedlist spacing="compact">
374 Many bug fixes. mmap enabled by default, but may still be buggy.
380 <sect1 id="version119"><title>
383 <itemizedlist spacing="compact">
386 Redesign and rewrite audio playback implementation. (faster and smaller, hopefully)
392 Implement recording and full duplex (DSP_CAP_DUPLEX) support.
398 Make procfs support optional.
404 Quick interrupt status check, to lessen overhead in interrupt
411 Add mmap(2) support. Disabled for now, it is still buggy and experimental.
417 Surround all syscalls with a semaphore for cheap and easy SMP protection.
423 Fix bug in channel shutdown (hardware channel reset) code.
429 Remove unnecessary spinlocks (better performance).
435 Eliminate "unknown AFMT" message by using a different method
436 of selecting the best AFMT_xxx sound sample format for use.
442 Support for realtime hardware pointer position reporting
443 (DSP_CAP_REALTIME, SNDCTL_DSP_GETxPTR ioctls)
449 Support for capture/playback triggering
450 (DSP_CAP_TRIGGER, SNDCTL_DSP_SETTRIGGER ioctls)
456 SNDCTL_DSP_SETDUPLEX and SNDCTL_DSP_POST ioctls now handled.
462 Rewrite open(2) and close(2) logic to allow only one user at
463 a time. All other open(2) attempts will sleep until they succeed.
464 FIXME: open(O_RDONLY) and open(O_WRONLY) should be allowed to succeed.
470 Reviewed code to ensure that SMP and multiple audio devices
478 <sect1 id="version118"><title>
481 <itemizedlist spacing="compact">
484 Clean up interrupt handler output. Fixes the following kernel error message:
487 unhandled interrupt ...
493 Convert documentation to DocBook, so that PDF, HTML and PostScript (.ps) output is readily
501 <sect1 id="version117"><title>
504 <itemizedlist spacing="compact">
507 Fix module unload bug where mixer device left registered
514 <sect1 id="version116"><title>
517 <itemizedlist spacing="compact">
520 Rewrite via_set_rate to mimic ALSA basic AC97 rate setting
525 Remove much dead code
530 Complete spin_lock_irqsave -> spin_lock_irq conversion in via_dsp_ioctl
535 Fix build problem in via_dsp_ioctl
540 Optimize included headers to eliminate headers found in linux/sound
546 <sect1 id="version115"><title>
549 <itemizedlist spacing="compact">
552 Disable some overly-verbose debugging code
557 Remove unnecessary sound locks
562 Fix some ioctls for better time resolution
567 Begin spin_lock_irqsave -> spin_lock_irq conversion in via_dsp_ioctl
573 <sect1 id="version114"><title>
576 <itemizedlist spacing="compact">
579 Completed rewrite of driver. Eliminated SoundBlaster compatibility
580 completely, and now uses the much-faster scatter-gather DMA engine.
588 <chapter id="intfunctions">
589 <title>Internal Functions</title>
590 !Isound/oss/via82cxxx_audio.c