via-audio.tmpl 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
  4. <book id="ViaAudioGuide">
  5. <bookinfo>
  6. <title>Via 686 Audio Driver for Linux</title>
  7. <authorgroup>
  8. <author>
  9. <firstname>Jeff</firstname>
  10. <surname>Garzik</surname>
  11. </author>
  12. </authorgroup>
  13. <copyright>
  14. <year>1999-2001</year>
  15. <holder>Jeff Garzik</holder>
  16. </copyright>
  17. <legalnotice>
  18. <para>
  19. This documentation is free software; you can redistribute
  20. it and/or modify it under the terms of the GNU General Public
  21. License as published by the Free Software Foundation; either
  22. version 2 of the License, or (at your option) any later
  23. version.
  24. </para>
  25. <para>
  26. This program is distributed in the hope that it will be
  27. useful, but WITHOUT ANY WARRANTY; without even the implied
  28. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  29. See the GNU General Public License for more details.
  30. </para>
  31. <para>
  32. You should have received a copy of the GNU General Public
  33. License along with this program; if not, write to the Free
  34. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35. MA 02111-1307 USA
  36. </para>
  37. <para>
  38. For more details see the file COPYING in the source
  39. distribution of Linux.
  40. </para>
  41. </legalnotice>
  42. </bookinfo>
  43. <toc></toc>
  44. <chapter id="intro">
  45. <title>Introduction</title>
  46. <para>
  47. The Via VT82C686A "super southbridge" chips contain
  48. AC97-compatible audio logic which features dual 16-bit stereo
  49. PCM sound channels (full duplex), plus a third PCM channel intended for use
  50. in hardware-assisted FM synthesis.
  51. </para>
  52. <para>
  53. The current Linux kernel audio driver for this family of chips
  54. supports audio playback and recording, but hardware-assisted
  55. FM features, and hardware buffer direct-access (mmap)
  56. support are not yet available.
  57. </para>
  58. <para>
  59. This driver supports any Linux kernel version after 2.4.10.
  60. </para>
  61. <para>
  62. Please send bug reports to the mailing list <email>linux-via@gtf.org</email>.
  63. To subscribe, e-mail <email>majordomo@gtf.org</email> with
  64. </para>
  65. <programlisting>
  66. subscribe linux-via
  67. </programlisting>
  68. <para>
  69. in the body of the message.
  70. </para>
  71. </chapter>
  72. <chapter id="install">
  73. <title>Driver Installation</title>
  74. <para>
  75. To use this audio driver, select the
  76. CONFIG_SOUND_VIA82CXXX option in the section Sound during kernel configuration.
  77. Follow the usual kernel procedures for rebuilding the kernel,
  78. or building and installing driver modules.
  79. </para>
  80. <para>
  81. To make this driver the default audio driver, you can add the
  82. following to your /etc/conf.modules file:
  83. </para>
  84. <programlisting>
  85. alias sound via82cxxx_audio
  86. </programlisting>
  87. <para>
  88. Note that soundcore and ac97_codec support modules
  89. are also required for working audio, in addition to
  90. the via82cxxx_audio module itself.
  91. </para>
  92. </chapter>
  93. <chapter id="reportbug">
  94. <title>Submitting a bug report</title>
  95. <sect1 id="bugrepdesc"><title>Description of problem</title>
  96. <para>
  97. Describe the application you were using to play/record sound, and how
  98. to reproduce the problem.
  99. </para>
  100. </sect1>
  101. <sect1 id="bugrepdiag"><title>Diagnostic output</title>
  102. <para>
  103. Obtain the via-audio-diag diagnostics program from
  104. http://sf.net/projects/gkernel/ and provide a dump of the
  105. audio chip's registers while the problem is occurring. Sample command line:
  106. </para>
  107. <programlisting>
  108. ./via-audio-diag -aps > diag-output.txt
  109. </programlisting>
  110. </sect1>
  111. <sect1 id="bugrepdebug"><title>Driver debug output</title>
  112. <para>
  113. Define <constant>VIA_DEBUG</constant> at the beginning of the driver, then capture and email
  114. the kernel log output. This can be viewed in the system kernel log (if
  115. enabled), or via the dmesg program. Sample command line:
  116. </para>
  117. <programlisting>
  118. dmesg > /tmp/dmesg-output.txt
  119. </programlisting>
  120. </sect1>
  121. <sect1 id="bugrepprintk"><title>Bigger kernel message buffer</title>
  122. <para>
  123. If you wish to increase the size of the buffer displayed by dmesg, then
  124. change the <constant>LOG_BUF_LEN</constant> macro at the top of linux/kernel/printk.c, recompile
  125. your kernel, and pass the <constant>LOG_BUF_LEN</constant> value to dmesg. Sample command line with
  126. <constant>LOG_BUF_LEN</constant> == 32768:
  127. </para>
  128. <programlisting>
  129. dmesg -s 32768 > /tmp/dmesg-output.txt
  130. </programlisting>
  131. </sect1>
  132. </chapter>
  133. <chapter id="bugs">
  134. <title>Known Bugs And Assumptions</title>
  135. <para>
  136. <variablelist>
  137. <varlistentry><term>Low volume</term>
  138. <listitem>
  139. <para>
  140. Volume too low on many systems. Workaround: use mixer program
  141. such as xmixer to increase volume.
  142. </para>
  143. </listitem></varlistentry>
  144. </variablelist>
  145. </para>
  146. </chapter>
  147. <chapter id="thanks">
  148. <title>Thanks</title>
  149. <para>
  150. Via for providing e-mail support, specs, and NDA'd source code.
  151. </para>
  152. <para>
  153. MandrakeSoft for providing hacking time.
  154. </para>
  155. <para>
  156. AC97 mixer interface fixes and debugging by Ron Cemer <email>roncemer@gte.net</email>.
  157. </para>
  158. <para>
  159. Rui Sousa <email>rui.sousa@conexant.com</email>, for bugfixing
  160. MMAP support, and several other notable fixes that resulted from
  161. his hard work and testing.
  162. </para>
  163. <para>
  164. Adrian Cox <email>adrian@humboldt.co.uk</email>, for bugfixing
  165. MMAP support, and several other notable fixes that resulted from
  166. his hard work and testing.
  167. </para>
  168. <para>
  169. Thomas Sailer for further bugfixes.
  170. </para>
  171. </chapter>
  172. <chapter id="notes">
  173. <title>Random Notes</title>
  174. <para>
  175. Two /proc pseudo-files provide diagnostic information. This is generally
  176. not useful to most users. Power users can disable CONFIG_SOUND_VIA82CXXX_PROCFS,
  177. and remove the /proc support code. Once
  178. version 2.0.0 is released, the /proc support code will be disabled by
  179. default. Available /proc pseudo-files:
  180. </para>
  181. <programlisting>
  182. /proc/driver/via/0/info
  183. /proc/driver/via/0/ac97
  184. </programlisting>
  185. <para>
  186. This driver by default supports all PCI audio devices which report
  187. a vendor id of 0x1106, and a device id of 0x3058. Subsystem vendor
  188. and device ids are not examined.
  189. </para>
  190. <para>
  191. GNU indent formatting options:
  192. <programlisting>
  193. -kr -i8 -ts8 -br -ce -bap -sob -l80 -pcs -cs -ss -bs -di1 -nbc -lp -psl
  194. </programlisting>
  195. </para>
  196. <para>
  197. Via has graciously donated e-mail support and source code to help further
  198. the development of this driver. Their assistance has been invaluable
  199. in the design and coding of the next major version of this driver.
  200. </para>
  201. <para>
  202. The Via audio chip apparently provides a second PCM scatter-gather
  203. DMA channel just for FM data, but does not have a full hardware MIDI
  204. processor. I haven't put much thought towards a solution here, but it
  205. might involve using SoftOSS midi wave table, or simply disabling MIDI
  206. support altogether and using the FM PCM channel as a second (input? output?)
  207. </para>
  208. </chapter>
  209. <chapter id="changelog">
  210. <title>Driver ChangeLog</title>
  211. <sect1 id="version191"><title>
  212. Version 1.9.1
  213. </title>
  214. <itemizedlist spacing="compact">
  215. <listitem>
  216. <para>
  217. DSP read/write bugfixes from Thomas Sailer.
  218. </para>
  219. </listitem>
  220. <listitem>
  221. <para>
  222. Add new PCI id for single-channel use of Via 8233.
  223. </para>
  224. </listitem>
  225. <listitem>
  226. <para>
  227. Other bug fixes, tweaks, new ioctls.
  228. </para>
  229. </listitem>
  230. </itemizedlist>
  231. </sect1>
  232. <sect1 id="version1115"><title>
  233. Version 1.1.15
  234. </title>
  235. <itemizedlist spacing="compact">
  236. <listitem>
  237. <para>
  238. Support for variable fragment size and variable fragment number (Rui
  239. Sousa)
  240. </para>
  241. </listitem>
  242. <listitem>
  243. <para>
  244. Fixes for the SPEED, STEREO, CHANNELS, FMT ioctls when in read &amp;
  245. write mode (Rui Sousa)
  246. </para>
  247. </listitem>
  248. <listitem>
  249. <para>
  250. Mmaped sound is now fully functional. (Rui Sousa)
  251. </para>
  252. </listitem>
  253. <listitem>
  254. <para>
  255. Make sure to enable PCI device before reading any of its PCI
  256. config information. (fixes potential hotplug problems)
  257. </para>
  258. </listitem>
  259. <listitem>
  260. <para>
  261. Clean up code a bit and add more internal function documentation.
  262. </para>
  263. </listitem>
  264. <listitem>
  265. <para>
  266. AC97 codec access fixes (Adrian Cox)
  267. </para>
  268. </listitem>
  269. <listitem>
  270. <para>
  271. Big endian fixes (Adrian Cox)
  272. </para>
  273. </listitem>
  274. <listitem>
  275. <para>
  276. MIDI support (Adrian Cox)
  277. </para>
  278. </listitem>
  279. <listitem>
  280. <para>
  281. Detect and report locked-rate AC97 codecs. If your hardware only
  282. supports 48Khz (locked rate), then your recording/playback software
  283. must upsample or downsample accordingly. The hardware cannot do it.
  284. </para>
  285. </listitem>
  286. <listitem>
  287. <para>
  288. Use new pci_request_regions and pci_disable_device functions in
  289. kernel 2.4.6.
  290. </para>
  291. </listitem>
  292. </itemizedlist>
  293. </sect1>
  294. <sect1 id="version1114"><title>
  295. Version 1.1.14
  296. </title>
  297. <itemizedlist spacing="compact">
  298. <listitem>
  299. <para>
  300. Use VM_RESERVE when available, to eliminate unnecessary page faults.
  301. </para>
  302. </listitem>
  303. </itemizedlist>
  304. </sect1>
  305. <sect1 id="version1112"><title>
  306. Version 1.1.12
  307. </title>
  308. <itemizedlist spacing="compact">
  309. <listitem>
  310. <para>
  311. mmap bug fixes from Linus.
  312. </para>
  313. </listitem>
  314. </itemizedlist>
  315. </sect1>
  316. <sect1 id="version1111"><title>
  317. Version 1.1.11
  318. </title>
  319. <itemizedlist spacing="compact">
  320. <listitem>
  321. <para>
  322. Many more bug fixes. mmap enabled by default, but may still be buggy.
  323. </para>
  324. </listitem>
  325. <listitem>
  326. <para>
  327. Uses new and spiffy method of mmap'ing the DMA buffer, based
  328. on a suggestion from Linus.
  329. </para>
  330. </listitem>
  331. </itemizedlist>
  332. </sect1>
  333. <sect1 id="version1110"><title>
  334. Version 1.1.10
  335. </title>
  336. <itemizedlist spacing="compact">
  337. <listitem>
  338. <para>
  339. Many bug fixes. mmap enabled by default, but may still be buggy.
  340. </para>
  341. </listitem>
  342. </itemizedlist>
  343. </sect1>
  344. <sect1 id="version119"><title>
  345. Version 1.1.9
  346. </title>
  347. <itemizedlist spacing="compact">
  348. <listitem>
  349. <para>
  350. Redesign and rewrite audio playback implementation. (faster and smaller, hopefully)
  351. </para>
  352. </listitem>
  353. <listitem>
  354. <para>
  355. Implement recording and full duplex (DSP_CAP_DUPLEX) support.
  356. </para>
  357. </listitem>
  358. <listitem>
  359. <para>
  360. Make procfs support optional.
  361. </para>
  362. </listitem>
  363. <listitem>
  364. <para>
  365. Quick interrupt status check, to lessen overhead in interrupt
  366. sharing situations.
  367. </para>
  368. </listitem>
  369. <listitem>
  370. <para>
  371. Add mmap(2) support. Disabled for now, it is still buggy and experimental.
  372. </para>
  373. </listitem>
  374. <listitem>
  375. <para>
  376. Surround all syscalls with a semaphore for cheap and easy SMP protection.
  377. </para>
  378. </listitem>
  379. <listitem>
  380. <para>
  381. Fix bug in channel shutdown (hardware channel reset) code.
  382. </para>
  383. </listitem>
  384. <listitem>
  385. <para>
  386. Remove unnecessary spinlocks (better performance).
  387. </para>
  388. </listitem>
  389. <listitem>
  390. <para>
  391. Eliminate "unknown AFMT" message by using a different method
  392. of selecting the best AFMT_xxx sound sample format for use.
  393. </para>
  394. </listitem>
  395. <listitem>
  396. <para>
  397. Support for realtime hardware pointer position reporting
  398. (DSP_CAP_REALTIME, SNDCTL_DSP_GETxPTR ioctls)
  399. </para>
  400. </listitem>
  401. <listitem>
  402. <para>
  403. Support for capture/playback triggering
  404. (DSP_CAP_TRIGGER, SNDCTL_DSP_SETTRIGGER ioctls)
  405. </para>
  406. </listitem>
  407. <listitem>
  408. <para>
  409. SNDCTL_DSP_SETDUPLEX and SNDCTL_DSP_POST ioctls now handled.
  410. </para>
  411. </listitem>
  412. <listitem>
  413. <para>
  414. Rewrite open(2) and close(2) logic to allow only one user at
  415. a time. All other open(2) attempts will sleep until they succeed.
  416. FIXME: open(O_RDONLY) and open(O_WRONLY) should be allowed to succeed.
  417. </para>
  418. </listitem>
  419. <listitem>
  420. <para>
  421. Reviewed code to ensure that SMP and multiple audio devices
  422. are fully supported.
  423. </para>
  424. </listitem>
  425. </itemizedlist>
  426. </sect1>
  427. <sect1 id="version118"><title>
  428. Version 1.1.8
  429. </title>
  430. <itemizedlist spacing="compact">
  431. <listitem>
  432. <para>
  433. Clean up interrupt handler output. Fixes the following kernel error message:
  434. </para>
  435. <programlisting>
  436. unhandled interrupt ...
  437. </programlisting>
  438. </listitem>
  439. <listitem>
  440. <para>
  441. Convert documentation to DocBook, so that PDF, HTML and PostScript (.ps) output is readily
  442. available.
  443. </para>
  444. </listitem>
  445. </itemizedlist>
  446. </sect1>
  447. <sect1 id="version117"><title>
  448. Version 1.1.7
  449. </title>
  450. <itemizedlist spacing="compact">
  451. <listitem>
  452. <para>
  453. Fix module unload bug where mixer device left registered
  454. after driver exit
  455. </para>
  456. </listitem>
  457. </itemizedlist>
  458. </sect1>
  459. <sect1 id="version116"><title>
  460. Version 1.1.6
  461. </title>
  462. <itemizedlist spacing="compact">
  463. <listitem>
  464. <para>
  465. Rewrite via_set_rate to mimic ALSA basic AC97 rate setting
  466. </para>
  467. </listitem>
  468. <listitem>
  469. <para>
  470. Remove much dead code
  471. </para>
  472. </listitem>
  473. <listitem>
  474. <para>
  475. Complete spin_lock_irqsave -> spin_lock_irq conversion in via_dsp_ioctl
  476. </para>
  477. </listitem>
  478. <listitem>
  479. <para>
  480. Fix build problem in via_dsp_ioctl
  481. </para>
  482. </listitem>
  483. <listitem>
  484. <para>
  485. Optimize included headers to eliminate headers found in linux/sound
  486. </para>
  487. </listitem>
  488. </itemizedlist>
  489. </sect1>
  490. <sect1 id="version115"><title>
  491. Version 1.1.5
  492. </title>
  493. <itemizedlist spacing="compact">
  494. <listitem>
  495. <para>
  496. Disable some overly-verbose debugging code
  497. </para>
  498. </listitem>
  499. <listitem>
  500. <para>
  501. Remove unnecessary sound locks
  502. </para>
  503. </listitem>
  504. <listitem>
  505. <para>
  506. Fix some ioctls for better time resolution
  507. </para>
  508. </listitem>
  509. <listitem>
  510. <para>
  511. Begin spin_lock_irqsave -> spin_lock_irq conversion in via_dsp_ioctl
  512. </para>
  513. </listitem>
  514. </itemizedlist>
  515. </sect1>
  516. <sect1 id="version114"><title>
  517. Version 1.1.4
  518. </title>
  519. <itemizedlist spacing="compact">
  520. <listitem>
  521. <para>
  522. Completed rewrite of driver. Eliminated SoundBlaster compatibility
  523. completely, and now uses the much-faster scatter-gather DMA engine.
  524. </para>
  525. </listitem>
  526. </itemizedlist>
  527. </sect1>
  528. </chapter>
  529. <chapter id="intfunctions">
  530. <title>Internal Functions</title>
  531. !Isound/oss/via82cxxx_audio.c
  532. </chapter>
  533. </book>