How to disable HDMI subdevice

Hello,
I am trying to solve this problem for some times but couldn’t find a way of doing it. This problem is VERY annoying.
I was using an external dac for many years. The new one i am using have a lot of latency (built for music not movie…). So i want to use the sound from my TV. It’s a LG CX oled, with HDMI 2.1. I also have a DP monitor (dual monitor in kde is a nightmare, but it’s another story…).
HDMI output from my graphic card is divided in subdevice. In fact Alsa do not even recognize them as subdevice, and it seems completely different of what i have in my playback device in kde sound applet :

**** Liste des périphériques matériels PLAYBACK ****
carte 0 : J20 [JLsounds Hi-Rez Audio 2.0], périphérique 0 : USB Audio [USB Audio]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 1 : HDMI [HDA ATI HDMI], périphérique 3 : HDMI 0 [PHL 245E1]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 1 : HDMI [HDA ATI HDMI], périphérique 7 : HDMI 1 [HDMI 1]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 1 : HDMI [HDA ATI HDMI], périphérique 8 : HDMI 2 [HDMI 2]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 1 : HDMI [HDA ATI HDMI], périphérique 9 : HDMI 3 [LG TV SSCR2]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 1 : HDMI [HDA ATI HDMI], périphérique 10 : HDMI 4 [HDMI 4]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 1 : HDMI [HDA ATI HDMI], périphérique 11 : HDMI 5 [HDMI 5]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0
carte 2 : Generic [HD-Audio Generic], périphérique 0 : ALC1220 Analog [ALC1220 Analog]
  Sous-périphériques : 1/1
  Sous-périphérique #0 : subdevice #0

Strangely in my kde sound applet i have the choice between HDMI Output (not working). HDMI 4 Stereo and 5.1 and 7.1.
The problem is i only get sound from my TV with HDMI 4 stereo, and whatever i do it always failback to HDMI 1. If the pc go in screen saving, or if i simply power off (or power on also…) the dp monitor.

In fact it failback to the JLsounds usb, but behavior is the same if it’s not connected, it always go back to hdmi 1 every time it can…
And sometimes HDMI 4 is not in the playback device and it’s call HDMI 2 instead…
No way to disable these useless hdmi output in alsamixer, and i tried to use pipewire over pulse and it’s not working better.


Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

ALSA uses different numbering for audio devices to PulseAudio/PipeWire

carte 1 : HDMI [HDA ATI HDMI], périphérique 3 : HDMI 0 [PHL 245E1]
carte 1 : HDMI [HDA ATI HDMI], périphérique 9 : HDMI 3 [LG TV SSCR2]

Please post more information about PulseAudio/PipeWire

pactl list cards

that will show card information similar to GUI controls and information about ALSA devices

To disable HDMI outputs, install alsa-tools and use jack retasking tool to disable HDMI output

sudo hdajackretask

Change the first HDMI connection to Not Connected
(pin ID numbers may be different on your system)

And click Install boot override

When system is restarted, audio device for HDMI to monitor [PHL 245E1] should not be present in ALSA