Skip to content

Commit 23c2229

Browse files
Dennis YC Hsiehmbgg
authored andcommitted
soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api
Add clear parameter to let client decide if event should be clear to 0 after GCE receive it. Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com> Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> Link: https://lore.kernel.org/r/1594136714-11650-9-git-send-email-dennis-yc.hsieh@mediatek.com [mb: fix commit message] Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
1 parent 946f179 commit 23c2229

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
481481
mbox_flush(mtk_crtc->cmdq_client->chan, 2000);
482482
cmdq_handle = cmdq_pkt_create(mtk_crtc->cmdq_client, PAGE_SIZE);
483483
cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event);
484-
cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event);
484+
cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, true);
485485
mtk_crtc_ddp_config(crtc, cmdq_handle);
486486
cmdq_pkt_finalize(cmdq_handle);
487487
cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,16 @@ int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
316316
}
317317
EXPORT_SYMBOL(cmdq_pkt_write_s_mask_value);
318318

319-
int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event)
319+
int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear)
320320
{
321321
struct cmdq_instruction inst = { {0} };
322+
u32 clear_option = clear ? CMDQ_WFE_UPDATE : 0;
322323

323324
if (event >= CMDQ_MAX_EVENT)
324325
return -EINVAL;
325326

326327
inst.op = CMDQ_CODE_WFE;
327-
inst.value = CMDQ_WFE_OPTION;
328+
inst.value = CMDQ_WFE_OPTION | clear_option;
328329
inst.event = event;
329330

330331
return cmdq_pkt_append_command(pkt, inst);

include/linux/mailbox/mtk-cmdq-mailbox.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
* bit 16-27: update value
2929
* bit 31: 1 - update, 0 - no update
3030
*/
31-
#define CMDQ_WFE_OPTION (CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | \
32-
CMDQ_WFE_WAIT_VALUE)
31+
#define CMDQ_WFE_OPTION (CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE)
3332

3433
/** cmdq event maximum */
3534
#define CMDQ_MAX_EVENT 0x3ff

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,12 @@ int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
182182
/**
183183
* cmdq_pkt_wfe() - append wait for event command to the CMDQ packet
184184
* @pkt: the CMDQ packet
185-
* @event: the desired event type to "wait and CLEAR"
185+
* @event: the desired event type to wait
186+
* @clear: clear event or not after event arrive
186187
*
187188
* Return: 0 for success; else the error code is returned
188189
*/
189-
int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event);
190+
int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear);
190191

191192
/**
192193
* cmdq_pkt_clear_event() - append clear event command to the CMDQ packet

0 commit comments

Comments
 (0)