← Documents Documentation/sound/cards/cmipci.rst GitHub 원문 ↗

Linux 6.18.37 · Sound

C-Media 8338/8738/8768/8770 드라이버 요약

CM8x38 계열의 이중 DAC, 4/6채널 재생, S/PDIF와 AC-3 raw 출력, 아날로그 믹서, MIDI·OPL3·조이스틱 설정을 장치명과 제어 이름 그대로 정리합니다.

Source pathDocumentation/sound/cards/cmipci.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

cmipci.rst:1-272

CM8x38 계열의 이중 DAC, 4/6채널 재생, S/PDIF와 AC-3 raw 출력, 아날로그 믹서, MIDI·OPL3·조이스틱 설정을 장치명과 제어 이름 그대로 정리합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

전면·후면 독립 재생과 이중 DAC

1-59

Takashi Iwai가 작성한 이 문서는 C-Media 8338/8738/8768/8770 드라이버의 주요 동작을 설명한다. CM8x38 칩은 ADC를 두 번째 DAC로 사용해 전면과 후면에 서로 다른 스테레오 채널을 재생할 수 있다. DAC가 둘이므로 아래의 4/6채널 다중 채널 재생과 달리 두 스트림은 독립적으로 처리된다.

기본 ALSA 매핑에서 카드 0의 첫 PCM `hw:0,0`은 전면과 4/6채널 재생에, 두 번째 PCM `hw:0,1`은 두 번째 DAC를 통한 후면 재생에 할당된다. 첫 DAC는 `U8`과 `S16LE`를 지원하지만 두 번째 DAC는 `S16LE`만 지원하며 2채널 스테레오만 처리한다.

CM8x38 DAC는 연속적인 재생 표본률을 지원하지 않고 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000Hz의 고정 표본률만 지원한다.

후면 출력은 `Four Channel Mode` 스위치를 끈 경우에만 들린다. 스위치가 켜져 있으면 후면 스피커로 신호가 가지 않으며 기본값은 켜짐이다. 그러나 스위치를 끄면 Master와 PCM 볼륨과 관계없이 후면 스피커가 최대 볼륨으로 출력될 수 있어 장비를 손상할 수 있으므로, 스위치를 끄기 전에 스피커를 분리해야 한다.

각주에서 작성자는 `Four Channel` 비트가 켜진 이중 DAC 모드에서 전면·후면 4채널이 올바른 볼륨으로 분리 출력된 적이 있었지만 재부팅 뒤 사라졌고 레지스터 덤프를 저장하지 못했다고 설명한다. 이를 가능하게 하는 알려지지 않은 레지스터가 있을 수 있다.

카드에 후면 출력 잭이 따로 있으면 기본적으로 후면 재생이 그곳으로 전달된다. 별도 잭이 없으면 `Line-In As Rear`를 `alsamixer` 등에서 켜 라인 입력 잭을 후면 출력으로 사용할 수 있다. `Exchange DAC` 스위치는 전면과 후면 경로를 맞바꿔 두 번째 DAC가 전면 출력으로 나가게 한다.

CM8x38 이중 DAC 비교
항목첫 번째 DAC두 번째 DAC
PCMhw:0,0hw:0,1
기본 용도전면 및 4/6채널후면
형식U8, S16LES16LE
채널전면/다중 채널2채널 스테레오만

독립 전면·후면 재생에서 두 DAC의 제약을 비교한다.

후면 출력 경로
별도 후면 잭 있음후면 재생을 전용 잭으로 출력
별도 후면 잭 없음Line-In As Rear 켜기라인 입력 잭을 후면 출력으로 사용
Exchange DAC 켜기두 번째 DAC 경로를 전면 출력으로 교환

카드 잭 구성과 믹서 스위치에 따라 후면 출력 위치가 바뀐다.

=================================================
Brief Notes on C-Media 8338/8738/8768/8770 Driver
=================================================

Takashi Iwai <tiwai@suse.de>


Front/Rear Multi-channel Playback
---------------------------------

