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: Tune: Collection of patches to produce ALSA UCM friendly binary control blobs #9070

Merged
merged 6 commits into from
Apr 29, 2024
18 changes: 12 additions & 6 deletions tools/tune/crossover/example_crossover.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function export_crossover(cr)
endian = "little";
tpath1 = '../../topology/topology1/m4/crossover';
tpath2 = '../../topology/topology2/include/components/crossover';
ctlpath = '../../ctl/ipc3';
ctlpath3 = '../../ctl/ipc3/crossover';
ctlpath4 = '../../ctl/ipc4/crossover';
Copy link
Member

Choose a reason for hiding this comment

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

@singalsu presumably an OEM or integrator will have multiple SKUs to tune. Should there be some sort of prefix for the blobs so that the storage can be specified as SKU-specific?

And while I am at it, can those tuning scripts actually be used in a script that generates blobs for multiple platforms, just taking input parameters for each SKU?


str_way = sprintf('%dway', cr.num_sinks);
str_freq = get_str_freq(cr);
Expand All @@ -49,8 +50,10 @@ function export_crossover(cr)
tplg1_fn = sprintf('%s/coef_%s_%s_%s.m4', tpath1, str_way, str_freq, str_pid); % Control Bytes File
tplg2_fn = sprintf('%s/coef_%s_%s_%s.conf', tpath2, str_way, str_freq, str_pid);
% Use those files with sof-ctl to update the component's configuration
blob_fn = sprintf('%s/crossover_coef_%dway.blob', ctlpath, cr.num_sinks); % Blob binary file
alsa_fn = sprintf('%s/crossover_coef_%dway.txt', ctlpath, cr.num_sinks); % ALSA CSV format file
blob3_fn = sprintf('%s/coef_%dway.blob', ctlpath3, cr.num_sinks); % Blob binary file
alsa3_fn = sprintf('%s/coef_%dway.txt', ctlpath3, cr.num_sinks); % ALSA CSV format file
blob4_fn = sprintf('%s/coef_%dway.blob', ctlpath4, cr.num_sinks); % Blob binary file
alsa4_fn = sprintf('%s/coef_%dway.txt', ctlpath4, cr.num_sinks); % ALSA CSV format file

% This array is an example on how to assign a buffer from pipeline 1 to output 0,
% buffer from pipeline 2 to output 1, etc...
Expand Down Expand Up @@ -85,11 +88,14 @@ function export_crossover(cr)

mkdir_check(tpath1);
mkdir_check(tpath2);
mkdir_check(ctlpath);
mkdir_check(ctlpath3);
mkdir_check(ctlpath4);
tplg_write(tplg1_fn, blob8, "CROSSOVER");
tplg2_write(tplg2_fn, blob8_ipc4, "crossover_config", 'Exported Control Bytes');
sof_ucm_blob_write(blob_fn, blob8);
alsactl_write(alsa_fn, blob8);
sof_ucm_blob_write(blob3_fn, blob8);
sof_ucm_blob_write(blob4_fn, blob8_ipc4);
alsactl_write(alsa3_fn, blob8);
alsactl_write(alsa4_fn, blob8_ipc4);

% Plot Magnitude and Phase Response of each sink
crossover_plot_freq(crossover.lp, crossover.hp, cr.fs, cr.num_sinks);
Expand Down