<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Brief Notes on C-Media 8338/8738/8768/8770 Driver — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=3918102e" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Sound Blaster Live mixer / default DSP code" href="sb-live-mixer.html" />
<link rel="prev" title="Analog Joystick Support on ALSA Drivers" href="joystick.html" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../subsystem-apis.html#human-interfaces">Human interfaces</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../input/index.html">Input Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../hid/index.html">Human Interface Devices (HID)</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../index.html">Sound Subsystem Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../gpu/index.html">GPU Driver Developer’s Guide</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../fb/index.html">Frame Buffer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../leds/index.html">LEDs</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/sound/cards/cmipci.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="brief-notes-on-c-media-8338-8738-8768-8770-driver">
<h1>Brief Notes on C-Media 8338/8738/8768/8770 Driver<a class="headerlink" href="#brief-notes-on-c-media-8338-8738-8768-8770-driver" title="Link to this heading">¶</a></h1>
<p>Takashi Iwai <<a class="reference external" href="mailto:tiwai%40suse.de">tiwai<span>@</span>suse<span>.</span>de</a>></p>
<section id="front-rear-multi-channel-playback">
<h2>Front/Rear Multi-channel Playback<a class="headerlink" href="#front-rear-multi-channel-playback" title="Link to this heading">¶</a></h2>
<p>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.</p>
<p>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.</p>
<p>There are slight differences between the two DACs:</p>
<ul class="simple">
<li><p>The first DAC supports U8 and S16LE formats, while the second DAC
supports only S16LE.</p></li>
<li><p>The second DAC supports only two channel stereo.</p></li>
</ul>
<p>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.</p>
<p>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.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>When “Four Channel Mode” switch is off, the output from rear speakers
will be FULL VOLUME regardless of Master and PCM volumes <a class="footnote-reference brackets" href="#id2" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>.
This might damage your audio equipment. Please disconnect speakers
before your turn off this switch.</p>
</div>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id2" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
<p>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...</p>
</aside>
</aside>
<p>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.</p>
<p>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.</p>
</section>
<section id="multi-channel-playback">
<h2>4/6 Multi-Channel Playback<a class="headerlink" href="#multi-channel-playback" title="Link to this heading">¶</a></h2>
<p>The recent CM8738 chips support for the 4/6 multi-channel playback
function. This is useful especially for AC3 decoding.</p>
<p>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.</p>
<p>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.</p>
<p>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</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>% aplay -Dsurround51 sixchannels.wav
</pre></div>
</div>
<p>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,</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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);
</pre></div>
</div>
<p>and use the interleaved 4 channel data.</p>
<p>There are some control switches affecting to the speaker connections:</p>
<dl class="simple">
<dt>Line-In Mode</dt><dd><p>an <code class="xref c c-enum broken_xref docutils literal notranslate"><span class="pre">enum</span> <span class="pre">control</span></code> 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.</p>
</dd>
<dt>Mic-In Mode</dt><dd><p>an <code class="xref c c-enum broken_xref docutils literal notranslate"><span class="pre">enum</span> <span class="pre">control</span></code> 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.</p>
</dd>
</dl>
</section>
<section id="digital-i-o">
<h2>Digital I/O<a class="headerlink" href="#digital-i-o" title="Link to this heading">¶</a></h2>
<p>The CM8x38 provides the excellent SPDIF capability with very cheap
price (yes, that’s the reason I bought the card :)</p>
<p>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:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>% aplay -Dhw:0,2 foo.wav
</pre></div>
</div>
<p>or</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>% aplay -Dspdif foo.wav
</pre></div>
</div>
<p>24bit format is also supported experimentally.</p>
<p>The playback and capture over SPDIF use normal DAC and ADC,
respectively, so you cannot playback both analog and digital streams
simultaneously.</p>
<p>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).</p>
<p>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.)</p>
<p>Additionally there are relevant control switches:</p>
<dl>
<dt>IEC958 Mix Analog</dt><dd><p>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).</p>
<p>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).</p>
</dd>
<dt>IEC958 In Select</dt><dd><p>Select SPDIF input, the internal CD-in (false)
and the external input (true).</p>
</dd>
<dt>IEC958 Loop</dt><dd><p>SPDIF input data is loop back into SPDIF
output (aka bypass)</p>
</dd>
<dt>IEC958 Copyright</dt><dd><p>Set the copyright bit.</p>
</dd>
<dt>IEC958 5V</dt><dd><p>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.</p>
</dd>
<dt>IEC958 In Monitor</dt><dd><p>SPDIF input is routed to DAC.</p>
</dd>
<dt>IEC958 In Phase Inverse</dt><dd><p>Set SPDIF input format as inverse.
[FIXME: this doesn’t work on all chips..]</p>
</dd>
<dt>IEC958 In Valid</dt><dd><p>Set input validity flag detection.</p>
</dd>
</dl>
<p>Note: When “PCM Playback Switch” is on, you’ll hear the digital output
stream through analog line-out.</p>
</section>
<section id="the-ac3-raw-digital-output">
<h2>The AC3 (RAW DIGITAL) OUTPUT<a class="headerlink" href="#the-ac3-raw-digital-output" title="Link to this heading">¶</a></h2>
<p>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.</p>
<p>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.</p>
<p>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.</p>
</section>
<section id="analog-mixer-interface">
<h2>ANALOG MIXER INTERFACE<a class="headerlink" href="#analog-mixer-interface" title="Link to this heading">¶</a></h2>
<p>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.</p>
<p>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</p>
</section>
<section id="midi-controller">
<h2>MIDI CONTROLLER<a class="headerlink" href="#midi-controller" title="Link to this heading">¶</a></h2>
<p>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.</p>
<p>With CMI8738 and newer chips, the MIDI interface is enabled by default
and the driver automatically chooses a port address.</p>
<p>There is <em>no</em> 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.</p>
</section>
<section id="fm-opl-3-synth">
<h2>FM OPL/3 Synth<a class="headerlink" href="#fm-opl-3-synth" title="Link to this heading">¶</a></h2>
<p>The FM OPL/3 is also enabled as default only for the first card.
Set “fm_port” module option for more cards.</p>
<p>The output quality of FM OPL/3 is, however, very weird.
I don’t know why..</p>
<p>CMI8768 and newer chips do not have the FM synth.</p>
</section>
<section id="joystick-and-modem">
<h2>Joystick and Modem<a class="headerlink" href="#joystick-and-modem" title="Link to this heading">¶</a></h2>
<p>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.</p>
<p>The modem is enabled dynamically via a card control switch “Modem”.</p>
</section>
<section id="debugging-information">
<h2>Debugging Information<a class="headerlink" href="#debugging-information" title="Link to this heading">¶</a></h2>
<p>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.</p>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../../_sources/sound/cards/cmipci.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>