Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: sof-ctl: Use same blob format as UCM2/cset-tlv #9760

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

singalsu
Copy link
Collaborator

The sof-ctl change for same .txt and .bin format as used with UCM v2 is the key change. It is done to avoid confusion with slightly different blob format chosen for UCM v2. Other changes are for organizing the blobs and updating the example blobs to have the updated header.

Sof-ctl is a developer tool, so the compatibility break with previous blob format is not an issue.

@singalsu
Copy link
Collaborator Author

Note: The first five patches are the same as in #9749 .

ublob8 = zeros(nb + nh, 1, 'uint8');
ublob8(1:4) = w32b(SOF_CTRL_CMD_BINARY);
ublob8(5:8) = w32b(nb);
ublob8(9:end) = blob8;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mention this change in commit text. Since the updated sof-ctl adds the required header, adding it in sof_ucm_blob_write() is no more needed.

@singalsu singalsu force-pushed the sofctl_align_with_ucm branch from 82d5f6c to 3f9476e Compare December 31, 2024 15:48
@@ -131,7 +134,7 @@ static int read_setup(struct ctl_data *ctl_data)
if (ctl_data->no_abi) {
header_init(ctl_data);
abi_size = sizeof(struct sof_abi_hdr);
data_start_int_index += abi_size / sizeof(uint32_t);
data_start_int_index += abi_size / sizeof(uint32_t) + BUFFER_ABI_OFFSET;
Copy link
Collaborator Author

@singalsu singalsu Dec 31, 2024

Choose a reason for hiding this comment

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

Could use here and in other similar equations for more consistent code the BUFFER_TLV_HEADER_BYTES.

tools/ctl/ctl.c Outdated
* to get similar blob as in set command. Helps to compare the received
* blob to sent blobs. The comp_id is not useful.
*/
ctl_data->buffer[BUFFER_TAG_OFFSET] = SOF_CTRL_CMD_BINARY;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ujfalusi What do you think of this kernel originated value rewrite?

Copy link
Contributor

Choose a reason for hiding this comment

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

In IPC3 the header.numid was used to store the command (or type) for the control (VOLUME, SWITCH, BINARY, ENUM), this is not relevant for IPC4, it is largely ignored, but when you get the control data, the kernel sets it to 'something' close enough to numid: header.numid = scontrol->comp_id.
I guess we could change the kernel to set this to SOF_CTRL_CMD_BINARY for IPC4?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, I think it would be good, then the blob get responses for same blobs but from different component instances would be the same.

This patch renames the common helper functions with sof_prefix.
The other scripts are updated to use the updated names. There is
no change in functionality.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds to sof_tplg_write() and sof_tplg2_write() helper
functions create of file directory path if such is missing. Other
format blob export functions already have the same check.

The duplicated checks are removed from component specific blobs
create functions.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch updates the equalizer tools to use the common helper
functions instead of the originally developed similar functions
for equalizers. The old duplicated functions are deleted.

Signed-off-by: Seppo Ingalsuo <[email protected]>
The common functions version of topology blob export supports
the howto comment. These changes add the instructions text to
all equalizer blobs.

Signed-off-by: Seppo Ingalsuo <[email protected]>
To align the suffix for binary blob files for UCM cset-tlv
and sof-ctl the file naming is changed from .blob to .bin.
The .bin is better associated for binary files.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This change aligns the blob formats with UCM2 and sof-ctl.
The binary blobs for UCM2 have an additional 8 byte header that
was internally generated inside sof-ctl. This patch changes
sof-ctl to expect the header to be in .txt and .bin format
in the data file.

The Octave scripts to export blobs for topology, sof-ctl, and
UCM2 are updated to match the change. The topology embedded blobs
remain as before without the header.

Signed-off-by: Seppo Ingalsuo <[email protected]>
It is a common mistake (including myself) to attempt to set bytes
control without option "-s" but with provided blob file name. In
such case the previous version silently ignores the blob file name
and dumps existing bytes control values.

This change adds check of optind value from getopt(). If there
were non-parsed arguments, the sof-ctl returns with error.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch organizes the blobs by move of IIR and FIR blobs to
own sub-directories. This makes the directory structure similar
as in blobs in UCM2.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds the similar TLV header to text format blobs for
sof-ctl as present in current .bin format blobs for UCM2. The
header data consists of uint32_t value 3 for SOF_CTRL_CMD_BINARY
and uint32_t value for size of the blob.

The other change is increase of SOF ABI version number in the 6th
value in the new blob.

Signed-off-by: Seppo Ingalsuo <[email protected]>
The comma from line end and blob end is removed. With this change
the blobs exported are identical to retrieved blobs with sof-ctl
tool and e.g. can be compared directly.

Signed-off-by: Seppo Ingalsuo <[email protected]>
The sof-ctl is used to create the bytes control SOF ABI
header for the binary blob files.

These changes ensure that the sof-ctl is built from tools and
that the correct version of sof-ctl exists in user's path.

Signed-off-by: Seppo Ingalsuo <[email protected]>
@singalsu singalsu force-pushed the sofctl_align_with_ucm branch from 3f9476e to 3e2617e Compare January 9, 2025 09:46
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

LGTM, is there any external dependency on kernel or alsa ?

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.

3 participants