[not a bug] audio and intpm - oss drivers failing, kernel with sound(4) modules now silent with built-in headphone jack

Today I was trying to play audio on headphones, running a local build of FreeBSD 13.1 from stable/13 (changeset 134b047d3e93) on a Minisforum HX90 machine. The uname for this build:

Code:
FreeBSD xmin.cloud.thinkum.space 13.1-STABLE FreeBSD 13.1-STABLE #0 build/stable/13-134b047d3e93: Sun Nov 13 15:11:34 PST 2022     gimbal@xmin.cloud.thinkum.space:/usr/obj/xmin_FreeBSD-13.1-STABLE_amd64_1301509/usr/src/amd64.amd64/sys/XMIN amd64

I'll try to add some details about the hardware layout, after trying to summarize at least one of the issues I'm experiencing with audio here.

In at least one earlier FreeBSD 13.1 build from stable/13 on this machine, I was able to listen to audio normally. `speakertest` worked and audio in Firefox worked. Today, none of these is working, using a kernel with FreeBSD sound(4) support. I've checked all of the knobs that I can imagine to check - cycled through every pcm listed in /dev/sndstat, each time running the following to check the oss+alsa audio over the headhpones:

Code:
speaker-test -Dplug:surround40 -c4 -t wav

Using the audio jack on the HX90 box - which has worked out before - it was completely silent, even with the mixer output channels each at 100:100.

I happen to have an older Creative Soundblaster x-fi device also, it's a USB audio device. After ensuring something like kldload uaudio has been run, then with the following configuration, I can hear audio over the headphone jack - sort of.

Code:
$ cat /dev/sndstat
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <ATI R6xx (HDMI)> (play)
pcm2: <ATI R6xx (HDMI)> (play)
pcm3: <ATI R6xx (HDMI)> (play)
pcm4: <USB audio> (play/rec) default
pcm5: <USB audio> (play/rec)
No devices installed from userspace.
$ sysctl hw.snd.default_unit
hw.snd.default_unit: 4

It "sort of" works out, in the sense that I can hear the speakertest with the headphone audio jack normally placed in the headphone out jack on the creative x-fi device. With speakertest from the command line, it works out normally. With audio in Firefox, however, the sound isn't normally audible unless the headphone jack is only partly inserted, I'd say approx. 3/4. With the headphone jack fully seated with the x-fi device, then at least with audio in firefox, there's some odd garbled sound but not normal audio. With the headhpone jack only partially seated, the sound is good - though the jack connection is really iffy then. I don't know what's the issue with the hardware side, here, it sounds fine with the speakertest out when the jack is fully seated.

There's a headphone jack on the minisforum box, it was working pretty well in one earlier kernel/ports installation. It's now seemingly useless as a headphone jack - it doesn't produce sound via alsa or firefox.

I can try cycling through some earlier boot environments, to try to address the question of whether the latest ports build or the latest kernel upgrade may have resulted in it not producing output on the machine's built-in headphone jack, using FreeBSD sound(4)

I've also tried out the OSS support from the audio/oss drivers. I build the audio/oss port locally, installed it, then rebuilt the kernel without sound support and installed that to a new boot environment. Here I've experienced a separate issue, maybe related to amd support for this machine.

This kernel build wthout sound(4) has the same uname as illustrated above.

Code:
FreeBSD xmin.cloud.thinkum.space 13.1-STABLE FreeBSD 13.1-STABLE #0 build/stable/13-134b047d3e93: Sun Nov 13 15:11:34 PST 2022     gimbal@xmin.cloud.thinkum.space:/usr/obj/xmin_FreeBSD-13.1-STABLE_amd64_1301509/usr/src/amd64.amd64/sys/XMIN amd64

After building and installing the kernel without sound(4) or the snd_* modules I added the following to sysctl.conf:
Code:
kern.module_path="/usr/local/lib/oss/modules;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays"

