GTX 1060 - No Audio over HDMI - Only HDA Intel detected - Azalia

This did not fix it for me. Does someone know what is wrong? My bus layout is correct.

[seedship@triple-destinies ~]$ lspci | grep NVIDIA
01:00.0 VGA compatible controller: NVIDIA Corporation GP104BM [GeForce GTX 1070 Mobile] (rev a1)

These are the NVIDIA drivers I have.

[seedship@triple-destinies ~]$ lsmod | grep nvidia
nvidia_drm             53248  4
nvidia_modeset       1114112  6 nvidia_drm
nvidia              18829312  246 nvidia_modeset
drm_kms_helper        212992  1 nvidia_drm
drm                   495616  7 drm_kms_helper,nvidia_drm
ipmi_msghandler        65536  2 ipmi_devintf,nvidia

This is the output of my dmesg when I grep for HDMI

[seedship@triple-destinies ~]$ dmesg | grep HDMI
[    0.786875] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)

I’m running Arch Linux (5.1.16) on an HP Omen 17t with a GTX 1070.

This work around is broken as of the 435.21 driver release.

This is a solution that worked from My Omen X - that would NOT show my NVHDA aka (HDMI Sound) in Ubuntu.

I will add that for the past month this solution SEEMS to have been FINALLY put into Ubuntu’s kernel.
Though just for &#%$ sake I will add that this fix is almost 3 years old, and for me it was approximately a year old issue as of this writing.

but here is the long fix … I hope it helps!

