From 889c5b9809f1635005d77871bb9abc09df6a3cc3 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Thu, 21 Jan 2021 14:44:05 -0600 Subject: [PATCH] sof-soundwire: add support for dmics the pinmux allows for SoundWire to be used on e.g. link0 and link1, and the rest of the pins can be assigned for dmic usages. We currently don't track this capability which means users don't see a capture device, e.g. on HP Spectre x360. The sof_sdw machine driver was modified to report the cfg-dmics string, possible values are 0..4. BugLink: https://github.com/thesofproject/linux/issues/2700 BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/75 Signed-off-by: Pierre-Louis Bossart Signed-off-by: Jaroslav Kysela --- ucm2/sof-soundwire/dmic.conf | 21 +++++++++++++++++++++ ucm2/sof-soundwire/sof-soundwire.conf | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 ucm2/sof-soundwire/dmic.conf diff --git a/ucm2/sof-soundwire/dmic.conf b/ucm2/sof-soundwire/dmic.conf new file mode 100644 index 0000000..1f704a5 --- /dev/null +++ b/ucm2/sof-soundwire/dmic.conf @@ -0,0 +1,21 @@ +SectionDevice."Mic" { + Comment "Digital Microphone" + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},3" + If.chn { + Condition { + Type RegexMatch + Regex "[34]" + String "${var:Mics1}" + } + True { + CaptureChannels 4 + } + } + CaptureMixerElem "Dmic0" + CaptureVolume "Dmic0 Capture Volume" + CaptureSwitch "Dmic0 Capture Switch" + } +} diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf index 2ba44be..ec8b01e 100644 --- a/ucm2/sof-soundwire/sof-soundwire.conf +++ b/ucm2/sof-soundwire/sof-soundwire.conf @@ -11,6 +11,7 @@ Define { SpeakerAmps1 "0" HeadsetCodec1 "" MicCodec1 "" + Mics1 "0" } DefineRegex { @@ -34,6 +35,10 @@ DefineRegex { Regex " mic:([a-z0-9]+)" String "${CardComponents}" } + Mics { + Regex " cfg-mics:([1-9][0-9]*)" + String "${CardComponents}" + } } If.hs_init { -- 2.47.1