Then, I tried to find a matching OSS driver for either of the Minisofrum HX-90 headphone-out jack, or for the headphone-out jack on the creative x-fi device on USB. After trying to kldload a couple of the OSS modules, I saw the following in every instance:

Code:
intsmb0: <AMD FCH SMBus Controller> port 0xff00-0xff0f at device 20.0 on pci0
intsmb0: Could not allocate I/O space
device_attach: intsmb0 attach returned 6

None of the oss tools showed any available audio devices. With that error message occurring for each OSS module, I don't know if they ever will, even if I accidentally found the matching OSS driver for any of this audio hardware.

The kernel in this instance was built without sound(4) or any of the snd drivers. Candidly, I don't know how to diagnose the kernel message about an intsmb0.

If the information could help with diagnosing this, for the kernel where sound(4) support is built and loaded in the system, I see the following from pciconf:
Code:
 $ pciconf -lv
hostb0@pci0:0:0:0:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1630 subvendor=0x1022 subdevice=0x1630
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne Root Complex'
    class      = bridge
    subclass   = HOST-PCI
none0@pci0:0:0:2:    class=0x080600 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1631 subvendor=0x1022 subdevice=0x1631
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne IOMMU'
    class      = base peripheral
    subclass   = IOMMU
hostb1@pci0:0:1:0:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir PCIe Dummy Host Bridge'
    class      = bridge
    subclass   = HOST-PCI
pcib1@pci0:0:1:3:    class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x1634 subvendor=0x1022 subdevice=0x1453
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne PCIe GPP Bridge'
    class      = bridge
    subclass   = PCI-PCI
hostb2@pci0:0:2:0:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir PCIe Dummy Host Bridge'
    class      = bridge
    subclass   = HOST-PCI
hostb3@pci0:0:8:0:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir PCIe Dummy Host Bridge'
    class      = bridge
    subclass   = HOST-PCI
pcib2@pci0:0:8:1:    class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x1635 subvendor=0x1022 subdevice=0x1635
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir Internal PCIe GPP Bridge to Bus'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:8:2:    class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x1635 subvendor=0x1022 subdevice=0x1635
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir Internal PCIe GPP Bridge to Bus'
    class      = bridge
    subclass   = PCI-PCI
none1@pci0:0:20:0:    class=0x0c0500 rev=0x51 hdr=0x00 vendor=0x1022 device=0x790b subvendor=0x1022 subdevice=0x790b
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH SMBus Controller'
    class      = serial bus
    subclass   = SMBus
isab0@pci0:0:20:3:    class=0x060100 rev=0x51 hdr=0x00 vendor=0x1022 device=0x790e subvendor=0x1022 subdevice=0x790e
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH LPC Bridge'
    class      = bridge
    subclass   = PCI-ISA
hostb4@pci0:0:24:0:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x166a subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 0'
    class      = bridge
    subclass   = HOST-PCI
hostb5@pci0:0:24:1:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x166b subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 1'
    class      = bridge
    subclass   = HOST-PCI
hostb6@pci0:0:24:2:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x166c subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 2'
    class      = bridge
    subclass   = HOST-PCI
hostb7@pci0:0:24:3:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x166d subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 3'
    class      = bridge
    subclass   = HOST-PCI
hostb8@pci0:0:24:4:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x166e subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 4'
    class      = bridge
    subclass   = HOST-PCI
hostb9@pci0:0:24:5:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x166f subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 5'
    class      = bridge
    subclass   = HOST-PCI
hostb10@pci0:0:24:6:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1670 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 6'
    class      = bridge
    subclass   = HOST-PCI
hostb11@pci0:0:24:7:    class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1671 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Cezanne Data Fabric; Function 7'
    class      = bridge
    subclass   = HOST-PCI
igc0@pci0:1:0:0:    class=0x020000 rev=0x01 hdr=0x00 vendor=0x8086 device=0x15f3 subvendor=0x8086 subdevice=0x0000
    vendor     = 'Intel Corporation'
    device     = 'Ethernet Controller I225-V'
    class      = network
    subclass   = ethernet
