forked from alsa-project/alsa-ucm-conf
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UCM2: Intel: sof-hda-dsp: Control SOF processing from UCM
This patch adds to Intel/sof-hda-dsp/HiFi.conf inclusion of HiFi-sof.conf that by redefine of headphone and speaker handling adds to UCM control of DRC and EQ SOF processing components. The modified setting are applied in case of SOF processing components' controls are detected. There is no change to operation if no controls are present e.g. with legacy SOF topology. If DRC control is found, it is assumed that also FIR and IIR also exist. If there is no DRC but FIR is found, then it is assumed that IIR also exists. This matches SOF FW builds for IPC3 (FIR, IIR) and IPC4 (DRC, FIR, IIR). The controls names are different in IPC3 and IPC4 topologies. Also the configuration blobs differ. The speaker mode is by default set up with 100 Hz high-pass IIR. The DRC is set to a default speaker setting that boosts playback loudness. The FIR is bypassed. In the headphone mode all the processing is set to bypass and DRC switch is set off. The processing can be customized for products with UCM scripts placed into sof/product_configs. The file path should be <sys_vendor>/<product_name>.conf from DMI ID. An user configuration can be similarly placed into sof/user_configs directory to e.g. avoid it being overwritten by distribution. Signed-off-by: Seppo Ingalsuo <[email protected]>
- Loading branch information
Showing
2 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
# 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" | ||
BlobPath "${ConfTopDir}/sof/${var:SOFIPCVer}" | ||
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" | ||
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" | ||
} | ||
False.Define { | ||
SOFIPCVer "ipc3" | ||
BlobPath "${ConfTopDir}/sof/${var:SOFIPCVer}" | ||
PostMixerAnalogPlaybackIIRBytes "EQIIR1.0 eqiir_coef_1" | ||
PostMixerAnalogPlaybackFIRBytes "EQFIR1.0 eqfir_coef_1" | ||
PostMixerAnalogPlaybackDRCBytes "not available" | ||
PostMixerAnalogPlaybackDRCSwitch "not available" | ||
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 "/sof/product_configs/${var:ConfPathFromDMI}" | ||
Define.SOFConfFullPath "${ConfTopDir}${var:SOFProductConfig}" | ||
Define.SOFUserConfig "/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 [ | ||
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}" | ||
#shell "/bin/echo '${var:__endpoint} ${var:EndpointIirBlob} ${var:EndpointFirBlob} ${var:EndpointDrcBlob}' >> /tmp/alsa-ucm.txt" | ||
] | ||
} | ||
False.If.endpoint_with_eq { | ||
Condition { | ||
Type ControlExists | ||
Control "name='${var:PostMixerAnalogPlaybackFIRBytes}'" | ||
} | ||
True { | ||
EnableSequence [ | ||
cset-tlv "name='${var:PostMixerAnalogPlaybackIIRBytes}' ${var:EndpointIirBlob}" | ||
cset-tlv "name='${var:PostMixerAnalogPlaybackFIRBytes}' ${var:EndpointFirBlob}" | ||
#shell "/bin/echo '${var:__endpoint} ${var:EndpointIirBlob} ${var:EndpointFirBlob}' >> /tmp/alsa-ucm.txt" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
SectionDevice."Headphones" { | ||
Comment "Headphones" | ||
|
||
If.headphone_switch { | ||
Condition { | ||
Type ControlExists | ||
Control "name='Headphone Playback Switch'" | ||
} | ||
True { | ||
EnableSequence [ | ||
cset "name='Headphone Playback Switch' on" | ||
] | ||
DisableSequence [ | ||
cset "name='Headphone Playback Switch' off" | ||
] | ||
} | ||
} | ||
|
||
Macro.headphone.SofControl "endpoint=Headphone drcswitch=off" | ||
|
||
Value { | ||
PlaybackPriority 200 | ||
PlaybackPCM "hw:${CardId}" | ||
PlaybackMixerElem "${var:hpvol}" | ||
PlaybackMasterElem "Master" | ||
PlaybackVolume "${var:hpvol} Playback Volume" | ||
PlaybackSwitch "Headphone Playback Switch" | ||
JackControl "${var:hpjack}" | ||
} | ||
} | ||
|
||
# Redefine speaker control for SOF. This is same as spk in HDA/HiFi-analog.conf | ||
# but adds DRC and EQ controls. | ||
|
||
If.spk { | ||
Condition { | ||
Type ControlExists | ||
Control "name='Speaker Playback Switch'" | ||
} | ||
True.SectionDevice."Speaker" { | ||
Comment "Speaker" | ||
|
||
If.seq { | ||
Condition { | ||
Type ControlExists | ||
Control "name='Bass Speaker Playback Switch'" | ||
} | ||
True { | ||
EnableSequence [ | ||
cset "name='Speaker Playback Switch' on" | ||
cset "name='Bass Speaker Playback Switch' on" | ||
] | ||
|
||
DisableSequence [ | ||
cset "name='Speaker Playback Switch' off" | ||
cset "name='Bass Speaker Playback Switch' off" | ||
] | ||
} | ||
False { | ||
EnableSequence [ | ||
cset "name='Speaker Playback Switch' on" | ||
] | ||
|
||
DisableSequence [ | ||
cset "name='Speaker Playback Switch' off" | ||
] | ||
} | ||
} | ||
|
||
Macro.speaker.SofControl "endpoint=Speaker drcswitch=on" | ||
|
||
Value { | ||
PlaybackPriority 100 | ||
PlaybackPCM "hw:${CardId}" | ||
PlaybackMixerElem "Speaker" | ||
PlaybackMasterElem "Master" | ||
PlaybackVolume "Speaker Playback Volume" | ||
PlaybackSwitch "Speaker Playback Switch" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters