(Yet Another) HDMI Audio output not working

Hi,

I'm trying to get sound over HDMI when connecting my ThinkPad T480s and my Samsung 4K TV with an HDMI cable. But no sound gets to the TV.
I've read and try things from (Handbook) Chapter 9. Multimedia, (Wiki) Sound & Audio and half a dozen various forum & blog posts but I can't have the sound work through HDMI.

Here's what I did to switch to HDMI output:
$ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC257 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Realtek ALC257 (Right Analog Mic)> (rec)
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
$ mixer -d pcm2
default_unit: 0 -> 2
pcm2:mixer: <Intel Kaby Lake (HDMI/DP 8ch)> on hdaa1 (play) (default)
vol = 0.50:0.50 pbk
pcm = 0.50:0.50 pbk
$ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC257 (Analog 2.0+HP/2.0)> (play/rec)
pcm1: <Realtek ALC257 (Right Analog Mic)> (rec)
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play) default
No devices installed from userspace.
I checked the volumes with mixertui, DSBmixer and GTK-mixer to ensure it was neither mute nor low.

Here are the modules and audio plugins that are loaded:
3 1 0xffffffff82718000 5b18 sysctlinfo.ko
4 1 0xffffffff8271f000 3368 sysctlbyname_improved.ko
8 1 0xffffffff8380c000 1e2228 i915kms.ko
9 2 0xffffffff839ef000 85090 drm.ko
15 1 0xffffffff83a96000 4388 acpi_video.ko
42 2 0xffffffff83d9d000 e5b0 snd_uaudio.ko
45 1 0xffffffff83db9000 24a8 snd_driver.ko
46 1 0xffffffff83dbc000 3200 snd_als4000.ko
47 1 0xffffffff83dc0000 41e8 snd_atiixp.ko
48 1 0xffffffff83dc5000 31f0 snd_cs4281.ko
49 1 0xffffffff83dc9000 5490 snd_envy24.ko
50 3 0xffffffff83dcf000 2110 snd_spicds.ko
51 1 0xffffffff83dd2000 4670 snd_envy24ht.ko
52 1 0xffffffff83dd7000 2230 snd_fm801.ko
53 1 0xffffffff83dda000 5508 snd_hdspe.ko
54 1 0xffffffff83de0000 7ce0 snd_maestro3.ko
55 1 0xffffffff83de8000 f1d0 snd_neomagic.ko
56 1 0xffffffff83df8000 4230 snd_solo.ko
57 1 0xffffffff83dfd000 3250 snd_t4dwave.ko
58 1 0xffffffff83e01000 31f0 snd_via82c686.ko
59 1 0xffffffff83e05000 4200 snd_vibes.ko

Here's what `sysctl dev.pcm` outputs:
dev.pcm.2.mode: 3
dev.pcm.2.bitperfect: 0
dev.pcm.2.buffersize: 65536
dev.pcm.2.play.vchanformat: s16le:2.0
dev.pcm.2.play.vchanrate: 48000
dev.pcm.2.play.vchanmode: passthrough
dev.pcm.2.play.vchans: 1
dev.pcm.2.play.32bit: 24
dev.pcm.2.%iommu:
dev.pcm.2.%parent: hdaa1
dev.pcm.2.%pnpinfo:
dev.pcm.2.%location: nid=3
dev.pcm.2.%driver: pcm
dev.pcm.2.%desc: Intel Kaby Lake (HDMI/DP 8ch)
dev.pcm.1.mode: 5
dev.pcm.1.bitperfect: 0
dev.pcm.1.buffersize: 65536
dev.pcm.1.rec.vchanformat: s16le:2.0
dev.pcm.1.rec.vchanrate: 48000
dev.pcm.1.rec.vchanmode: fixed
dev.pcm.1.rec.vchans: 1
dev.pcm.1.rec.autosrc: 2
dev.pcm.1.rec.32bit: 24
dev.pcm.1.%iommu:
dev.pcm.1.%parent: hdaa0
dev.pcm.1.%pnpinfo:
dev.pcm.1.%location: nid=25
dev.pcm.1.%driver: pcm
dev.pcm.1.%desc: Realtek ALC257 (Right Analog Mic)
dev.pcm.0.mode: 7
dev.pcm.0.bitperfect: 0
dev.pcm.0.buffersize: 65536
dev.pcm.0.rec.vchanformat: s16le:2.0
dev.pcm.0.rec.vchanrate: 48000
dev.pcm.0.rec.vchanmode: fixed
dev.pcm.0.rec.vchans: 1
dev.pcm.0.rec.autosrc: 2
dev.pcm.0.rec.32bit: 24
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchans: 2
dev.pcm.0.play.32bit: 24
dev.pcm.0.%iommu:
dev.pcm.0.%parent: hdaa0
dev.pcm.0.%pnpinfo:
dev.pcm.0.%location: nid=20,33,18
dev.pcm.0.%driver: pcm
dev.pcm.0.%desc: Realtek ALC257 (Analog 2.0+HP/2.0)
dev.pcm.%parent:

