GTX 1060M with Linux no HDMI audio device

I have a ASUS GL702VM-GC143T ROG Strix laptop with an GTX 1060M GPU. Under Linux (I usually use Gentoo but same behaviour with Xubuntu) when I plug the HDMI cable from my TV into the laptop the display shows up but no HDMI audio device is discovered. Under Windows 10 the HDMI audio device shows up when the HDMI cable is plugged in.

With the HDMI cable connected while running Xorg no HDMI audio shows using lspci and the ALSA module snd-hda-codec-hdmi never gets loaded. I have tried the setpci method to rescan the PCI bus but it doesn’t make any difference.

Kernel: 4.13.10-gentoo, NVIDIA driver version: 387.12

At the moment I can’t think of anything else to try and am presuming there is a bug which is stopping the GPU from ‘switching on’ the HDMI audio part.

Thanks in advance.
nvidia-bug-report.log.gz (142 KB)

See this:
[url]https://devtalk.nvidia.com/default/topic/1024022/linux/gtx-1060-no-audio-over-hdmi-only-hda-intel-detected-azalia/[/url]

I’ve already tried the setpci / rescan the bus and it makes no difference - the HDMI audio device still doesn’t show up.

Sorry, missed that. Please run nvidia-bug-report.sh and attach targz file to your post to see your config.

Attached bug report to original post.

Logs look fine.
What does
setpci -s 01:00.0 0x488.l
output before and after you try to set it using
setpci -s 01:00.0 0x488.l=0x2000000:0x2000000

Before I run it the output is: 00000000

After running output is: 02000000

Looks ok. So either you’re doing something wrong regarding unloading modules/pci rescan or with your gpu it’s a different register. The driver can’t do anything about it, it’s on bus level.
Maybe see what the 0x488 register is set to under windows using
setpci -s 01:00.0 0x488.l
or
lspci -s1: -nnxxxx
pcitools are ported to windows.

Under Windows setpci -s 01:00.0 0x488.l outputs ffffffff

(Windows is 64-bit while I’m running 32-bit Linux)

If I use acpi=off pci=biosirq kernel options on boot then fffffff is set under Linux but the NVidia modules do not load (no IRQ available) but the NVidia HDMI audio device shows up under lspci.

That’s odd. 0xFFFFFFFF would rather point to either no device present or setpci failing to read.
What’s the output of
lspci -d 10de:* -nnxxxx
in the three cases Windows/Linux normal boot/Linux boot with kernel options? Did you try booting an 64bit Linux and using the setpci procedure?

Attached lspci outputs for Linux no boot options, Linux with boot options and Windows
lspci-ouputs.tar.gz (1.8 KB)

Can confirm this is probably a Linux kernel (ACPI?) issue. The setpci workaround works with kernel 4.4.96-gentoo and stops working with 4.9.51-gentoo

You’re running a lot of kernel parameters concerning acpi and pm, tried without them?

Tried with and without kernel parameters.

Workaround works with 4.4.x kernels but not with >=4.9.x kernels

Already created bug report on kernel bugzilla.

Can you please point me to the bugzilla entry?
The 4.9 kernel is definitely broken, it always uses just the cached pci config space, never re-reads it.