From ed3cfff3a980165facc4193099966d11858716ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=94=9C=E7=93=9C=E6=9E=9C=E9=85=92?= Date: Fri, 9 Oct 2026 11:16:26 +0800 Subject: [PATCH] sof-soundwire: use a single multicodec file for ES9356 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 Signed-off-by: Jaroslav Kysela --- ucm2/sof-soundwire/es9356.conf | 125 +++++++++++++++++++------- ucm2/sof-soundwire/sof-soundwire.conf | 5 +- 2 files changed, 97 insertions(+), 33 deletions(-) diff --git a/ucm2/sof-soundwire/es9356.conf b/ucm2/sof-soundwire/es9356.conf index 5374924..f9d62d9 100644 --- a/ucm2/sof-soundwire/es9356.conf +++ b/ucm2/sof-soundwire/es9356.conf @@ -1,51 +1,114 @@ # 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" + } + } } } diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf index d6cb248..656196e 100644 --- a/ucm2/sof-soundwire/sof-soundwire.conf +++ b/ucm2/sof-soundwire/sof-soundwire.conf @@ -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" } } -- 2.52.0