# No sound via HDMI with snd_hda



## k.jacker (May 11, 2017)

Hei and sorry for another thread on this topic,

I have tried to get sound via HDMI for a while now, and have so far figured out that the switch in my motherboard's BIOS (Asus H81i-plus with Haswell i3-4170) to choose digital audio output via S/PDIF or HDMI does nothing. So I succesfully disabled the S/PDIF out and activated digital output via HDMI like this in /boot/device.hints

```
hint.hdac.0.cad0.nid3.config="as=1 conn=Jack"
hint.hdac.1.cad0.nid17.config="as=3 conn=None"
```
That results in a promising `sysctl dev.hdac.0.pindump=1`
...the only concern might be the "Sense: 0x00000000 (disconnected)" in the third line.

```
hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0:  3 18560010 1  0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0: NumGPIO=0 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=0
```
..and pcm0 is now showing HDMI output, which wasn't the case before.
`cat /dev/sndstat`

```
Installed devices:

pcm0: <Intel Haswell (HDMI/DP 8ch)> (play) default
pcm1: <Realtek ALC887 (Rear Analog)> (play/rec)
pcm2: <Realtek ALC887 (Front Analog)> (play/rec)
No devices installed from userspace.
```

Here is the - now disabled - S/PDIF output `sysctl dev.hdac.1.pindmup=1`

```
hdaa1: Dumping AFG pins:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1: 17 58561130 3  0  Digital-out   None  Digital 0x18       Black   1 DISA
hdaa1:     Caps:    OUT
...
```

Still no sound via HDMI/pcm0. No problem with sound via rear jack/pcm1.
Of course I read and followed the suggestions in the Handbook and a lot of related threads here on the forum. I read sound() and snd_hda() up and down as well and also tried `sysctl dev.hdac.0.msi=0` and `sysctl dev.hdac.0.polling=1`.
I am out of ideas now.

`freebsd-version` = 11.0-RELEASE-p10
Fresh install, no custom kernel, no Xorg, oss or the like involved.

Anyone with more knowledge or someone who got HDMI audio with snd_hda running and willing to post his pindumps for comparison?

Thanks a lot in advance!
Matthias


----------



## scottro (May 11, 2017)

I've gotten HDMI working with mplayer and mpv.  I cover it on a page I have http://srobb.net/dvds.html in the HDMI section.  I haven't done it in over a year, but I was using sysctl to change the default device or using the mpv command line.

https://forums.freebsd.org/threads/50934/ is the thread where I got some help with it.


----------



## k.jacker (May 11, 2017)

Hei, thanks for your reply.
I read the thread and have tried the suggestions from your page but sadly still no sound via HDMI.

It works through the analog rear jack (pcm1) on the vt-console and inside Xorg, playing music and even watching tv-streams with sound like you suggest:
`mplayer -ao oss:/dev/dsp1.0 some_audio_or_video_file/stream`

But silence when changing to `oss:/dev/dsp0.0` which is pcm0/HDMI output.

I really got a little confused that it worked at all with oss as the driver, since oss is not in use on my computer. I thought oss requires to build a custom kernel with all sound-drivers removed and oss-support compiled in.
Some questions strike me...
Does HDMI output maybe require oss?
Does HDMI output only work inside Xorg?
Have you build a kernel with oss suppert?


----------



## k.jacker (May 11, 2017)

Hei scottro,
would you mind to post your output of `sysctl dev.hdac.0(or1).pindump=1` and `sysctl dev.hdaa.0(or1)` wherever your HDMI output is?
I think that would really help me with further tweaking with sysctl.
Thank you


----------



## aragats (May 11, 2017)

k.jacker said:


> I really got a little confused that it worked at all with oss as the driver, since oss is not in use on my computer.


OSS is built-in, you do not need to install it.


----------



## tobik@ (May 11, 2017)

k.jacker said:


> I really got a little confused that it worked at all with oss as the driver, since oss is not in use on my computer. I thought oss requires to build a custom kernel with all sound-drivers removed and oss-support compiled in.


FreeBSD's sound(4) implements most of OSS's API. You're thinking of the original OSS which is available as a port audio/oss. Anyway since FreeBSD provides  the same API as OSS it also uses the same audio backends in applications.


----------



## k.jacker (May 11, 2017)

Thanks for clearing that up, tobik@. Yeah, It must have been the port I once tried. That was some time ago, just remembered I had to build a kernel to use it.



k.jacker said:


> ei scottro,
> would you mind to post your output of  sysctl dev.hdac.0(or1).pindump=1 and  sysctl dev.hdaa.0(or1) wherever your HDMI output is?
> I think that would really help me with further tweaking with sysctl.
> Thank you


