From: Peter Ujfalusi Date: Wed, 24 Apr 2024 10:34:13 +0000 (+0300) Subject: ucm2: common: pcm: Add hdmi.conf to handle the creation X-Git-Tag: v1.2.12~11 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=a3e1786a2025663ef9da74c9f7f2d0ecf876c0e2;p=alsa-ucm-conf.git ucm2: common: pcm: Add hdmi.conf to handle the creation 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 { } Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/411 Signed-off-by: Peter Ujfalusi Signed-off-by: Jaroslav Kysela --- diff --git a/ucm2/common/pcm/hdmi.conf b/ucm2/common/pcm/hdmi.conf new file mode 100644 index 0000000..0a870ed --- /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" + ] +}