Skip to content

Conversation

@singalsu
Copy link
Contributor

This is a set of patches to control with UCMv2 audio processing in Sound Open Firmware (SOF). The settings are generic, mostly pass-through mode, except for speaker where a generic high-pass filter and DRC boost are applied.

All the filters can be set up with a bespoke tuned version per product for a better audio experience.

}
}

Macro.headphone.SofControl "endpoint=Headphone drcswitch=off"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, try to keep only this line in SectionDevice."Headphones" subtree. The subtrees should be merged, so there is no requirement to redefine the whole block again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change works,

SectionDevice."Headphones" {
	Macro.headphone.SofControl "endpoint=Headphone drcswitch=off"
}

}
}

Macro.speaker.SofControl "endpoint=Speaker drcswitch=on"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here, both of these fail. @perexg What is the correct way?

SectionDevice."Speaker" {
        Macro.speaker.SofControl "endpoint=Speaker drcswitch=on"
}

If.spk {
	Condition {
		Type ControlExists
		Control "name='Speaker Playback Switch'"
	}
	True.SectionDevice."Speaker" {
               Macro.speaker.SofControl "endpoint=Speaker drcswitch=on"
        }
}

The speaker controls are not set, there's no print Speaker happening to /tmp/alsa-ucm.txt and I see in /var/log/syslog message " wireplumber[3991]: Failed to enable ucm device Speaker".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pereg Sorry for noise, again my bad. In my testing version I had device specific customization in place but needed EQ blobs were not in place. I should get this now working!

@@ -0,0 +1,7 @@
# How to build

These blobs were exported with example_fir_eq.m tool from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably create one more level for those blobs like ucm2/blobs/sof/....

singalsu added 2 commits May 30, 2024 18:25
The example set contains passthrough configuration blobs with SOF IPC3
and IPC4 headers for DRC, FIR, and IIR. A few high-pass configurations
are added for IIR to be used e.g. for speakers. A DRC blob is added
that can be used to boost speaker playback loudness.

The blobs are all in binary format.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This example shows how to define IIR, FIR, and DRC processing for
speaker and headphone endpoints.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Copy link
Contributor

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested an earlier version, but did another test with this version on a Intel IPC4 laptop. I tested specifying tuning blobs, switching between speaker and headphones, and also specifying the blob via a user config. All worked as advertise.

I can do a similar test when @singalsu you update the version.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's not common to leave such commented-out code, but I did find these immensely useful when debugging and I could imagine these are useful for anyone who wants to add tuning for new laptop configurations later one. So if possible, +1 to leave these as examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the commented shell up before controls set to see the print before fails with them. There's now also a comment about use for debugging.

@singalsu singalsu requested review from kv2019i and perexg May 31, 2024 10:26
Copy link
Contributor

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singalsu, this looks clean to my untrained eyes, I only have one nitpick and one question

}
}

# Merge this add to Headpones subtree in HDA/HiFi-analog.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the 'add' from the comment

Copy link
Member

@perexg perexg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the speaker block (missing condition) all looks really nice now.

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 blobs/sof/product_configs. The file path should be
<sys_vendor>/<product_name>.conf from DMI ID. An user configuration can
be similarly placed into blobs/sof/user_configs directory to e.g. avoid
it being overwritten by distribution.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Copy link
Contributor

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singalsu, looks clean to me.

@perexg perexg closed this in 4502b17 May 31, 2024
perexg pushed a commit that referenced this pull request May 31, 2024
This example shows how to define IIR, FIR, and DRC processing for
speaker and headphone endpoints.

Closes: #419
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
perexg pushed a commit that referenced this pull request May 31, 2024
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 blobs/sof/product_configs. The file path should be
<sys_vendor>/<product_name>.conf from DMI ID. An user configuration can
be similarly placed into blobs/sof/user_configs directory to e.g. avoid
it being overwritten by distribution.

Closes: #419
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
@perexg
Copy link
Member

perexg commented May 31, 2024

Thanks. Applied now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants