From 5f0c4e4c3160252d3794feec7d1ac1303f5f9cd1 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Tue, 9 May 2023 15:12:07 +0200 Subject: [PATCH] [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 Signed-off-by: Peter Ujfalusi --- src/audio/pipeline/pipeline-stream.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/audio/pipeline/pipeline-stream.c b/src/audio/pipeline/pipeline-stream.c index 1b9badada..0a29ab860 100644 --- a/src/audio/pipeline/pipeline-stream.c +++ b/src/audio/pipeline/pipeline-stream.c @@ -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);