No sound via HDMI

Hello,

This is a frequent issue but I didn't find something that works.
My hardware are an i3 7100T with a Realtek ALC887. I use the graphic card included in the processor (HD630).

The sound works well from the rear analog panel. But nothing from HDMI port.

Code:
$ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC887 (Rear Analog)> (play/rec) default
pcm1: <Realtek ALC887 (Front Analog)> (play/rec)
pcm2: <Realtek ALC887 (Internal Digital)> (play)
pcm3: <Realtek ALC887 (Rear Digital)> (play)
No devices installed from userspace.

I tried sysctl hw.snd.default_unit= for each of the pcm listed, without result.
The thing that worries me is that there isn't HDMI port listed in cat /dev/sndstat.

Any hint will be appreciated.
 
Last edited by a moderator:
There is no HDMI output listed.
On some motherboards, audio via HDMI must be explicitly enabled in the BIOS. I'd check that.
 
Thanks for you reply.

I don't see anything related to HDMI & sound in the BIOS settings except "SDIF out type" which can be set either at "SPDIF" or "HDMI". In both cases, there is no change.

Here is dmesg|grep hda:

Code:
hdac0: <Intel Sunrise Point HDA Controller> mem 0xf7340000-0xf7343fff,0xf7320000-0xf732ffff irq 16 at device 31.3 on pci0
hdacc0: <Realtek ALC887 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC887 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC887 (Rear Analog)> at nid 20 and 24,26 on hdaa0
pcm1: <Realtek ALC887 (Front Analog)> at nid 27 and 25 on hdaa0
pcm2: <Realtek ALC887 (Digital)> at nid 17 on hdaa0
pcm3: <Realtek ALC887 (Rear Digital)> at nid 30 on hdaa0
hdacc1: <Intel Kabylake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kabylake Audio Function Group> at nid 1 on hdacc1

This is the partial result of pciconf -lv:
Code:
hdac0@pci0:0:31:3:    class=0x040300 card=0x86c71043 chip=0xa1708086 rev=0x31 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '100 Series/C230 Series Chipset Family HD Audio Controller'
    class      = multimedia
    subclass   = HDA

Strangely enough, I don't see any Realtek audio device in pciconf, instead there is just an Intel one.

Here is dmesg|grep drm

Code:
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
[drm] Got stolen memory base 0xc4000000, size 0x4000000
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-2: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-2
[drm]   - kern.vt.fb.default_mode
[drm] Connector DP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DP-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-3: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-3
[drm]   - kern.vt.fb.default_mode
[drm] Connector DP-2: get mode from tunables:
[drm]   - kern.vt.fb.modes.DP-2
[drm]   - kern.vt.fb.default_mode
[drm] Initialized i915 1.6.0 20171222 for drmn0 on minor 0
name=drmn0 flags=0x0 stride=5760 bpp=32
drmn0: fb0: inteldrmfb frame buffer device
drmn0: successfully loaded firmware image with name: i915/kbl_dmc_ver1_04.bin
[drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)

In fact, I don't know where to dig.
 
Last edited by a moderator:
I don't see anything related to HDMI & sound in the BIOS settings except "SDIF out type" which can be set either at "SPDIF" or "HDMI". In both cases, there is no change.

Yeah, try setting that to HDMI and then use whatever output is the digital one, which in this case:

pcm2: <Realtek ALC887 (Digital)> at nid 17 on hdaa0
pcm3: <Realtek ALC887 (Rear Digital)> at nid 30 on hdaa0

... pcm2 or maybe pcm3 would appear to be the possible ones.

You're right though, usually you will actually see one probed as HDMI when it is enabled and working, and if you tried all possible pcmx devices with it set to HMDI, then it has to be something else.

Hmmmm. 🤔
 
I just looked through all my computers and found two Intel Haswell systems that behave different:

System "A" does not have HDMI audio settings in BIOS. A HDMI audio device shows up in cat /dev/sndstat
Code:
% cat /dev/sndstat
Installed devices:
pcm0: <Intel Haswell (HDMI/DP 8ch)> (play)

System "B" also has the "SPDIF out type" in the BIOS. but setting it to HDMI, still does not make any HDMI audio device show up in cat /dev/sndstat.

Below I post both machine's output of sysctl dev.hdaa.0 for comparison.

System "A" with HDMI showing up:
Code:
% sysctl dev.hdaa.0
dev.hdaa.0.reconfig: 0
dev.hdaa.0.gpo_config:
dev.hdaa.0.gpo_state:
dev.hdaa.0.gpio_config:
dev.hdaa.0.gpio_state:
dev.hdaa.0.gpi_state:
dev.hdaa.0.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.0.nid3_original: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0                                                                                                                     
dev.hdaa.0.nid3_config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.0.nid3: pin: Digital-out (Jack)
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
    Association: 0 (0x0001)
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.0.nid2: audio output
     Widget cap: 0x00006611 PWR DIGITAL 8CH
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000005 AC3 PCM
        PCM cap: 0x001e07f0 16 20 24 32 bits, 32 44 48 88 96 176 192 KHz

dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x80860101
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Intel Haswell Audio Function Group

