Skip to content

Commit

Permalink
kcps: fix 0 module CPC case
Browse files Browse the repository at this point in the history
If a module contains 0 as its CPC value, the consumption calculation
routine will assign a "safe" maximum value to keep the DSP running at
the maximum clock rate. This works when constructing a pipeline, but
when a pipeline is torn down, returning the maximum clock rate leads
to the clock being to 0 Hz. Fix this by detecting such cases in
pipeline termination code.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh committed Jul 5, 2024
1 parent e734619 commit 4b54a38
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/audio/pipeline/pipeline-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ static int pipeline_calc_cps_consumption(struct comp_dev *current,
"0 CPS requested for module: %#x, core: %d using safe max KCPS: %u",
current->ipc_config.id, comp_core, ppl_data->kcps[comp_core]);

/*
* This return code indicates to the caller, that the kcps calue
* shouldn't be used for slowing down the clock when terminating
* the pipeline
*/
return PPL_STATUS_PATH_STOP;
} else {
kcps = cd->cpc * 1000 / current->period;
Expand Down Expand Up @@ -430,6 +435,10 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd)
ret = walk_ctx.comp_func(p->source_comp, NULL, &walk_ctx, PPL_DIR_DOWNSTREAM);

for (int i = 0; i < arch_num_cpus(); i++) {
if (ret == PPL_STATUS_PATH_STOP)
/* Some components didn't provide CPC values */
break;

if (data.kcps[i] > 0) {
core_kcps_adjust(i, -data.kcps[i]);
tr_info(pipe, "Sum of KCPS consumption: %d, core: %d", core_kcps_get(i), i);
Expand Down

0 comments on commit 4b54a38

Please sign in to comment.