HDMI output stopped via physical device (hw:1, 7) but works via logical device (hdmi:CARD=NVidia, DEV=1)

Manuel Montesino via Alsa-user <[email protected]> Sat, 12 Dec 2020 00:25:37 -0500
Newsgroups gmane.linux.alsa.user
Message-ID <[email protected]>
I've been building/using my own Linux distro for 10-15 years following 
linuxfromscratch.org. My most recent build is from a few weeks ago based 
on kernel 5.9.8. Something very strange happened today. I've been 
essentially using the same ALSA/PulseAudio configuration for years and 
all has been well routing audio through HDMI on a nVidia card. I've 
always been able to address hw:1,7 without issue until today. It just 
stopped working. The only thing that happened a few hours prior was a 
Kodi crash (19 beta 1) at the beginning of playing a movie that would 
have used pass-through audio.

After hours of troubleshooting, there are two key findings:

1. There are no errors anywhere. Any software (xmms, mpv, ffplay, etc.) 
addressing hw:1,7 does not fail, but my receiver does not pick up the 
stream.

2. Audio output works perfectly when addressing via logical device name: 
hdmi:CARD=NVidia,DEV=1.

For point 1, I've read through 
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture/Troubleshooting 
and understand that it could be a hardware issue. This is all I can 
think that it might actually be at this point, but I'm having a really 
hard time continuing with that logic because all is well everywhere else 
when using hdmi:CARD=NVidia,DEV=1. I've tried shutting everything down 
(PC, receiver, projector) multiple times, and I've also tried plugging 
in the source HDMI cable into my receiver WHILE the audio stream is 
active.

For point 2, I can live with this since everything works, including 
pass-through bitstreams, but does anyone know how to translate 
hdmi:CARD=NVidia,DEV=1 for my ~/.asoundrc file? I haven't been able to 
figure out how to do that instead of using the card/device/subdevice 
parameters, and I often prefer to avoid PulseAudio and just do 
everything direct.

Since most of the software I use can talk directly via 
hdmi:CARD=NVidia,DEV=1 I'm in mostly good shape, and I do have a 
workaround for Chrome by setting Pulse as the default in ~/.asoundrc and 
loading the proper sink in Pulse as shown below (for anyone else who 
might be in a similar situation). But this is a very strange and 
puzzling occurrence, and I'd love to know if anyone else has experienced 
this.

Thanks for reading!


Workaround for Chrome by using PulseAudio:

~/.asoundrc

pcm.pulse {
     type pulse
}
ctl.pulse {
     type pulse
}
pcm.!default {
     type pulse
}
ctl.!default {
     type pulse
}

/etc/pulse/default.pa

# What was...
#load-module module-alsa-sink device=hw:1,7 channels=2
# ...is now...
load-module module-alsa-sink device=hdmi:CARD=NVidia,DEV=1 channels=2