----------



## scottro (May 11, 2017)

I won't be able to do that for a few hours, but will do so when I get hom.


----------



## scottro (May 12, 2017)

```
sysctl dev.hdac.0
dev.hdac.0.polling: 0
dev.hdac.0.pindump: 0
dev.hdac.0.wake: 0
dev.hdac.0.%parent: pci0
dev.hdac.0.%pnpinfo: vendor=0x8086 device=0x1e20 subvendor=0x1558 subdevice=0x0240 class=0x040300
dev.hdac.0.%location: slot=27 function=0 dbsf=pci0:0:27:0 handle=\_SB_.PCI0.HDEF
dev.hdac.0.%driver: hdac
dev.hdac.0.%desc: Intel Panther Point HDA Controller
```

If I use the pindump part, I just get pindump: 0 -> 0
For sysctl dev.hdaa1 I get

```
dev.hdaa.1.reconfig: 0
dev.hdaa.1.gpo_config:
dev.hdaa.1.gpo_state:
dev.hdaa.1.gpio_config:
dev.hdaa.1.gpio_state:
dev.hdaa.1.gpi_state:
dev.hdaa.1.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.1.nid8: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.1.nid7_original: 0x58560030 as=3 seq=0 device=Digital-out conn=None cty
pe=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid7_config: 0x58560030 as=3 seq=0 device=Digital-out conn=None ctype
=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid7: pin: Digital-out (None) [DISABLED]
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x58560030 as=3 seq=0 device=Digital-out conn=None ctype=Digita
l 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=4 [audio output] [DISABLED]
dev.hdaa.1.nid6_original: 0x18560020 as=2 seq=0 device=Digital-out conn=Jack cty
pe=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid6_config: 0x18560020 as=2 seq=0 device=Digital-out conn=Jack ctype
=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid6: pin: Digital-out (Jack)
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
    Association: 0 (0x0001)
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x18560020 as=2 seq=0 device=Digital-out conn=Jack ctype=Digita
l 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=3 [audio output]

dev.hdaa.1.nid5_original: 0x58560010 as=1 seq=0 device=Digital-out conn=None cty
pe=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid5_config: 0x58560010 as=1 seq=0 device=Digital-out conn=None ctype
=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid5: 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=Digita
l 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.1.nid4: 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.1.nid3: 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.1.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.1.%parent: hdacc1
dev.hdaa.1.%pnpinfo: type=0x01 subsystem=0x15580240
dev.hdaa.1.%location: nid=1
dev.hdaa.1.%driver: hdaa
dev.hdaa.1.%desc: Intel Panther Point Audio Function Group
```


----------



## k.jacker (May 12, 2017)

Very nice, thank you scottro!

My bad. I missed to say that the pindump produces kernel output to /dev/ttyv0.
`sysctl dev.hdac.1.pindump=1` and then `dmesg|grep hda` would do as well.

I doesn't hurry at all, but if you could post that too, I would really appreciate that 

The output from the pindump is the only way to get information about jack-sensing on the outputs, and mine says "disconnected", even if it's not.
I think that is, why it's not working for me. Everything else looks good when I compare my configuration of the digital output to yours.

Thanks in advance
Matthias


----------



## scottro (May 12, 2017)

I know almost nothing about it so was just blindly following your request. 
 Sorry I don't know enough about it to be useful.

The laptop that I used is a barebones clevo, probably 6 or 7  years old, that I got from rjtech.com, which still has (just checked) barebones laptops among their offerings.

Here is the dmesg|grep hda result.


```
hdac0: <Intel Panther Point HDA Controller> mem 0xf7e10000-0xf7e13fff irq 22 at device 27.0 on pci0
hdacc0: <VIA VT1802_1 HDA CODEC> at cad 0 on hdac0
hdaa0: <VIA VT1802_1 Audio Function Group> at nid 1 on hdacc0
pcm0: <VIA VT1802_1 (Analog 2.0+HP/2.0)> at nid 36,37 and 41,43 on hdaa0
hdacc1: <Intel Panther Point HDA CODEC> at cad 3 on hdac0
hdaa1: <Intel Panther Point Audio Function Group> at nid 1 on hdacc1
pcm1: <Intel Panther Point (HDMI/DP 8ch)> at nid 6 on hdaa1
```


----------



## k.jacker (May 12, 2017)

Oh, that is a lot less output then I expected from your laptop compared to my computer.

Thanks anyway for your effort! The stuff you postet earlier helped me at least to understand that the rest of my configuration is ok, expect for the jack-sensing that I suspect to break it for me.

I will now focus on that and see if I can get it going. 

Matthias


----------

