Incorrect 5.1-channel sound handling on Intel Icelake laptop

I have an Intel Icelake laptop (a Lenovo Yoga C940). I was trying to get 5.1 sound to work through the HDMI outputs and I ran into a strange situation.

I was running speaker-test --channels 6 to the built-in speakers, which should result in the six channels being mixed down to the stereo setup of the built-in speakers. (Although there are five speakers on the laptop the interface to them is only two channels.) But the output from the six channels is:
0 - Front Left going to the left side
4 - Front Center going to the left side
1 - Front Right going to the right side
3 - Rear Right producing no sound at all
2 - Rear Left going to both sides
5 - LFE going to the right side

Two-channel sound works correctly.

I then tried 7.1-channel sound with the same results plus
7 - Side Right going to the right side
6 - Side Left going to the left side

So something is working incorrectly. What can I look at to figure out what is going wrong?

Of course, playing 5.1-channel sound on a two-channel speaker system isn’t all that useful. What I really wanted was to have 5.1-channel sound playing correctly through my monitor via ARC to my 5.1-channel sound system. But there the situation is even worse as:
0 - Front Left produces sound on the left speaker and subwoofer
4 - Front Center produces sound on the left speaker and subwoofer
1 - Front Right going to the right speaker and subwoofer
3 - Rear Right produces no sound at all
2 - Rear Left produces sound on the left and right speakers and the subwoofer
5 - LFE produces sound on the right speaker and subwoofer
So it appears that even though the HDMI output has 8 channels something is mixing the sound down to two channels, and incorrectly.

What can I look at to figure out what is going wrong here?

peter

Here is some software and hardware information:

Installed Packages
Name : wireplumber
Version : 0.4.11
Release : 1.fc36

idefix> aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pipewire
PipeWire Sound Server
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=sofhdadsp
sof-hda-dsp,
Default Audio Device
idefix> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sofhdadsp [sof-hda-dsp], device 0: HDA Analog () []
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 1: HDA Digital (
)
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 3: HDMI1 () []
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 4: HDMI2 (
)
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 5: HDMI3 (*)
Subdevices: 0/1
Subdevice #0: subdevice #0

/proc/asound/card0/codec#0 excerpts:
Codec: Realtek ALC298
Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
Control: name=“Speaker Playback Volume”, index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x01, mute=0
Amp-Out vals: [0x50 0x50]
Converter: stream=1, channel=0
PCM:
rates [0x60]: 44100 48000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Power states: D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out
Control: name=“Headphone Playback Volume”, index=0, device=0
ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x01, mute=0
Amp-Out vals: [0x50 0x50]
Converter: stream=1, channel=0
PCM:
rates [0x60]: 44100 48000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Power states: D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0

/proc/asound/card0/codec#2 excerpts:
Codec: Intel Icelake HDMI
Node 0x03 [Audio Output] wcaps 0x6611: 8-Channels Digital
Device: name=“HDMI 1”, type=“HDMI”, device=4
Converter: stream=3, channel=0
Digital: Enabled KAE
Digital category: 0x0
IEC Coding Type: 0x0
PCM:
rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
bits [0x1a]: 16 24 32
formats [0x5]: PCM AC3
Power states: D0 D3 EPSS
Power: setting=D0, actual=D0

Have you done a full update recently? sudo dnf upgrade

Yes, I did a full upgrade yesterday and then again today, which picked up a new kernel - 5.18.11-200.fc36.x86_64 - and some new pipewire components. No change - Rear Right still produces no sound. Something is going wrong with the remixing scheme - but how can I find out what?

There appears to be two different things going wrong here:
1/ bad remixing from 6 or 8 channels down to 2
2/ no recognition of the HDMI codec on the built-in Intel sound

I still don’t know where to look to figure out what is going wrong. Both may be the result of different problems in ALSA ucm2 but I don’t know how to see what is going on in it and I don’t know whether it is actually the problem.

The problem appears to be in speaker-test, which is mislabelling its channels. The channel that produces no sound is the sub-woofer channel, and it subject to a filter that strips out anything over about 150Hz, which results in silence on the small speakers in a laptop.

Today when I tried the same thing, it works as expected, with mixing 5.1 down to 2 correctly.