Configuring HDMI audio to work well in Gnome-3.38: Volume control not working. How can we enable auto switching speaker and headphone.

Gnome-3.38 is working well in FreeBSD, except for 2 issues.

Gnome volume control/sound setting does not work; except if the slider is down, it mutes. I am using HDMI output for display and audio. Intel Cougar Point HDMI (DH67CL motherboard).
Speaker connected to HDMI, Headphone jack is the front jack in the CPU (not HDMI).
I can get sound from speaker, if these lines are added to /etc/sysctl.conf:
Code:
hw.snd.default_unit=4

Code:
:~% cat /dev/sndstat

Installed devices:
pcm0: <Realtek ALC892 (Analog 5.1+HP/2.0)> (play/rec) default
pcm1: <Realtek ALC892 (Rear Digital)> (play)
pcm2: <Realtek ALC892 (Rear Digital)> (play)
pcm3: <Realtek ALC892 (Front Analog Mic)> (rec)
pcm4: <Intel Cougar Point (HDMI/DP 8ch)> (play)
No devices installed from userspace.

Code:
:~% pciconf -vl
hdac0@pci0:0:27:0:    class=0x040300 card=0x20038086 chip=0x1c208086 rev=0x05 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '6 Series/C200 Series Chipset Family High Definition Audio Controller'
    class      = multimedia
    subclass   = HDA
With this HDMI sound output, the Gnome volume mixer does not work. I use mixertui to control the sound level. mixertui shows MASTER & PCM controls. Adjusting PCM level controls sound level. Master only can mute the sound output.
I have attached the relevant sound related parts from dmesg and dmesg output. This is when the default sound device is selected with hw.snd.default_unit=4.

So far, I've tried commenting out the default device line and adding below lines to /boot/device.hints
Code:
hint.hdaa.1.nid7.config="as=1 seq=0 misc=0"
hint.hdaa.0.nid27.config="as=1 seq=15 misc=1"

It did not work. I am confused about the lines here, especially if as=1 is correct. What I want is speaker output as default and headphone jack work when headphone is connected.
This is the speaker output:
Code:
pcm4: <Intel Cougar Point (HDMI/DP 8ch)> at nid 7 on hdaa1
pcm4: Playback:
pcm4:      Stream cap: 0x00000005 AC3 PCM
pcm4:         PCM cap: 0x001e07f0 16 20 24 32 bits, 32 44 48 88 96 176 192 KHz
pcm4:             DAC: 4
pcm4:
pcm4:     nid=7 [pin: Digital-out (Jack)]
pcm4:       + <- nid=4 [audio output] [src: pcm]
pcm4:
pcm4: Master Volume (OSS: vol): 0/0dB
pcm4:    +- ctl  3 (nid   7 in ):    mute
pcm4:
pcm4: PCM Volume (OSS: pcm): 0/0dB
pcm4:    +- ctl  3 (nid   7 in ):    mute

It will be nice if headphone auto switching works. I mean, if I connect to headphone jack, it automatically enables headphone out as default.
Headphone (which is the front jack) device? (I assume):
Code:
pcm1: <Realtek ALC892 (Front Analog)> at nid 27 and 25 on hdaa0
pcm1: Playback:
pcm1:      Stream cap: 0x00000001 PCM
pcm1:         PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
pcm1:             DAC: 5
pcm1: 
pcm1:     nid=27 [pin: Headphones (Green Jack)]
pcm1:       + <- nid=15 [audio mixer] [src: pcm, mix]
pcm1:              + <- nid=5 [audio output] [src: pcm]
pcm1:              + <- nid=11 [audio mixer] [src: mix]
pcm1:
 

Attachments

  • sound_debug.txt
    2.6 KB · Views: 106
  • dmesg-20-10.txt
    60.3 KB · Views: 90
My impression (from reading the snd_hda man page) is that automatic switching only works between inputs controlled by a single audio chip.
Adding hint.hdaa.1.nid7.config="as=1 seq=0" line to /boot/device.hints did not select pcm4 (HDMI out) as the default device. Though, sound works in firefox. In VLC, I've to choose pcm4 as audio device to get sound output. If I add hw.snd.default_unit=4 to /etc/sysctl.conf, HDMI out becomes default.
I use mixertui>pcm to control the volume.
mixertui.png

Getting the gnome-volume control to work with PCM is the aim. Vol and PCM are the controls available for this device. Adjusting Vol does nothing, from 1 to 100, except muting at volume 0. I believe, Gnome volume control is using 'Vol' as the control. Is there a way to make Gnome volume control to use pcm, which actually controls the sound volume.
I have added below line
Code:
hint.hdaa.1.nid7.config="as=1 seq=0"
which seems to do nothing.

Code:
~% sysctl -a | grep "nid7"        

dev.hdaa.1.nid7_original: 0x18560030 as=3 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid7_config: 0x18560030 as=3 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid7: pin: Digital-out (Jack)
dev.hdaa.0.nid7: vendor widget [DISABLED]

This is the sound settings in gnome-control-centre. The "System Volume" seems to be mapped to "vol" and it is not useful. In the settings, if I put /dev/dsp4 as default, still not working. I'm not sure if there is a "gsettings.." Gnome sound related registry which can set PCM as System Volume (Default sound control).

Screenshot from 2020-10-22 13-34-11.png
 
Back
Top