# NVIDIA - HDMI - 5.1 sound help



## nbsjbsd (Sep 15, 2019)

Hi all,
I've got a fresh install of FreeBSD12 with KDE Desktop on an Nvidia 550ti. I've installed the /usr/ports/x11/nvidia-driver and I'm quite happy with what I see so far. I have hdmi sound out from my pc to my surround sound receiver and then out to a 5.1 setup. This is a fully functional system that was running Ubuntu up until yesterday.

I've managed to get sound working to my front two speakers and the sub woofer but cant get sound to my middle speaker or my back two speakers.

pcm4 (below) is the only one that works when I send a test sound to it so I've set that up in /boot/loader.conf

```
sysctl net.local.stream.recvspace=65536
sysctl net.local.stream.sendspace=65536
hw.snd.default_unit: 4 
dev.pcm.4.play.vchanformat=s16le:5.1
```


`cat /dev/sndstat`

```
Installed devices:
pcm0: <VIA VT1708B_1 (Analog 7.1+HP/2.0)> (play/rec)
pcm1: <VIA VT1708B_1 (Digital)> (play)
pcm2: <NVIDIA MCP78 (Digital)> (play)
pcm3: <NVIDIA GTX550 (HDMI/DP 8ch)> (play)
pcm4: <NVIDIA GTX550 (HDMI/DP 8ch)> (play) default
pcm5: <NVIDIA GTX550 (HDMI/DP 8ch)> (play)
pcm6: <NVIDIA GTX550 (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```

Any clues on where I should look now to get 5.1 fully functional? 

tks in advance


----------



## cabriofahrer (Sep 15, 2019)

I am not sure, but I think this only works with a hda-chip, this is from man snd:


```
Multichannel Audio
     Multichannel audio, popularly referred to as "surround sound" is
     supported and enabled by default.  The FreeBSD multichannel matrix
     processor supports up to 18 interleaved channels, but the limit is
     currently set to 8 channels (as commonly used for 7.1 surround sound).
     The internal matrix mapping can handle reduction, expansion or re-routing
     of channels.  This provides a base interface for related multichannel
     ioctl() support.  Multichannel audio works both with and without VCHANs.

     Most bridge device drivers are still missing multichannel matrixing
     support, but in most cases this should be trivial to implement.  Use the
     dev.pcm.%d.[play|rec].vchanformat sysctl(8) to adjust the number of
     channels used.  The current multichannel interleaved structure and
     arrangement was implemented by inspecting various popular UNIX
     applications.  There were no single standard, so much care has been taken
     to try to satisfy each possible scenario, despite the fact that each
     application has its own conflicting standard.
```

However, I think it could work with pulseaudio, which was what probably did the trick in Ubuntu. There also is a port/package in Freebsd for a pulseaudio frontend called "pavucontrol". Never tried this before but maybe you could test this and report back, as surround sound could be an interesting issue for others, too.


----------



## nbsjbsd (Sep 15, 2019)

Thanks cabriofahrer . That didn't lead to anything obvious unfortunately. I hate the thought of going back to Linux but this is my theatre pc - gotta have surround sound.


----------



## cabriofahrer (Sep 15, 2019)

What do you mean, installing pulseaudio and pavocontrol on FreeBSD did not work?


----------



## nbsjbsd (Sep 15, 2019)

cabriofahrer said:


> What do you mean, installing pulseaudio and pavocontrol on FreeBSD did not work?



Sorry - it worked but I wasn't able to glean anything valuable to help with resolving the issue. Still digging away trying to see what I can come up with.


----------



## Criosphinx (Sep 15, 2019)

I'm not using the HDMI output but I have configured the onboard audio.
`cat /dev/sndstat`

```
Installed devices:
pcm0: <NVIDIA (0x0042) (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA (0x0042) (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA (0x0042) (HDMI/DP 8ch)> (play)
pcm3: <Realtek ALC887 (Analog 5.1/2.0)> (play/rec) default
pcm4: <Realtek ALC887 (Front Analog Headphones)> (play)
pcm5: <CX2388x PCM interface> (rec)
pcm6: <CX2388x PCM interface> (rec)
No devices installed from userspace.
```

In /etc/sysctl.conf I added: 
	
	



```
dev.pcm.3.play.vchanformat=s16le:5.1
```

Found the controller hdac.1 and location cad=2 with command `doas sysctl -a | grep hdac`

