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