Skip to content

Commit 3d86ced

Browse files
Chun-Kuang HuAngeloGioacchino Del Regno
authored andcommitted
soc: mediatek: cmdq: Add cmdq_pkt_eoc() helper function
cmdq_pkt_eoc() append eoc command to CMDQ packet. eoc command would ask GCE to generate IRQ. It's usually appended to the end of packet to notify all command in the packet is done. Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> Link: https://lore.kernel.org/r/20240222154120.16959-6-chunkuang.hu@kernel.org Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
1 parent 698cdcb commit 3d86ced

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

drivers/soc/mediatek/mtk-cmdq-helper.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,16 @@ int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa)
414414
}
415415
EXPORT_SYMBOL(cmdq_pkt_jump_rel);
416416

417+
int cmdq_pkt_eoc(struct cmdq_pkt *pkt)
418+
{
419+
struct cmdq_instruction inst = { {0} };
420+
421+
inst.op = CMDQ_CODE_EOC;
422+
inst.value = CMDQ_EOC_IRQ_EN;
423+
return cmdq_pkt_append_command(pkt, inst);
424+
}
425+
EXPORT_SYMBOL(cmdq_pkt_eoc);
426+
417427
int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
418428
{
419429
struct cmdq_instruction inst = { {0} };

include/linux/soc/mediatek/mtk-cmdq.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,20 @@ static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_
281281
*/
282282
int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa);
283283

284+
/**
285+
* cmdq_pkt_eoc() - Append EOC and ask GCE to generate an IRQ at end of execution
286+
* @pkt: The CMDQ packet
287+
*
288+
* Appends an End Of Code (EOC) command to the CMDQ packet and asks the GCE
289+
* to generate an interrupt at the end of the execution of all commands in
290+
* the pipeline.
291+
* The EOC command is usually appended to the end of the pipeline to notify
292+
* that all commands are done.
293+
*
294+
* Return: 0 for success or negative error number
295+
*/
296+
int cmdq_pkt_eoc(struct cmdq_pkt *pkt);
297+
284298
/**
285299
* cmdq_pkt_finalize() - Append EOC and jump command to pkt.
286300
* @pkt: the CMDQ packet
@@ -412,6 +426,11 @@ static inline int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_p
412426
return -EINVAL;
413427
}
414428

429+
static inline int cmdq_pkt_eoc(struct cmdq_pkt *pkt)
430+
{
431+
return -EINVAL;
432+
}
433+
415434
static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
416435
{
417436
return -EINVAL;

0 commit comments

Comments
 (0)