Here's what `sysctl hw.snd` outputs:
hw.snd.maxautovchans: 16
hw.snd.default_unit: 2
hw.snd.default_auto: 0
hw.snd.verbose: 0
hw.snd.vpc_mixer_bypass: 1
hw.snd.feeder_rate_quality: 1
hw.snd.feeder_rate_round: 25
hw.snd.feeder_rate_max: 2016000
hw.snd.feeder_rate_min: 1
hw.snd.feeder_rate_polyphase_max: 183040
hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
hw.snd.feeder_eq_exact_rate: 0
hw.snd.feeder_eq_presets: PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
hw.snd.basename_clone: 1
hw.snd.compat_linux_mmap: 0
hw.snd.syncdelay: -1
hw.snd.usefrags: 0
hw.snd.vpc_reset: 0
hw.snd.vpc_0db: 45
hw.snd.vpc_autoreset: 1
hw.snd.timeout: 5
hw.snd.latency_profile: 1
hw.snd.latency: 2
hw.snd.report_soft_matrix: 1
hw.snd.report_soft_formats: 1

Here's the pcm related bits of dmesg booted verbose:
pcm3: detached
pcm0: <Realtek ALC257 (Analog 2.0+HP/2.0)> at nid 20,33 and 18 on hdaa0
pcm0: Playback:
pcm0: Stream cap: 0x00000001 PCM
pcm0: PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
pcm0: DAC: 2
pcm0:
pcm0: nid=20 [pin: Speaker (Fixed)]
pcm0: + <- nid=2 [audio output] [src: pcm]
pcm0:
pcm0: nid=33 [pin: Headphones (Black Jack)]
pcm0: + <- nid=2 [audio output] [src: pcm]
pcm0:
pcm0: Record:
pcm0: Stream cap: 0x00000001 PCM
pcm0: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
pcm0: ADC: 7
pcm0:
pcm0: nid=7 [audio input]
pcm0: + <- nid=36 [audio selector] [src: monitor]
pcm0: + <- nid=18 [pin: Mic (Fixed)] [src: monitor]
pcm0:
pcm0: Master Volume (OSS: vol): -65/0dB
pcm0: +- ctl 1 (nid 2 out): -65/0dB (88 steps)
pcm0: +- ctl 8 (nid 20 in ): mute
pcm0: +- ctl 14 (nid 33 in ): mute
pcm0:
pcm0: PCM Volume (OSS: pcm): -65/0dB
pcm0: +- ctl 1 (nid 2 out): -65/0dB (88 steps)
pcm0: +- ctl 8 (nid 20 in ): mute
pcm0: +- ctl 14 (nid 33 in ): mute
pcm0:
pcm0: Microphone2 Volume (OSS: monitor): 0/30dB
pcm0: +- ctl 3 (nid 7 in 0): -17/30dB (64 steps) + mute
pcm0: +- ctl 6 (nid 18 out): 0/30dB (4 steps)
pcm0:
pcm0: Recording Level (OSS: rec): -17/30dB
pcm0: +- ctl 3 (nid 7 in 0): -17/30dB (64 steps) + mute
pcm0: +- ctl 6 (nid 18 out): 0/30dB (4 steps)
pcm0:
pcm0: Mixer "vol":
pcm0: Mixer "pcm":
pcm0: Mixer "speaker":
pcm0: Mixer "rec":
pcm0: Mixer "ogain":
pcm0: Mixer "monitor":
pcm0: Playback channel set is: Front Left, Front Right,
pcm0: Playback channel matrix is: 2.0 (unknown)
pcm0: Automatically set rec source to: monitor
pcm0: Recording channel set is: Front Left, Front Right,
pcm0: Recording channel matrix is: 2.0 (unknown)
pcm1: <Realtek ALC257 (Right Analog Mic)> at nid 25 on hdaa0
pcm1: Record:
pcm1: Stream cap: 0x00000001 PCM
pcm1: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
pcm1: ADC: 8
pcm1:
pcm1: nid=8 [audio input]
pcm1: + <- nid=35 [audio mixer] [src: speaker, mic]
pcm1: + <- nid=25 [pin: Mic (Black Jack)] [src: mic]
pcm1: + <- nid=29 [beep widget] [src: speaker]
pcm1:
pcm1: Microphone Volume (OSS: mic): 0/30dB
pcm1: +- ctl 10 (nid 25 out): 0/30dB (4 steps)
pcm1: +- ctl 22 (nid 35 in 1): mute
pcm1:
pcm1: Speaker/Beep Volume (OSS: speaker)
pcm1: +- ctl 25 (nid 35 in 4): mute
pcm1:
pcm1: Recording Level (OSS: rec): -17/30dB
pcm1: +- ctl 4 (nid 8 in 0): -17/30dB (64 steps) + mute
pcm1: +- ctl 10 (nid 25 out): 0/30dB (4 steps)
pcm1: +- ctl 22 (nid 35 in 1): mute
pcm1: +- ctl 25 (nid 35 in 4): mute
pcm1:
pcm1: Mixer "mic":
pcm1: Mixer "rec":
pcm1: Recording channel set is: Front Left, Front Right,
pcm1: Recording channel matrix is: 2.0 (disconnected)
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
pcm2: Playback:
pcm2: Stream cap: 0x00000005 AC3 PCM
pcm2: PCM cap: 0x001a07f0 16 24 32 bits, 32 44 48 88 96 176 192 KHz
pcm2: DAC: 2
pcm2:
pcm2: nid=3 [pin: Digital-out (Jack)]
pcm2: + <- nid=2 [audio output] [src: pcm]
pcm2:
pcm2: Master Volume (OSS: vol): 0/0dB
pcm2: +- ctl 1 (nid 3 in ): mute
pcm2:
pcm2: PCM Volume (OSS: pcm): 0/0dB
pcm2: +- ctl 1 (nid 3 in ): mute
pcm2:
pcm2: Mixer "vol":
pcm2: Mixer "pcm":
pcm2: Soft PCM mixer ENABLED
pcm2: Playback channel matrix is: unknown, assuming 7.1 (disconnected)

