From 62a00497f40bb4e0b3431b8dc3bc9bd7ade09990 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Thu, 17 Feb 2022 11:39:52 -0600 Subject: [PATCH 1/7] ucm2: sof-essx8336: initial support Loosely based on the sof-hda-dsp model for DMIC conditional handling. Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/139 Signed-off-by: Pierre-Louis Bossart Signed-off-by: Jaroslav Kysela --- ucm2/Intel/sof-essx8336/Hdmi.conf | 40 +++++++ ucm2/Intel/sof-essx8336/HiFi.conf | 137 ++++++++++++++++++++++ ucm2/Intel/sof-essx8336/sof-essx8336.conf | 64 ++++++++++ 3 files changed, 241 insertions(+) create mode 100644 ucm2/Intel/sof-essx8336/Hdmi.conf create mode 100644 ucm2/Intel/sof-essx8336/HiFi.conf create mode 100644 ucm2/Intel/sof-essx8336/sof-essx8336.conf diff --git a/ucm2/Intel/sof-essx8336/Hdmi.conf b/ucm2/Intel/sof-essx8336/Hdmi.conf new file mode 100644 index 0000000..8912b4f --- /dev/null +++ b/ucm2/Intel/sof-essx8336/Hdmi.conf @@ -0,0 +1,40 @@ +# Use case Configuration for sof-es8336 + +If.hdmi1 { + Condition { Type String Empty "" } + True { + Define { + HdmiNum 1 + HdmiPCM 5 + HdmiCtlIndex 0 + HdmiPrio 500 + } + Include.hdmi1.File "/codecs/hda/hdmi.conf" + } +} + +If.hdmi2 { + Condition { Type String Empty "" } + True { + Define { + HdmiNum 2 + HdmiPCM 6 + HdmiCtlIndex 1 + HdmiPrio 600 + } + Include.hdmi2.File "/codecs/hda/hdmi.conf" + } +} + +If.hdmi3 { + Condition { Type String Empty "" } + True { + Define { + HdmiNum 3 + HdmiPCM 7 + HdmiCtlIndex 2 + HdmiPrio 700 + } + Include.hdmi3.File "/codecs/hda/hdmi.conf" + } +} diff --git a/ucm2/Intel/sof-essx8336/HiFi.conf b/ucm2/Intel/sof-essx8336/HiFi.conf new file mode 100644 index 0000000..14575c5 --- /dev/null +++ b/ucm2/Intel/sof-essx8336/HiFi.conf @@ -0,0 +1,137 @@ +SectionVerb { + +If.amic { + Condition { + Type String + Empty "${var:DeviceDmic}" + } + True.SectionDevice."Mic" { + Comment "Analog Microphone" + + ConflictingDevice [ + "Headset" + ] + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" + } + + EnableSequence [ + cset "name='Internal Mic Switch' on" + ] + + DisableSequence [ + cset "name='Internal Mic Switch' off" + ] + } +} + +If.dmic { + Condition { + Type String + Empty "${var:DeviceDmic}" + } + False.SectionDevice."${var:DeviceDmic}" { + Comment "Digital Microphone" + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},1" + If.chn { + Condition { + Type RegexMatch + Regex "cfg-dmics:[34]" + String "${CardComponents}" + } + True { + CaptureChannels 4 + } + } + CaptureMixerElem "Dmic0" + CaptureVolume "Dmic0 Capture Volume" + CaptureSwitch "Dmic0 Capture Switch" + } + } +} + +SectionDevice."Speaker" { + Comment "Speaker" + + ConflictingDevice [ + "Headphones" + ] + + EnableSequence [ + cset "name='Speaker Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Switch' off" + ] + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Speaker" + PlaybackMasterElem "Master" + PlaybackVolume "Speaker Volume" + PlaybackSwitch "Speaker Switch" + } +} + +SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Speaker" + ] + + EnableSequence [ + cset "name='Headphone Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Switch' off" + ] + + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Headphone" + PlaybackMasterElem "Master" + PlaybackVolume "Headphone Volume" + PlaybackSwitch "Headphone Switch" + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +} + +SectionDevice."Headset" { + Comment "Headset Microphone" + + If.conflict { + Condition { + Type String + Empty "${var:DeviceDmic}" + } + True.ConflictingDevice [ + "Mic" + ] + } + + EnableSequence [ + cset "name='Headset Mic Switch' on" + ] + + DisableSequence [ + cset "name='Headset Mic Switch' off" + ] + + Value { + CapturePriority 300 + CapturePCM "hw:${CardId}" + JackControl "Headset Mic Jack" + } +} + +Include.hdmi.File "/Intel/sof-essx8336/Hdmi.conf" diff --git a/ucm2/Intel/sof-essx8336/sof-essx8336.conf b/ucm2/Intel/sof-essx8336/sof-essx8336.conf new file mode 100644 index 0000000..88e3edb --- /dev/null +++ b/ucm2/Intel/sof-essx8336/sof-essx8336.conf @@ -0,0 +1,64 @@ +Syntax 4 + +Define.DeviceDmic "" + +If.devdmic { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-dmics:" + } + True.Define.DeviceDmic "Dmic" +} + +SectionUseCase."HiFi" { + File "/Intel/sof-es8336/HiFi.conf" + Comment "Play and record HiFi quality Music" +} + +# the kcontrols initial values, which will be set by `alsactl init` +If.speaker { + Condition { + Type ControlExists + Control "DAC Playback Volume" + } + True.BootSequence [ + cset "name='DAC Playback Volume' 60%" + ] +} + +If.headphone { + Condition { + Type ControlExists + Control "name='Headphone Playback Volume'" + } + True.BootSequence [ + cset "name='Headphone Playback Volume' 60%" + ] +} + +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%" + ] + } +} + +If.Capture { + Condition { + Type ControlExists + Control "name='ADC Capture Volume'" + } + True.BootSequence [ + cset "name='ADC Capture Volume' 60%" + ] +} -- 2.33.0