CMIPCI.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. Brief Notes on C-Media 8338/8738/8768/8770 Driver
  2. =================================================
  3. Takashi Iwai <tiwai@suse.de>
  4. Front/Rear Multi-channel Playback
  5. ---------------------------------
  6. CM8x38 chip can use ADC as the second DAC so that two different stereo
  7. channels can be used for front/rear playbacks. Since there are two
  8. DACs, both streams are handled independently unlike the 4/6ch multi-
  9. channel playbacks in the section below.
  10. As default, ALSA driver assigns the first PCM device (i.e. hw:0,0 for
  11. card#0) for front and 4/6ch playbacks, while the second PCM device
  12. (hw:0,1) is assigned to the second DAC for rear playback.
  13. There are slight differences between the two DACs:
  14. - The first DAC supports U8 and S16LE formats, while the second DAC
  15. supports only S16LE.
  16. - The second DAC supports only two channel stereo.
  17. Please note that the CM8x38 DAC doesn't support continuous playback
  18. rate but only fixed rates: 5512, 8000, 11025, 16000, 22050, 32000,
  19. 44100 and 48000 Hz.
  20. The rear output can be heard only when "Four Channel Mode" switch is
  21. disabled. Otherwise no signal will be routed to the rear speakers.
  22. As default it's turned on.
  23. *** WARNING ***
  24. When "Four Channel Mode" switch is off, the output from rear speakers
  25. will be FULL VOLUME regardless of Master and PCM volumes.
  26. This might damage your audio equipment. Please disconnect speakers
  27. before your turn off this switch.
  28. *** WARNING ***
  29. [ Well.. I once got the output with correct volume (i.e. same with the
  30. front one) and was so excited. It was even with "Four Channel" bit
  31. on and "double DAC" mode. Actually I could hear separate 4 channels
  32. from front and rear speakers! But.. after reboot, all was gone.
  33. It's a very pity that I didn't save the register dump at that
  34. time.. Maybe there is an unknown register to achieve this... ]
  35. If your card has an extra output jack for the rear output, the rear
  36. playback should be routed there as default. If not, there is a
  37. control switch in the driver "Line-In As Rear", which you can change
  38. via alsamixer or somewhat else. When this switch is on, line-in jack
  39. is used as rear output.
  40. There are two more controls regarding to the rear output.
  41. The "Exchange DAC" switch is used to exchange front and rear playback
  42. routes, i.e. the 2nd DAC is output from front output.
  43. 4/6 Multi-Channel Playback
  44. --------------------------
  45. The recent CM8738 chips support for the 4/6 multi-channel playback
  46. function. This is useful especially for AC3 decoding.
  47. When the multi-channel is supported, the driver name has a suffix
  48. "-MC" such like "CMI8738-MC6". You can check this name from
  49. /proc/asound/cards.
  50. When the 4/6-ch output is enabled, the second DAC accepts up to 6 (or
  51. 4) channels. While the dual DAC supports two different rates or
  52. formats, the 4/6-ch playback supports only the same condition for all
  53. channels. Since the multi-channel playback mode uses both DACs, you
  54. cannot operate with full-duplex.
  55. The 4.0 and 5.1 modes are defined as the pcm "surround40" and "surround51"
  56. in alsa-lib. For example, you can play a WAV file with 6 channels like
  57. % aplay -Dsurround51 sixchannels.wav
  58. For programming the 4/6 channel playback, you need to specify the PCM
  59. channels as you like and set the format S16LE. For example, for playback
  60. with 4 channels,
  61. snd_pcm_hw_params_set_access(pcm, hw, SND_PCM_ACCESS_RW_INTERLEAVED);
  62. // or mmap if you like
  63. snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_S16_LE);
  64. snd_pcm_hw_params_set_channels(pcm, hw, 4);
  65. and use the interleaved 4 channel data.
  66. There are some control switches affecting to the speaker connections:
  67. "Line-In Mode" - an enum control to change the behavior of line-in
  68. jack. Either "Line-In", "Rear Output" or "Bass Output" can
  69. be selected. The last item is available only with model 039
  70. or newer.
  71. When "Rear Output" is chosen, the surround channels 3 and 4
  72. are output to line-in jack.
  73. "Mic-In Mode" - an enum control to change the behavior of mic-in
  74. jack. Either "Mic-In" or "Center/LFE Output" can be
  75. selected.
  76. When "Center/LFE Output" is chosen, the center and bass
  77. channels (channels 5 and 6) are output to mic-in jack.
  78. Digital I/O
  79. -----------
  80. The CM8x38 provides the excellent SPDIF capability with very cheap
  81. price (yes, that's the reason I bought the card :)
  82. The SPDIF playback and capture are done via the third PCM device
  83. (hw:0,2). Usually this is assigned to the PCM device "spdif".
  84. The available rates are 44100 and 48000 Hz.
  85. For playback with aplay, you can run like below:
  86. % aplay -Dhw:0,2 foo.wav
  87. or
  88. % aplay -Dspdif foo.wav
  89. 24bit format is also supported experimentally.
  90. The playback and capture over SPDIF use normal DAC and ADC,
  91. respectively, so you cannot playback both analog and digital streams
  92. simultaneously.
  93. To enable SPDIF output, you need to turn on "IEC958 Output Switch"
  94. control via mixer or alsactl ("IEC958" is the official name of
  95. so-called S/PDIF). Then you'll see the red light on from the card so
  96. you know that's working obviously :)
  97. The SPDIF input is always enabled, so you can hear SPDIF input data
  98. from line-out with "IEC958 In Monitor" switch at any time (see
  99. below).
  100. You can play via SPDIF even with the first device (hw:0,0),
  101. but SPDIF is enabled only when the proper format (S16LE), sample rate
  102. (441100 or 48000) and channels (2) are used. Otherwise it's turned
  103. off. (Also don't forget to turn on "IEC958 Output Switch", too.)
  104. Additionally there are relevant control switches:
  105. "IEC958 Mix Analog" - Mix analog PCM playback and FM-OPL/3 streams and
  106. output through SPDIF. This switch appears only on old chip
  107. models (CM8738 033 and 037).
  108. Note: without this control you can output PCM to SPDIF.
  109. This is "mixing" of streams, so e.g. it's not for AC3 output
  110. (see the next section).
  111. "IEC958 In Select" - Select SPDIF input, the internal CD-in (false)
  112. and the external input (true).
  113. "IEC958 Loop" - SPDIF input data is loop back into SPDIF
  114. output (aka bypass)
  115. "IEC958 Copyright" - Set the copyright bit.
  116. "IEC958 5V" - Select 0.5V (coax) or 5V (optical) interface.
  117. On some cards this doesn't work and you need to change the
  118. configuration with hardware dip-switch.
  119. "IEC958 In Monitor" - SPDIF input is routed to DAC.
  120. "IEC958 In Phase Inverse" - Set SPDIF input format as inverse.
  121. [FIXME: this doesn't work on all chips..]
  122. "IEC958 In Valid" - Set input validity flag detection.
  123. Note: When "PCM Playback Switch" is on, you'll hear the digital output
  124. stream through analog line-out.
  125. The AC3 (RAW DIGITAL) OUTPUT
  126. ----------------------------
  127. The driver supports raw digital (typically AC3) i/o over SPDIF. This
  128. can be toggled via IEC958 playback control, but usually you need to
  129. access it via alsa-lib. See alsa-lib documents for more details.
  130. On the raw digital mode, the "PCM Playback Switch" is automatically
  131. turned off so that non-audio data is heard from the analog line-out.
  132. Similarly the following switches are off: "IEC958 Mix Analog" and
  133. "IEC958 Loop". The switches are resumed after closing the SPDIF PCM
  134. device automatically to the previous state.
  135. On the model 033, AC3 is implemented by the software conversion in
  136. the alsa-lib. If you need to bypass the software conversion of IEC958
  137. subframes, pass the "soft_ac3=0" module option. This doesn't matter
  138. on the newer models.
  139. ANALOG MIXER INTERFACE
  140. ----------------------
  141. The mixer interface on CM8x38 is similar to SB16.
  142. There are Master, PCM, Synth, CD, Line, Mic and PC Speaker playback
  143. volumes. Synth, CD, Line and Mic have playback and capture switches,
  144. too, as well as SB16.
  145. In addition to the standard SB mixer, CM8x38 provides more functions.
  146. - PCM playback switch
  147. - PCM capture switch (to capture the data sent to DAC)
  148. - Mic Boost switch
  149. - Mic capture volume
  150. - Aux playback volume/switch and capture switch
  151. - 3D control switch
  152. MIDI CONTROLLER
  153. ---------------
  154. With CMI8338 chips, the MPU401-UART interface is disabled as default.
  155. You need to set the module option "mpu_port" to a valid I/O port address
  156. to enable MIDI support. Valid I/O ports are 0x300, 0x310, 0x320 and
  157. 0x330. Choose a value that doesn't conflict with other cards.
  158. With CMI8738 and newer chips, the MIDI interface is enabled by default
  159. and the driver automatically chooses a port address.
  160. There is _no_ hardware wavetable function on this chip (except for
  161. OPL3 synth below).
  162. What's said as MIDI synth on Windows is a software synthesizer
  163. emulation. On Linux use TiMidity or other softsynth program for
  164. playing MIDI music.
  165. FM OPL/3 Synth
  166. --------------
  167. The FM OPL/3 is also enabled as default only for the first card.
  168. Set "fm_port" module option for more cards.
  169. The output quality of FM OPL/3 is, however, very weird.
  170. I don't know why..
  171. CMI8768 and newer chips do not have the FM synth.
  172. Joystick and Modem
  173. ------------------
  174. The legacy joystick is supported. To enable the joystick support, pass
  175. joystick_port=1 module option. The value 1 means the auto-detection.
  176. If the auto-detection fails, try to pass the exact I/O address.
  177. The modem is enabled dynamically via a card control switch "Modem".
  178. Debugging Information
  179. ---------------------
  180. The registers are shown in /proc/asound/cardX/cmipci. If you have any
  181. problem (especially unexpected behavior of mixer), please attach the
  182. output of this proc file together with the bug report.