What would I forget doing to enable HDMI audio output?

Thanks.
 
Following.
P.s. i have T480 but could not make hdmi sound go trough as well ... even after editing /boot/device.hints
Even tried to boot with HDMI attached but nothing ...
 
Hi,

I'm trying to get sound over HDMI when connecting my ThinkPad T480s and my Samsung 4K TV with an HDMI cable. But no sound gets to the TV.
I've read and try things from (Handbook) Chapter 9. Multimedia, (Wiki) Sound & Audio and half a dozen various forum & blog posts but I can't have the sound work through HDMI.

Here's what I did to switch to HDMI output:

I checked the volumes with mixertui, DSBmixer and GTK-mixer to ensure it was neither mute nor low.

Here are the modules and audio plugins that are loaded:


Here's what `sysctl dev.pcm` outputs:


Here's what `sysctl hw.snd` outputs:


Here's the pcm related bits of dmesg booted verbose:


What would I forget doing to enable HDMI audio output?

Thanks.
Did some digging.
Dont have usb-c to dp so i can not check it.
 
I do have usb-c monitor i might try to unpack it tomorrow, plug in usb-c and see if i have sound from headphones as my monitor does have sound card but no speakers if usb-c to dp sends sound signal maybe usb-c to usb-c can do as well and use sound card in monitor .
I have AOC with sound card i think ( have 3.5mm jack in there) tried with hdmi, but nothing as sound was playing from laptop.
 
