From: Peter Ujfalusi Date: Tue, 30 Apr 2024 10:58:29 +0000 (+0300) Subject: ucm2: common: pcm: hdmi: Add new macro to conditionally X-Git-Tag: v1.2.13~41 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=92aa6fda6b5c16bf17f370b3a46f5b4914e53090;p=alsa-ucm-conf.git ucm2: common: pcm: hdmi: Add new macro to conditionally The new HdmiDevice macro can be used to create the hdmi PCM device for a hardware PCM whose ID can be found in the Iec61937Devices comma separated device ID list. It is the caller's responsibility to pass correct device id of an HDMI PCM as Dev. The new macro needs Syntax 7 support. Example for a use by sof-hda-dsp where the HDMI devices are 3, 4 and 5 Macro.0.HdmiDevice { Iec61937Devices "${var:Iec61937Pcms1}" Dev 3 Idx 0 } Macro.1.HdmiDevice { Iec61937Devices "${var:Iec61937Pcms1}" Dev 4 Idx 1 } Macro.2.HdmiDevice { Iec61937Devices "${var:Iec61937Pcms1}" Dev 5 Idx 2 } If.HdmiIec61937 { Condition { Type RegexMatch Regex "((^|,)[345](,|$))" String "${var:Iec61937Pcms1}" } True.Macro.save_hdmi_cfg.HdmiPCMSave { Name "42-sof-hdmi" } } The Iec61937Pcms1 contains a match string of "5,4,3" Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/413 Signed-off-by: Peter Ujfalusi Signed-off-by: Jaroslav Kysela --- diff --git a/ucm2/common/pcm/hdmi.conf b/ucm2/common/pcm/hdmi.conf index 0a870ed..e2820dc 100644 --- a/ucm2/common/pcm/hdmi.conf +++ b/ucm2/common/pcm/hdmi.conf @@ -72,3 +72,22 @@ DefineMacro.HdmiPCMSave { cfg-save "${var:LibDir}/${var:__Name}.conf:hdmi-pcm" ] } + +# Macro SofHdmiDevice - Create hdmi PCM device for a sound card if passthrough +# is supported +# +# Arguments: +# Iec61937Devices - Comma separated list of PCM device ids supporting iec61937 +# passthrough +# Dev - Hardware PCM device to match in Iec61937Devices for iec61937 support +# Idx - hdmi: device index and control index +# + +DefineMacro.HdmiDevice.If.iec61937 { + Condition { + Type RegexMatch + Regex "((^|,)[${var:__Dev}](,|$))" + String "${var:__Iec61937Devices}" + } + True.Macro.0.HdmiPCM { Device "${var:__Dev}" Index "${var:__Idx}" } +}