]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
hda: improve the microphone device allocation
authorJaroslav Kysela <perex@perex.cz>
Fri, 4 Jun 2021 10:02:53 +0000 (12:02 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 1 Sep 2021 09:16:22 +0000 (11:16 +0200)
This change use the local variables for the UCM microphone
device names. Also, handle the no-dmic case for sof-hda-dsp
hardware.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/HDA-Intel/HDA-Intel.conf
ucm2/HDA-Intel/HiFi-analog.conf
ucm2/HDA-Intel/HiFi.conf
ucm2/sof-hda-dsp/HiFi.conf
ucm2/sof-hda-dsp/sof-hda-dsp.conf

index 8a8e0e742d3ef688f36b189779655662d65cb6ab..0d10fd4710a2cd1f1dd05723f667338634a4c3d2 100644 (file)
@@ -3,13 +3,17 @@ Syntax 4
 Define.Use ""  # a non-empty string to use UCM configuration for HDA devices
 
 Define.AcpCardId "$${find-card:field=name,return=id,regex='^acp$'}"
+Define.DeviceMic "Mic"
 
 If.acp {
        Condition {
                Type String
                Empty "${var:AcpCardId}"
        }
-       False.Define.Use y
+       False {
+               Define.Use y
+               Define.DeviceMic "Mic2"
+       }
 }
 
 If.use {
index 1de9f9deea9407fab90fe0ba43bf7304bd9cd048..dd0da023a3604edc890ca7d7d4e0ed844585b046 100644 (file)
@@ -87,7 +87,7 @@ If.monomic {
                ControlEnum "Headphone Mic"
        }
        True {
-               SectionDevice."Mic2" {
+               SectionDevice."${var:DeviceMic}" {
                        Comment "Headphones Stereo Microphone"
 
                        ConflictingDevice [
@@ -122,7 +122,7 @@ If.monomic {
                }
        }
        False {
-               SectionDevice."Mic2" {
+               SectionDevice."${var:DeviceMic}" {
                        Comment "Headphones Stereo Microphone"
 
                        Value {
index f09ce1cbeb9016999d52f8361ea50e4c2b8e1732..9f31e077d737e7e81950ca2b9144dbfcdf091208 100644 (file)
@@ -16,11 +16,8 @@ If.analog {
                                Type String
                                Empty "${var:AcpCardId}"
                        }
-                       True {
-                               RenameDevice."Mic1" "Mic"
-                       }
                        False.Include.acp {
-                               Before.SectionDevice "Mic1"
+                               Before.SectionDevice "${var:DeviceMic}"
                                File "/HDA-Intel/HiFi-acp.conf"
                        }
                }
index 2c02c157c7726a5dd1609024d872a09ff2a0eba6..867769c796881d6093cb8168c5f42bf34c74c908 100644 (file)
@@ -4,43 +4,48 @@ SectionVerb {
        Value.TQ "HiFi"
 }
 
-<HDA-Intel/HiFi-analog.conf>
+Include.hda-analog.File "/HDA-Intel/HiFi-analog.conf"
 
-If.monomic.After.SectionDevice "Mic1"
-
-SectionDevice."Mic1" {
-       Comment "Digital Microphone"
+If.dmic {
+       Condition {
+               Type String
+               Empty "${var:DeviceDmic}"
+       }
+       Before.SectionDevice "${var:DeviceMic}"
+       False.SectionDevice."${var:DeviceDmic}" {
+               Comment "Digital Microphone"
 
-       Value {
-               CapturePriority 100
-               CapturePCM "hw:${CardId},6"
-               If.chn {
-                       Condition {
-                               Type RegexMatch
-                               Regex "cfg-dmics:[34]"
-                               String "${CardComponents}"
-                       }
-                       True {
-                               CaptureChannels 4
-                       }
-               }
-               If.vol {
-                       Condition {
-                               Type ControlExists
-                               Control "name='Dmic0 Capture Switch'"
-                       }
-                       True {
-                               CaptureMixerElem "Dmic0"
-                               CaptureVolume "Dmic0 Capture Volume"
-                               CaptureSwitch "Dmic0 Capture Switch"
+               Value {
+                       CapturePriority 100
+                       CapturePCM "hw:${CardId},6"
+                       If.chn {
+                               Condition {
+                                       Type RegexMatch
+                                       Regex "cfg-dmics:[34]"
+                                       String "${CardComponents}"
+                               }
+                               True {
+                                       CaptureChannels 4
+                               }
                        }
-                       False {
-                               # v1.3 SOF firmware
-                               CaptureMixerElem "PGA10.0 10 Master"
-                               CaptureVolume "PGA10.0 10 Master Capture Volume"
+                       If.vol {
+                               Condition {
+                                       Type ControlExists
+                                       Control "name='Dmic0 Capture Switch'"
+                               }
+                               True {
+                                       CaptureMixerElem "Dmic0"
+                                       CaptureVolume "Dmic0 Capture Volume"
+                                       CaptureSwitch "Dmic0 Capture Switch"
+                               }
+                               False {
+                                       # v1.3 SOF firmware
+                                       CaptureMixerElem "PGA10.0 10 Master"
+                                       CaptureVolume "PGA10.0 10 Master Capture Volume"
+                               }
                        }
                }
        }
 }
 
-<sof-hda-dsp/Hdmi.conf>
+Include.hdmi.File "/sof-hda-dsp/Hdmi.conf"
index ca3473a614ec0456a8b412d975ac844104240510..4c222fac4f1329731637b62a256fe7240c8f7098 100644 (file)
@@ -1,4 +1,17 @@
-Syntax 3
+Syntax 4
+
+Define.DeviceMic "Mic"
+Define.DeviceDmic ""
+
+If.dmic {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "cfg-dmics:"
+       }
+       True.Define.DeviceDmic "Mic1"
+       True.Define.DeviceMic "Mic2"
+}
 
 SectionUseCase."HiFi" {
        File "HiFi.conf"
@@ -48,14 +61,20 @@ If.headphone {
        ]
 }
 
-If.Dmic0 {
+If.dmic {
        Condition {
-               Type ControlExists
-               Control "name='Dmic0 Capture Volume'"
+               Type String
+               Empty "${var:DeviceDmic}"
+       }
+       False.If.Dmic0 {
+               Condition {
+                       Type ControlExists
+                       Control "name='Dmic0 Capture Volume'"
+               }
+               True.BootSequence [
+                       cset "name='Dmic0 Capture Volume' 70%"
+               ]
        }
-       True.BootSequence [
-               cset "name='Dmic0 Capture Volume' 70%"
-       ]
 }
 
 If.Capture {