From patchwork Fri Oct 26 14:43:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10657541 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 A720714BD for ; Fri, 26 Oct 2018 14:52:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 946D02C951 for ; Fri, 26 Oct 2018 14:52:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 879322C953; Fri, 26 Oct 2018 14:52:38 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 084E02C951 for ; Fri, 26 Oct 2018 14:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2platC7i19VkzlW8xQEjOQ04QBDuvUQy5SEe5+q6WCc=; b=Qnmge3Qhn4QYC6 Ymc/cOS8UCtDmvvIQDuchbUpLXEpDOZARHcHQjn/F98JvGvTipCVFeHEB6gVNVWhbVmr7IpjqM/5F t7+ojeJmo32NLemytaWlxJRu1yfcn8gcr0nWwSA549Ms2WB3LPZo5cUMIvdSmTNEQQLsk4dpMJ71L as1/1U7jMZCh0xwL9osGbIyCMAYVdTMJ2APFZqjjCnB3uwoi0/xKltzahXb6Ly7ixlD0BUsW2u21l rcDahWmmJs1+p9kdWD8imxeVQl4D7Mk4NwRknywl9yTGglF7mnIfqwGyCStE4xsdxG/7FaQxFCZhT api6/5mhaPo7X6xUcdyQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3TL-0006jF-DT; Fri, 26 Oct 2018 14:52:23 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3Ms-0002ZB-Go for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 14:47:42 +0000 Received: by mail-pl1-x641.google.com with SMTP id o19-v6so606379pll.12 for ; Fri, 26 Oct 2018 07:45:32 -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=efp6sFiQWGhKGiEpT9DPizID7xKe3bNjf2I9V30y+Ys=; b=fgB+w/jtIZgJ3cUnZ6wBZHi5PXY/IpocFCJWrAWselKgGvHeS0V9aqCXHUEbdEjQ44 ErNWTafUecoXd3fhSrnYeSt4xcw75Y5R0o04cGYTSrXjiMnk4792xGpiZ62SxA2fnZAd 0FIzExMCXDksaN/p57I3Lqn531A2ajs+387Z4= 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=efp6sFiQWGhKGiEpT9DPizID7xKe3bNjf2I9V30y+Ys=; b=YGoFIlPc23BKHCEGw/eULG7pUNxOPcMqYAvM0/mL0ROb57nfE9OH14HLknA2ZKFM2w H8IpxeePHtfyRnK1HnC+YMQsVWmIDgv/S96fKcvkkSCbiYkcfWBs6Zks34kUG2Me0PwB nedbY35XwKZVXF4Xhwp5fLjHn4SGfMF7ejaZ9CdCaK/XTCQmpZg2ZObrBw8ZDcYhC+E9 5Bm9JWevEKwG6l84Me1brc+vemSK1kG+RLlFGkRGP8u6Ir8zRskY4iTLqUt/eonWTQqF s44mBhcUgWHi6zE0z9+A8G2b2L8QAzuyzZ6cxHjLUkbv6TIWzbTEWDIK6rLwTwHo+lzX XOBg== X-Gm-Message-State: AGRZ1gJEUjmqUmZCHWP3QRMTpPaSqPycoCBAXE/k7KXbSzb8W8RyoEQZ NUeJcffoaSFo2uS8cSGfpVOQ8Q== X-Google-Smtp-Source: AJdET5fucCB5re78rfZVblg7SE55jUyPO8u1lB6Zs29yTuXi0Svqs/9BYlVGAZ5aL7lBnP6KYNcuFg== X-Received: by 2002:a17:902:b106:: with SMTP id q6-v6mr3811436plr.238.1540565131346; Fri, 26 Oct 2018 07:45:31 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id z22-v6sm12044467pgv.24.2018.10.26.07.45.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:30 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 14/25] drm/sun4i: sun6i_mipi_dsi: Increase hfp packet overhead Date: Fri, 26 Oct 2018 20:13:33 +0530 Message-Id: <20181026144344.27778-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181026144344.27778-1-jagan@amarulasolutions.com> References: <20181026144344.27778-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_074542_610613_740D414F X-CRM114-Status: GOOD ( 17.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Increase the hfp packet overhead with another 10 bytes, the extra 10 bytes(which is hblk packet overhead) is adding for hfp packet overhead since hfp depends on hblk. This is truely as per BSP code from BPI-M64-bsp. The real computation from BSP is (in 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, increase the DSI hfp packet overhead by hblk packet overhead. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki Tested-by: Jagan Teki --- Changes for v3: - new patch Changes for v2: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 6584b51736a9..20e330186b7f 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -461,7 +461,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, { struct mipi_dsi_device *device = dsi->device; unsigned int Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8; - u16 hbp, hfp, hsa, hblk_max, hblk, vblk; + u16 hbp, hfp_pkt_overhead, hfp, hsa, hblk_max, hblk, vblk; size_t bytes; u8 *buffer; @@ -484,14 +484,6 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, hbp = max((unsigned int)HBP_PACKET_OVERHEAD, (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); - /* - * The frontporch is set using a blanking packet (4 bytes + - * payload + 2 bytes). Its minimal size is therefore 6 bytes - */ -#define HFP_PACKET_OVERHEAD 6 - hfp = max((unsigned int)HFP_PACKET_OVERHEAD, - (mode->hsync_start - mode->hdisplay) * Bpp - HFP_PACKET_OVERHEAD); - /* * hblk seems to be the line + porches length. * The blank is set using a blanking packet (4 bytes + 4 bytes + @@ -502,6 +494,18 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, hblk_max -= HBLK_PACKET_OVERHEAD; hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, hblk_max); + /* + * The frontporch is set using a blanking packet (4 bytes + + * payload + 2 bytes). Its minimal size is therefore 6 bytes + * + * According to BSP code, extra 10 bytes(which is hblk packet overhead) + * is adding for hfp packet overhead since hfp depends on hblk. + */ +#define HFP_PACKET_OVERHEAD 6 + hfp_pkt_overhead = (HFP_PACKET_OVERHEAD + HBLK_PACKET_OVERHEAD); + hfp = max((unsigned int)hfp_pkt_overhead, + (mode->hsync_start - mode->hdisplay) * Bpp - hfp_pkt_overhead); + /* * And I'm not entirely sure what vblk is about. The driver in * Allwinner BSP is using a rather convoluted calculation