From 80d054c888daf2b2b818d1c2be533b6c025729c3 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 24 Apr 2024 13:34:13 +0300 Subject: [PATCH 1/3] ucm2: common: pcm: Add hdmi.conf to handle the creation of hdmi PCM devices User space expect to see hdmi: PCM devices to be able to use bytestream passthrough. The common/pcm/hdmi.conf provides two macros: HdmiPCM: to generate an ALSA conf section for an hdmi: PCM device HdmiPCMSave: to save the generated config Example of use (sof-hda-dsp card with hardware HDMI PCMs: 3-5): Macro.0.HdmiPCM { Device 3 Index 0 } Macro.1.HdmiPCM { Device 4 Index 1 } Macro.2.HdmiPCM { Device 5 Index 2 } Macro.3.HdmiPCMSave { } Signed-off-by: Peter Ujfalusi --- ucm2/common/pcm/hdmi.conf | 74 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 ucm2/common/pcm/hdmi.conf diff --git a/ucm2/common/pcm/hdmi.conf b/ucm2/common/pcm/hdmi.conf new file mode 100644 index 00000000..0a870edb --- /dev/null +++ b/ucm2/common/pcm/hdmi.conf @@ -0,0 +1,74 @@ +# Macro HdmiPCM - Generate ALSA control section for hdmi: PCM device +# +# Arguments: +# Device - hardware PCM device +# Index - hdmi: device index and control index +# + +DefineMacro.HdmiPCM { + LibraryConfig.generic.Config.hdmi-pcm.pcm.hdmi."${var:__Index}" { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string + } + @args.AES0 { + type integer + } + @args.AES1 { + type integer + } + @args.AES2 { + type integer + } + @args.AES3 { + type integer + } + type hooks + slave.pcm { + type hw + card $CARD + device "${evali:$__Device}" + } + hooks.0 { + type ctl_elems + hook_args [ + { + name "IEC958 Playback Default" + index "${evali:$__Index}" + lock true + preserve true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + { + name "IEC958 Playback Switch" + index "${evali:$__Index}" + value true + } + ] + } + hint.device "${evali:$__Device}" + } +} + +# Macro HdmiPCMSave - Save the generated ALSA control for hdmi: PCM device(s) +# generated inside 'hdmi-pcm' section by prior calls to +# HdmiPCM macro +# +# Arguments: +# [Name] - Optional name excluding the .conf extension to use for the +# configuration file, defaults to "42-hdmi-pcm" +# + +DefineMacro.HdmiPCMSave { + If.name { + Condition { + Type String + Empty "${var:-__Name}" + } + True.Define.__Name "42-hdmi-pcm" + } + + FixedBootSequence [ + cfg-save "${var:LibDir}/${var:__Name}.conf:hdmi-pcm" + ] +} From 60af971271a10837b95a449bd46bc40527ea79b5 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 11 Apr 2024 15:06:42 +0300 Subject: [PATCH 2/3] ucm2: Intel/sof-hda-dsp: Create ALSA config file for hdmi: PCM device If the HDMI PCM index (3-5) is found in iec61937-pcm list of the card's components list then use the HdmiPCM/HdmiPCMSave macros to create the configuration file. The PCMs that will be created are: aplay -L | grep hdmi hdmi:CARD=sofhdadsp,DEV=0 hdmi:CARD=sofhdadsp,DEV=1 hdmi:CARD=sofhdadsp,DEV=2 Audio servers (Pulseaudio, Pipewrire) or applications then can use these for bytestream passthrough, for example: mplayer -ao alsa:device=hdmi=sofhdadsp,DEV=0 -ac hwdts