Skip to content

Commit

Permalink
HACK: ALSA: Assign internal PCM chmap/ELD/IEC958 kctls to device 0
Browse files Browse the repository at this point in the history
On SoC sound devices utilizing codec2codec DAI links with a HDMI codec
the kctls for chmap, ELD, IEC958 are currently created using the
internal PCM device numbers. This causes userspace to not see the
actual channel mapping.

Affected devices include LibreTech LePotato and Wetek Play 2.

The proper fix would be not create these kctls for internal PCMs and
instead create them for the real userspace-visible PCMs, somehow
forwarding the controls between the HDMI codec and the real PCM.

As a workaround, simply use device=0 for all channel map controls and
SoC HDMI codec controls for internal PCM devices.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
  • Loading branch information
anssih authored and chewitt committed Apr 17, 2022
1 parent 3c5d414 commit be0c223
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion sound/core/pcm_lib.c
Expand Up @@ -2514,7 +2514,10 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
knew.name = "Playback Channel Map";
else
knew.name = "Capture Channel Map";
knew.device = pcm->device;
if (pcm->internal && pcm->device)
dev_info(pcm->card->dev, "workaround active: internal PCM chmap controls mapped to device 0\n");
else
knew.device = pcm->device;
knew.count = pcm->streams[stream].substream_count;
knew.private_value = private_value;
info->kctl = snd_ctl_new1(&knew, info);
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/codecs/hdmi-codec.c
Expand Up @@ -802,7 +802,8 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
if (!kctl)
return -ENOMEM;

kctl->id.device = rtd->pcm->device;
if (!rtd->pcm->internal)
kctl->id.device = rtd->pcm->device;
ret = snd_ctl_add(rtd->card->snd_card, kctl);
if (ret < 0)
return ret;
Expand Down

0 comments on commit be0c223

Please sign in to comment.