Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3402004pxv; Mon, 12 Jul 2021 16:51:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGXK3+M8gZZBgNcQGQqiu303v3+e4UQkgmLnNR4ADGxkWuUnWatkXk6VPW6KJg5KFpnr/o X-Received: by 2002:a17:907:e9e:: with SMTP id ho30mr1996734ejc.114.1626133902547; Mon, 12 Jul 2021 16:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626133902; cv=none; d=google.com; s=arc-20160816; b=T+8yureZZxH6dU7Hdt2HUD/LK/aU/oYGlze29NZv+FDrLnRtgmnjGE55YqlMpiRtRH UfFUN5s4iPEfBZOUZTZPVtY2jZRgjUQ8nQSoTtHMpb0zzAyPaPK8boZIXuHSO8D8Qs1L P5uGQERN+9/Cr0UgHjs6/IlL5W7cazOYV0mtwTdOOyp+zgXnhdNCA0NPFqVPMZ63vCe0 cxk7bBGLi2GXEzegVdbQn5BTku2YLubMncAwWC2mqgUAL39OxmSIcIxVr2vti500iPgs ug5cIKKvdkRW4ofeVa45fnBWepTs87P0KaQaT6LOmoyrhlFLR3ZRpM4u3SadC6x1kREX VUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4ru40/pOJOlJ/6xrJpQMJuPrCch3DKzb3z2VaeL515A=; b=dNKlIJV40GDXLW/zjcsEpCmN6RKkr/ts7QCyVxbGgUYhzzk5gQBt5917ZcLzWp0+kx uB4J6TlkbfO4KmzpX+U/v0dc1RxYBixLjLcRPGRYjLz5S72Gz/yypkHOUfQr423dqxcg oVPp2AEgzG7353AhAK3TmNPJXbrx8ZdRbsIxxwdAZAfKehUb7V934/JRB0KJrRvft4OA uvQgaLWtTy4JYDdXBBh6oKArhGpsjCvB6w/mqagJ2ORGGNiwsXM4y4dONdLAT922oFFX QlEx8gwv0WzwGXqslAOQybGDCGXFrurKbcAUt1fLTTfpmAgmZKudNQjB7TdvVGcuraV7 j+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tmXjkn9y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si14205945ejb.365.2021.07.12.16.51.18; Mon, 12 Jul 2021 16:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tmXjkn9y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbhGLXxN (ORCPT + 99 others); Mon, 12 Jul 2021 19:53:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:38460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232878AbhGLXxM (ORCPT ); Mon, 12 Jul 2021 19:53:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C72B61166; Mon, 12 Jul 2021 23:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626133823; bh=/wtDrP5iuggwVl9aJiLqEemxJKIrDTTzHICklU/8cNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmXjkn9yq14A9eZAjz7KlsaFQQRUZzzbXhWEsLhg/z6lHlqB9oxBVRuz2mAAroh7u n6WLrbqK2eZpM3LfRzjimGYo/z8n9y+r8Bhh8+iqSbadNCY1mPBkPtkqpxj+Xozd2r /+aaDyfXFj42b6fWx2lQgnio1jZseRwryBsrxq2/CK/XB1HGAUBilQd3aJdixrB0Ii O2qK6uKXKCPO7fqtCvquQmePb5vc02YR7TPrK4pGoiwAm5G/FBPuagaxSP7zn8N236 axLNuzi23W44pr/NiI8rREAuXvVO45E+8tjCrZRvfHwieKKVr0evrD4xgygtxC12Q9 f77nooBUjjk4w== From: Chun-Kuang Hu To: Philipp Zabel , David Airlie , Daniel Vetter Cc: Yongqiang Niu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Chun-Kuang Hu Subject: [PATCH 1/4] drm/mediatek: Use mailbox rx_callback instead of cmdq_task_cb Date: Tue, 13 Jul 2021 07:50:11 +0800 Message-Id: <20210712235014.42673-2-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210712235014.42673-1-chunkuang.hu@kernel.org> References: <20210712235014.42673-1-chunkuang.hu@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 474efb844249..cac8fe219c95 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -4,6 +4,8 @@ */ #include +#include +#include #include #include #include @@ -222,9 +224,11 @@ struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc, } #if IS_REACHABLE(CONFIG_MTK_CMDQ) -static void ddp_cmdq_cb(struct cmdq_cb_data data) +static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg) { - cmdq_pkt_destroy(data.data); + struct cmdq_cb_data *data = mssg; + + cmdq_pkt_destroy(data->pkt); } #endif @@ -475,7 +479,12 @@ static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc, cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, false); mtk_crtc_ddp_config(crtc, cmdq_handle); cmdq_pkt_finalize(cmdq_handle); - cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle); + dma_sync_single_for_device(mtk_crtc->cmdq_client->chan->mbox->dev, + cmdq_handle->pa_base, + cmdq_handle->cmd_buf_size, + DMA_TO_DEVICE); + mbox_send_message(mtk_crtc->cmdq_client->chan, cmdq_handle); + mbox_client_txdone(mtk_crtc->cmdq_client->chan, 0); } #endif mtk_crtc->config_updating = false; @@ -842,6 +851,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, } if (mtk_crtc->cmdq_client) { + mtk_crtc->cmdq_client->client.rx_callback = ddp_cmdq_cb; ret = of_property_read_u32_index(priv->mutex_node, "mediatek,gce-events", drm_crtc_index(&mtk_crtc->base), -- 2.25.1