kernel 4.17.2 - ALSA issue - HDMI audio dead

So this is Fedora 28 and they just released kernel 4.17.2, which, as the title says, killed HDMI audio output of my GTX 980.

I thought it’s PulseAudio acting out again, but no (FYI, 11.x had problems with cards that have no sinks on PA startup which also broke HDMI out, but 12.0 is fine)

After hours of frustration I found out that even after turning the TV out on (with nvidia-settings), /proc/asound/NVidia/eld#0.1 keeps saying:
monitor_present 0
eld_valid 0

This can be worked around in several ways (including a GUI way, some clicking in pavucontrol every time you turn the TV out on), but funniest is:

cat /proc/asound/NVidia/codec#0 > /dev/null

Reading that file somehow makes the driver recognize that the output is now “plugged” (in PA terminology), /proc/asound/card0/eld#0.1 shows the TV normally, pulseaudio automatically switches to correct profile and everything works as expected.

But until you read that file, everything is dead.

Anyone knows what causes this? Is this a kernel regression in snd-hda-intel, or is this some kind of conflict with the nvidia driver they introduced in 4.17?

I’m using the Vulkan dev driver 396.24.02 (which, again, works excellent with kernel up to 4.16.16)

Still a problem in 415.25, and 418.43, with audio over displayport.

HDMI: invalid ELD data byte 0

… seems to be the culprit

410.78 is fine with displayport audio. (in spite of connection type being shown as HDMI)

cat /proc/asound/NVidia/eld#0.0
monitor_present         1
eld_valid               1
monitor_name            HDTX
        
connection_type         HDMI
eld_version             [0x2] CEA-861D or below
edid_version            [0x3] CEA-861-B, C or D
manufacture_id          0x8520
product_id              0x680
port_id                 0x200
support_hdcp            0
support_ai              0
audio_sync_delay        0
speakers                [0x5f] FL/FR LFE FC RL/RR RC RLC/RRC
sad_count               8
sad0_coding_type        [0x1] LPCM
sad0_channels           2
sad0_rates              [0x1ee0] 32000 44100 48000 88200 96000 176400 192000
sad0_bits               [0xe0000] 16 20 24
sad1_coding_type        [0x1] LPCM
sad1_channels           8
sad1_rates              [0x1ee0] 32000 44100 48000 88200 96000 176400 192000
sad1_bits               [0xe0000] 16 20 24
sad2_coding_type        [0x2] AC-3
sad2_channels           6
sad2_rates              [0xe0] 32000 44100 48000
sad2_max_bitrate        640000
sad3_coding_type        [0x7] DTS
sad3_channels           7
sad3_rates              [0x6e0] 32000 44100 48000 88200 96000
sad3_max_bitrate        1536000
sad4_coding_type        [0x9] DSD (One Bit Audio)
sad4_channels           6
sad4_rates              [0x40] 44100
sad5_coding_type        [0xa] E-AC-3/DD+ (Dolby Digital Plus)
sad5_channels           8
sad5_rates              [0xc0] 44100 48000
sad6_coding_type        [0xc] MLP (Dolby TrueHD)
sad6_channels           8
sad6_rates              [0x1480] 48000 96000 192000
sad7_coding_type        [0xb] DTS-HD
sad7_channels           8
sad7_rates              [0x1480] 48000 96000 192000

dmesg info

[    1.219156] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  410.78  Sat Nov 10 22:09:04 CST 2018 (using threaded interrupts)
[    1.220552] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  410.78  Sat Nov 10 22:07:09 CST 2018
[    1.221322] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    2.281445] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 243
[    2.817638] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input8
[    2.817721] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input9

FWIW, even with a forced EDID, no love.

Hi, see this thread: https://devtalk.nvidia.com/default/topic/1044547/linux/audio-problems-with-the-415-18-drivers for the same issue. It has been introduced since 415. I just found an interesting thing on my system: the problem does always occur, I can have sound around every 1 reboot out of 4. It looks like a race condition, and this is also linked to the activation of the DP video port while booting (see my posts https://devtalk.nvidia.com/default/topic/1044547/linux/audio-problems-with-the-415-18-drivers/post/5319272/#5319272 ). Do you see the same thing?

I’m not sure whether you’re confusing two separate issues, or you’ve just noticed it late…

What I have (and it’s still here, 2 GPUs and a million kernels later) was already present in 39x.xx drivers, and appeared in a KERNEL 4.17 update, not a driver version. Same driver worked 100% with a 4.16 kernel.

And the current (kernel 5.1.16, nvidia 430.25) 100% working work-around is to:
pacmd set-card-profile alsa_card.pci-0000_01_00.1 output:hdmi-stereo-extra1
every time you turn on your TV (output name is hardware-specific of course).

Reading a /proc file became erratic, but it’s still fun that it used to work 100% reliably at that point (kernel 4.17.x, driver 396.x). How the FSCK do you get a sound card working by reading a file?! This is below nonsensical… but true!