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: 10847491 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 3F0331669 for ; Mon, 11 Mar 2019 13:37:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A3FC291A9 for ; Mon, 11 Mar 2019 13:37:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10B78291E9; Mon, 11 Mar 2019 13:37:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4CD5291EA for ; Mon, 11 Mar 2019 13:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727598AbfCKNhO (ORCPT ); Mon, 11 Mar 2019 09:37:14 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40310 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727597AbfCKNhO (ORCPT ); Mon, 11 Mar 2019 09:37:14 -0400 Received: by mail-pf1-f195.google.com with SMTP id h1so3715825pfo.7 for ; Mon, 11 Mar 2019 06:37:14 -0700 (PDT) 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-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=OJh0DFZ9bzo+9l12bS4CN48Ol3+wspFEF28Mw5cDMNXZXB2Lav14WVqG6YGfnGgDgL C/shv0wC+Kp7Df5peFomghYy2sHPIVHpDIcTO0nh5iaoX29le57LBUuJo62a5zn+vnAo pMya2x0xvREDSX9l7eJlbL8s1tza7BUdylWtyA1bDVsSZln6FfpxbVRF5gqBu6Qu7dsk 4P/CyKnYSlabxQvtTf5XNeqe6N82m0D1Yfe6L7oVPbxGTtqyBaSLKLaQPQ47a4Om0eCr 39bU669XaWoQ1FDAfl8ApCvU+POoicol6QJXGWlz/ri8E27uZXZfAed6Y3Mfx3l4/8VG u3fA== X-Gm-Message-State: APjAAAW1lgYZKklP4bvsWB224/Iu4Oa690cK1tQgOclbe8oFe1dVCOxx WeZkhm/PMZe7ovAGsp3nOVh9WEFyQOo= 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki 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 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org 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;