diff mbox series

ASoC: hdmi-codec: Fix broken channel map reporting

Message ID 20230909114633.3193-1-hias@horus.com
State Superseded
Headers show
Series ASoC: hdmi-codec: Fix broken channel map reporting | expand

Commit Message

Matthias Reichl Sept. 9, 2023, 11:46 a.m. UTC
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

Revert this incorrect change so that channel maps are properly
reported again.

Fixes: 4e0871333661 ("ASoC: hdmi-codec: fix channel info for compressed formats")
Cc: stable@vger.kernel.org
Signed-off-by: Matthias Reichl <hias@horus.com>
---
 sound/soc/codecs/hdmi-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Sept. 13, 2023, 7:23 p.m. UTC | #1
On Sun, Sep 10, 2023 at 02:14:34PM +0200, Matthias Reichl wrote:

> An alternative would be to set chmap_idx to HDMI_CODEC_CHMAP_IDX_UNKNOWN
> in the non-PCM case so the channel map control will return UNKNOWN for
> all channels. i.e. use this code instead:

>         if (pcm_audio)
>                 hcp->chmap_idx = ca_id;
>         else
>                 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;

> Any input on that topic is highly appreciated.

This is going to depend a bit on what userspace is expecting which I
don't have a good feel for.  The above does look reasonable TBH, I'm
tempted to go for that.
Mark Brown Sept. 26, 2023, 3:29 p.m. UTC | #2
On Sun, Sep 10, 2023 at 02:14:34PM +0200, Matthias Reichl wrote:

> An alternative would be to set chmap_idx to HDMI_CODEC_CHMAP_IDX_UNKNOWN
> in the non-PCM case so the channel map control will return UNKNOWN for
> all channels. i.e. use this code instead:

>         if (pcm_audio)
>                 hcp->chmap_idx = ca_id;
>         else
>                 hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;

> Any input on that topic is highly appreciated.

Can you send this version as a real patch please?
diff mbox series

Patch

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 13689e718d36f..c8e48225598f8 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -531,7 +531,7 @@  static int hdmi_codec_fill_codec_params(struct snd_soc_dai *dai,
 	hp->sample_rate = sample_rate;
 	hp->channels = channels;
 
-	hcp->chmap_idx = idx;
+	hcp->chmap_idx = ca_id;
 
 	return 0;
 }