From patchwork Fri Aug 3 03:10:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stu Hsieh X-Patchwork-Id: 10554519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24092157D for ; Fri, 3 Aug 2018 03:20:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F13812C02B for ; Fri, 3 Aug 2018 03:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E37B62C3EF; Fri, 3 Aug 2018 03:20:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B82E2C02B for ; Fri, 3 Aug 2018 03:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XZJBh9gkwDXEbVrRMccuRTnqHcBpIvoW0CubbYTCYLo=; b=W67/l90Pwxmn3M qxIg4/vdbgrifspDUrrVUcItfoW8hck/8ck8e8qyhMJtQgKGefmK7uEJGVOpIWNBkFH+UHCT92pN6 TLqsAiaD+0eKfia1DT9o95qaj/7L03vZ3gDA+2B/Hu+18atpU2aBn+RRLc0xSjrQTTpYX1jotUp/Z frLxTBw7YmSS/p9BO5VQ2KV+HWJ9HD9hHFpSW2KqP8iU/EFnZMPVJr7xV2CwF375njscLI3Bvvl/v cZv0cWQlyY/KZ4HGu85RSd3zi9A+/8V9i8R1f0AaEsl3WVBfu6mAi/fvKpK87ELw8wj6vX3GhdXgK VSEwhR3kG6oQOlvyUHJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1flQdn-0002ab-8v; Fri, 03 Aug 2018 03:20:35 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1flQV3-0002P2-E9; Fri, 03 Aug 2018 03:11:37 +0000 X-UUID: 719cd0b7a22347e0b0e31cc3391f060f-20180803 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 384554160; Fri, 03 Aug 2018 11:11:13 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 3 Aug 2018 11:11:11 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 3 Aug 2018 11:11:11 +0800 From: Stu Hsieh To: CK Hu , Philipp Zabel Subject: [PATCH v2 05/15] drm/mediatek: add RDMA memory mode for crtc created Date: Fri, 3 Aug 2018 11:10:58 +0800 Message-ID: <1533265868-28110-6-git-send-email-stu.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533265868-28110-1-git-send-email-stu.hsieh@mediatek.com> References: <1533265868-28110-1-git-send-email-stu.hsieh@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180802_201133_629290_E62FEABA X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: srv_heupstream@mediatek.com, David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Stu Hsieh , Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch add RDMA memory mode for crtc created For mt2712, the third ddp use RDMA engine to read data from dram. Therefore, when crtc created, crtc need to decide using OVL or RDMA by ddp to read data from dram. If this ddp use RDMA, the crtc should set this RDMA which in the crtc using memory mode. Signed-off-by: Stu Hsieh --- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 5 ++++- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 ++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index 585943c81e1f..60851bb2dd63 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -150,6 +150,7 @@ static int mtk_disp_rdma_bind(struct device *dev, struct device *master, void *data) { struct mtk_disp_rdma *priv = dev_get_drvdata(dev); + struct mtk_ddp_comp *comp = &priv->ddp_comp; struct drm_device *drm_dev = data; int ret; @@ -160,8 +161,10 @@ static int mtk_disp_rdma_bind(struct device *dev, struct device *master, return ret; } - return 0; + comp->comp_mode = &priv->rdma_memory_mode; + + return 0; } static void mtk_disp_rdma_unbind(struct device *dev, struct device *master, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 2d6aa150a9ff..4bf636e466f2 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -578,6 +578,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, enum mtk_ddp_comp_id comp_id = path[i]; struct mtk_ddp_comp *comp; struct device_node *node; + bool *rdma_memory_mode; node = priv->comp_node[comp_id]; comp = priv->ddp_comp[comp_id]; @@ -595,6 +596,13 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, goto unprepare; } + if (i == 0 && (comp_id == DDP_COMPONENT_RDMA0 || + comp_id == DDP_COMPONENT_RDMA1 || + comp_id == DDP_COMPONENT_RDMA2)) { + rdma_memory_mode = comp->comp_mode; + *rdma_memory_mode = true; + } + mtk_crtc->ddp_comp[i] = comp; } diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index 7413ffeb3c9d..a1988ce15141 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -93,6 +93,7 @@ struct mtk_ddp_comp { struct device *larb_dev; enum mtk_ddp_comp_id id; const struct mtk_ddp_comp_funcs *funcs; + void *comp_mode; }; static inline void mtk_ddp_comp_config(struct mtk_ddp_comp *comp,