[PATCH] pipeline: make CPC data "opt-in" with fallback

CPC is used to select the correct clock for the desired pipeline
workload.

In the case where the CPC data is not available from the manifest and the
kernel driver sends a CPC of 0 then SOF should pick a platform safe level
to ensure operational glitch free audio at the expense of power
consumption. i.e. it's better to prioritize and preserve audio quality
over audio power when CPC data is missing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
This commit is contained in:
Liam Girdwood 2023-05-09 15:12:07 +02:00 committed by Marcin Szkudlinski
parent f4af8cadde
commit 5f0c4e4c31
1 changed files with 10 additions and 6 deletions

View File

@ -296,14 +296,18 @@ static int add_pipeline_cps_consumption(struct comp_dev *current,
cd = &md->cfg.base_cfg;
}
int kcps = cd->cpc * 1000 / ppl_data->p->period;
if (kcps == 0) {
tr_warn(pipe, "0 KCPS for module: %#x, core: %d", current->ipc_config.id, ppl_data->p->core);
} else {
core_kcps_adjust(ppl_data->p->core, kcps);
tr_info(pipe, "Registering KCPS consumption: %d, core: %d", kcps, ppl_data->p->core);
if (cd->cpc == 0) {
/* Use maximum clock budget, assume 1ms chunk size */
cd->cpc = CLK_MAX_CPU_HZ / 1000;
tr_warn(pipe,
"0 CPS requested for module: %#x, core: %d using safe max CPC: %u",
current->ipc_config.id, ppl_data->p->core, cd->cpc);
}
int kcps = cd->cpc * 1000 / ppl_data->p->period;
tr_info(pipe, "Registering KCPS consumption: %d, core: %d", kcps, ppl_data->p->core);
core_kcps_adjust(ppl_data->p->core, kcps);
int summary_cps = core_kcps_get(ppl_data->p->core);
tr_info(pipe, "Sum of KCPS consumption: %d, core: %d", summary_cps, ppl_data->p->core);
return pipeline_for_each_comp(current, ctx, dir);