ASoC: hdmi-codec: Fix broken channel map reporting
authorMatthias Reichl <hias@horus.com>
Fri, 29 Sep 2023 19:50:28 +0000 (21:50 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 2 Oct 2023 13:06:14 +0000 (14:06 +0100)
commitb84b53149476b22cc3b8677b771fb4cf06d1d455
tree491d2ef3629d81499df94eac01c7626cd6c69a51
parentdd9f9cc1e6b9391140afa5cf27bb47c9e2a08d02
ASoC: hdmi-codec: Fix broken channel map reporting

Commit 4e0871333661 ("ASoC: hdmi-codec: fix channel info for
compressed formats") accidentally changed hcp->chmap_idx from
ca_id, the CEA channel allocation ID, to idx, the index to
the table of channel mappings ordered by preference.

This resulted in wrong channel maps being reported to userspace,
eg for 5.1 "FL,FR,LFE,FC" was reported instead of the expected
"FL,FR,LFE,FC,RL,RR":

~ # speaker-test -c 6 -t sine
...
 0 - Front Left
 3 - Front Center
 1 - Front Right
 2 - LFE
 4 - Unknown
 5 - Unknown

~ # amixer cget iface=PCM,name='Playback Channel Map' | grep ': values'
  : values=3,4,8,7,0,0,0,0

Switch this back to ca_id in case of PCM audio so the correct channel
map is reported again and set it to HDMI_CODEC_CHMAP_IDX_UNKNOWN in
case of non-PCM audio so the PCM channel map control returns "Unknown"
channels (value 0).

Fixes: 4e0871333661 ("ASoC: hdmi-codec: fix channel info for compressed formats")
Cc: stable@vger.kernel.org
Signed-off-by: Matthias Reichl <hias@horus.com>
Link: https://lore.kernel.org/r/20230929195027.97136-1-hias@horus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/hdmi-codec.c