CM8x38 chip can use ADC as the second DAC so that two different stereo
channels can be used for front/rear playbacks.  Since there are two
DACs, both streams are handled independently unlike the 4/6ch multi-
channel playbacks in the section below.

As default, ALSA driver assigns the first PCM device (i.e. hw:0,0 for
card#0) for front and 4/6ch playbacks, while the second PCM device
(hw:0,1) is assigned to the second DAC for rear playback.

There are slight differences between the two DACs:

- The first DAC supports U8 and S16LE formats, while the second DAC
  supports only S16LE.
- The second DAC supports only two channel stereo.

Please note that the CM8x38 DAC doesn't support continuous playback
rate but only fixed rates: 5512, 8000, 11025, 16000, 22050, 32000,
44100 and 48000 Hz.

The rear output can be heard only when "Four Channel Mode" switch is
disabled.  Otherwise no signal will be routed to the rear speakers.
As default it's turned on.

.. WARNING::
  When "Four Channel Mode" switch is off, the output from rear speakers
  will be FULL VOLUME regardless of Master and PCM volumes [#]_.
  This might damage your audio equipment.  Please disconnect speakers
  before your turn off this switch.


.. [#]
  Well.. I once got the output with correct volume (i.e. same with the
  front one) and was so excited.  It was even with "Four Channel" bit
  on and "double DAC" mode.  Actually I could hear separate 4 channels
  from front and rear speakers!  But.. after reboot, all was gone.
  It's a very pity that I didn't save the register dump at that
  time..  Maybe there is an unknown register to achieve this...

If your card has an extra output jack for the rear output, the rear
playback should be routed there as default.  If not, there is a
control switch in the driver "Line-In As Rear", which you can change
via alsamixer or somewhat else.  When this switch is on, line-in jack
is used as rear output.

There are two more controls regarding to the rear output.
The "Exchange DAC" switch is used to exchange front and rear playback
routes, i.e. the 2nd DAC is output from front output.

4/6채널 다중 채널 재생

60-109

최근 CM8738 칩은 AC-3 디코딩 등에 유용한 4/6채널 재생을 지원한다. 다중 채널 지원 모델의 드라이버 이름에는 `CMI8738-MC6`처럼 `-MC` 접미사가 붙으며 `/proc/asound/cards`에서 확인할 수 있다.

4/6채널 출력을 켜면 두 번째 DAC가 최대 6채널 또는 4채널을 받는다. 이중 DAC 모드는 두 스트림에 서로 다른 표본률이나 형식을 허용하지만, 4/6채널 재생은 모든 채널이 같은 조건을 써야 한다. 다중 채널 모드가 두 DAC를 모두 사용하므로 전이중으로 동작할 수 없다.

alsa-lib는 4.0과 5.1 모드를 각각 `surround40`, `surround51` PCM으로 정의한다. 6채널 WAV 파일은 다음처럼 재생한다.

% aplay -Dsurround51 sixchannels.wav

프로그램에서 4/6채널 재생을 구성할 때는 원하는 PCM 채널 수와 `S16LE` 형식을 지정하고 인터리브된 채널 데이터를 사용한다. 4채널 설정 예는 다음과 같다.

snd_pcm_hw_params_set_access(pcm, hw, SND_PCM_ACCESS_RW_INTERLEAVED);
    // or mmap if you like
snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_S16_LE);
snd_pcm_hw_params_set_channels(pcm, hw, 4);

`Line-In Mode`는 라인 입력 잭을 `Line-In`, `Rear Output`, `Bass Output` 중 하나로 바꾼다. `Bass Output`은 모델 039 이상에서만 제공된다. `Rear Output`을 고르면 서라운드 채널 3과 4가 라인 입력 잭으로 출력된다. `Mic-In Mode`는 마이크 잭을 `Mic-In` 또는 `Center/LFE Output`으로 바꾸며, 후자를 고르면 중앙과 저음 채널 5와 6이 마이크 입력 잭으로 출력된다.

다중 채널 출력 잭 모드
제어선택값출력 채널
Line-In ModeLine-In / Rear Output / Bass OutputRear Output은 채널 3·4, Bass Output은 모델 039 이상
Mic-In ModeMic-In / Center/LFE OutputCenter/LFE는 채널 5·6

입력 잭을 후면·저음·Center/LFE 출력으로 전환하는 제어다.

4/6 Multi-Channel Playback
--------------------------

The recent CM8738 chips support for the 4/6 multi-channel playback
function.  This is useful especially for AC3 decoding.

When the multi-channel is supported, the driver name has a suffix
"-MC" such like "CMI8738-MC6".  You can check this name from
/proc/asound/cards.

When the 4/6-ch output is enabled, the second DAC accepts up to 6 (or
4) channels.  While the dual DAC supports two different rates or
formats, the 4/6-ch playback supports only the same condition for all
channels.  Since the multi-channel playback mode uses both DACs, you
cannot operate with full-duplex.

The 4.0 and 5.1 modes are defined as the pcm "surround40" and "surround51"
in alsa-lib.  For example, you can play a WAV file with 6 channels like
::

        % aplay -Dsurround51 sixchannels.wav

For programming the 4/6 channel playback, you need to specify the PCM
channels as you like and set the format S16LE.  For example, for playback
with 4 channels,
::

        snd_pcm_hw_params_set_access(pcm, hw, SND_PCM_ACCESS_RW_INTERLEAVED);
            // or mmap if you like
        snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_S16_LE);
        snd_pcm_hw_params_set_channels(pcm, hw, 4);

and use the interleaved 4 channel data.

There are some control switches affecting to the speaker connections:

Line-In Mode
        an enum control to change the behavior of line-in
        jack.  Either "Line-In", "Rear Output" or "Bass Output" can
        be selected.  The last item is available only with model 039
        or newer. 
        When "Rear Output" is chosen, the surround channels 3 and 4
        are output to line-in jack.
Mic-In Mode
        an enum control to change the behavior of mic-in
        jack.  Either "Mic-In" or "Center/LFE Output" can be
        selected. 
        When "Center/LFE Output" is chosen, the center and bass
        channels (channels 5 and 6) are output to mic-in jack. 

S/PDIF 디지털 입출력

110-149

CM8x38은 저렴한 가격으로 S/PDIF 기능을 제공한다. S/PDIF 재생과 캡처는 세 번째 PCM `hw:0,2`를 사용하며 보통 `spdif` PCM에 할당된다. 사용 가능한 표본률은 44100과 48000Hz이고 24비트 형식도 실험적으로 지원한다.

% aplay -Dhw:0,2 foo.wav
% aplay -Dspdif foo.wav

S/PDIF 재생과 캡처는 각각 일반 DAC와 ADC를 사용하므로 아날로그와 디지털 스트림을 동시에 재생할 수 없다. 출력을 켜려면 믹서나 `alsactl`에서 `IEC958 Output Switch`를 켠다. IEC958은 흔히 S/PDIF라고 부르는 규격의 공식 명칭이다. 동작하면 카드의 빨간 표시등이 켜진다.

S/PDIF 입력은 항상 활성화되어 `IEC958 In Monitor`를 켜면 언제든 라인 출력에서 입력 데이터를 들을 수 있다. 첫 번째 PCM `hw:0,0`으로도 S/PDIF 재생이 가능하지만 올바른 형식 `S16LE`, 원문에 적힌 표본률 `441100` 또는 `48000`, 채널 수 2를 모두 써야 한다. 그렇지 않으면 S/PDIF가 꺼지며 `IEC958 Output Switch`도 켜야 한다. `441100`은 원문의 수치를 그대로 보존한 것이다.

CM8x38 S/PDIF 경로
경로장치조건
전용 S/PDIFhw:0,2 또는 spdif44100/48000Hz, 24비트 실험 지원
첫 PCM 경유hw:0,0S16LE, 원문 441100 또는 48000Hz, 2채널
입력 모니터IEC958 In Monitor입력은 항상 활성, DAC로 라우팅

디지털 PCM과 첫 PCM을 통한 출력 조건을 비교한다.

Digital I/O
-----------

The CM8x38 provides the excellent SPDIF capability with very cheap
price (yes, that's the reason I bought the card :)

The SPDIF playback and capture are done via the third PCM device
(hw:0,2).  Usually this is assigned to the PCM device "spdif".
The available rates are 44100 and 48000 Hz.
For playback with aplay, you can run like below:
::

        % aplay -Dhw:0,2 foo.wav

or

::

        % aplay -Dspdif foo.wav

24bit format is also supported experimentally.

The playback and capture over SPDIF use normal DAC and ADC,
respectively, so you cannot playback both analog and digital streams
simultaneously.

To enable SPDIF output, you need to turn on "IEC958 Output Switch"
control via mixer or alsactl ("IEC958" is the official name of
so-called S/PDIF).  Then you'll see the red light on from the card so
you know that's working obviously :)
The SPDIF input is always enabled, so you can hear SPDIF input data
from line-out with "IEC958 In Monitor" switch at any time (see
below).

You can play via SPDIF even with the first device (hw:0,0),
but SPDIF is enabled only when the proper format (S16LE), sample rate
(441100 or 48000) and channels (2) are used.  Otherwise it's turned
off.  (Also don't forget to turn on "IEC958 Output Switch", too.)

IEC958 제어와 AC-3 raw 디지털 출력

150-209

`IEC958 Mix Analog`은 아날로그 PCM 재생과 FM-OPL/3 스트림을 섞어 S/PDIF로 출력하며 구형 CM8738 모델 033과 037에만 나타난다. 이 제어 없이도 PCM을 S/PDIF로 보낼 수 있다. 스트림을 혼합하는 기능이므로 AC-3 출력에는 맞지 않는다.

`IEC958 In Select`는 내부 CD 입력(false)과 외부 입력(true) 중 S/PDIF 입력을 선택한다. `IEC958 Loop`는 입력을 출력으로 되돌리는 바이패스이고, `IEC958 Copyright`는 저작권 비트를 설정한다. `IEC958 5V`는 0.5V 동축과 5V 광 인터페이스를 고르지만 일부 카드에서는 동작하지 않아 하드웨어 DIP 스위치를 바꿔야 한다.

`IEC958 In Monitor`는 S/PDIF 입력을 DAC로 보낸다. `IEC958 In Phase Inverse`는 입력 형식을 반전하지만 모든 칩에서 동작하지 않는다. `IEC958 In Valid`는 입력 유효성 플래그 감지를 설정한다. `PCM Playback Switch`가 켜져 있으면 디지털 출력 스트림을 아날로그 라인 출력에서도 듣는다.

IEC958 관련 믹서 제어
제어기능제약
IEC958 Mix Analog아날로그 PCM과 FM-OPL/3 혼합CM8738 033/037만, AC-3용 아님
IEC958 In Select내부 CD(false) / 외부(true) 선택입력 소스 선택
IEC958 Loop입력을 출력으로 루프백바이패스
IEC958 Copyright저작권 비트 설정상태 비트
IEC958 5V0.5V 동축 / 5V 광 선택일부 카드는 DIP 스위치 필요
IEC958 In Monitor입력을 DAC로 라우팅아날로그 모니터
IEC958 In Phase Inverse입력 형식 반전일부 칩에서 미동작
IEC958 In Valid입력 validity 감지유효성 플래그

S/PDIF 입력·출력·모니터링에 영향을 주는 스위치다.

드라이버는 S/PDIF를 통한 raw 디지털 입출력, 일반적으로 AC-3를 지원한다. IEC958 재생 제어로 전환할 수 있지만 보통 alsa-lib를 통해 접근한다.

raw 디지털 모드에서는 비오디오 데이터가 아날로그 라인 출력으로 들리지 않도록 `PCM Playback Switch`를 자동으로 끈다. `IEC958 Mix Analog`과 `IEC958 Loop`도 꺼지며, S/PDIF PCM 장치를 닫으면 세 스위치는 자동으로 이전 상태로 복원된다.

모델 033에서는 alsa-lib의 소프트웨어 변환으로 AC-3를 구현한다. IEC958 서브프레임의 소프트웨어 변환을 우회하려면 `soft_ac3=0` 모듈 옵션을 전달한다. 새 모델에는 이 옵션이 영향을 주지 않는다.

AC-3 raw 디지털 모드
S/PDIF raw PCM 열기PCM Playback Switch 끄기IEC958 Mix Analog 끄기IEC958 Loop 끄기AC-3 raw 출력
S/PDIF PCM 닫기세 스위치를 이전 상태로 자동 복원

비오디오 데이터가 아날로그 출력으로 새지 않도록 스위치를 임시 변경한다.

Additionally there are relevant control switches:

IEC958 Mix Analog
        Mix analog PCM playback and FM-OPL/3 streams and
        output through SPDIF.  This switch appears only on old chip
        models (CM8738 033 and 037).

        Note: without this control you can output PCM to SPDIF.
        This is "mixing" of streams, so e.g. it's not for AC3 output
        (see the next section).

IEC958 In Select
        Select SPDIF input, the internal CD-in (false)
        and the external input (true).

IEC958 Loop
        SPDIF input data is loop back into SPDIF
        output (aka bypass)

IEC958 Copyright
        Set the copyright bit.

IEC958 5V
        Select 0.5V (coax) or 5V (optical) interface.
        On some cards this doesn't work and you need to change the
        configuration with hardware dip-switch.

IEC958 In Monitor
        SPDIF input is routed to DAC.

IEC958 In Phase Inverse
        Set SPDIF input format as inverse.
        [FIXME: this doesn't work on all chips..]

IEC958 In Valid
        Set input validity flag detection.

Note: When "PCM Playback Switch" is on, you'll hear the digital output
stream through analog line-out.


The AC3 (RAW DIGITAL) OUTPUT
----------------------------

The driver supports raw digital (typically AC3) i/o over SPDIF.  This
can be toggled via IEC958 playback control, but usually you need to
access it via alsa-lib.  See alsa-lib documents for more details.

On the raw digital mode, the "PCM Playback Switch" is automatically
turned off so that non-audio data is heard from the analog line-out.
Similarly the following switches are off: "IEC958 Mix Analog" and
"IEC958 Loop".  The switches are resumed after closing the SPDIF PCM
device automatically to the previous state.

On the model 033, AC3 is implemented by the software conversion in
the alsa-lib.  If you need to bypass the software conversion of IEC958
subframes, pass the "soft_ac3=0" module option.  This doesn't matter
on the newer models.

아날로그 믹서, MIDI, OPL3, 조이스틱과 디버깅

210-272

CM8x38 믹서는 SB16과 비슷하다. Master, PCM, Synth, CD, Line, Mic, PC Speaker 재생 볼륨을 제공하고, SB16처럼 Synth, CD, Line, Mic에는 재생·캡처 스위치도 있다.

표준 SB 믹서 외에 PCM 재생 스위치, DAC로 보낸 데이터를 캡처하는 PCM 캡처 스위치, Mic Boost, Mic 캡처 볼륨, Aux 재생 볼륨·스위치와 캡처 스위치, 3D 제어 스위치를 제공한다.

CM8x38 아날로그 믹서 확장
그룹제어
기본 재생 볼륨Master, PCM, Synth, CD, Line, Mic, PC Speaker
기본 재생·캡처 스위치Synth, CD, Line, Mic
추가 PCMPCM Playback Switch, PCM Capture Switch
추가 입력·효과Mic Boost, Mic Capture Volume, Aux, 3D Control

SB16 계열 기본 제어에 더해 제공하는 기능이다.

CMI8338에서는 MPU401-UART가 기본으로 꺼져 있다. MIDI를 켜려면 `mpu_port`에 0x300, 0x310, 0x320, 0x330 중 다른 카드와 충돌하지 않는 I/O 포트 주소를 지정한다. CMI8738 이상에서는 MIDI 인터페이스가 기본으로 켜지고 드라이버가 포트를 자동 선택한다.

이 칩에는 아래 OPL3 합성기를 제외하면 하드웨어 웨이브테이블이 없다. Windows에서 MIDI synth라고 부르는 것은 소프트웨어 신시사이저 에뮬레이션이므로 Linux에서는 TiMidity 같은 소프트신시사이저로 MIDI 음악을 재생한다.

FM OPL/3는 첫 카드에만 기본으로 활성화된다. 추가 카드에는 `fm_port` 모듈 옵션을 설정한다. 작성자는 FM OPL/3 출력 품질이 매우 이상하며 이유를 모른다고 적었다. CMI8768 이상에는 FM 신시사이저가 없다.

레거시 조이스틱을 켜려면 `joystick_port=1`을 전달한다. 값 1은 자동 감지이며 실패하면 정확한 I/O 주소를 지정한다. 모뎀은 카드의 `Modem` 제어 스위치로 동적으로 켠다.

레지스터는 `/proc/asound/cardX/cmipci`에서 볼 수 있다. 특히 믹서가 예상과 다르게 동작하는 문제를 보고할 때 이 proc 파일의 출력을 버그 보고서에 첨부해야 한다.

MIDI·FM·조이스틱 설정
기능칩 / 기본값설정
MIDICMI8338 기본 비활성mpu_port=0x300/0x310/0x320/0x330
MIDICMI8738 이상 기본 활성드라이버가 포트 자동 선택
FM OPL/3첫 카드만 기본 활성추가 카드는 fm_port, CMI8768 이상에는 없음
조이스틱기본 비활성joystick_port=1 자동 감지 또는 정확한 주소
모뎀동적 활성Modem 카드 제어 스위치

칩 세대별 기본 동작과 모듈 옵션을 정리한다.

ANALOG MIXER INTERFACE
----------------------

The mixer interface on CM8x38 is similar to SB16.
There are Master, PCM, Synth, CD, Line, Mic and PC Speaker playback
volumes.  Synth, CD, Line and Mic have playback and capture switches,
too, as well as SB16.

In addition to the standard SB mixer, CM8x38 provides more functions.
- PCM playback switch
- PCM capture switch (to capture the data sent to DAC)
- Mic Boost switch
- Mic capture volume
- Aux playback volume/switch and capture switch
- 3D control switch


MIDI CONTROLLER
---------------

With CMI8338 chips, the MPU401-UART interface is disabled as default.
You need to set the module option "mpu_port" to a valid I/O port address
to enable MIDI support.  Valid I/O ports are 0x300, 0x310, 0x320 and
0x330.  Choose a value that doesn't conflict with other cards.

With CMI8738 and newer chips, the MIDI interface is enabled by default
and the driver automatically chooses a port address.

There is *no* hardware wavetable function on this chip (except for
OPL3 synth below).
What's said as MIDI synth on Windows is a software synthesizer
emulation.  On Linux use TiMidity or other softsynth program for
playing MIDI music.


FM OPL/3 Synth
--------------

The FM OPL/3 is also enabled as default only for the first card.
Set "fm_port" module option for more cards.

The output quality of FM OPL/3 is, however, very weird.
I don't know why..

CMI8768 and newer chips do not have the FM synth.


Joystick and Modem
------------------

The legacy joystick is supported.  To enable the joystick support, pass
joystick_port=1 module option.  The value 1 means the auto-detection.
If the auto-detection fails, try to pass the exact I/O address.

The modem is enabled dynamically via a card control switch "Modem".


Debugging Information
---------------------

The registers are shown in /proc/asound/cardX/cmipci.  If you have any
problem (especially unexpected behavior of mixer), please attach the
output of this proc file together with the bug report.