Skip to content

Commit c1ec54b

Browse files
author
Chun-Kuang Hu
committed
drm/mediatek: Use mailbox rx_callback instead of cmdq_task_cb
rx_callback is a standard mailbox callback mechanism and could cover the function of proprietary cmdq_task_cb, so use the standard one instead of the proprietary one. Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 5b0ef98 commit c1ec54b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55

66
#include <linux/clk.h>
7+
#include <linux/dma-mapping.h>
8+
#include <linux/mailbox_controller.h>
79
#include <linux/pm_runtime.h>
810
#include <linux/soc/mediatek/mtk-cmdq.h>
911
#include <linux/soc/mediatek/mtk-mmsys.h>
@@ -222,9 +224,11 @@ struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc,
222224
}
223225

224226
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
225-
static void ddp_cmdq_cb(struct cmdq_cb_data data)
227+
static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
226228
{
227-
cmdq_pkt_destroy(data.data);
229+
struct cmdq_cb_data *data = mssg;
230+
231+
cmdq_pkt_destroy(data->pkt);
228232
}
229233
#endif
230234

@@ -475,7 +479,12 @@ static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc,
475479
cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, false);
476480
mtk_crtc_ddp_config(crtc, cmdq_handle);
477481
cmdq_pkt_finalize(cmdq_handle);
478-
cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);
482+
dma_sync_single_for_device(mtk_crtc->cmdq_client->chan->mbox->dev,
483+
cmdq_handle->pa_base,
484+
cmdq_handle->cmd_buf_size,
485+
DMA_TO_DEVICE);
486+
mbox_send_message(mtk_crtc->cmdq_client->chan, cmdq_handle);
487+
mbox_client_txdone(mtk_crtc->cmdq_client->chan, 0);
479488
}
480489
#endif
481490
mtk_crtc->config_updating = false;
@@ -842,6 +851,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
842851
}
843852

844853
if (mtk_crtc->cmdq_client) {
854+
mtk_crtc->cmdq_client->client.rx_callback = ddp_cmdq_cb;
845855
ret = of_property_read_u32_index(priv->mutex_node,
846856
"mediatek,gce-events",
847857
drm_crtc_index(&mtk_crtc->base),

0 commit comments

Comments
 (0)