No NVHDA Solution - Install a Kernel module to toggle audio function.
∘ I can confirm that kernel module, posted by
‣ Maik Freudenberg (https://bugs.freedesktop.org/show_bug.cgi?id=75985#c27),
• Kernel module to toggle audio function
∘ is working fine on my system. Thank you for the fix. The HDMI audio device now works as it should (now detected).
∘ The steps I did to enable HDMI audio device:
• 1. Download and extract the file nvhda.tar.xz. (from above link)
• 2. Run these commands in Terminal, in the location of the extracted folder

$ make

$ sudo make install

$ echo nvhda | sudo tee -a /etc/initramfs-tools/modules

$ echo "options nvhda load_state=1" | sudo tee /etc/modprobe.d/nvhda.conf
$ sudo update-initramfs -u

‣ 3. Reboot.
#############################################################################
Problems SOLVED! I
∘ Hibernate/Suspend - NVHDA Sound doesn’t repopulate
• However, if I manually disable the audio output output “sudo tee /proc/acpi/nvhda <<< OFF” I’m then able to get it to sleep. I then have to turn it on again on resume with "sudo tee /proc/acpi/nvhda <<< ON

$ sudo tee /proc/acpi/nvhda <<< OFF
      (before Hibernation/Suspend or Sleep)

$ sudo tee /proc/acpi/nvhda <<< ON
        (After Resume)

• SOLVED! I

and w.r.t. to HDMI NOT resuming in Ubuntu …
another “Mind Games” Ubuntu Solution … is to select “Lock” and Ubuntu …
playing Mind Games again will give 2 options (turn off or pause)
Why do I say mind games … because it WON’T let you turn off but will them allow the pause option, which when done in this way … it will allow it to turn on with HDMI (NVHDA) working properly.

Trying to Help, Mark

I will add

for the benefit of ALL!

the new Nvidia 435 not only works with the NVHDA (HDMI Sound perfectly)

The Last small issue is now GONE …
slight and ever so SLIGHT “Stuttering”, for lack of a better word, is gone.

Another way to say it … moving windows in Ubuntu is now BUTTERY SMOOTH …

for the first time in HISTORY (with Nvidia)

Linux 5.3 includes a change that will make the HDA controller visible at boot time (and after suspend/resume). This replaces many of the workarounds discussed previously (e.g. the kernel module for audio enabling).

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b516ea586d717472178e6ef1c152e85608b0ce32

This change has also been backported to the latest kernel updates for Endless & Ubuntu.

Good Job

Does the aforementioned patch work for anyone?

On 5.3 to get sound working via HDMI I still need the out-of-tree nvhda module.

It seems to be working fine at this moment.

System Specs

Ubuntu 18.04.3 LTR
Kernel 5.0.0-30

it is working for me as well, I removed the old nvhda module.

Good News … 2 1/2 years later and UBUNTU HAS FIXED THIS …

IT WAS LIKELY NOT REALLY Ubuntu’s fault as I thought (though they indeed were slow to pick up on a 2 1/2 year thread … in that way it was)

HERE IS THE EXPLANATION that I found: (cut and paste)

Reason Possibly Explained
∘ PCI: Enable NVIDIA HDA controllers
‣ Many NVIDIA GPUs can be configured as either a single-function video device or a multi-function device with video at function 0 and an HDA audio controller at function 1. The HDA controller can be enabled or disabled by a bit in the function 0 config space.
‣ Some BIOSes leave the HDA disabled, which means the HDMI connector from the NVIDIA GPU may not work. Sometimes the BIOS enables the HDA if an HDMI cable is connected at boot time, but that doesn’t handle hotplug cases.
‣ Enable the HDA controller on device enumeration and resume and re-read the header type, which tells us whether the GPU is a multi-function device.
‣ This quirk is limited to NVIDIA PCI devices with the VGA Controller device class. This is expected to correspond to product configurations where theNVIDIA GPU has connectors attached. Other products where the device class is 3D Controller are expected to correspond to configurations where the NVIDIA GPU is dedicated (dGPU) and has no connectors. See original post (URL below) for more details.
‣ This commit takes inspiration from an earlier patch by Daniel Drake.

melentye, please see this for an explanation:
[url]Fails to enable: Not multifunction, no audio · Issue #7 · hhfeuer/nvhda · GitHub
The pci subsystem of the kernel is quirky, deaf to pci config space changes at times, depending on pci root bus, chipset and kernel version or whatever. So the pci quirk introduced with kernel 5.3, which only runs at a specific time, is a 99% solution, the remaining 1% still being covered by the nvhda module being able to vary point of boot to run. Sorry about that.

Thanks everyone for reporting back and generix for the link. Although I wasn’t able to tie the comments in the GH thread to my situation in a practical way, the 99 vs 1% explanation makes sense.

After some more testing, I start to suspect that bbswitch module has some role in HDMI audio not working for me. To summarize:

  • kernel 5.3 + bbswitch + nvhda => can power down/up the dGPU and audio works
  • kernel 5.3 + bbswitch => audio doesn’t work
  • kernel 5.3 => no way to power down dGPU when unused, audio works though

Is this intended to work with Prime offloading? I’m using driver 435.21 with patched xorg for Prime offloading. Connecting anything to the HDMI port, while in this configuration, does nothing, whereas when using modesetting Plasma will show its monitor layout UI applet, the expected behavior.

I have an MSI GS65 9sf model laptop which has HDMI connected to the discreet nvidia 2070 chip, while the Intel chip is connected to the display and TB port. When in Prime offloading configuration, I can see an event when running udevadm monitor upon plugging in a device (In my case, a Denon receiver, but I’ve also tried the TV directly), but that’s about it. I can also see the name and metadata of the connected device in nvidia-settings but xrandr doesn’t know anything about it.

My goal isn’t just to do audio over HDMI, but also video, but always with the Prime offloading configuration. Is this possible? If so, any thoughts as to what I may be missing?

I plan to restart X in modesetting configuration to test the nvhda I just installed and report back.

Thanks

No luck so far. At boot the device reads:

# cat /proc/acpi/nvhda 
0000:01:00.0 OFF

So I toggle it on manually:

# echo ON > /proc/acpi/nvhda

This shows up in the kernel log:

[  540.350761] nvhda: enabling audio
[  540.350800] pci 0000:01:00.1: [10de:10f9] type 00 class 0x040300
[  540.350841] pci 0000:01:00.1: reg 0x10: [mem 0xad080000-0xad083fff]
[  540.351172] pci 0000:01:00.1: Adding to iommu group 1
[  540.351236] nvhda: Audio found, adding
[  540.351246] pci 0000:01:00.1: BAR 0: assigned [mem 0xad080000-0xad083fff]
[  540.351777] snd_hda_intel 0000:01:00.1: Disabling MSI
[  540.351789] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[  542.144313] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input31
[  542.144562] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input32
[  543.388411] pci 0000:01:00.1: Removing from iommu group 1

Except neither alsa nor lspci see it:

# cat /proc/asound/cards 
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xad410000 irq 148
# lspci -v | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2070 Mobile] (rev a1) (prog-if 00 [VGA controller])
        Kernel driver in use: nvidia
        Kernel modules: nouveau, nvidia_drm, nvidia

(Note nouveau is blacklisted and not loaded. Not sure why it’s showing up there)

If I check the device again:

# cat /proc/acpi/nvhda 
0000:01:00.0 OFF

Note it’s OFF. But, this shows up in the kernel log when I do the above:

[ 7714.160081] nvhda: No audio device found, unsetting config bit.

But only the first time I cat the device after having manually set it! Subsequent times don’t do anything. I’ve waited for many minutes to see if this log entry will eventually show up and it does not. It only appears when catting the device after setting it. Not sure how significant this is.

I’ve tested the machine in windows and all works as expected. Thoughts?

Here’s the kernel log on boot:

# dmesg | grep nvhda
[    4.145616] nvhda: version 0.01
[    4.145622] nvhda: Found nv VGA device 0000:01:00.0
[    4.145629] nvhda: Found nv audio device 0000:01:00.1
[    4.145633] nvhda: Found nv audio device 0000:01:00.1
[    4.145634] nvhda: Succesfully loaded. Audio 0000:01:00.0 is on

But I see no evidence it’s working:

# lspci -v | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2070 Mobile] (rev a1) (prog-if 00 [VGA controller])
        Kernel driver in use: nvidia
        Kernel modules: nouveau, nvidia_drm, nvidia

At this point I tail the kernel log manually to make sure the following really does trigger the log entry. It does:

root@craptop:~# cat /proc/acpi/nvhda 
0000:01:00.0 OFF
root@craptop:~# dmesg | grep nvhda
[    4.145616] nvhda: version 0.01
[    4.145622] nvhda: Found nv VGA device 0000:01:00.0
[    4.145629] nvhda: Found nv audio device 0000:01:00.1
[    4.145633] nvhda: Found nv audio device 0000:01:00.1
[    4.145634] nvhda: Succesfully loaded. Audio 0000:01:00.0 is on
[  139.795865] nvhda: No audio device found, unsetting config bit.

Note the new log entry. Not sure how to proceed. Any suggestions?

DanielCeregatti, this has to do with the new runtime power management which is used on Turing gpus in conjunction with render offload:
[url]http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/dynamicpowermanagement.html[/url]
See the “Known Issues And Workarounds” part, “Automated Setup”.
For runtime suspending to work, currently all subdevices (including audio) have to be removed. This is done by a udev rule. The pci quirk/nvhda module adds the device which then removed again by the udev rule.

NB: in render offload mode, no external connectors on the nvidia gpu will work anyway, since that would be wanting to use it (to display the image) and not wanting to use it (on demand render offload) at the same time.

Hi generix,

Thanks for your help. It was the udev rules that were turning off the audio. Once I disabled the udev rules and restarted in modesetting configuration, plugging in an external HDMI worked for both video and audio, and also brought up the UI for choosing what to do with the newly connected display. So this much seems to work perfectly, as long as one remains in a modesetting configuration.

Thing is, my goal is to remain in render offload configuration by default, but retain the ability to plug an external device for both video and audio. When in render offload configuration, plugging an external device into the HDMI port does nothing, but there is a detectable event that udevadm monitor can report.

Should we be able to achieve this with the current state of the driver?

Like said in my previous post, nope, doesn’t work, not achievable. Using external monitors on the nvidia gpu requires switching to prime output mode.

I have confirmed that all aspects of audio and video work perfectly when plugging in an external display and using a modesetting xorg configuration.

When in render offload configuration and without the udev rules, the nvidia audio device shows up:

$ cat /proc/asound/cards 
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xad410000 irq 165
 1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xad080000 irq 17

And when I plug the HDMI cable in, I see udev events:

$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[1030.110193] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)
UDEV  [1030.112521] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)
KERNEL[1030.142061] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)
UDEV  [1030.144240] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

The pavucontrol program shows the device and its options, but they all read “unplugged”.

Also, since the goal is to drive the external display for both video and audio, there would need to be a way to make the display come on upon HDMI connect, but I have no idea what this will entail.

The question then becomes: can one run a render offload configuration but without the udev rules, have the power settings set with scripts at boot, then undo these setting with yet another script that would be run before plugging in the external display, then performing whatever magic is necessary to make both the display and audio available for use, which would allow for extending or cloning the display?