You might try to do
sudo sysctl dev.hdac.1.pindump=1
to take a look at the pins. Check dmesg to see which hdac the Intel one is.
At least you can see if it's said to be connected. Mine says
...
hdaa0: 6 185600f0 15 0 Digital-out Jack Digital 0x18 Unknown 0
hdaa0: Caps: OUT Sense: 0xc0000000 (connected, ELD valid)
...

for you it seems to be nid3.

You can also try to check sysctl dev.hdaa.1.nid3 to see pin configs etc.
 
You might try to do
sudo sysctl dev.hdac.1.pindump=1
to take a look at the pins. Check dmesg to see which hdac the Intel one is.
At least you can see if it's said to be connected. Mine says
...
hdaa0: 6 185600f0 15 0 Digital-out Jack Digital 0x18 Unknown 0
hdaa0: Caps: OUT Sense: 0xc0000000 (connected, ELD valid)
...

for you it seems to be nid3.

You can also try to check sysctl dev.hdaa.1.nid3 to see pin configs etc.
There does not seem to be any dev.hdac.1. Only a dev.hdac.0.

Also, dmesg says "hdaa1 (…) disconnected" for the only "Digital-out" entry I can find in dmesg.
 
Hi my first post on these forums, hope this helps:

As I am sure you know, your output for cat /dev/sndstat shows me that the hdmi is recognized and that pcm2 is your hdmi, same for me but I have a Intel Cougar Point instead of Intel Kaby Lake. I used to use mixertui to set my pcm2 to be the default device, as it would always be on pcm0 default after every reboot, This worked until one day I had no sound watching Youtube. The fix for me was to add a line to /etc/sysctl.conf

Code:
hw.snd.default_unit=2

now reboot the computer

pcm2 is always my default device now and I dont need to manually set it with mixertui, and no more sound issues.

My system is a clean fresh install running xfce, bare metal, not a VM. I did not load any extra modules or audio plugins, so I am not sure if all that borked your sound, someone with more experience could help us with that, and also as T-Daemon stated there are known issues with Kaby Lake. I cannot test that as I don't have the same hardware.

Good luck, keep us posted

 
Forgot to ask:

Is the sound working from the laptop speakers?

What desktop environment are you using?

Is the laptop always hooked up to the TV ?

if not always hooked up to TV then I figure my advice of making pcm2 the default is not the best for you. I am using a desktop workstation hooked up to TV as only display. But I suggest you still try to see if it works....it is easy to set it back, we could narrow down even more that it is a switching issue. When I was using mixertui to switch pcm outputs, if the program with no sound was open, for example Firefox. I would have to re-launch Firefox to have the hdmi sound work.

I just set up a second computer with kde5 x11 today, exact same hardware as my xfce FreeBSD computer, hooked up to same TV. The built in mixer on the right side of the panel lets me switch default pcm output without the need to re-launch programs.

pcm0 is still the default card, I haven't changed any settings on the kde computer.
 
