Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions src/idc/idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,26 +320,41 @@ static int idc_reset(uint32_t comp_id)
* \param[in] ppl_id Pipeline id to be triggered.
* \return Error code.
*/
static int idc_ppl_state(uint32_t ppl_id)
static int idc_ppl_state(uint32_t ppl_id, uint32_t phase)
{
#if CONFIG_IPC_MAJOR_4
struct ipc *ipc = ipc_get();
struct idc *idc = *idc_get();
struct idc_payload *payload = idc_payload_get(idc, cpu_get_id());
struct ipc_comp_dev *ppl_icd;
uint32_t cmd = *(uint32_t *)payload;
bool delayed = false;

ppl_icd = ipc_get_comp_by_ppl_id(ipc, COMP_TYPE_PIPELINE, ppl_id);
if (!ppl_icd) {
tr_err(&idc_tr, "idc: comp %d not found", ppl_id);
return IPC4_INVALID_RESOURCE_ID;
}

return set_pipeline_state(ppl_icd, cmd, &delayed);
#else
return 0;
/* if no phase specified, correct it to be a ONESHOT */
if (!phase)
phase = IDC_PPL_STATE_PHASE_ONESHOT;

if (phase & IDC_PPL_STATE_PHASE_PREPARE) {
int ret;

ret = ipc4_pipeline_prepare(ppl_icd, cmd);
if (ret)
return ret;
}

if (phase & IDC_PPL_STATE_PHASE_TRIGGER) {
bool delayed = false;

return ipc4_pipeline_trigger(ppl_icd, cmd, &delayed);
}

#endif
return 0;
}

static void idc_prepare_d0ix(void)
Expand Down Expand Up @@ -428,7 +443,8 @@ void idc_cmd(struct idc_msg *msg)
ret = idc_reset(msg->extension);
break;
case iTS(IDC_MSG_PPL_STATE):
ret = idc_ppl_state(msg->extension);
ret = idc_ppl_state(msg->extension & IDC_PPL_STATE_PPL_ID_MASK,
IDC_PPL_STATE_PHASE_GET(msg->extension));
break;
case iTS(IDC_MSG_PREPARE_D0ix):
idc_prepare_d0ix();
Expand Down
4 changes: 3 additions & 1 deletion src/include/sof/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ int ipc4_trigger_chain_dma(struct ipc *ipc, struct ipc4_chain_dma *cdma, bool *d
int ipc4_process_on_core(uint32_t core, bool blocking);
int ipc4_pipeline_complete(struct ipc *ipc, uint32_t comp_id);
int ipc4_find_dma_config(struct ipc_config_dai *dai, uint8_t *data_buffer, uint32_t size);
int set_pipeline_state(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed);
int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd);
int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed);

#else
#error "No or invalid IPC MAJOR version selected."
#endif
Expand Down
Loading