```
irq265: hdac0:69 @cpu0(domain0): 5
irq267: hdac1:73 @cpu0(domain0): 44645
dev.hdaa.1.%parent: hdacc1
dev.hdaa.0.%parent: hdacc0
dev.hdacc.1.%parent: hdac1
dev.hdacc.1.%pnpinfo: vendor=0x10ec device=0x0887 revision=0x03 stepping=0x02
dev.hdacc.1.%location: cad=2
dev.hdacc.1.%driver: hdacc
dev.hdacc.1.%desc: Realtek ALC887 HDA CODEC
dev.hdacc.0.%parent: hdac0
dev.hdacc.0.%pnpinfo: vendor=0x10de device=0x0042 revision=0x01 stepping=0x00
dev.hdacc.0.%location: cad=0
dev.hdacc.0.%driver: hdacc
dev.hdacc.0.%desc: NVIDIA (0x0042) HDA CODEC
dev.hdacc.%parent:
dev.hdac.1.polling: 0
dev.hdac.1.pindump: 0
dev.hdac.1.wake: 0
dev.hdac.1.%parent: pci0
dev.hdac.1.%pnpinfo: vendor=0x8086 device=0x1e20 subvendor=0x1458 subdevice=0xa002 class=0x040300
dev.hdac.1.%location: slot=27 function=0 dbsf=pci0:0:27:0 handle=\_SB_.PCI0.HDEF
dev.hdac.1.%driver: hdac
dev.hdac.1.%desc: Intel Panther Point HDA Controller
dev.hdac.0.polling: 0
dev.hdac.0.pindump: 0
dev.hdac.0.%parent: pci1
dev.hdac.0.%pnpinfo: vendor=0x10de device=0x0e1b subvendor=0x3842 subdevice=0x2652 class=0x040300
dev.hdac.0.%location: slot=0 function=1 dbsf=pci0:1:0:1
dev.hdac.0.%driver: hdac
dev.hdac.0.%desc: NVIDIA (0x0e1b) HDA Controller
dev.hdac.%parent:
```

And the correct pin numbers with `doas systcl dev.hdac.1.pindump=1`

```
hdaa1: Dumping AFG pins:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1: 17 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps:    OUT           
hdaa1: 18 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps: IN               
hdaa1: 20 01014410 1  0  Line-out      Jack  1/8     Rear       Green   4
hdaa1:     Caps: IN OUT HP EAPD      Sense: 0x80000000 (connected)
hdaa1: 21 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps: IN OUT              Sense: 0x00000000 (disconnected)
hdaa1: 22 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps: IN OUT              Sense: 0x00000000 (disconnected)
hdaa1: 23 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps: IN OUT              Sense: 0x00000000 (disconnected)
hdaa1: 24 01019c12 1  2  Line-out      Jack  1/8     Rear       Pink    12
hdaa1:     Caps: IN OUT         VREF Sense: 0x80000000 (connected)
hdaa1: 25 02a19c60 6  0  Mic           Jack  1/8     Front      Pink    12
hdaa1:     Caps: IN OUT HP      VREF Sense: 0x00000000 (disconnected)
hdaa1: 26 01013411 1  1  Line-out      Jack  1/8     Rear       Blue    4
hdaa1:     Caps: IN OUT         VREF Sense: 0x80000000 (connected)
hdaa1: 27 02214c20 2  0  Headphones    Jack  1/8     Front      Green   12
hdaa1:     Caps: IN OUT HP EAPD VREF Sense: 0x00000000 (disconnected)
hdaa1: 28 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps: IN                  Sense: 0x00000000 (disconnected)
hdaa1: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps:    OUT           
hdaa1: 31 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1:     Caps: IN               
hdaa1: NumGPIO=2 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdaa1:  GPIO0: disabled
hdaa1:  GPIO1: disabled
```

Pins 20,24 and 26 are the green,pink and blue rear connectors respectively

With this information I add these lines

```
hint.hdac.1.cad2.nid20.config="as=1 seq=0"
hint.hdac.1.cad2.nid26.config="as=1 seq=1 device=Line-out"
hint.hdac.1.cad2.nid24.config="as=1 seq=2 device=Line-out"
```
To /boot/device.hints

As I said I'm not using the hdmi but I suppose configuration is similar.

Pindump of the NVidia device: `doas sysctl dev.hdac.0.pindump=1`

```
hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0:  4 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0:  5 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0:  6 585600f0 15 0  Digital-out   None  Digital 0x18       Unknown 0 DISA
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0:  7 185600f0 15 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
```
In my case I should change the lines:
	
	



```
hint.hdac.0.cad0.nid4.config="as=1 seq=0"
hint.hdac.0.cad0.nid5.config="as=1 seq=1 device=Line-out"
hint.hdac.0.cad0.nid6.config="as=1 seq=2 device=Line-out"
```
but I can't test it right now


----------

