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

This didn’t work. I inserted the setpci module in grub and added the entry. Made no difference. Did anyone manage too get this approach working? Making it as a service works better for me.

that got me a little further thank you!
now I’m down to this error message

[b]

Failed to start system-logind.service: Unit system_logind.service not found

[/b]

But the good news is, my system’s sound settings now shows the HDMI Output. But when I select it, sound still plays through my laptop’s speakers.

But I figured out that I had to open HDAJackRetask and tick Set model=auto (in options) and apply for the sound to really be played via HDMI.

Did anybody else experience this behavior?

change

sudo systemctl start system-logind

to

sudo systemctl start systemd-logind

systemd is missing the letter d.

“3D controller” here means that this GPU doesn’t have a display engine, presumably because it’s an Optimus laptop. Audio and display are both Intel’s responsibility there.

The backlight dies for me too. As you said, the link /sys/class/backlight/acpi_video0 is broken because /sys/devices/pci0000:00/0000:00:01.0/backlist is then missing.

Not sure how to bring it up either.

Whenever I’m not using this script for getting the audio to work with HDMI, I can control the brightness using a work-around (not what I’d like but it works):

#!/bin/sh

path=/sys/class/backlight/acpi_video0

luminance() {
    read -r level < "$path"/actual_brightness
    factor=$((100 / max))
    printf '%d\n' "$((level * factor))"
}

read -r max < "$path"/max_brightness

xbacklight -set "$(luminance)"

inotifywait -me modify --format '' "$path"/actual_brightness | while read; do
    xbacklight -set "$(luminance)"
done

Based on all information in this thread, I’ve been able to construct a systemd solution to get the HDMI Audio device exposed on my Skylake laptop with a GTX1060 running in “Discrete Graphics” (not Hybrid) mode on Ubuntu 17.10:

/etc/systemd/system/fix-hdmi-audio.service

[Unit]
Description=nVidia HDMI Audio Fixer
Before=systemd-logind.service display-manager.service
After=module-init-tools.service

[Service]
Type=oneshot
ExecStart=/root/fix-hdmi-audio.sh

[Install]
WantedBy=multi-user.target

/root/fix-hdmi-audio.sh

#!/bin/sh
setpci -s 01:00.0 0x488.l=0x2000000:0x2000000
rmmod nvidia-uvm nvidia-drm nvidia-modeset nvidia
sh -c 'echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove'
sh -c 'echo 1 > /sys/bus/pci/devices/0000:00:01.0/rescan'
modprobe nvidia nvidia-modeset nvidia-drm nvidia-uvm

And then execute the following commands (as root) to make it do this at boot:

chmod +x /root/fix-hdmi-audio.sh
systemctl enable fix-hdmi-audio.service

After each reboot, I now see the HDMI audio device on my laptop:

fludizz@tongerlo:~$ lspci | grep "PCIe Controller\|NVIDIA"
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 07)
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev a1)
fludizz@tongerlo:~$ aplay -l | grep NVidia
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]

Fludizz, have you tried putting your laptop to sleep and resuming it? Does the HDMI audio still work after that? In my case, it breaks after resuming from suspend.

Yes, it still works after waking up from suspend.

Only thing I have to do after waking is enabling the HDMI Output from the Volume Control options - it doesn’t automatically switch to HDMI Audio.

[edit]
Fixed that by switching to pasystray instead of volti / pavucontrol. pasystray allowed me to force HDMI Audio as ‘default’ audio device.

This is a confusing issue for me. I usually run my Thinkpad in hybrid mode, using nvidia and modesetting in order to get Prime Sync.
There are comments in a couple of other threads that there are DP audio problems which will be fixed in the driver.
What I mean to ask is:
is this fix involving start-up scripts the last word, or is nvidia able & willing to fix this in the driver?

Hi aplattner, do you have any time to investigate this further?

This issue is affecting an increasing number of consumer products and I’d like to help you find a solution so that we can have this fixed in upstream Linux or your Linux drivers - without the need for any of these special scripts.

I have checked under Windows. RWEverything and Windows pciutils don’t seem to be able to read PCI extended configuration space, but System Information Viewer can.

Under Windows the HDMI audio device is not visible on the PCI bus by default, but plug in the HDMI cable and it appears. Unplug the cable and it disappears again.

Here is the PCI config space before connecting HDMI:

And with a HDMI TV connected:

i.e. the 0x488 value is changing in the way you have described on this thread.

I did a fresh install of Win10 and found that the HDMI audio PCI device does not appear at all - not even when a HDMI TV is connected - until the nvidia driver is installed.

I checked the ACPI tables for this product, and there is no mention of the exact values 0x488 nor 0x2000000. I checked all the PCI_Config OperationRegions and there aren’t any regions defined that would allow access to offset 0x488.

I believe this strongly suggests that the NVIDIA Windows driver has some specific logic to do this 0x488 write upon HDMI connection event. It would be great if you can confirm that, and under which conditions this register change is done (or not done). If this theory is correct then we can move on and see how to implement the same magic under Linux.

I’m also waiting for a real fix of this problem.

My system specs:
i7-7700HQ + GTX 1060 6GB
Linux kernel version: 4.10.0-42-generic
Nvidia driver Version: 384.90
OS: Linux Mint 18.2

The register 0x488 has а value 02000000 on my system without any workarounds:

$ sudo lspci -d 10de:* -xxxx | grep 480
480: 00 00 00 00 13 00 00 00 <b>00 00 00 02</b> 00 00 00 00

However, the Nvidia audio device is still not available at system startup.
I can make it work by performing a pci rescan, but after that I noticed a power management problem related to the Nvidia audio device. Laptop consumes 5 watts more power after this workaround.
I hope that the problem will be fixed soon.