vgapci0@pci0:2:0:0:    class=0x030000 rev=0xc4 hdr=0x00 vendor=0x1002 device=0x1638 subvendor=0x1002 subdevice=0x0123
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Cezanne'
    class      = display
    subclass   = VGA
hdac0@pci0:2:0:1:    class=0x040300 rev=0x00 hdr=0x00 vendor=0x1002 device=0x1637 subvendor=0x1002 subdevice=0x1637
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Renoir Radeon High Definition Audio Controller'
    class      = multimedia
    subclass   = HDA
none2@pci0:2:0:2:    class=0x108000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x15df subvendor=0x1022 subdevice=0x15df
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Family 17h (Models 10h-1fh) Platform Security Processor'
    class      = encrypt/decrypt
xhci0@pci0:2:0:3:    class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1639 subvendor=0x1022 subdevice=0x1639
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne USB 3.1'
    class      = serial bus
    subclass   = USB
xhci1@pci0:2:0:4:    class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1639 subvendor=0x1022 subdevice=0x1639
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne USB 3.1'
    class      = serial bus
    subclass   = USB
none3@pci0:2:0:5:    class=0x048000 rev=0x01 hdr=0x00 vendor=0x1022 device=0x15e2 subvendor=0x1022 subdevice=0x15e2
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'ACP/ACP3X/ACP6x Audio Coprocessor'
    class      = multimedia
hdac1@pci0:2:0:6:    class=0x040300 rev=0x00 hdr=0x00 vendor=0x1022 device=0x15e3 subvendor=0x10ec subdevice=0x0000
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Family 17h/19h HD Audio Controller'
    class      = multimedia
    subclass   = HDA
none4@pci0:2:0:7:    class=0x118000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x15e4 subvendor=0x1022 subdevice=0x15e4
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Sensor Fusion Hub'
    class      = dasp
ahci0@pci0:3:0:0:    class=0x010601 rev=0x81 hdr=0x00 vendor=0x1022 device=0x7901 subvendor=0x1022 subdevice=0x7901
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
ahci1@pci0:3:0:1:    class=0x010601 rev=0x81 hdr=0x00 vendor=0x1022 device=0x7901 subvendor=0x1022 subdevice=0x7901
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA

For the kernel without sound(4) modules, there's none listed for the PCI devices shown there as for hdac0 and hdac1.

