bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-0996-ASoC-hdmi-codec-Fix-broken-channel-map-reporting.patch
1 From a1caea3c996f6bfa8c9568f521257f4e473285fb Mon Sep 17 00:00:00 2001
2 From: Matthias Reichl <hias@horus.com>
3 Date: Fri, 29 Sep 2023 21:50:28 +0200
4 Subject: [PATCH] ASoC: hdmi-codec: Fix broken channel map reporting
5
6 Commit b84b53149476b22cc3b8677b771fb4cf06d1d455 upstream.
7
8 Commit 4e0871333661 ("ASoC: hdmi-codec: fix channel info for
9 compressed formats") accidentally changed hcp->chmap_idx from
10 ca_id, the CEA channel allocation ID, to idx, the index to
11 the table of channel mappings ordered by preference.
12
13 This resulted in wrong channel maps being reported to userspace,
14 eg for 5.1 "FL,FR,LFE,FC" was reported instead of the expected
15 "FL,FR,LFE,FC,RL,RR":
16
17 ~ # speaker-test -c 6 -t sine
18 ...
19 0 - Front Left
20 3 - Front Center
21 1 - Front Right
22 2 - LFE
23 4 - Unknown
24 5 - Unknown
25
26 ~ # amixer cget iface=PCM,name='Playback Channel Map' | grep ': values'
27 : values=3,4,8,7,0,0,0,0
28
29 Switch this back to ca_id in case of PCM audio so the correct channel
30 map is reported again and set it to HDMI_CODEC_CHMAP_IDX_UNKNOWN in
31 case of non-PCM audio so the PCM channel map control returns "Unknown"
32 channels (value 0).
33
34 Fixes: 4e0871333661 ("ASoC: hdmi-codec: fix channel info for compressed formats")
35 Cc: stable@vger.kernel.org
36 Signed-off-by: Matthias Reichl <hias@horus.com>
37 Link: https://lore.kernel.org/r/20230929195027.97136-1-hias@horus.com
38 Signed-off-by: Mark Brown <broonie@kernel.org>
39 ---
40 sound/soc/codecs/hdmi-codec.c | 5 ++++-
41 1 file changed, 4 insertions(+), 1 deletion(-)
42
43 --- a/sound/soc/codecs/hdmi-codec.c
44 +++ b/sound/soc/codecs/hdmi-codec.c
45 @@ -520,7 +520,10 @@ static int hdmi_codec_fill_codec_params(
46 hp->sample_rate = sample_rate;
47 hp->channels = channels;
48
49 - hcp->chmap_idx = idx;
50 + if (pcm_audio)
51 + hcp->chmap_idx = ca_id;
52 + else
53 + hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
54
55 return 0;
56 }