* [PATCH] ASoC: SOF: pcm: Set the PCM device name for HDMI
@ 2025-10-29 10:51 Peter Ujfalusi
2025-10-30 11:08 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2025-10-29 10:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart, perex, arun
User space (alsa-lib) uses the PCM device name to detect HDMI devices, the
name is expected to be in form of 'HDMI'+<space>+number.
The PCM device name is not configured in ASoC, only the PCM id is set based
on the loaded topology.
Detect the HDMI PCM playback devices and configure the name to help user
space to handle HDMI PCMs correctly.
aplay -l | grep HDMI (Audio capable monitor connected)
Before the change:
card 0: sofhdadsp [sof-hda-dsp], device 3: HDMI1 (*) []
card 0: sofhdadsp [sof-hda-dsp], device 4: HDMI2 (*) []
card 0: sofhdadsp [sof-hda-dsp], device 5: HDMI3 (*) []
after the change:
card 0: sofhdadsp [sof-hda-dsp], device 3: HDMI1 (*) [DELL P1917S]
card 0: sofhdadsp [sof-hda-dsp], device 4: HDMI2 (*) [HDMI 2]
card 0: sofhdadsp [sof-hda-dsp], device 5: HDMI3 (*) [HDMI 3]
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
sound/soc/sof/pcm.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index fe43de1fe96c..cee04574264e 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -613,6 +613,24 @@ static int sof_pcm_new(struct snd_soc_component *component,
snd_pcm_set_managed_buffer(pcm->streams[stream].substream,
SNDRV_DMA_TYPE_DEV_SG, sdev->dev,
0, le32_to_cpu(caps->buffer_size_max));
+
+ /* Set the PCM device name for HDMI playback */
+ if (!strncmp(pcm->id, "HDMI", 4)) {
+ int hdmi_idx;
+
+ /*
+ * Make sure that the name is in"HDMI<SPACE>x" format as this is
+ * expected by user space.
+ * See alsa-lib's __snd_pcm_info_eld_fixup_check() which is
+ * guarding the __snd_pcm_info_eld_fixup() in
+ * snd_ctl_hw_pcm_info() and snd_pcm_hw_info() library functions
+ */
+ if (sscanf(pcm->id, "HDMI%d", &hdmi_idx) == 1)
+ snprintf(pcm->name, sizeof(pcm->name), "HDMI %d",
+ hdmi_idx);
+ else
+ strscpy(pcm->name, pcm->id, sizeof(pcm->name));
+ }
capture:
stream = SNDRV_PCM_STREAM_CAPTURE;
--
2.51.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: SOF: pcm: Set the PCM device name for HDMI
2025-10-29 10:51 [PATCH] ASoC: SOF: pcm: Set the PCM device name for HDMI Peter Ujfalusi
@ 2025-10-30 11:08 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-10-30 11:08 UTC (permalink / raw)
To: lgirdwood, Peter Ujfalusi
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart, perex, arun
On Wed, 29 Oct 2025 12:51:34 +0200, Peter Ujfalusi wrote:
> User space (alsa-lib) uses the PCM device name to detect HDMI devices, the
> name is expected to be in form of 'HDMI'+<space>+number.
> The PCM device name is not configured in ASoC, only the PCM id is set based
> on the loaded topology.
>
> Detect the HDMI PCM playback devices and configure the name to help user
> space to handle HDMI PCMs correctly.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: pcm: Set the PCM device name for HDMI
commit: 541aecd34383a85eaf7c8556779466e394554fed
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-30 11:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29 10:51 [PATCH] ASoC: SOF: pcm: Set the PCM device name for HDMI Peter Ujfalusi
2025-10-30 11:08 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox