ipc4: setdx: prevent d0 when ppl are active

This patch prevent driver from requesting FW to enter D0 state when
there are still active pipelines.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This commit is contained in:
Tomasz Leman 2022-02-28 15:19:01 +01:00 committed by Liam Girdwood
parent 00fce8bd20
commit edf5866da7
1 changed files with 22 additions and 0 deletions

View File

@ -177,6 +177,23 @@ static int propagate_state_to_ppl_comp(struct ipc *ipc, uint32_t ppl_id, int cmd
return ret;
}
static bool is_any_ppl_active(void)
{
struct ipc_comp_dev *icd;
struct list_item *clist;
list_for_item(clist, &ipc_get()->comp_list) {
icd = container_of(clist, struct ipc_comp_dev, list);
if (icd->type != COMP_TYPE_PIPELINE)
continue;
if (icd->pipeline->status == COMP_STATE_ACTIVE)
return true;
}
return false;
}
/* Ipc4 pipeline message <------> ipc3 pipeline message
* RUNNING <-------> TRIGGER START
* INIT + PAUSED <-------> PIPELINE COMPLETE
@ -798,6 +815,11 @@ static int ipc4_module_process_dx(union ipc4_message_header *ipc4)
return IPC4_BUSY;
}
if (is_any_ppl_active()) {
tr_err(&ipc_tr, "some pipelines are still active");
return IPC4_BUSY;
}
ipc_get()->pm_prepare_D3 = 1;
/* TODO: prepare for D3 */
}