Skip to content

Commit 9958185

Browse files
Dennis YC Hsiehmbgg
authored andcommitted
soc: mediatek: cmdq: export finalize function
Export finalize function to client which helps append eoc and jump command to pkt. Let client decide call finalize or not. Signed-off-by: Dennis YC Hsieh <[email protected]> Reviewed-by: CK Hu <[email protected]> Acked-by: Chun-Kuang Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Matthias Brugger <[email protected]>
1 parent 613c2e2 commit 9958185

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
492492
cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event);
493493
cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event);
494494
mtk_crtc_ddp_config(crtc, cmdq_handle);
495+
cmdq_pkt_finalize(cmdq_handle);
495496
cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);
496497
}
497498
#endif

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
300300
}
301301
EXPORT_SYMBOL(cmdq_pkt_assign);
302302

303-
static int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
303+
int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
304304
{
305305
struct cmdq_instruction inst = { {0} };
306306
int err;
@@ -319,6 +319,7 @@ static int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
319319

320320
return err;
321321
}
322+
EXPORT_SYMBOL(cmdq_pkt_finalize);
322323

323324
static void cmdq_pkt_flush_async_cb(struct cmdq_cb_data data)
324325
{
@@ -353,10 +354,6 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb,
353354
unsigned long flags = 0;
354355
struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
355356

356-
err = cmdq_pkt_finalize(pkt);
357-
if (err < 0)
358-
return err;
359-
360357
pkt->cb.cb = cb;
361358
pkt->cb.data = data;
362359
pkt->async_cb.cb = cmdq_pkt_flush_async_cb;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
166166
*/
167167
int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value);
168168

169+
/**
170+
* cmdq_pkt_finalize() - Append EOC and jump command to pkt.
171+
* @pkt: the CMDQ packet
172+
*
173+
* Return: 0 for success; else the error code is returned
174+
*/
175+
int cmdq_pkt_finalize(struct cmdq_pkt *pkt);
176+
169177
/**
170178
* cmdq_pkt_flush_async() - trigger CMDQ to asynchronously execute the CMDQ
171179
* packet and call back at the end of done packet

0 commit comments

Comments
 (0)