hhfeuer / nvhda

Linux kernel module to toggle Nvidia HDMI audio device on/off on notebooks
GNU General Public License v2.0
91 stars 12 forks source link

"invalid ELD data byte 5" when HDMI Cable is connected #2

Open tamer-hassan opened 6 years ago

tamer-hassan commented 6 years ago

..and hdmi audio is not enabled.

kernel 4.15.0 on Ubuntu 18.04 Developer release

$ tail -f /var/log/syslog
Mar 27 19:41:47 GL702VM kernel: [ 9906.147781] nvhda: version 0.01
Mar 27 19:41:47 GL702VM kernel: [ 9906.147788] nvhda: Found nv VGA device 0000:01:00.0
Mar 27 19:41:47 GL702VM kernel: [ 9906.147797] nvhda: Found nv audio device 0000:01:00.1
Mar 27 19:41:47 GL702VM kernel: [ 9906.147800] nvhda: Found nv audio device 0000:01:00.1
Mar 27 19:41:47 GL702VM kernel: [ 9906.147801] nvhda: Succesfully loaded. Audio 0000:01:00.0 is on

Mar 27 19:42:36 GL702VM kernel: [ 9955.125480] snd_hda_codec_hdmi hdaudioC1D0: HDMI: invalid ELD data byte 5
^C

jasmin@GL702VM:~/Downloads/nvhda$ cat /proc/acpi/nvhda 
0000:01:00.0 ON

jasmin@GL702VM:~/Downloads/nvhda$ uname -r
4.15.0-13-generic

jasmin@GL702VM:~/Downloads/nvhda$ apt policy nvidia-driver-390 
nvidia-driver-390:
  Installed: 390.42-0ubuntu1
  Candidate: 390.42-0ubuntu1
  Version table:
 *** 390.42-0ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages
        100 /var/lib/dpkg/status
hhfeuer commented 6 years ago

Please check if turning off and on makes it work when hdmi cable is connected: sudo tee /proc/acpi/nvhda <<<OFF sudo tee /proc/acpi/nvhda <<<ON Please attach the output of xrandr

tamer-hassan commented 6 years ago

before connecting hdmi cable:

jasmin@GL702VM:~$ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-4 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm
   1920x1080     75.00*+

after HDMI connected:

jasmin@GL702VM:~$ xrandr
Screen 0: minimum 8 x 8, current 5760 x 2160, maximum 32767 x 32767
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 3840x2160+1920+0 (normal left inverted right x axis y axis) 1872mm x 1053mm
   3840x2160     60.00*+  59.94    50.00    29.97    25.00    23.98  
   4096x2160     59.94    50.00    29.97    25.00    24.00    23.98  
   1920x1080     60.00    59.94    50.00    29.97    25.00    24.00    23.98    60.00    50.04    48.08  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1400x1050     59.98  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-4 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm
   1920x1080     75.00*+

After running:

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

Audio is enabled successfully..

hhfeuer commented 6 years ago

It's a bit odd. Telling by the messages from dmesg the audio device is already present when the module loads so it doesn't toggle it. Are you using any other workaround to make it visible before or is it there on boot? Without loading the module, is sudo lspci -d 10de:* displaying the audio device?

tamer-hassan commented 6 years ago

I'm not using any other workarounds. nvhda is the first workaround I used, when I started with Ubuntu 17.10. I then upgraded to 18.04 developer release, updated the nvhda source tree, and reinstalled with dkms, as I did originally on 17.10. On a fresh boot, before connecting HDMI cable, nvhda is already on

$ cat /proc/acpi/nvhda 
0000:01:00.0 ON

let me uninstall, reboot fresh without nvhda and report back if audio device is already present.

hhfeuer commented 6 years ago

Ah, ok. So it was working with 17.10, but kind of broke with 18.04? What exact kernel version are you running? Please post the output of dmesg | grep -i nv so I can see in which order the driver loads.

tamer-hassan commented 6 years ago

Exactly. was working perfectly on 17.10 and kind of broke with 18.04. Kernel is as posted in first post: 4.15.0-13-generic After I uninstalled via dkms and rebooted I realized nvhda was still loaded, via initramfs (i forgot, maybe this was leftover). removed and rebooted, now nvhda is not loaded anymore.

