]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
sof-soundwire: use a single multicodec file for ES9356
author甜瓜果酒 <zuzhenhuang365@gmail.com>
Fri, 9 Oct 2026 03:16:26 +0000 (11:16 +0800)
committerJaroslav Kysela <perex@perex.cz>
Fri, 9 Oct 2026 08:59:33 +0000 (10:59 +0200)
Address review feedback: mark ES9356 as a multicodec codec and keep a single
codec file instead of separate per-function files.

- add es9356 to MultiCodecRegex and the MultiCodecInit probe list
- allow the optional "-spk" suffix in the MultiCodecInit speaker match, like
  the microphone match already allows "-dmic"; this board reports
  "spk:es9356-spk" for the amp function (plus the generic "spk:es9356"), so
  without it SpeakerCodecFile stays "es9356-spk" and the single file is not
  found
- es9356.conf now provides all roles (speaker, headset, internal DMIC)

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/869
Signed-off-by: Zachary Huang <zuzhenhuang365@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/sof-soundwire/es9356.conf
ucm2/sof-soundwire/sof-soundwire.conf

index 5374924dcf31604289d2b27af6692903d76c597a..f9d62d9c484ab600efb742f1b2dc535c4c3b2041 100644 (file)
 # Use case Configuration for sof-soundwire card
 #
-# Everest Semiconductor ES9356 (SDCA) - headset (UAJ) function.
+# Everest Semiconductor ES9356 (SDCA) - a single device providing the headset
+# (UAJ), the speaker (SmartAmp) and the internal DMIC (SmartMic) functions.
 #
 # On AMD ACP6.3 SDCA boards the PCM layout of this codec is:
 #   device 0: headset playback, device 1: headset capture,
 #   device 2: speaker playback, device 4: internal DMIC capture.
 
-SectionDevice."Headphones" {
-       Comment "Headphones"
+If.codec_spk {
+       Condition {
+               Type RegexMatch
+               Regex "(es9356(-spk)?)"
+               String "${var:SpeakerCodec1}"
+       }
+       True {
+               SectionDevice."Speaker" {
+                       Comment "Speaker"
 
-       ConflictingDevice [
-               "Speaker"
-       ]
+                       ConflictingDevice [
+                               "Headphones"
+                       ]
 
-       EnableSequence [
-               cset "name='Headphone Switch' on"
-       ]
+                       EnableSequence [
+                               cset "name='Speaker Switch' on"
+                       ]
 
-       DisableSequence [
-               cset "name='Headphone Switch' off"
-       ]
+                       DisableSequence [
+                               cset "name='Speaker Switch' off"
+                       ]
 
-       Value {
-               PlaybackPriority 200
-               PlaybackPCM "hw:${CardId}"
-               JackControl "Headphone Jack"
+                       Value {
+                               PlaybackPriority 100
+                               PlaybackPCM "hw:${CardId},2"
+                       }
+               }
        }
 }
 
-SectionDevice."Headset" {
-       Comment "Headset Microphone"
+If.codec_hs {
+       Condition {
+               Type RegexMatch
+               Regex "(es9356(-sdca)?)"
+               String "${var:HeadsetCodec1}"
+       }
+       True {
+               SectionDevice."Headphones" {
+                       Comment "Headphones"
+
+                       ConflictingDevice [
+                               "Speaker"
+                       ]
+
+                       EnableSequence [
+                               cset "name='Headphone Switch' on"
+                       ]
+
+                       DisableSequence [
+                               cset "name='Headphone Switch' off"
+                       ]
+
+                       Value {
+                               PlaybackPriority 200
+                               PlaybackPCM "hw:${CardId}"
+                               JackControl "Headphone Jack"
+                       }
+               }
+
+               SectionDevice."Headset" {
+                       Comment "Headset Microphone"
 
-       ConflictingDevice [
-               "Mic"
-       ]
+                       ConflictingDevice [
+                               "Mic"
+                       ]
 
-       EnableSequence [
-               cset "name='Headset Mic Switch' on"
-       ]
+                       EnableSequence [
+                               cset "name='Headset Mic Switch' on"
+                       ]
+
+                       DisableSequence [
+                               cset "name='Headset Mic Switch' off"
+                       ]
+
+                       Value {
+                               CapturePriority 200
+                               CapturePCM "hw:${CardId},1"
+                               JackControl "Headset Mic Jack"
+                       }
+               }
+       }
+}
+
+If.codec_mic {
+       Condition {
+               Type RegexMatch
+               # guard with '=' to avoid empty or es9356-spk matching
+               Regex "=(es9356(-sdca|-dmic)?)="
+               String "=${var:MicCodec1}="
+       }
+       True {
+               SectionDevice."Mic" {
+                       Comment "Internal Microphone"
 
-       DisableSequence [
-               cset "name='Headset Mic Switch' off"
-       ]
+                       ConflictingDevice [
+                               "Headset"
+                       ]
 
-       Value {
-               CapturePriority 200
-               CapturePCM "hw:${CardId},1"
-               JackControl "Headset Mic Jack"
+                       Value {
+                               CapturePriority 100
+                               CapturePCM "hw:${CardId},4"
+                       }
+               }
        }
 }
index d6cb2489ea66931adcb2c7f4c5beaed41778847a..656196e1877caefecba84eb1dc6050bf8494e257 100644 (file)
@@ -19,7 +19,7 @@ Define {
        Mics1 "0"
        Iec61937Pcms1 ""
        MultiCodec1 ""
-       MultiCodecRegex "rt712|rt713|rt721|rt722|rt1320"
+       MultiCodecRegex "rt712|rt713|rt721|rt722|rt1320|es9356"
 }
 
 DefineRegex {
@@ -99,7 +99,7 @@ DefineMacro.MultiCodecInit.If.a {
                        Condition {
                                Type RegexMatch
                                # guard with "=" to avoid empty string matching
-                               Regex "=(${var:__CodecId}(-sdca)?)="
+                               Regex "=(${var:__CodecId}(-sdca|-spk)?)="
                                String "=${var:SpeakerCodec1}="
                        }
                        True.Define.SpeakerCodecFile "${var:__CodecId}"
@@ -137,6 +137,7 @@ If.multi_init {
                Macro.rt721.MultiCodecInit "CodecId=rt721"
                Macro.rt722.MultiCodecInit "CodecId=rt722"
                Macro.rt1320.MultiCodecInit "CodecId=rt1320"
+               Macro.es9356.MultiCodecInit "CodecId=es9356"
        }
 }