I have the same specs, except for Xubuntu 17.10, and Nvidia: 387.12 as well as Linux: 4.13.0-21-generic and with the systemd workaround the HDA Nvidia is found and working. Sadly upon restart I need to reinstall pulseaudio for it to work at all (doesnt detect any more cards); I have to restart lightdm to use HDMI at all and strangely bluetooth is broken. So I suspect loading the HDA Nvidia in systemd is a bit too late bootwise.

I can confirm that kernel module, posted by Maik Freudenberg (https://bugs.freedesktop.org/show_bug.cgi?id=75985#c27), is working fine on my system. Thank you for the fix. The HDMI audio device now works as it should.

The steps I did to enable HDMI audio device:

  1. Download and extract the file nvhda.tar.xz.
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
  1. Reboot.

With this fix, I did not notice any problems with power management or system stability. HDMI audio works at system startup, after resume from sleep, after plugging/unplugging HDMI cable.

I tried this module. Everything is fine except that there is no sound again when you exit from sleep mode. My specs: gl502vm (gtx1060).

from dmesg:
[45311.568050] snd_hda_codec_hdmi hdaudioC1D0: out of range cmd 0:4:707:ffffffff
[45311.576447] done.
[45311.583399] video LNXVIDEO:01: Restoring backlight state
[45311.583422] PM: suspend exit
[45311.583916] snd_hda_codec_hdmi hdaudioC1D0: out of range cmd 0:4:707:ffffffff
[45311.829959] snd_hda_codec_hdmi hdaudioC1D0: HDMI: invalid ELD buf size -1
[45311.829974] snd_hda_codec_hdmi hdaudioC1D0: HDMI: invalid ELD buf size -1
[45311.829981] snd_hda_codec_hdmi hdaudioC1D0: HDMI: invalid ELD buf size -1

@bromk081
Does audio work if you run
sudo tee /proc/acpi/nvhda <<<OFF
suspend
resume
sudo tee /proc/acpi/nvhda <<<ON

Yes, sound works after this:“sudo tee /proc/acpi/nvhda <<<ON”

Is it possible to automate this process?

Create scripts and systemd services for that
nvhda-suspend.sh

#!/bin/bash
echo "OFF" > /proc/acpi/nvhda
logger audio_off

nvhda-resume.sh

#!/bin/bash
echo "ON" > /proc/acpi/nvhda
logger audio_on

nvhda-suspend.service

[Unit]
Description=nvhda suspend
Before=sleep.target

[Service]
Type=oneshot
ExecStart=/PathTo/nvhda-suspend.sh

[Install]
WantedBy=sleep.target

nvhda-resume.service

[Unit]
Description=nvhda resume
After=suspend.target

[Service]
Type=oneshot
ExecStart=/PathTo/nvhda-resume.sh

[Install]
WantedBy=suspend.target

copy service files to your systemd service directory, systemctl daemon-reload, systemctl enable nvhda-resume.service, systemctl enable nvhda-suspend.service

All as root, you will have to set correct paths, make scripts executable, not tested.

To have a bit more info what is exactly happening on suspend/resume, can you please post the output of
sudo lspci -d 10de:* -xxx
after resume when audio is not working?

UPDATED

After resume:

01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile 6GB] (rev a1)
00: de 10 60 1c 07 00 10 00 a1 00 00 03 00 00 00 00
10: 00 00 00 eb 0c 00 00 c0 00 00 00 00 0c 00 00 d0
20: 00 00 00 00 01 e0 00 00 00 00 00 00 43 10 00 18
30: 00 00 00 00 60 00 00 00 00 00 00 00 ff 01 00 00
40: 43 10 00 18 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 00 00 00 01 00 00 00 ce d6 23 00 00 00 00 00
60: 01 68 03 00 08 00 00 00 05 78 80 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 10 00 02 00 e1 8d 2c 01
80: 30 21 0b 00 03 4d 45 00 42 01 02 11 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 13 08 04 00
a0: 00 04 00 00 0e 00 00 00 03 00 1f 00 00 00 00 00
b0: 00 00 00 00 09 00 14 01 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev ff)
00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

After:
sudo tee /proc/acpi/nvhda <<<OFF
sudo tee /proc/acpi/nvhda <<<ON

01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile 6GB] (rev a1)
00: de 10 60 1c 07 00 10 00 a1 00 00 03 00 00 80 00
10: 00 00 00 eb 0c 00 00 c0 00 00 00 00 0c 00 00 d0
20: 00 00 00 00 01 e0 00 00 00 00 00 00 43 10 00 18
30: 00 00 00 00 60 00 00 00 00 00 00 00 ff 01 00 00
40: 43 10 00 18 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 00 00 00 01 00 00 00 ce d6 23 00 00 00 00 00
60: 01 68 03 00 08 00 00 00 05 78 80 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 10 00 02 00 e1 8d 2c 01
80: 30 21 0b 00 03 3d 46 00 42 01 01 11 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 13 08 04 00
a0: 00 04 00 00 0e 00 00 00 03 00 1f 00 00 00 00 00
b0: 00 00 00 00 09 00 14 01 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev a1)
00: de 10 f1 10 00 00 10 00 a1 00 03 04 00 00 80 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 60 00 00 00 00 00 00 00 00 02 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 00 00 00 00 00 00 00 00 ce d6 23 00 00 00 00 00
60: 01 68 03 00 08 00 00 00 05 78 80 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 10 00 02 00 e1 8d 2c 01
80: 30 29 09 00 03 3d 45 00 43 01 01 11 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 13 08 04 00
a0: 00 00 00 00 0e 00 00 00 00 00 01 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

This didn’t work for me, initially because of a typo.

~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Need sleep now.