From fa2c74eeb8523d657df4d8dc1114bc58a68eff5d Mon Sep 17 00:00:00 2001 From: Vasiliy Kovalev Date: Mon, 5 Jun 2023 14:33:01 +0300 Subject: [PATCH] sof-essx8336: update strategy and add support for es8326 codec The configuration files are selected based on the contents of the driver component , where: x==1 - ESSX8316, ESSX8336 x==2 - ESSX8326 Add HeadsetMic + Dmic inverse topology for component. Signed-off-by: Vasiliy Kovalev --- ucm2/Intel/sof-essx8336/HiFi-2.conf | 122 ++++++++++++++++++++++ ucm2/Intel/sof-essx8336/HiFi.conf | 91 +++++++++++++--- ucm2/Intel/sof-essx8336/sof-essx8316.conf | 68 ++++++++++++ ucm2/Intel/sof-essx8336/sof-essx8326.conf | 52 +++++++++ ucm2/Intel/sof-essx8336/sof-essx8336.conf | 54 +--------- 5 files changed, 320 insertions(+), 67 deletions(-) create mode 100644 ucm2/Intel/sof-essx8336/HiFi-2.conf create mode 100644 ucm2/Intel/sof-essx8336/sof-essx8316.conf create mode 100644 ucm2/Intel/sof-essx8336/sof-essx8326.conf diff --git a/ucm2/Intel/sof-essx8336/HiFi-2.conf b/ucm2/Intel/sof-essx8336/HiFi-2.conf new file mode 100644 index 0000000..762612d --- /dev/null +++ b/ucm2/Intel/sof-essx8336/HiFi-2.conf @@ -0,0 +1,122 @@ +SectionVerb { + EnableSequence [ + cdev "hw:sofessx8336" + + # Disable all inputs / outputs + cset "name='Speaker Switch' off" + cset "name='Headphone Switch' off" + cset "name='Headset Mic Switch' off" + cset "name='Internal Mic Switch' off" + + # Set DAC vol to 0 dB (191/255) + cset "name='DAC Playback Volume' 191" + + # Disable Auto Level Control + cset "name='ALC Switch' off" + # Set ADC vol to +29 dB (249/255) + cset "name='ADC Capture Volume' 249" + # Set Mic amplifier to +6 dB (1/5) + cset "name='ADC PGA Gain Volume' 1" + ] + + DisableSequence [ + cdev "hw:sofessx8336" + ] + + Value { + PlaybackPCM "hw:sofessx8336" + CapturePCM "hw:sofessx8336" + } +} + +SectionDevice."Speaker" { + Comment "Speakers" + + ConflictingDevice [ + "Headphones" + ] + + EnableSequence [ + cset "name='Speaker Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Switch' off" + ] + + Value { + PlaybackChannels "2" + PlaybackPriority "1" + JackHWMute "Headphones" + } +} + +SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Speaker" + ] + + EnableSequence [ + cset "name='Headphone Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Switch' off" + ] + + Value { + PlaybackChannels "2" + PlaybackPriority "2" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +} + +SectionDevice."Mic" { + Comment "Internal Microphone" + + ConflictingDevice [ + "HeadsetMic" + ] + + EnableSequence [ + cset "name='Mic Mux' 1" + cset "name='Internal Mic Switch' on" + ] + + DisableSequence [ + cset "name='Internal Mic Switch' off" + ] + + Value { + CaptureChannels "2" + CapturePriority "1" + } +} + +SectionDevice."HeadsetMic" { + Comment "Headset Microphone" + + ConflictingDevice [ + "Mic" + ] + + EnableSequence [ + cset "name='Mic Mux' 0" + cset "name='Headset Mic Switch' on" + ] + + DisableSequence [ + cset "name='Headset Mic Switch' off" + ] + + Value { + CaptureChannels "2" + CapturePriority "2" + JackControl "Headset Mic Jack" + } +} + +Include.hdmi.File "Hdmi.conf" diff --git a/ucm2/Intel/sof-essx8336/HiFi.conf b/ucm2/Intel/sof-essx8336/HiFi.conf index 236cb61..e3f511e 100644 --- a/ucm2/Intel/sof-essx8336/HiFi.conf +++ b/ucm2/Intel/sof-essx8336/HiFi.conf @@ -94,21 +94,52 @@ SectionDevice."Speaker" { } } -SectionDevice."Headphones" { - Comment "Headphones" +If.headphones { + Condition { + Type String + Empty "${var:DeviceDmic}" + } + False.SectionDevice."Headphones" { + Comment "Headphones" - ConflictingDevice [ - "Speaker" - ] + ConflictingDevice [ + "Speaker" + ] - Value { - PlaybackPriority 300 - PlaybackPCM "hw:${CardId}" - PlaybackMixerElem "Headphone Mixer" - PlaybackMasterElem "DAC" - JackControl "Headphone Jack" - JackHWMute "Speaker" + EnableSequence [ + cset "name='Headset Mic Switch' on" + ] + + DisableSequence [ + cset "name='Headset Mic Switch' off" + ] + + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Headphone Mixer" + PlaybackMasterElem "DAC" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } + } + True.SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Speaker" + ] + + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Headphone Mixer" + PlaybackMasterElem "DAC" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } } + } If.hmic { Condition { @@ -139,9 +170,35 @@ If.hmic { JackControl "Headset Mic Jack" } } + False.If.Inverse { + Condition { + Type String + Empty "${var:HeadsetNearDmicInv}" + } + True.SectionDevice."Headset" { +# Comment "Headset Microphone near DMic" + Comment "Headset Microphone" + + EnableSequence [ + cset "name='Differential Mux' lin2-rin2" + cset "name='Headset Mic Switch' on" + ] + + DisableSequence [ + cset "name='Headset Mic Switch' off" + ] + + Value { + CapturePriority 300 + CapturePCM "hw:${CardId}" + CaptureMixerElem "ADC PGA Gain" + CaptureMasterElem "ADC" + JackControl "Headphone Jack" + } + } False.SectionDevice."Headset" { - # For topologies with inverse path definition - Comment "Headset Microphone near DMic" +# Comment "Headset Microphone near DMic (Inv)" + Comment "Headset Microphone" EnableSequence [ cset "name='Differential Mux' lin1-rin1" @@ -157,10 +214,10 @@ If.hmic { CapturePCM "hw:${CardId}" CaptureMixerElem "ADC PGA Gain" CaptureMasterElem "ADC" - - JackControl "Headset Mic Jack" + JackControl "Headphone Jack" } } + } } -Include.hdmi.File "/Intel/sof-essx8336/Hdmi.conf" +Include.hdmi.File "Hdmi.conf" diff --git a/ucm2/Intel/sof-essx8336/sof-essx8316.conf b/ucm2/Intel/sof-essx8336/sof-essx8316.conf new file mode 100644 index 0000000..7da8d10 --- /dev/null +++ b/ucm2/Intel/sof-essx8336/sof-essx8316.conf @@ -0,0 +1,68 @@ +Syntax 6 + +BootSequence [ + # Setup muxes / switches + cset "name='Left Headphone Mixer Left DAC Switch' on" + cset "name='Right Headphone Mixer Right DAC Switch' on" + # Set digital mix mux to "dmic disable" + # That doesn't affect dmic, but other values mute headset mic + cset "name='Digital Mic Mux' 0" + + # Set HP vol to 0 dB + cset "name='Headphone Playback Volume' 100%" + cset "name='Headphone Mixer Volume' 100%" + + # Set DAC vol + cset "name='DAC Playback Volume' 60%" + # LDATA TO LDAC, RDATA TO RDAC + cset "name='DAC Source Mux' 0" + + # Disable Auto Level Control + cset "name='ALC Capture Switch' off" + + # Set capture vol + cset "name='ADC Capture Volume' 60%" +] + +Define.DeviceDmic "" + +If.devdmic { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-dmics:" + } + True.Define.DeviceDmic "Dmic" +} + +# For inverse topology Dmic + HeadsetMic +Define.HeadsetNearDmicInv "" + +If.inv_hmic { + Condition { + Type String + Haystack "${CardComponents}" + Needle "hmic-inv" + } + True.Define.HeadsetNearDmicInv "true" +} + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Play and record HiFi quality Music" +} +If.dmic { + Condition { + Type String + Empty "${var:DeviceDmic}" + } + False.If.Dmic0 { + Condition { + Type ControlExists + Control "name='Dmic0 Capture Volume'" + } + True.BootSequence [ + cset "name='Dmic0 Capture Volume' 70%" + ] + } +} diff --git a/ucm2/Intel/sof-essx8336/sof-essx8326.conf b/ucm2/Intel/sof-essx8336/sof-essx8326.conf new file mode 100644 index 0000000..a87a85d --- /dev/null +++ b/ucm2/Intel/sof-essx8336/sof-essx8326.conf @@ -0,0 +1,52 @@ +BootSequence [ + # Disable all inputs / outputs + cset "name='Speaker Switch' off" + cset "name='Headphone Switch' off" + cset "name='Headset Mic Switch' off" + cset "name='Internal Mic Switch' off" + + # Set DAC vol to 0 dB (191/255) + cset "name='DAC Playback Volume' 191" + + # Disable Auto Level Control + cset "name='ALC Switch' off" + # Set ADC vol to +29 dB (249/255) + cset "name='ADC Capture Volume' 249" + # Set Mic amplifier to +6 dB (1/5) + cset "name='ADC PGA Gain Volume' 1" + + # Select default Analog Mic + cset "name='Mic Mux' 0" +] + +Define.DeviceDmic "" + +If.devdmic { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-dmics:" + } + True.Define.DeviceDmic "Dmic" +} + +SectionUseCase."HiFi" { + File "HiFi-2.conf" + Comment "Play and record HiFi quality Music" +} + +If.dmic { + Condition { + Type String + Empty "${var:DeviceDmic}" + } + False.If.Dmic0 { + Condition { + Type ControlExists + Control "name='Dmic0 Capture Volume'" + } + True.BootSequence [ + cset "name='Dmic0 Capture Volume' 70%" + ] + } +} diff --git a/ucm2/Intel/sof-essx8336/sof-essx8336.conf b/ucm2/Intel/sof-essx8336/sof-essx8336.conf index f74e007..1ca7c66 100644 --- a/ucm2/Intel/sof-essx8336/sof-essx8336.conf +++ b/ucm2/Intel/sof-essx8336/sof-essx8336.conf @@ -1,57 +1,11 @@ Syntax 6 -BootSequence [ - # Setup muxes / switches - cset "name='Left Headphone Mixer Left DAC Switch' on" - cset "name='Right Headphone Mixer Right DAC Switch' on" - # Set digital mix mux to "dmic disable" - # That doesn't affect dmic, but other values mute headset mic - cset "name='Digital Mic Mux' 0" - - # Set HP vol to 0 dB - cset "name='Headphone Playback Volume' 100%" - cset "name='Headphone Mixer Volume' 100%" - - # Set DAC vol - cset "name='DAC Playback Volume' 60%" - # LDATA TO LDAC, RDATA TO RDAC - cset "name='DAC Source Mux' 0" - - # Disable Auto Level Control - cset "name='ALC Capture Switch' off" - - # Set capture vol - cset "name='ADC Capture Volume' 60%" -] - -Define.DeviceDmic "" - -If.devdmic { +If.hw_init { Condition { Type String Haystack "${CardComponents}" - Needle "cfg-dmics:" - } - True.Define.DeviceDmic "Dmic" -} - -SectionUseCase."HiFi" { - File "/Intel/sof-essx8336/HiFi.conf" - Comment "Play and record HiFi quality Music" -} -If.dmic { - Condition { - Type String - Empty "${var:DeviceDmic}" - } - False.If.Dmic0 { - Condition { - Type ControlExists - Control "name='Dmic0 Capture Volume'" - } - True.BootSequence [ - cset "name='Dmic0 Capture Volume' 70%" - ] + Needle " spk:ES8326" } + True.Include.hw_init.File "sof-essx8326.conf" + False.Include.hw_init.File "sof-essx8316.conf" } - -- 2.33.8