Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9110pxu; Wed, 6 Jan 2021 19:14:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAdSr2npVdCkPm4idJxe18hsTfhV3RZtKhhV5jgTqBdyljKCI3jVO3brzSKUR2MKYwcsiK X-Received: by 2002:aa7:c3cd:: with SMTP id l13mr91960edr.97.1609989297282; Wed, 06 Jan 2021 19:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609989297; cv=none; d=google.com; s=arc-20160816; b=Lde7ydrcJ9P7Uk8jP54Un4HtYmQfKxYPQDI+D+bdAX0Lz1a5PZYUKDHAdkCoAjWSCq XuCA38vEddTA4ZzfYzrfXZYi4OD6mIOtBvaQhMzItyduJ8yQ+kW4krVtPqagl1RAumKI olMNjZTLCqtD1h33rGIp0xJ4MUGJ5ra6+rzylg7wKiEEBeNMR/KYJOP1BfhZ87+GDkGl ZXSMs7vTijMkZFgIs9xrc71I7RsBSDTYoMODq5hndT7P9nUrekndhXskzBWZNPaz9sVO Lbv8LZA7mBLxoxvWcLb+VWCnf2W8wsMUuXnFWtOFx/4rYQ6WBjq6S6M8owjKQMxeE6XH rP3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=aOLo9+zDLGaYTWSOqWCQgwO9rgKWdj2FWUx9J+UNIW8=; b=NU0v95evCTZBKOQEMX1zdOg+pL6HObU9V95YhRh8vtw3MYnkpMXaaSqP9XZfKemEXd P5gHPoZ3h/DxnHLzSlIQuHdRKX8hmDdxyvkPxWyfnhqMfKnDVKAwBWHgkldTtwq+/gbk I/Xd+bf8XGkbuwFrtGLLkXDS9R/u2Z8W8GkmCpwJMBrdHDj9z9WpAeDhTTGLh+C5OLIu 6BZ9j4b72zQqjtYoFwmZBjOZqFaPRwNL0SLTNktfuAR3g1MbDkEVjGZqgCLdalsO21lR rCdffMvCggHh61VauxXOnfgnsCfhcnT53S85908JetFqT/rgjY3z6GwuEJkunoWepaFj RHbg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si1755263edd.90.2021.01.06.19.14.32; Wed, 06 Jan 2021 19:14:57 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbhAGDMe (ORCPT + 99 others); Wed, 6 Jan 2021 22:12:34 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:56517 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727117AbhAGDMa (ORCPT ); Wed, 6 Jan 2021 22:12:30 -0500 X-UUID: ec7a9b38c32f497ebe22ac6b1374ba7c-20210107 X-UUID: ec7a9b38c32f497ebe22ac6b1374ba7c-20210107 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1266674678; Thu, 07 Jan 2021 11:11:30 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 7 Jan 2021 11:11:28 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 7 Jan 2021 11:11:28 +0800 From: Yongqiang Niu To: CK Hu , Philipp Zabel , Rob Herring , Matthias Brugger CC: David Airlie , Daniel Vetter , Mark Rutland , , , , , , , Hsin-Yi Wang , Yongqiang Niu Subject: [PATCH v9, 05/11] drm/mediatek: add fifo_size into rdma private data Date: Thu, 7 Jan 2021 11:11:15 +0800 Message-ID: <1609989081-29353-6-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1609989081-29353-1-git-send-email-yongqiang.niu@mediatek.com> References: <1609989081-29353-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get the fifo size from device tree because each rdma in the same SoC may have different fifo size Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index d46b8ae..8c64d5c 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -64,6 +64,7 @@ struct mtk_disp_rdma { struct mtk_ddp_comp ddp_comp; struct drm_crtc *crtc; const struct mtk_disp_rdma_data *data; + u32 fifo_size; }; static inline struct mtk_disp_rdma *comp_to_rdma(struct mtk_ddp_comp *comp) @@ -132,12 +133,18 @@ static void mtk_rdma_config(struct mtk_ddp_comp *comp, unsigned int width, unsigned int threshold; unsigned int reg; struct mtk_disp_rdma *rdma = comp_to_rdma(comp); + u32 rdma_fifo_size; mtk_ddp_write_mask(cmdq_pkt, width, comp, DISP_REG_RDMA_SIZE_CON_0, 0xfff); mtk_ddp_write_mask(cmdq_pkt, height, comp, DISP_REG_RDMA_SIZE_CON_1, 0xfffff); + if (rdma->fifo_size) + rdma_fifo_size = rdma->fifo_size; + else + rdma_fifo_size = RDMA_FIFO_SIZE(rdma); + /* * Enable FIFO underflow since DSI and DPI can't be blocked. * Keep the FIFO pseudo size reset default of 8 KiB. Set the @@ -146,7 +153,7 @@ static void mtk_rdma_config(struct mtk_ddp_comp *comp, unsigned int width, */ threshold = width * height * vrefresh * 4 * 7 / 1000000; reg = RDMA_FIFO_UNDERFLOW_EN | - RDMA_FIFO_PSEUDO_SIZE(RDMA_FIFO_SIZE(rdma)) | + RDMA_FIFO_PSEUDO_SIZE(rdma_fifo_size) | RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); mtk_ddp_write(cmdq_pkt, reg, comp, DISP_REG_RDMA_FIFO_CON); } @@ -292,6 +299,16 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) return comp_id; } + if (of_find_property(dev->of_node, "mediatek,rdma-fifo-size", &ret)) { + ret = of_property_read_u32(dev->of_node, + "mediatek,rdma-fifo-size", + &priv->fifo_size); + if (ret) { + dev_err(dev, "Failed to get rdma fifo size\n"); + return ret; + } + } + ret = mtk_ddp_comp_init(dev, dev->of_node, &priv->ddp_comp, comp_id, &mtk_disp_rdma_funcs); if (ret) { -- 1.8.1.1.dirty