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: 151 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8F8833F087 for ; Mon, 11 Mar 2019 14:37:16 +0100 (CET) Received: by mail-pf1-f198.google.com with SMTP id h70sf6160883pfd.11 for ; Mon, 11 Mar 2019 06:37:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1552311434; cv=pass; d=google.com; s=arc-20160816; b=Jl0jclCwmd3wo0ZXua0br1RCgLF3560O4amp5N5/jGh3EeRf5Ezu0vWOfeDSzn74Wq Uxl48IuJwJxUllPXE7H65kAxMqV9Y8flfXz6e+UuiIRMNNLeX7HD5sIRd+sTCSjUwckY hJSij4EhklWFUX0D4Jhxy5vDeXl4JQYVNb3n63ojqkYq5+7RawkDKctKdVoANi2RkxIS QqrIp1YrLW15YlENQ0YdoEt3XioXLQxLezoY7tck1i9B43uauNaJ/SjAvjuraTp3rqcD Yf3NfBa89zF2ketfE4aeyY5p5goff3kNzJFUtJW/9PGb9FJ/CyywojKlClbLtvvRMbGE IrLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=fCFfGD+ic2E3EXGmSgXajiIyIKxSXYgHeEt2bUGNETI=; b=V7oNs8ZgU/C9G0hxVNmnwUhPQzHHOwpduJztFUQS3E6KK2X+ggInvhKTTd6BR4K5G5 ptVa4rSWB1ZAvq5yowcOk1Bs1AZjM66v8J0RQBUis5XuUGAl/wmyhHWKp/OHUpP/Y2XF 7tgAtcT3ArAkijaul7zcbzJpFhdCwCsVMXZSWq68Xgvopb5yuGnRhzJmsIgduDwfXYOY GSo1LbcQ/a//bv3nVVtQvZfcsEr8e8MHI2uapeFm0wnFc92pHT3v871hiV/GpLNntGNX g047/jcwROvmNUiBgzIfp8FUKhlgmQ+ZvUNCRkbew0VXjfwjgMJJrJhSBwb1kcpbj3bA JQHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XErLydjX; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=fCFfGD+ic2E3EXGmSgXajiIyIKxSXYgHeEt2bUGNETI=; b=BUtYcQyP6U95ukIqVMifNUm5RSFa2QRYdeTSgOnEbFs/gOK9Winqxu28/FjMGI/tvf vOpaEdCZv9txxapHRqwzE2qpeVg9U69rmNc59csyW0NzX+yix6YHKMT+eT2M34S8tAmm 4yW3Xdroh8ARWVOSegTFTof4KwV1gJD8QS9bg= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=fCFfGD+ic2E3EXGmSgXajiIyIKxSXYgHeEt2bUGNETI=; b=NRBwrqP10E2GEjU+nMQBn2y+EhJ6fXZklHlyVBLurVP28ppk9MN3s/cqMmMUqRY5PN onQkpOoBfLd6YF/ycjzT5XFP89Yf17Vfb5xuMwcK+cMkcAYNRMu52sch3Xobn1qaKG5j KGGBqSOeWLB8Y7ogAbWQLk30WkF5iLp4RZuUFV48yG+5S2EhFVR6sWd+TcO3Ju+rpwPs +B25ggUfGp4/MRMvEEIoEVjsC4Li2e3pWfZfmSnF7RM6rFVuMeEOR1rECB41LabVbcH+ nftO8RCB+rGvpjTTzoI4ceeiFvfwOLH+kPfvJ+qm0vlltOokaUTVXm4fa4hysA9zNCsv fZmQ== X-Gm-Message-State: APjAAAWxRC6neqEEvj86QLKbrK0FCm1pDZ4wpFT5opQD/zgJ8xEMulQR V3h/Ga8XmcvghiVFtfz+JNzAB8rQ X-Google-Smtp-Source: APXvYqwojJon4TZ6/Hp9cxaRVGoFh/8Rgo7tqWvg7VEe1oXpg2ypJpqHKWc4fo47uQ9A7BeASZXoSA== X-Received: by 2002:a17:902:aa06:: with SMTP id be6mr10305642plb.58.1552311434866; Mon, 11 Mar 2019 06:37:14 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:47ca:: with SMTP id p71ls7712236pfi.1.gmail; Mon, 11 Mar 2019 06:37:14 -0700 (PDT) X-Received: by 2002:a63:fb16:: with SMTP id o22mr29384706pgh.209.1552311434382; Mon, 11 Mar 2019 06:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552311434; cv=none; d=google.com; s=arc-20160816; b=SW9/9ocHR7A+FV2qlikRID0Ldh0bm+1jJSwWZj8Y7TbFPI13tOQWaGyzKYtcTAP9LK evjGYf7aiMT7f1s1aTt+Dq29MF7SSk/K8UetDLmqpNkhM2gYFG4PRunwbwDO66/tBWAZ XV5B6AH2sk6mzt03nljZtt+OeV7tNbfOrroxLAY9XG7TFnyuLRXsqMly1lROHi8ynGp6 QNqduoPSrx79c3TETYrGL/4kozTfXFjNprwsZG7sL93AaRxd1UsZ9YcX3O5NUqzp7QBW Ys0xLMs2D3obBmDDoX0jQ21AO9JjVvPeKtgiptUZFBTTV1gEDiOao0nJWQkjZdKq2B33 i0jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=MkagwlmaneGvabM0zWKgTIFVY3fD3rJzVWmLGOw3QRg=; b=pajR38KbiPK26QwENNq73b4+80b3g2mPzYKsqzaNlEIitAke/bAoE5q1bDl0S8q3k/ TluhYZz6jY3wClOOAXMvL77mtN4oKLVan0WIHdfls9fDYa4xPBNK47ArCoHSN189xrCe Sjsudjt+QdquZfcyixf/sYeCOOfCc2rejkhA78D/gnCZYBen0Sxp0GSg8V2XcObPJje+ GxbyKr0J04tetApwA924ht7wJpIwgGSZOpV6WHxGMVoNept9R/8IBdOdFlg/bsSxKY4g SYuKuC/6S+WZ/xT1G5lw1pP8c4tcLDaCEKm//SxadBIJ3QLtBoSND4qdBbh4Bafhw/4v 91ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XErLydjX; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id j93sor8330831plb.30.2019.03.11.06.37.14 for (Google Transport Security); Mon, 11 Mar 2019 06:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; 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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XErLydjX; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;