]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: Intel/sof-hda-dsp: Create ALSA config file for
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 11 Apr 2024 12:06:42 +0000 (15:06 +0300)
committerJaroslav Kysela <perex@perex.cz>
Mon, 29 Apr 2024 13:36:17 +0000 (15:36 +0200)
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 <video with dts>

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/411
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf

index 98098e72cc566da529004a3ccfb9797a4921ed80..00e40d690aee8ec152de2e9677b0588eecb4c370 100644 (file)
@@ -1,10 +1,20 @@
 Syntax 6
 
-Define.DeviceMic "Mic"
-Define.DeviceDmic ""
-
 Include.card-init.File "/lib/card-init.conf"
 
+Define {
+       DeviceMic "Mic"
+       DeviceDmic ""
+       Iec61937Pcms1 ""
+}
+
+DefineRegex {
+       Iec61937Pcms {
+               Regex "iec61937-pcm:(([0-9]+(,))*[0-9]+)"
+               String "${CardComponents}"
+       }
+}
+
 If.devdmic {
        Condition {
                Type String
@@ -115,3 +125,41 @@ If.Capture {
                cset "name='Capture Switch' on"
        ]
 }
+
+Include.hdmi-pcm.File "/common/pcm/hdmi.conf"
+
+If.Hdmi3-iec61937 {
+       Condition {
+               Type RegexMatch
+               Regex "((^|,)[3](,|$))"
+               String "${var:Iec61937Pcms1}"
+       }
+       True.Macro.hdmi3.HdmiPCM { Device 3 Index 0 }
+}
+
+If.Hdmi4-iec61937 {
+       Condition {
+               Type RegexMatch
+               Regex "((^|,)[4](,|$))"
+               String "${var:Iec61937Pcms1}"
+       }
+       True.Macro.hdmi4.HdmiPCM { Device 4 Index 1 }
+}
+
+If.Hdmi5-iec61937 {
+       Condition {
+               Type RegexMatch
+               Regex "((^|,)[5](,|$))"
+               String "${var:Iec61937Pcms1}"
+       }
+       True.Macro.hdmi5.HdmiPCM { Device 5 Index 2 }
+}
+
+If.HdmiIec61937 {
+       Condition {
+               Type RegexMatch
+               Regex "((^|,)[345](,|$))"
+               String "${var:Iec61937Pcms1}"
+       }
+       True.Macro.save_hdmi_cfg.HdmiPCMSave { Name "42-sof-hdmi" }
+}