You are not logged in.

#1 2024-03-24 20:50:38

jonny112
Member
Registered: 2024-03-24
Posts: 1

HD-Audio codec CM8888 (CM8828+CM9882A) only works if system is idle

I'm trying to get a PCI-e sound card based on the C-Media Oxygen Express HD-Audio codec to work.
It offers 7.1 analog outputs, stereo and mic inputs as well as S/PDIF in-/outputs.

lspci:
05:00.0 Audio device: C-Media Electronics Inc CM8888 [Oxygen Express]
        Subsystem: C-Media Electronics Inc HDA Controller
        Flags: bus master, fast devsel, latency 0, IRQ 24
        Memory at fc700000 (32-bit, non-prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [ac] MSI-X: Enable- Count=1 Masked-
        Capabilities: [100] Advanced Error Reporting
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel

Chips on the board are labeled "CM8828 PCI-E HD Sound Processor" for the controller and "CM9882" for the D/A codec.
According to the datasheets available from the manufacturer (https://www.cmedia.com.tw/support/download_center) the main difference between CM8888 and CM8828 are the supported number of channels and the maximum sampling depth.

This codec is used in a variety, of currently available high-performance/low-budget PCI audio interface cards.
Examples:
- StarTech PEXSOUND7CH (https://www.startech.com/en-us/cards-ad … exsound7ch)
- Delock 89640 (https://www.delock.com/produkt/89640/me … tml?g=2194)
- LogiLink PC0076 (http://www.logilink.info/Suche/PC0076)
- various unbranded offers on eBay

The device is detected by snd_hda_intel.

dmesg | grep 0000:05:
[    0.364940] pci 0000:05:00.0: [13f6:5011] type 00 class 0x040300
[    0.364963] pci 0000:05:00.0: reg 0x10: [mem 0xfc700000-0xfc703fff]
[    0.365114] pci 0000:05:00.0: supports D1 D2
[    0.390974] pci_bus 0000:05: resource 1 [mem 0xfc700000-0xfc7fffff]
[    7.060749] snd_hda_intel 0000:05:00.0: enabling device (0000 -> 0002)
[    7.060830] snd_hda_intel 0000:05:00.0: Force to non-snoop mode
[    7.113399] input: HDA C-Media Mic as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input10
[    7.113455] input: HDA C-Media Line as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input11
[    7.113512] input: HDA C-Media Line Out Front as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input12
[    7.113564] input: HDA C-Media Line Out Surround as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input13
[    7.113611] input: HDA C-Media Line Out CLFE as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input14
[    7.113733] input: HDA C-Media Line Out Side as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input15
[    7.113791] input: HDA C-Media Front Headphone as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:04.0/0000:05:00.0/sound/card0/input16

All expected PCMs and mixer controls are available and functional.

aplay -l:
card 0: CMedia [HDA C-Media], device 0: Generic Analog [Generic Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CMedia [HDA C-Media], device 1: Generic Digital [Generic Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

aplay -L:
sysdefault:CARD=CMedia
    HDA C-Media, Generic Analog
    Default Audio Device
front:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    Front output / input
surround21:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CMedia,DEV=0
    HDA C-Media, Generic Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CMedia,DEV=0
    HDA C-Media, Generic Digital
    IEC958 (S/PDIF) Digital Audio Output
usbstream:CARD=CMedia
    HDA C-Media
    USB Stream Output

/proc/asound/card0/codec#0:
Codec: C-Media Generic
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x13f68828
Subsystem Id: 0x13f68280
Revision Id: 0x101300
No Modem Function Group found
Default PCM:
    rates [0x7e0]: 44100 48000 88200 96000 176400 192000
    bits [0xa]: 16 24
    formats [0x2]: FLOAT
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D1 D2 D3 CLKSTOP EPSS
  Power: setting=D0, actual=D0
GPIO: io=2, o=0, i=0, unsolicited=1, wake=1
  IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Node 0x02 [Audio Output] wcaps 0x11: Stereo
  Device: name="Generic Analog", type="Audio", device=0
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
Node 0x03 [Audio Output] wcaps 0x11: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
Node 0x04 [Audio Output] wcaps 0x11: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
Node 0x05 [Audio Output] wcaps 0x11: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
Node 0x06 [Audio Output] wcaps 0x21d: Stereo Digital Amp-Out
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Control: name="IEC958 Default PCM Playback Switch", index=0, device=0
  Device: name="Generic Digital", type="SPDIF", device=1
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Converter: stream=0, channel=0
  Digital: Enabled
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7e0]: 44100 48000 88200 96000 176400 192000
    bits [0xa]: 16 24
    formats [0x5]: PCM AC3
Node 0x07 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In
  Control: name="Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Device: name="Generic Analog", type="Audio", device=0
  Amp-In caps: ofs=0x10, nsteps=0x2e, stepsize=0x03, mute=1
  Amp-In vals:  [0xae 0xae]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Connection: 1
     0x23
Node 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In
  Amp-In caps: ofs=0x10, nsteps=0x2e, stepsize=0x03, mute=1
  Amp-In vals:  [0x90 0x90]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Connection: 1
     0x18
Node 0x0a [Audio Input] wcaps 0x100311: Stereo Digital
  Control: name="IEC958 Capture Switch", index=0, device=0
  Control: name="IEC958 Capture Default", index=0, device=0
  Device: name="Generic Digital", type="SPDIF", device=1
  Converter: stream=0, channel=0
  SDI-Select: 0
  Digital:
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7e0]: 44100 48000 88200 96000 176400 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
  Connection: 1
     0x1f
Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x97 0x97] [0x97 0x97]
  Connection: 2
     0x18 0x19
Node 0x0c [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out
  Control: name="Front Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x80 0x80]
  Amp-Out caps: ofs=0x3e, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Connection: 2
     0x02 0x0b
Node 0x0d [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out
  Control: name="Surround Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x3e, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x00 0x00]
  Connection: 1
     0x03
Node 0x0e [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out
  Control: name="Center Playback Volume", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Control: name="LFE Playback Volume", index=0, device=0
    ControlAmp: chs=2, dir=Out, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x3e, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x00 0x00]
  Connection: 1
     0x04
Node 0x0f [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out
  Control: name="Side Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x3e, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x00 0x00]
  Connection: 1
     0x05
Node 0x10 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x11 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x12 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x13 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x14 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
  Control: name="Front Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0000003c: IN OUT HP Detect
  Pin Default 0x01014010: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=04, enabled=1
  Connection: 1
     0x0c
Node 0x15 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
  Control: name="Surround Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x01011012: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0x1, Sequence = 0x2
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=05, enabled=1
  Connection: 1
     0x0d
Node 0x16 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
  Control: name="Center Playback Switch", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Control: name="LFE Playback Switch", index=0, device=0
    ControlAmp: chs=2, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00000014: OUT Detect
  Pin Default 0x01016011: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Orange
    DefAssociation = 0x1, Sequence = 0x1
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=06, enabled=1
  Connection: 1
     0x0e
Node 0x17 [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
  Control: name="Side Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00000014: OUT Detect
  Pin Default 0x01012014: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Grey
    DefAssociation = 0x1, Sequence = 0x4
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=07, enabled=1
  Connection: 1
     0x0f
Node 0x18 [Pin Complex] wcaps 0x40008b: Stereo Amp-In
  Control: name="Line Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000024: IN Detect
  Pin Default 0x01813020: [Jack] Line In at Ext Rear
    Conn = 1/8, Color = Blue
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0x20: IN
  Unsolicited: tag=03, enabled=1
Node 0x19 [Pin Complex] wcaps 0x40008b: Stereo Amp-In
  Control: name="Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000024: IN Detect
  Pin Default 0x01a19030: [Jack] Mic at Ext Rear
    Conn = 1/8, Color = Pink
    DefAssociation = 0x3, Sequence = 0x0
  Pin-ctls: 0x20: IN
  Unsolicited: tag=02, enabled=1
Node 0x1a [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1b [Pin Complex] wcaps 0x40018d: Stereo Amp-Out
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x02214040: [Jack] HP Out at Ext Front
    Conn = 1/8, Color = Green
    DefAssociation = 0x4, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=01, enabled=1
  Connection: 1
     0x26
Node 0x1c [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1d [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1e [Pin Complex] wcaps 0x400300: Mono Digital
  Pincap 0x00000010: OUT
  Pin Default 0x0144f1f0: [Jack] SPDIF Out at Ext Rear
    Conn = RCA, Color = Other
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Connection: 1
     0x06
Node 0x1f [Pin Complex] wcaps 0x400200: Mono Digital
  Pincap 0x00000020: IN
  Pin Default 0x01c4f1f0: [Jack] SPDIF In at Ext Rear
    Conn = RCA, Color = Other
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
Node 0x20 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x21 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x22 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x80 0x80] [0x80 0x80]
  Connection: 3
     0x18 0x19 0x14
Node 0x24 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x25 [Audio Output] wcaps 0x11: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xa]: 16 24
    formats [0x1]: PCM
Node 0x26 [Audio Mixer] wcaps 0x20010f: Stereo Amp-In Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x3e, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x00 0x00]
  Connection: 1
     0x25

I've tested various sampling formats and channel configurations.
Everything up to the full 8 channels, 192kHz, 24/32bit PCM playback and even AC-3/DTS passthrough on S/PDIF is working.

There is just one major issue:
Playback only runs stable if the system is almost fully idle. Any small load (such as moving the mouse fast across UI elements) causes audio buffer updates to be dropped, with the codec repeating the last buffer. In fact, I'm only able to achieve smooth playback from the console using aplay or mpv with direct ALSA output and no sound server involved. When one CPU core is fully utilized (stress -c 1, while 16 threads are available) playback almost completely stalls with buffer updates only occurring every few seconds. ALSA seems to be oblivious to the issue. No xruns are reported and dmesg remains completely silent. The application continues to play and when the system returns to idle again, playback resumes from the position the application has reached until then. Interestingly, when playback is stalled with one core fully utilized and I perform some other task generating I/O traffic, this causes playback to continue, jerky nevertheless, but it appears as if unrelated I/O interrupts cause more of the audio buffer updates to get through again.

I went through the official HD-Audio troubleshooting suggestions (https://www.kernel.org/doc/html/latest/ … notes.html) but none of them helped mitigate the issue. Forcing enable_msi on or off makes no difference, position_fix=2 or bdl_pos_adj<8 break it entirely. Fiddling with ALSA settings like buffer/period has also been to no avail, if anything, it made things worse.

I can however rule out a general issue with the hardware. Booting the same machine to Windows 10 and using Microsoft's generic "High Definition Audio Device" driver, playback on the card runs glitch free even if I put the system under heavy load.

Has anyone had similar issues with this or other HDA codecs, and found a workaround?
Probably the issue is not so much ALSA/HDA but more PCI/ACPI related.
Any suggestions what other settings I could try or how I could obtain more relevant debug info?
As all features of this card appear to be supported by the HDA driver, it would be really neat getting it to work stable.

Board: ASRock X570 Pro4
Chipset: AMD X570
BIOS: AMI P5.50
CPU: AMD Ryzen 7 3800XT 8-Core Processor
MemTotal: 32785236 kB
Kernel: 6.7.5-arch1-1

Last edited by jonny112 (2024-03-30 18:55:10)

Offline

#2 2024-11-21 00:19:53

Ghostradamus
Member
Registered: 2024-11-21
Posts: 1

Re: HD-Audio codec CM8888 (CM8828+CM9882A) only works if system is idle

I have a similar card with the exact same chip and configuration. It stopped working after a kernel update but it worked before, The only solution for me was to use the Liquorix kernel.
Debian & Ubuntu view this as a CM8888 chipset (it's CM8828) and audio was just full of crackling, making it unusable. To fix the sound issues just create a file in /etc/modprobe.d/ called alsa-base.conf with the line "options snd-hda-intel bdl_pos_adj=1,64 snoop=0" and perfect sound should be restored.

Offline

Board footer

Powered by FluxBB