From patchwork Mon Mar 11 13:36:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10847493 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 6DB19139A for ; Mon, 11 Mar 2019 13:37:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56FCF29198 for ; Mon, 11 Mar 2019 13:37:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B40D291B3; Mon, 11 Mar 2019 13:37:18 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88267291C7 for ; Mon, 11 Mar 2019 13:37:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8403089A61; Mon, 11 Mar 2019 13:37:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 80EA289A61 for ; Mon, 11 Mar 2019 13:37:14 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id e17so4071225pgd.2 for ; Mon, 11 Mar 2019 06:37:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MkagwlmaneGvabM0zWKgTIFVY3fD3rJzVWmLGOw3QRg=; b=YVgLNnt2niH82iRspLp8jz09iaE5aKjktcEnzdN0507nbmUG9vpycjA8YWtAfGKTF/ rm0iSE16zSbsMOeyR5ft5VOcBkNFaUjKVrLsNFo0njyk4ZclKnZlBELUl2pxhzQQn2fK JDdoz4NZouZs7YTrWGY214OD7mHdHiY7ZED6oZ2IEKPGBhpT0HZ43eh/5L/YA4hV/7WL Dkk6mAlQZ0aZN+9SAIeWDMekoFVz+a33CiO68ONbXuyMs1b8c2ynchvCteIf8zX78mHw 8mJN7U+utClJ2kuLiLCUSeaJgCNCFr9UoY2t5l6RkMOj8F8hzwQtdv+AaXQYkAXuV+Fj xjhw== X-Gm-Message-State: APjAAAVs5euFWIB/MwBW1+mTYXm31EDG7p4K4tBWHrQIQvmbyb7ptbT5 elkLNso3NGJ9jXWM1h+fbv+GgA== X-Google-Smtp-Source: APXvYqzgDkRmYbgZGTC2UrWOeicCqY4vApUX7An7J715NGniYxmfJNivATrHauH7tdqmvXkAa9wkDg== X-Received: by 2002:a17:902:aa92:: with SMTP id d18mr3697807plr.278.1552311434067; Mon, 11 Mar 2019 06:37:14 -0700 (PDT) Received: from localhost.localdomain ([183.82.224.199]) by smtp.gmail.com with ESMTPSA id s79sm9960397pfa.61.2019.03.11.06.37.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 06:37:13 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , Michael Turquette , Rob Herring , Mark Rutland Subject: [PATCH v8 01/15] drm/sun4i: dsi: Fix video start delay computation Date: Mon, 11 Mar 2019 19:06:23 +0530 Message-Id: <20190311133637.18334-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190311133637.18334-1-jagan@amarulasolutions.com> References: <20190311133637.18334-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MkagwlmaneGvabM0zWKgTIFVY3fD3rJzVWmLGOw3QRg=; b=XErLydjXMg/QyI27+lL8zd+GEF4hndh+xt4uFSI2FPJ8nxjLniWmr6+TVkvdqJjfmi CPWuViuINP+DP7WSAjjC17T8nQ3bsTAms8GEl+PBZ5MlGIji/OhpNwwYT54Dq+wwQf8p 7J1a88YNyCChcBjq6esKarAOf4z9EmKUQmmoo= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Vertical video start delay is computed by excluding vertical front porch value from total vertical timings. This clearly confirmed from BSP code and here how it computed, (drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y) - panel->lcd_y - (panel->lcd_vbp) => timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y - panel->lcd_y - panel->lcd_vbp => timmings->ver_front_porch But the current driver is assuming it can exclude vertical front porch along with vertical sync values from total vertical timings, which resulting wrong start delay indeed wrong picture rendering in the panel. Example: timings, where it produces the issue. { .vdisplay = 600, .vsync_start = 600 + 12, .vsync_end = 600 + 12 + 2, .vtotal = 600 + 12 + 2 + 21, } It produces the desired start delay value as 19 but the correct working value should be 513. So, Fix it by computing proper video start delay. Fixes: 69006ef0ecb1 ("drm/sun4i: dsi: Change the start delay calculation") Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 62a508420227..8d6292c0158b 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -364,8 +364,14 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100); - u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; + u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay); + + /** + * BSP comment: + * put start_delay to tcon. set ready sync early to dramfreq, + * so set start_delay 1 + */ + delay += 1; if (delay > mode->vtotal) delay = delay % mode->vtotal;