Initial output from dmesg, for the parts identifying the CPU in the machine:
Code:
Copyright (c) 1992-2021 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 13.1-STABLE #0 build/stable/13-134b047d3e93: Sun Nov 13 15:11:34 PST 2022
    gimbal@xmin.cloud.thinkum.space:/usr/obj/xmin_FreeBSD-13.1-STABLE_amd64_1301509/usr/src/amd64.amd64/sys/XMIN amd64
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
VT(efifb): resolution 800x600
CPU: AMD Ryzen 9 5900HX with Radeon Graphics         (3293.98-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0xa50f00  Family=0x19  Model=0x50  Stepping=0
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x7ed8320b<SSE3,PCLMULQDQ,MON,SSSE3,FMA,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
  AMD Features2=0x75c237ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT,TCE,Topology,PCXC,PNXC,DBE,PL2I,MWAITX,ADMSKX>
  Structured Extended Features=0x219c97a9<FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,PQM,PQE,RDSEED,ADX,SMAP,CLFLUSHOPT,CLWB,SHA>
  Structured Extended Features2=0x40069c<UMIP,PKU,OSPKE,VAES,VPCLMULQDQ,RDPID>
  Structured Extended Features3=0x10<FSRM>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  AMD Extended Feature Extensions ID EBX=0x191ef657<CLZERO,IRPerf,XSaveErPtr,RDPRU,WBNOINVD,IBPB,IBRS,STIBP,STIBP_ALWAYSON,PREFER_IBRS,SSBD>
  SVM: NP,NRIP,VClean,AFlush,DAssist,NAsids=32768
  TSC: P-state invariant, performance statistics
real memory  = 68717379584 (65534 MB)
avail memory = 66236026880 (63167 MB)

Could there be any guesses about how to address the error with intsmb0? if it might be needed by something used by the OSS drivers?

Not in itself related to FreeBSD, but if anyone might have a guess about why the audio is wonky on the X-fi USB device (with Firefox only, so far, compared to speaker-test) unless the headphone jack is only partially seated, thanks for any clue here. Hopefully there could be a workaround at least for that part of my wonky audio configuration

For the odd thing of the audio not working now, on the audio-out jack on the machine, I'll try to be sure that I have the latest kernel modules installed from my local build. The amdgpu support is working out for the hdmi video side, with the kernel modules as presently installed, but maybe there was some mismatch in the audio.

There's at least the partially seated jack with the x-fi external working out for audio right now, in the kernel with sound(4) built and installed.

My monitor doesn't have speakers, and neither does the machine right now, so it's headphone jacks only - and there's the one on the external that works, with quirks - for audio/video lectures, course work, etc, as an undergrad student somewhere
 
In update: This is probably the culprit of some of the error messages here - in my kernconf, lingering from an earlier build configuration where I'd disabled apm and hwpmc

Code:
# nodevice      apm
# nodevice      hwpmc
## oops, the following should not still be set here
nooptions  HWPMC_HOOKS

With all three of those options in the kernconf, my idea was that maybe it would make it any more certain that the machine's acpi support would be used. This Minisforum box is not a laptop, however, and I'd missed that third thing when updating the kernconf.

I'll rebuild the kernel shortly. Maybe the audio will work out then, or at least some of the other modules here.

If anyone might have any guess about the audio jack weirdness with the soundblaster x-fi external, I still can't figure that one out - could it be related to the sampling rate used for the device? but 'speaker-test' still worked out with it.

Maybe I've figured out some of the issue with the headphone jack on the machine itself, though.

With the complete apm and hwpmc support built and installed in the kernel, maybe it'll work out both for the sound(4) build and with the build without sound(4) and with the audio/oss port.

Finally tracked down that oddity about intsmb0 error message Health, all.
 
Second update: May not have tracked down the intsmb0 error message

I've rebuild the kernel with HWPMC_HOOKS and the hwpmc device enabled, still seeing the following:

Code:
# kldload intpm
kldload: an error occurred while loading module intpm. Please check dmesg(8) for more details.

# dmesg | tail -n2
interface intsmb.1 already present in the KLD 'kernel'!
linker_load_file: /boot/kernel/intpm.ko - unsupported file type

After fixing the kernconf, I can load the hwpmc module now:
Code:
# kldload hwpmc
# dmesg | tail -n1
hwpmc: SOFT/16/64/0x67<INT,USR,SYS,REA,WRI> TSC/1/64/0x20<REA> K8/16/48/0x1ff<INT,USR,SYS,EDG,THR,REA,WRI,INV,QUA>

No change in the silent headphone-out jack. With the error still occurring about intsmb0 I'm not certain if the oss drivers would work out either, on this machine.

From kldstat -v It seems that intsmb was built into the kernel, and yet is intpm or some dependency of intpm trying to have it loaded into the kernel?

Maybe it's an issue of processor compatibility, in this AMD machine. I'll try rebuilding the kernel with the following removed from my overoptimized kernconf, if this may be intel-specific

Code:
device          imcsmb

also to remove this from my overoptimized kernconf
Code:
device      intpm

These were listed in NOTES, and subsequently there was this overoptimization, lol. Maybe it's anti-optimization for a build running on an AMD machine?

Hopefully I'm close to fixing the audio issue tho.
 
I'll try rebuilding the kernel with the following removed from my overoptimized kernconf, if this may be intel-specific
I suggest you try a GENERIC kernel and see how things work on that.
 
Back
Top