From patchwork Mon Dec 10 16:17:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 83 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id 532C42E5487 for ; Mon, 10 Dec 2018 17:18:04 +0100 (CET) Received: by mail-wr1-f72.google.com with SMTP id j10sf3606709wrt.11 for ; Mon, 10 Dec 2018 08:18:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1544458684; cv=pass; d=google.com; s=arc-20160816; b=KIT7Nbr5pTA0Ha6JqZGXlRJP/F1IA9mAbl12hjJ4a2IwK1o2Q1T0UvQvsvLNTAr601 cq+eQjBUGDuob27ly0neZV4xVcIJt/uxkHp0P6b1SoV6vk/1s/lE8gAACux6grHKs5Oj bUW1jxbk1/YRBpNIKLHasyb0BSTvJkNmQoPYuNjO9y4Y5LmdDL8gJVEi+SlaQ7XcIaqz p5Q++dyC9NyaAqvy70a8uUrhLbefkBQE8bPid/qJXqmY3XaVjb3m+g5MQyLfABDVA1NN LtH13Clpq1LWZQD09GrzEbVbA79EUosZ2ZVu2LEElEYu68B9FHgCs1bmqCOsqvwWbY5d rzAA== 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:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iu6bo30lI7sS+xNVJvtG33E9f/2Ed96R3LMOZkklEQk=; b=Z/vaNrUzUhnT4tcIt+mGs39IKW32feCKYTgdE6w6QcM5owuFFLSqFhcfcTm4j6VMf7 8OniETi1IfmOKUvJCYiiqzkBMl8vF9E8Z+ujqmN4jJMy4MB2Woxe14ajR8WcDEYu11rf mwMI3afD1G5SgqY85DeEh3MVuPtJaaH8NA99QjLLlaZ9bBNPchewNYsrFg7H1wB4laWx H2fLQrDWNWUMlXyAatusL1NpW+/iJMN9Uncqt9Ev6j5pK5e75KjStXFm3sLILLK9JCWh j7MWk98+JSeJ0HUM+o516IqCUrNr3JO4pOR+jHf4AMB/Nu+KX5Xe1jCA/9jiOhyoVIvn NhbQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="V/ScvD53"; 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:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=iu6bo30lI7sS+xNVJvtG33E9f/2Ed96R3LMOZkklEQk=; b=qYDqilpAB88zPJS9qkaIpxAArV2i7RdjpLCjcF3wHpKwo2Ayh7rTMlrEZUiuJz/Fz4 5M+gPWnK98e3/1z3mgmaqQmpHBEzv4lLxav1J2SsCCEZzfKG9bt+fhZpZ2OW+7OiIBOW p8pzbn2EhKNl0Q1pY7mBxGerl0q13g4zewHo8= 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: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=iu6bo30lI7sS+xNVJvtG33E9f/2Ed96R3LMOZkklEQk=; b=tAqvVamINofY26/JciyXI2BHLpDZT+nlc/FIlpiFUAzCfiYRhvCN3FYA8w2UjLp4Ve FBonrZF1MSPoiRrHqFoNw6gl7G0bCwx588XwQChfh/CuM9UvJJx2L9pJaoi+B65O4sDo EbhzXf9srpUo8jVMAm14plijL948Tm+1Yp0KwGhAlHFMrh7ge72mj9KBhIwLRY0hzlC+ iQam4VpCXAfegno3zpiN2JZn8VcPxjLTZ1RbRT4j15akX0Xt7sltTQx35riLbp4FAoET BXqtuKOKG2nJZaOP9XsbpyXyTnYQOIXs6b6HpVXnESfzgLxnf6uWsjqmqtgf1kMMqGmE EkOA== X-Gm-Message-State: AA+aEWbaBv26XfEmqmUcKR9S8fcixLVBmfwa44BjWMpY7ETkqlRzrQSK ov7SM+fK3KkdSju36S7fyQKTJicR X-Google-Smtp-Source: AFSGD/Wa6N0PfeLiH4WqNDHUYZcTsW3gYZjRQepPkEfKS/tpsNtjbUEHGEh986Lpr6kOo2ysT7nW4w== X-Received: by 2002:a1c:8794:: with SMTP id j142mr504219wmd.3.1544458684029; Mon, 10 Dec 2018 08:18:04 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:8186:: with SMTP id 6ls2258685wra.9.gmail; Mon, 10 Dec 2018 08:18:03 -0800 (PST) X-Received: by 2002:a5d:44d1:: with SMTP id z17mr10107611wrr.271.1544458683570; Mon, 10 Dec 2018 08:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544458683; cv=none; d=google.com; s=arc-20160816; b=wNK3BD/ehMXipwuchH71ARkhP1AB4F3pvkzo2Cptp51BZYpClq7m5ypryu/ILo9l+8 WY2jQaOsuA1ngJPMt1BQXN3Y8UtiW8o1BB4z8QmiSdqL1XxaATGfdELCXxbh7GFJWcZk aLrkzTi0gP/KQmR2W7tKhI/mqHvlpzVQ/X28aTKzdf3mHolUIFWvKPZRuc2XDxGNHW6e cwN/QmBZI4uMR6vCCeYG45ESODcVD3ixQODpXeqE884s9fTwtrEsqSZbhkdO2IxDgNRG 2DOVMsU+xjIEtPHjtZi44XIDuRLeTHlFsJ3xS5aE2toBBnJs+zKe2moPEcJudNoPnVUQ VhqQ== 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=iu6bo30lI7sS+xNVJvtG33E9f/2Ed96R3LMOZkklEQk=; b=g5u4R9+GHLAy2QFvM9fdSI4QMs8N18aVJ2xDqMvFOTJNUKkeNGvILtsKjIAq+dwa9Z 5QjXVYHkYq+8rDen7tQ03iVG0druzcR/8acnkHN+PcL21mf+XN4n1N3kqqvqhLtLqkFr quUUJ4dIjAg3iTzhNXPZVn+dmt8GOYuQHf07eoA6s5kyRFsy7D63iMCKwxKsjjuqav7/ Pahv1efBDRmgb0wlGqYFLk0lzoRwgUkmXhbqhjrjFBLcTgBdDe/jhIuymFPh+EfRzAW2 KMo6zQ9oam7OYj5AiZeSZ/eNnKMrwn431jWqdKUDmIpjcpk3f14RmfGL/45SRG1XAcz/ I2zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="V/ScvD53"; 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 h76sor7752610wma.28.2018.12.10.08.18.03 for (Google Transport Security); Mon, 10 Dec 2018 08:18:03 -0800 (PST) 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:a1c:e3d7:: with SMTP id a206mr10879717wmh.77.1544458683263; Mon, 10 Dec 2018 08:18:03 -0800 (PST) Received: from localhost.localdomain (ip-162-59.sn-213-198.clouditalia.com. [213.198.162.59]) by smtp.gmail.com with ESMTPSA id b13sm8397503wrn.28.2018.12.10.08.18.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:18:02 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michael Trimarchi , linux-sunxi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v5 11/17] drm/sun4i: sun6i_mipi_dsi: Fix DSI hfp timing value Date: Mon, 10 Dec 2018 21:47:23 +0530 Message-Id: <20181210161729.29720-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181210161729.29720-1-jagan@amarulasolutions.com> References: <20181210161729.29720-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="V/ScvD53"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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: , 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 07eba9ec469b..d8947be92f9d 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -490,7 +490,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.