Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2394336imu; Thu, 24 Jan 2019 12:01:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN4lgkeE8KcOVmDyqr0pC/8BOblH4ksKDnclYXICD0d5GtgWf1kxu6DK1Qtfz1dVO6MtGOgd X-Received: by 2002:a62:d148:: with SMTP id t8mr8096473pfl.52.1548360105181; Thu, 24 Jan 2019 12:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360105; cv=none; d=google.com; s=arc-20160816; b=iTc9orCe1W9Qj9P8ohob0S+oKWYuBXO7B0EZwTqhf90Fk656cG2sJZK21XxeIg8NxS 3jBlZ4ONwzXnr512YRZhBMVxKylPDxX5AGC/BAD3xMpCn97elBmVdio79mfdtpxcRRj2 hFhns1vEwyL5E0N3dPhiE2+0CV2oT58TOOBwrm4mvzY3JhlTTjefffsLDb3GWUsGsheF voXrckEELRkLiZ60dNVGjYarWI5l6t8dC2TVU6MVTQzo0WLb+rx6gH8OnufXvc3RHqi6 NQ3UHYQHDQJ5ot+i7qPtrZqUnPEdk1aGGSP6Clx74K+n4nUM5pyEPKf+20IqR6pt+C7L /ZaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8SYjzJk1Ajw/4LSvmuyBM6xgYSP98STN7cje2swaDiQ=; b=Zw0diN/Nrdm11vsRS+4Rp+0WxrCRSIxwxsO2ECn5ADaw2Ahb28TyJp+nqNXoDb+V0S AeI7fV0gg6r6RfsSTcx99eFvRKj2991ba+A/HtFBCKpA2ZVPpsu+wb5ktqoec4/u86Oq lCG8HaZeUVQFkA1QMvYHcMAoYjz6obii/2Hvgco4eNyPygS+CM9B2TDcQhEZSbT7x5yz dwBDNxTKh9QnJquCgH8nSha7Y7+q15dKGOQxzbL4NCfaIfqI6pW+HQr1AVpnhsVupsR0 HtBuSZVWJlAOA8pnRolz26uSx/Jsmea2g5NU1a4fHB7gsOGRn8iQXhr633FpK0fGL/R4 t9ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o7lyrIkT; 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 1si6305814plr.189.2019.01.24.12.01.30; Thu, 24 Jan 2019 12:01:45 -0800 (PST) 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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o7lyrIkT; 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 S1731867AbfAXUBT (ORCPT + 99 others); Thu, 24 Jan 2019 15:01:19 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34082 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729277AbfAXUBR (ORCPT ); Thu, 24 Jan 2019 15:01:17 -0500 Received: by mail-pf1-f196.google.com with SMTP id h3so3549788pfg.1 for ; Thu, 24 Jan 2019 12:01:16 -0800 (PST) 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=8SYjzJk1Ajw/4LSvmuyBM6xgYSP98STN7cje2swaDiQ=; b=o7lyrIkTLas5a3xgc3B+h3z+ZF1kayWCYA+DRkIO5xFRgGUGwXFhXy4u65Kg8OdoW7 PHTG65m5HHlswX7p3b0zjZCTvqG+lf/LxEQHuRQI0F1nHBdA+ywmODr3C9+hePv4d5GZ fPcIILMmRq3oflwNoVMKkNL2hnpIRqihybDbA= 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=8SYjzJk1Ajw/4LSvmuyBM6xgYSP98STN7cje2swaDiQ=; b=RcOJRzuQaa1vtiW5m76Us6txjFiY4MPWDr8XV25VahdOarmw/pP29jsH2EQdYMAfXB k8GnQdm4OEravnw4EbrvIj+AzvCJULoz4iMjE/GAFgJRL6Bm+qIH8Gasc5GyUCsr+ASt RnR+3Q6wQrMJiWJCvBESvHXs3NNOlQuwrY1+Bkm1Vw0gJGup9NjtXFR1gX5kY64BeKQe 77Kh+W/qUmPKJORIqCg1CkztKv8Ydv1kgIGhlRkMHogEAYln46k7lKhuUt5jIS1loE+j WVBF5E2r2t8fTwmXtvisiHqu1Cx+yRu5sztQ5Cmtkdb+A+jdSc5VwotUHTLjcUFSiAeU 3SbA== X-Gm-Message-State: AJcUukcN4YQPjAGyQTdERDy8xE5yOi30eu97EQnlNCpnjVLFz+MNsG55 HxiLZGfqFb7rE7CdeToW3i8rKQ== X-Received: by 2002:a65:590b:: with SMTP id f11mr7269183pgu.60.1548360076442; Thu, 24 Jan 2019 12:01:16 -0800 (PST) Received: from localhost.localdomain ([115.97.179.75]) by smtp.gmail.com with ESMTPSA id x11sm61637003pfe.72.2019.01.24.12.01.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 12:01:15 -0800 (PST) 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 v6 21/22] drm/sun4i: sun6i_mipi_dsi: Fix DSI hfp timing value Date: Fri, 25 Jan 2019 01:28:59 +0530 Message-Id: <20190124195900.22620-22-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190124195900.22620-1-jagan@amarulasolutions.com> References: <20190124195900.22620-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current driver is calculating hfp maximum value by subtracting htotal with hsync_end which is front back value, but the hpp refers to front porch. Front porch value is calculating by subtracting hsync_start with hdisplay as per drm_mode timings, and BSP code from BPI-M64-bsp is eventually following the same. BPI-M64-bsp is computing hfp as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hbp = (hbp-hspw)*dsi_pixel_bits[format]/8 - (4+2); dsi_hact = x * dsi_pixel_bits[format]/8; dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); dsi_hfp = dsi_hblk - (4+dsi_hact+2) - (4+dsi_hbp+2); Example, u32 fmt = dsi_pixel_bits[format]/8; => ((ht-hspw)*fmt - 10) - (6 + x * fmt) - (6 + (hbp-hspw)*fmt - 6) => (ht - hspw - x - (hbp - hspw)) * fmt - 16 => (ht - x - hbp) * fmt - 16 => (ht - x - (timmings->hor_total_time - timmings->hor_front_porch - x) * fmt - 16 => (timmings->hor_total_time - x - timmings->hor_total_time + timmings->hor_front_porch + x) * fmt - 16 => timmings->hor_front_porch * fmt - 16 So, update the DSI hfp timing accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index e24719cabba2..9f72eb5f54a6 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -586,7 +586,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, */ #define HFP_PACKET_OVERHEAD 6 hfp = max((unsigned int)HFP_PACKET_OVERHEAD, - (mode->htotal - mode->hsync_end) * Bpp - HFP_PACKET_OVERHEAD); + (mode->hsync_start - mode->hdisplay) * Bpp - + HFP_PACKET_OVERHEAD); /* * hblk seems to be the line + porches length. -- 2.18.0.321.gffc6fa0e3