diff --git a/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf new file mode 100644 index 00000000..90af859f --- /dev/null +++ b/ucm2/Intel/sof-hda-dsp/HiFi-sof.conf @@ -0,0 +1,123 @@ +# Control audio processing in SOF + +# File paths for controlling SOF processing + +If.SOFIPCVer { + Condition { + Type ControlExists + Control "name='Post Mixer Analog Playback IIR Eq bytes'" + } + True.Define { + SOFIPCVer "ipc4" + PostMixerAnalogPlaybackIIRBytes "Post Mixer Analog Playback IIR Eq bytes" + PostMixerAnalogPlaybackFIRBytes "Post Mixer Analog Playback FIR Eq bytes" + 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" + PostMixerAnalogPlaybackDRCBytes "not available" + PostMixerAnalogPlaybackDRCSwitch "not available" + } +} + +If.SOFPath { + Condition { Type AlwaysTrue } + True.Define { + BlobPath "${ConfTopDir}/blobs/sof/${var:SOFIPCVer}" + SpeakerIirBlob "${var:BlobPath}/eq_iir/highpass_100hz_0db_48khz.blob" + SpeakerFirBlob "${var:BlobPath}/eq_fir/pass.blob" + SpeakerDrcBlob "${var:BlobPath}/drc/speaker_default.blob" + HeadphoneIirBlob "${var:BlobPath}/eq_iir/pass.blob" + HeadphoneFirBlob "${var:BlobPath}/eq_fir/pass.blob" + HeadphoneDrcBlob "${var:BlobPath}/drc/passthrough.blob" + } +} + +Define.ConfPathFromDMI "${sys:devices/virtual/dmi/id/sys_vendor}/${sys:devices/virtual/dmi/id/product_name}.conf" +Define.SOFProductConfig "/blobs/sof/product_configs/${var:ConfPathFromDMI}" +Define.SOFConfFullPath "${ConfTopDir}${var:SOFProductConfig}" +Define.SOFUserConfig "/blobs/sof/user_configs/${var:ConfPathFromDMI}" +Define.SOFUserConfFullPath "${ConfTopDir}${var:SOFUserConfig}" + +If.HasUserConfig { + Condition { + Type Path + Mode read + Path "${var:SOFUserConfFullPath}" + } + True { + Include.product-config.File "${var:SOFUserConfig}" + } + False.If.HasProductConfig { + Condition { + Type Path + Mode read + Path "${var:SOFConfFullPath}" + } + True { + Include.product-config.File "${var:SOFProductConfig}" + } + } +} + +# Redefine headphone control FOR SOF. This is same as Headphone in HDA/HiFi-analog.conf +# but adds DRC and EQ controls. + +DefineMacro.SofControl { + Define.EndpointDrcVar "${var:__endpoint}DrcBlob" + Define.EndpointIirVar "${var:__endpoint}IirBlob" + Define.EndpointFirVar "${var:__endpoint}FirBlob" + Define.EndpointDrcBlob "${var:$EndpointDrcVar}" + Define.EndpointIirBlob "${var:$EndpointIirVar}" + Define.EndpointFirBlob "${var:$EndpointFirVar}" + + If.endpoint_with_drc { + Condition { + Type ControlExists + Control "name='${var:PostMixerAnalogPlaybackDRCSwitch}'" + } + True { + EnableSequence [ + # For debug uncomment below the echo command to see what blobs are applied + #shell "/bin/echo '${var:__endpoint} ${var:EndpointIirBlob} ${var:EndpointFirBlob} ${var:EndpointDrcBlob}' >> /tmp/alsa-ucm.txt" + cset "name='${var:PostMixerAnalogPlaybackDRCSwitch}' ${var:__drcswitch}" + cset-tlv "name='${var:PostMixerAnalogPlaybackDRCBytes}' ${var:EndpointDrcBlob}" + cset-tlv "name='${var:PostMixerAnalogPlaybackIIRBytes}' ${var:EndpointIirBlob}" + cset-tlv "name='${var:PostMixerAnalogPlaybackFIRBytes}' ${var:EndpointFirBlob}" + ] + } + False.If.endpoint_with_eq { + Condition { + Type ControlExists + Control "name='${var:PostMixerAnalogPlaybackFIRBytes}'" + } + True { + EnableSequence [ + # For debug uncomment below the echo command to see what blobs are applied + #shell "/bin/echo '${var:__endpoint} ${var:EndpointIirBlob} ${var:EndpointFirBlob}' >> /tmp/alsa-ucm.txt" + cset-tlv "name='${var:PostMixerAnalogPlaybackIIRBytes}' ${var:EndpointIirBlob}" + cset-tlv "name='${var:PostMixerAnalogPlaybackFIRBytes}' ${var:EndpointFirBlob}" + ] + } + } + } +} + +# Merge this to Headpones subtree in HDA/HiFi-analog.conf +SectionDevice."Headphones" { + Macro.headphone.SofControl "endpoint=Headphone drcswitch=off" +} + +# Merge this to Speaker subtree in HDA/HiFi-analog.conf +If.spk { + Condition { + Type ControlExists + Control "name='Speaker Playback Switch'" + } + True.SectionDevice."Speaker" { + Macro.speaker.SofControl "endpoint=Speaker drcswitch=on" + } +} diff --git a/ucm2/Intel/sof-hda-dsp/HiFi.conf b/ucm2/Intel/sof-hda-dsp/HiFi.conf index 2063fc0d..9689b562 100644 --- a/ucm2/Intel/sof-hda-dsp/HiFi.conf +++ b/ucm2/Intel/sof-hda-dsp/HiFi.conf @@ -10,6 +10,8 @@ SectionVerb { Include.hda-analog.File "/HDA/HiFi-analog.conf" +Include.sof-analog.File "HiFi-sof.conf" + If.dmic { Condition { Type String