Skip to content

Commit ade1765

Browse files
Chun-Kuang HuAngeloGioacchino Del Regno
authored andcommitted
soc: mediatek: cmdq: Add parameter shift_pa to cmdq_pkt_jump()
In original design, cmdq_pkt_jump() call cmdq_get_shift_pa() every time to get shift_pa. But the shift_pa is constant value for each SoC, so client driver just need to call cmdq_get_shift_pa() once and pass shift_pa to cmdq_pkt_jump() to prevent frequent function call. Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> Link: https://lore.kernel.org/r/20240222154120.16959-3-chunkuang.hu@kernel.org Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
1 parent ed4d5ab commit ade1765

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,13 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
393393
}
394394
EXPORT_SYMBOL(cmdq_pkt_assign);
395395

396-
int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
396+
int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa)
397397
{
398398
struct cmdq_instruction inst = {};
399399

400400
inst.op = CMDQ_CODE_JUMP;
401401
inst.offset = CMDQ_JUMP_ABSOLUTE;
402-
inst.value = addr >>
403-
cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan);
402+
inst.value = addr >> shift_pa;
404403
return cmdq_pkt_append_command(pkt, inst);
405404
}
406405
EXPORT_SYMBOL(cmdq_pkt_jump);

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value);
253253
* a physical address which should contains more instruction.
254254
* @pkt: the CMDQ packet
255255
* @addr: physical address of target instruction buffer
256+
* @shift_pa: shift bits of physical address in CMDQ instruction. This value
257+
* is got by cmdq_get_shift_pa().
256258
*
257259
* Return: 0 for success; else the error code is returned
258260
*/
259-
int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr);
261+
int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa);
260262

261263
/**
262264
* cmdq_pkt_finalize() - Append EOC and jump command to pkt.
@@ -374,7 +376,7 @@ static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
374376
return -EINVAL;
375377
}
376378

377-
static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
379+
static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa)
378380
{
379381
return -EINVAL;
380382
}

0 commit comments

Comments
 (0)