Yes, the sounds works as expected, both on the laptop speakers and some USB external ones. Only sound via HDMI does not work. I have tried both settings all those parameters from a working X11 session (KDE or XFCE, that doesn't change the problem) and with rebooting - HDMI connected while booting or not.

To be sure it was not my TV or HDMI cable, I installed Slackware Linux on the laptop. HDMI output just worked there.
 
I also notice from your sysctl hw.snd

Code:
hw.snd.default_auto: 0

A zero value stops newly connected devices from becoming default unit. Try setting it to 1

I know you stated that you tried booting with HDMI attached, but if your pcm0 is set to default then maybe this is a conflict in settings. On the FreeBSD sound wiki page, the hw.snd sysctl tree section has it set to 1
 
I also notice from your sysctl hw.snd

Code:
hw.snd.default_auto: 0

A zero value stops newly connected devices from becoming default unit. Try setting it to 1

I know you stated that you tried booting with HDMI attached, but if your pcm0 is set to default then maybe this is a conflict in settings. On the FreeBSD sound wiki page, the hw.snd sysctl tree section has it set to 1
Nope. Even setting this to 1, playing with volume level are restarting mpv each time does not output sound on HDMI. On the laptop speakers, it works ok.
 
Ok so it seems either it is a Kaby Lake issue with HDMI sound or it will be a boot hint that can get the sound through the HDMI

Looking at your dmesg pcm output closer I see two things:

Code:
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
pcm2: Playback:
pcm2:      Stream cap: 0x00000005 AC3 PCM
pcm2:         PCM cap: 0x001a07f0 16 24 32 bits, 32 44 48 88 96 176 192 KHz
pcm2:             DAC: 2
pcm2:
pcm2:     nid=3 [pin: Digital-out (Jack)]
pcm2:       + <- nid=2 [audio output] [src: pcm]
pcm2:
pcm2: Master Volume (OSS: vol): 0/0dB
pcm2:    +- ctl  1 (nid   3 in ):    mute
pcm2:
pcm2: PCM Volume (OSS: pcm): 0/0dB
pcm2:    +- ctl  1 (nid   3 in ):    mute
pcm2:
pcm2: Mixer "vol":
pcm2: Mixer "pcm":
pcm2: Soft PCM mixer ENABLED
pcm2: Playback channel matrix is: unknown, assuming 7.1 (disconnected)

First thing I notice is Master Volume and PCM Volume both state mute

And the second, from another thread I was participating in about sound issues, the sound jacks (not HDMI) were enabled with boot hints. Your pcm2 is at nid 3 on hdaa1

so in /boot/device.hints

add:

hint.hdaa.1.nid3.config="as=1 seq=15"

reboot

or if that does not work, change the line to

hint.hdaa.1.nid3.config="as=2 seq=15"

reboot

If still no luck, remove the line from /boot/device.hints to remove any of the above changes.

reboot

Please note I could be wrong about the values you need in "as= seq=" you might need to play with these values "as=3 seq=15"

etc

my fingers are crossed
 
I've tried a few values but none worked. Which, given I have no idea what those numbers are, is not that unexpectable.
The output from `dev.hdaa.1` showed that hints were applied. But tat was not enough to have to sound go out of HDMI.
 
I've tried a few values but none worked. Which, given I have no idea what those numbers are, is not that unexpectable.
The output from `dev.hdaa.1` showed that hints were applied. But tat was not enough to have to sound go out of HDMI.
Sorry to hear, I feel we are close but I must bow out for now. I don't have the hardware to test and the back and forth would not work out. I do thank you though because I have learned much from this all. I have been reading the snd_hda section daily and it is starting to make sense. I need to start trying out somethings to really get in deeper. I might buy a refurbished Think pad , as I see it is a popular laptop for FreeBSD, and my findings could benefit many users down the road. At least everything else works for you and you can enjoy your BSD. Thanks for everything and good luck, do let us know if you ever find a solution.
 
Back
Top