System "B" without HDMI showing up:
Code:
sysctl dev.hdaa.0
dev.hdaa.0.reconfig: 0
dev.hdaa.0.gpo_config:
dev.hdaa.0.gpo_state:
dev.hdaa.0.gpio_config:
dev.hdaa.0.gpio_state:
dev.hdaa.0.gpi_state:
dev.hdaa.0.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.0.nid3_original: 0x58560010 as=1 seq=0 device=Digital-out conn=None ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.0.nid3_config: 0x58560010 as=1 seq=0 device=Digital-out conn=None ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.0.nid3: pin: Digital-out (None) [DISABLED]
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x58560010 as=1 seq=0 device=Digital-out conn=None ctype=Digital loc=0x18 color=Unknown misc=0
    Pin control: 0x00000000
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + [DISABLED] <- nid=2 [audio output] [DISABLED]

dev.hdaa.0.nid2: audio output [DISABLED]
     Widget cap: 0x00006611 PWR DIGITAL 8CH
     Stream cap: 0x00000005 AC3 PCM
        PCM cap: 0x001e07f0 16 20 24 32 bits, 32 44 48 88 96 176 192 KHz

dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x80860101
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Intel Haswell Audio Function Group

Take a look at dev.hdaa.0.nid3 and dev.hdaa.0.nid3_config, they are different, as on the machine with no HDMI device, there is "conn=none", which means disabled.

As dev.hdaa.0.nid3 is read-only I'd try something like the following in /boot/device.hints
hint.hdaa.0.nid3.config="conn=jack"
I'm not sure if that would associate the pin with the HDMI connector when it's set to HDMI in BIOS, but it's worth a try.
snd_hda(4) has explains the hints and for the "as", "seq" stuff.

If it should require editing the seqences and association of pins, just search the forum for "sound" and you'll find some good threads with examples.

I can't do any further testing on my machine, as said computer is a server, I heavily use for other things right now.
Still I hope this helps you, getting it to work.
 
k.jacker you just hit the thing. I saw that dev.hdaa.1.nid3 has HDMI capability and was disabled with conn=none. So, I put hint.hdaa.1.nid3.config="conn=jack" in /boot/device.hints, and after reboot:

Code:
$ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC887 (Rear Analog)> (play/rec) default
pcm1: <Realtek ALC887 (Front Analog)> (play/rec)
pcm2: <Realtek ALC887 (Digital)> (play)
pcm3: <Realtek ALC887 (Rear Digital)> (play)
pcm4: <Intel Kabylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.

But... After sysctl hw.snd.defaut_unit=4, still no sound from HDMI.

Code:
$ sysctl dev.hdaa.1.nid3
dev.hdaa.1.nid3: pin: Digital-out (Jack)
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
    Association: 0 (0x0001)
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

mute=1 and it's maybe the problem. Still I found no way to set it to 0. I played with as / seq but no joy for the moment.
 
Nice, that's a step in the right direction.

Audio output itself seems to go through nid2, what does sysctl dev.hdaa.1.nid2 show now?
 
Code:
$ sysctl dev.hdaa.1.nid2
dev.hdaa.1.nid2: audio output
     Widget cap: 0x00006611 PWR DIGITAL 8CH
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000005 AC3 PCM
        PCM cap: 0x001a07f0 16 24 32 bits, 32 44 48 88 96 176 192 KHz

Note that I enabled the verbose mode for the sound drivers:
Code:
$ cat /dev/sndstat
FreeBSD Audio Driver (64bit 2009061500/amd64)
Installed devices:
pcm0: <Realtek ALC887 (Rear Analog)> on hdaa0  (1p:1v/1r:1v)
pcm1: <Realtek ALC887 (Front Analog)> on hdaa0  (1p:1v/1r:1v)
pcm2: <Realtek ALC887 (Internal Digital)> on hdaa0  (1p:1v/0r:0v)
pcm3: <Realtek ALC887 (Rear Digital)> on hdaa0  (1p:1v/0r:0v)
pcm4: <Intel Kabylake (HDMI/DP 8ch)> on hdaa1  (1p:1v/0r:0v) default
No devices installed from userspace.

But I have to admit that I understand very few things from these outputs. Is there something to read about this?
 
Last edited by a moderator:
But I have to admit that I understand very few things from these outputs. Is there something to read about this?
Handbook: 7.2. Setting Up the Sound Card and snd_hda(4).

HDA can be a bit tricky to set up. The driver is constructed in a very flexible way because there are about a gazillion different ways of implementing the actual hardware pins. Instead of creating a gazillion different drivers, all doing the same thing differently, it was better to create a single, flexible, driver that can be adjusted. Unfortunately, due to the sheer volume of options and configurations it can be a little difficult to understand.
 
Thanks SirDice. Always there to help a lost soul like me.

I read many times the contents of the links you point out. I don't mean I all understood them but some important questions remain unanswered.

- From where the HDMI sound is supposed to come? Does it need to pass thru the realtek card or does it go directly to the Intel Kabylake?
- Why is there no sound device at all when I disable the sound card in BIOS?
- Association numbers (as) work between cards or is it only inside a given card? For example, if I set as=3 on hdaa1.nid3, does it group nids with as=3 that belong to hdaa0?
- Why the defaults settings of hdaa1 make its devices not available for sound output?

The last question and some posts from other people with almost the same problem make me consider that it could be a driver bug or maybe the driver can't fully support the Kabylake sound devices.

Moreover, I receive some errors from hdacc1. Something like:
Code:
hdacc1: Unexpected unsolicited response with tag 63: ffffffff
I found some relevant posts / PR like this but there's nothing that helps concerning my problem.

Finally, I feel this is something that needs a patch to be solved. So I made a PR 237340.

In the meantime, I will use rear analog output (which is not pratical at all for what I want to achieve).
 
Back
Top