Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5000710img; Tue, 26 Mar 2019 23:22:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlwWNGRzG4WXgmCom6yo8f2I+IG9wBeT1Czwrzwr8x8rIq9LvJHOg72+KJHEwJ8KnDLHr/ X-Received: by 2002:a63:6786:: with SMTP id b128mr23419935pgc.318.1553667770620; Tue, 26 Mar 2019 23:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667770; cv=none; d=google.com; s=arc-20160816; b=JIPmazsXUBBI4P+HPJuIHlqs6GDzcXhC9jX2QEvqnOKGyBHWK4kUuPKL4OB89ja7am l57CNg4YF1Nf5v7S8s22O6Bym8/0/208CBe75j3pQxpx9wNAyShnVRKPliMfPTXFn3TD vV2QCjNPIhO1SU8ZGlSLY1gdgriK7ukLHc/wal/Alp91k3r0MV40aiXgLTDdIs3QgZlv uCRiJ5+bDPtH9V6SXPdubE+tOM2nvN/VE+JjMVFsx0Ju1evIWKaC/LYpvlSmTqI3/Ysh jmWns/Zx7StfruKBtc08O7BOhYVHZ0IWKlo7RSvR42Ame/T3AzUUE/RBqMvq5KlgfLTi HQwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=N2E0/Bkpvz8UEdCqUJ/YDrZByI52ElDPkbKEc6JjB70=; b=fRCs1dQG/U+Td8i5LRnBomJKDICi41+cMVyhB82slFsXdwcvtpW01pyFB830SlGyTg Wmhe14EllEffwHYPpyl8fGm/XVAG8/Eym6GXElxQm14hL1EULyGtN4Ns/j0jx2LUGgV/ l75jbaYWYa9BrAAp2pHjr7+MXhaxTmUqpg6Tn5dhXKq6BNPKzkv3BesfltTJiDamgFlp yX6OOypVawEophoCvQV23VhyiKrmYmhs8auc3mFfEYIWwuXo6xt+cY30csZYCMNDEmYs NKBuRZm3xAfSAMdRbNd8naalCM1PoIGWIYoaoZ6ie4H8oNQktRtPgA6bc1WOpyctRDS3 VuKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si14142443pgb.77.2019.03.26.23.22.35; Tue, 26 Mar 2019 23:22:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387580AbfC0GUG (ORCPT + 99 others); Wed, 27 Mar 2019 02:20:06 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:49094 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387513AbfC0GUD (ORCPT ); Wed, 27 Mar 2019 02:20:03 -0400 X-UUID: 7dfe5b3bd31f4192a87ff2930c43c25a-20190327 X-UUID: 7dfe5b3bd31f4192a87ff2930c43c25a-20190327 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1540391883; Wed, 27 Mar 2019 14:19:57 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:52 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:51 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 18/25] drm/mediatek: add RDMA fifo size error handle Date: Wed, 27 Mar 2019 14:19:14 +0800 Message-ID: <1553667561-25447-19-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu This patch add RDMA fifo size error handle rdma fifo size will not always bigger than the calculated threshold if that case happened, we need set fifo size as the threshold Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index b0a5cff..ead38ba 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -137,11 +137,14 @@ static void mtk_rdma_config(struct mtk_ddp_comp *comp, unsigned int width, { unsigned int threshold; unsigned int reg; + unsigned int rdma_fifo_size; struct mtk_disp_rdma *rdma = comp_to_rdma(comp); rdma_update_bits(comp, DISP_REG_RDMA_SIZE_CON_0, 0xfff, width); rdma_update_bits(comp, DISP_REG_RDMA_SIZE_CON_1, 0xfffff, height); + 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 @@ -149,8 +152,12 @@ static void mtk_rdma_config(struct mtk_ddp_comp *comp, unsigned int width, * account for blanking, and with a pixel depth of 4 bytes: */ threshold = width * height * vrefresh * 4 * 7 / 1000000; + + if (threshold > rdma_fifo_size) + threshold = rdma_fifo_size; + 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); writel(reg, comp->regs + DISP_REG_RDMA_FIFO_CON); } -- 1.8.1.1.dirty