$ dmesg  | grep -i nv
[    0.000000] BIOS-e820: [mem 0x00000000320e1000-0x00000000320e1fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x0000000036521000-0x00000000370acfff] ACPI NVS
[    0.045230] PM: Registering ACPI NVS region [mem 0x320e1000-0x320e1fff] (4096 bytes)
[    0.045230] PM: Registering ACPI NVS region [mem 0x36521000-0x370acfff] (12107776 bytes)
[    1.215339] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[    1.233082] rtc_cmos 00:02: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
[    1.391122] nvidia: loading out-of-tree module taints kernel.
[    1.391128] nvidia: module license 'NVIDIA' taints kernel.
[    1.394215] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    1.400650] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
[    1.400922] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[    1.400998] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  390.42  Sat Mar  3 04:10:22 PST 2018 (using threaded interrupts)
[    1.402671] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  390.42  Sat Mar  3 03:30:48 PST 2018
[    1.403364] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    1.403366] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[    8.610217] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[    8.643036] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 239
[    8.861379] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[   10.858685] nvidia-modeset: Allocated GPU:0 (GPU-9cac9894-8637-734d-7405-487cd9a3e13b) @ PCI:0000:01:00.0
tamer-hassan commented 6 years ago
jasmin@GL702VM:~$ sudo lsmod | grep nvhda
jasmin@GL702VM:~$ sudo lspci -d 10de:*
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
jasmin@GL702VM:~$ sudo modprobe nvhda
jasmin@GL702VM:~$ sudo lspci -d 10de:*
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)
jasmin@GL702VM:~$ dmesg  | grep -i nv
[    0.000000] BIOS-e820: [mem 0x00000000320e1000-0x00000000320e1fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x0000000036521000-0x00000000370acfff] ACPI NVS
[    0.045237] PM: Registering ACPI NVS region [mem 0x320e1000-0x320e1fff] (4096 bytes)
[    0.045237] PM: Registering ACPI NVS region [mem 0x36521000-0x370acfff] (12107776 bytes)
[    1.223657] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[    1.241715] rtc_cmos 00:02: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
[    1.400647] nvidia: loading out-of-tree module taints kernel.
[    1.400652] nvidia: module license 'NVIDIA' taints kernel.
[    1.403704] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    1.410524] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
[    1.410850] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[    1.410909] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  390.42  Sat Mar  3 04:10:22 PST 2018 (using threaded interrupts)
[    1.412732] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  390.42  Sat Mar  3 03:30:48 PST 2018
[    1.413690] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    1.413692] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[    3.527208] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 239
[    3.769943] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[    3.819108] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
[    6.653466] nvidia-modeset: Allocated GPU:0 (GPU-9cac9894-8637-734d-7405-487cd9a3e13b) @ PCI:0000:01:00.0
[   85.578216] nvhda: version 0.01
[   85.578227] nvhda: Found nv VGA device 0000:01:00.0
[   85.578279] nvhda: enabling audio
[   85.578671] nvhda: Audio found, adding
[   85.579241] nvhda: Found nv audio device 0000:01:00.1
[   85.579243] nvhda: Succesfully loaded. Audio 0000:01:00.0 is on
[   86.387654] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input17
[   86.388072] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input18
[   86.388410] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input19
tamer-hassan commented 6 years ago

Now when I connect HDMI cable, I get in syslog: Mar 29 12:03:29 GL702VM kernel: [ 218.871401] snd_hda_codec_hdmi hdaudioC1D0: HDMI: invalid ELD data byte 6 and audio is not enabled. I still have to do the additional step of:

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

to get hdmi audio enabled.

hhfeuer commented 6 years ago

Ok, thank you for the info so far. I'll have to look into what changed in the Ubuntu kernel.

tamer-hassan commented 6 years ago

Ubuntu 18.04 LTS is now released. Still having the same issue with updated kernel 4.15 & nvidia driver 390.48 can you kindly investigate?

hhfeuer commented 6 years ago

Problem is, it's a general kernel problem. The nvhda module is just responsible for powering on/off the audio device which it is reliably doing. To actually get audio over hdmi, additionally it has to be routed to the right connector/stream which has to be done by gpu/sound driver on hdmi connect. This is currently kind of fluctuating and subject to investigation in the nouveau thread mentioned, it's not fully understoood yet. Depending on hardware/kernel this is either only working using the proprietary driver or also working with nouveau and now your case is kind of a third situation, not making it easier to debug. Do you remember under which kernel/driver this was fully working?

Brainiarc7 commented 6 years ago

I can confirm that this works fully on the Linux 4.17 kernel series.

Thanks for this 💯

Brainiarc7 commented 6 years ago

Hello @tamer-hassan ,

You may want to try out the latest Linux 4.17 kernel, just in case.

themanyone commented 4 years ago

Issue has returned, in Fedora 32 (rawhide): kernel-5.5.0-0.rc6.git3.1.fc32.x86_64 It was working fine in Fedora 31, before upgrade: kernel-5.4.14-200.fc31.x86_64 HDMI: invalid ELD data byte 2 I can force some playback through HDMI even though pavucontrol says it is disconnected. Go to volume control configuration, profile, select HDMI device (unplugged) (unavailalbe). Start sound app playing. In volume control Playback, choose HDMI playback for the app. Do this for each video or sound to force it out through HDMI. Of course, this workaround is less than ideal as HDMI audio should be detected and automatic. But it confirms HDMI is actually able to play a sound. All other system messages are similar to previous comments.