Skip to content

Commit fe988ea

Browse files
ujfalusikv2019i
authored andcommitted
ipc4: idc: Handle the phase parameter in idc_ppl_state()
Execute the requested phases of the pipeline state change specified by the phase parameter. If no phase has been specified then run both phases as oneshot. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent cf2aad7 commit fe988ea

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

src/idc/idc.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,26 +320,41 @@ static int idc_reset(uint32_t comp_id)
320320
* \param[in] ppl_id Pipeline id to be triggered.
321321
* \return Error code.
322322
*/
323-
static int idc_ppl_state(uint32_t ppl_id)
323+
static int idc_ppl_state(uint32_t ppl_id, uint32_t phase)
324324
{
325325
#if CONFIG_IPC_MAJOR_4
326326
struct ipc *ipc = ipc_get();
327327
struct idc *idc = *idc_get();
328328
struct idc_payload *payload = idc_payload_get(idc, cpu_get_id());
329329
struct ipc_comp_dev *ppl_icd;
330330
uint32_t cmd = *(uint32_t *)payload;
331-
bool delayed = false;
332331

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

339-
return set_pipeline_state(ppl_icd, cmd, &delayed);
340-
#else
341-
return 0;
338+
/* if no phase specified, correct it to be a ONESHOT */
339+
if (!phase)
340+
phase = IDC_PPL_STATE_PHASE_ONESHOT;
341+
342+
if (phase & IDC_PPL_STATE_PHASE_PREPARE) {
343+
int ret;
344+
345+
ret = ipc4_pipeline_prepare(ppl_icd, cmd);
346+
if (ret)
347+
return ret;
348+
}
349+
350+
if (phase & IDC_PPL_STATE_PHASE_TRIGGER) {
351+
bool delayed = false;
352+
353+
return ipc4_pipeline_trigger(ppl_icd, cmd, &delayed);
354+
}
355+
342356
#endif
357+
return 0;
343358
}
344359

345360
static void idc_prepare_d0ix(void)
@@ -428,7 +443,8 @@ void idc_cmd(struct idc_msg *msg)
428443
ret = idc_reset(msg->extension);
429444
break;
430445
case iTS(IDC_MSG_PPL_STATE):
431-
ret = idc_ppl_state(msg->extension & IDC_PPL_STATE_PPL_ID_MASK);
446+
ret = idc_ppl_state(msg->extension & IDC_PPL_STATE_PPL_ID_MASK,
447+
IDC_PPL_STATE_PHASE_GET(msg->extension));
432448
break;
433449
case iTS(IDC_MSG_PREPARE_D0ix):
434450
idc_prepare_d0ix();

0 commit comments

Comments
 (0)