From c9d1f7eafa6ccc9fff6dcd80fa1f40f539faf9c6 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 16 Dec 2024 15:38:44 +0200 Subject: [PATCH] UCM2: sof-soundwire: Enable DRC and equalizers for This patch enables SOF post-processing for soundwire speaker output. The DRC processing is enabled as BootSequence, and setup of DRC, IIR, and FIR equalizer blobs as FixedBootSeqeuence by DMI ID if custom blobs have been defined for the device in ucm2/blobs/sof/product_configs or ucm2/blobs/sof/user_configs. The DRC can be turned off permanently by user space if not desired since BootSequence is only used for first time UCM2 start. The DRC, IIR, FIR blobs are set as FixedBootSequence only if custom blobs are defined. Otherwise the blobs defined in topology remain in use. Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/481 Signed-off-by: Seppo Ingalsuo Signed-off-by: Jaroslav Kysela --- ucm2/Intel/sof-hda-dsp/dsp.conf | 31 ++++++++++++++++++++++----- ucm2/sof-soundwire/sof-soundwire.conf | 8 +++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ucm2/Intel/sof-hda-dsp/dsp.conf b/ucm2/Intel/sof-hda-dsp/dsp.conf index 9480e66..a4d73d1 100644 --- a/ucm2/Intel/sof-hda-dsp/dsp.conf +++ b/ucm2/Intel/sof-hda-dsp/dsp.conf @@ -26,6 +26,10 @@ Define { PostMixerAnalogPlaybackFirBytes "N/A" PostMixerAnalogPlaybackDrcBytes "N/A" PostMixerAnalogPlaybackDrcSwitch "N/A" + PostMixerSpeakerPlaybackIirBytes "N/A" + PostMixerSpeakerPlaybackFirBytes "N/A" + PostMixerSpeakerPlaybackDrcBytes "N/A" + PostMixerSpeakerPlaybackDrcSwitch "N/A" Dmic0CaptureIirBytes "N/A" Dmic0CaptureDrcBytes "N/A" Dmic0CaptureDrcSwitch "N/A" @@ -34,7 +38,7 @@ Define { Dmic0CaptureBeamformerBeamAngleSet "N/A" } -If.SOFIPCVer { +If.SOFHdaIpc4 { Condition { Type ControlExists Control "name='Post Mixer Analog Playback IIR Eq bytes'" @@ -46,10 +50,23 @@ If.SOFIPCVer { PostMixerAnalogPlaybackDrcBytes "Post Mixer Analog Playback DRC bytes" PostMixerAnalogPlaybackDrcSwitch "Post Mixer Analog Playback DRC switch" } - False.Define { - SOFIPCVer "ipc3" - PostMixerAnalogPlaybackIirBytes "EQIIR1.0 eqiir_coef_1" - PostMixerAnalogPlaybackFirBytes "EQFIR1.0 eqfir_coef_1" + False.If.SOFSdwIpc4 { + Condition { + Type ControlExists + Control "name='Post Mixer Speaker Playback IIR Eq bytes'" + } + True.Define { + SOFIPCVer "ipc4" + PostMixerSpeakerPlaybackIirBytes "Post Mixer Speaker Playback IIR Eq bytes" + PostMixerSpeakerPlaybackFirBytes "Post Mixer Speaker Playback FIR Eq bytes" + PostMixerSpeakerPlaybackDrcBytes "Post Mixer Speaker Playback DRC bytes" + PostMixerSpeakerPlaybackDrcSwitch "Post Mixer Speaker Playback DRC switch" + } + False.Define { + SOFIPCVer "ipc3" + PostMixerAnalogPlaybackIirBytes "EQIIR1.0 eqiir_coef_1" + PostMixerAnalogPlaybackFirBytes "EQFIR1.0 eqfir_coef_1" + } } } @@ -84,6 +101,10 @@ If.SOFPath { Dmic0CaptureDrcBlob "" Dmic0CaptureBeamformerBlob "" Dmic0CaptureIirBlob "" + # Similarly leave SDW speaker default blobs empty. + PostMixerSpeakerPlaybackIirBlob "" + PostMixerSpeakerPlaybackFirBlob "" + PostMixerSpeakerPlaybackDrcBlob "" ConfPathFromDMI "${var:SOFVendor}/${var:SOFProduct}.conf" SOFProductConfig "/blobs/sof/product_configs/${var:ConfPathFromDMI}" SOFConfFullPath "${ConfTopDir}${var:SOFProductConfig}" diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf index a2f9589..736912d 100644 --- a/ucm2/sof-soundwire/sof-soundwire.conf +++ b/ucm2/sof-soundwire/sof-soundwire.conf @@ -176,3 +176,11 @@ If.HdmiIec61937 { } True.Macro.save_hdmi_cfg.HdmiPCMSave { Name "42-sof-hdmi" } } + +# Define macros to set up processing controls +Include.dsp-variables.File "../Intel/sof-hda-dsp/dsp.conf" + +# Set BootSequence and FixedBootSequence for drc, eqiir, eqfir +Macro.SpeakerDrc.SofDrcBootSetup "endpoint='PostMixerSpeaker' direction='Playback'" +Macro.SpeakerIir.SofEqBootSetup "endpoint='PostMixerSpeaker' direction='Playback' eqtype='Iir'" +Macro.SpeakerFir.SofEqBootSetup "endpoint='PostMixerSpeaker' direction='Playback' eqtype='Fir'" -- 2.47.1