soc: mediatek: cmdq: export finalize function
authorDennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
Sun, 21 Jun 2020 14:18:32 +0000 (22:18 +0800)
committerMatthias Brugger <matthias.bgg@gmail.com>
Mon, 22 Jun 2020 11:12:46 +0000 (13:12 +0200)
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 <dennis-yc.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://lore.kernel.org/r/1592749115-24158-9-git-send-email-dennis-yc.hsieh@mediatek.com
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/soc/mediatek/mtk-cmdq-helper.c
include/linux/soc/mediatek/mtk-cmdq.h

index fe46c4b..ec6c9ff 100644 (file)
@@ -492,6 +492,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
                cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event);
                cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event);
                mtk_crtc_ddp_config(crtc, cmdq_handle);
+               cmdq_pkt_finalize(cmdq_handle);
                cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);
        }
 #endif
index b9e5e4e..2eda03f 100644 (file)
@@ -300,7 +300,7 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
 }
 EXPORT_SYMBOL(cmdq_pkt_assign);
 
-static int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
+int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
 {
        struct cmdq_instruction inst = { {0} };
        int err;
@@ -319,6 +319,7 @@ static int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
 
        return err;
 }
+EXPORT_SYMBOL(cmdq_pkt_finalize);
 
 static void cmdq_pkt_flush_async_cb(struct cmdq_cb_data data)
 {
@@ -353,10 +354,6 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb,
        unsigned long flags = 0;
        struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
 
-       err = cmdq_pkt_finalize(pkt);
-       if (err < 0)
-               return err;
-
        pkt->cb.cb = cb;
        pkt->cb.data = data;
        pkt->async_cb.cb = cmdq_pkt_flush_async_cb;
index 8334021..c331255 100644 (file)
@@ -167,6 +167,14 @@ int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
 int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value);
 
 /**
+ * cmdq_pkt_finalize() - Append EOC and jump command to pkt.
+ * @pkt:       the CMDQ packet
+ *
+ * Return: 0 for success; else the error code is returned
+ */
+int cmdq_pkt_finalize(struct cmdq_pkt *pkt);
+
+/**
  * cmdq_pkt_flush_async() - trigger CMDQ to asynchronously execute the CMDQ
  *                          packet and call back at the end of done packet
  * @pkt:       the CMDQ packet