Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp291746imu; Mon, 5 Nov 2018 00:34:01 -0800 (PST) X-Google-Smtp-Source: AJdET5dNzuCDflcFjVUOaHmfjqMjvCzZFB+S2HNFyYKGtwzNYuLW0cyBYAoSTvJKTIAS+2HQ3Ef+ X-Received: by 2002:a63:c141:: with SMTP id p1mr15827312pgi.424.1541406840927; Mon, 05 Nov 2018 00:34:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541406840; cv=none; d=google.com; s=arc-20160816; b=e8KJipP9BpL85MPhK2XsIt9i+g3pOC6VMZ2SkWbATYdflJpQruyzhTf+wrfy7enOwS osq1wj8KXa1zhtMvoIuYIXdRE+c6IFNnencuJdNCn0nbbMMYdYRg2f5/kT4rqe7ljc2a 465FM6glCs9Ymhdsm6eSD/lTTG3rWJ2giuyT5lIyFUNQulskOJbDK/RhXn3gbIY/34VW S+jsKZrsVDL5eApImq2jHg3zRRz8W9X/XMFev36mKKUeOPb112YQB5O98MA8TLgOHN7q NRne5DfcH5n8ghVKWdQCQUDKlYjOSNom7Td2tHCC90/FxAk2/XhdU1qRK/fZUumfOkuD ovfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KXe71TWTWaaux/plXdx/jJXqC3uQ5m2MsALEkW1AKyQ=; b=B1iSfgHWXzm3nXe5kzpNIfIM5EBjWK2c3qGfA0F7H+gXZwPeYdonBZU1C4R4Q9/G1C WEZlyHJskTsId5cWAvwAhErcuK9sfCzCGQKegJYgR6caFGAS6HUG4f9shgYcqRlDqr/K FH0ojlRfhcrOyo4M9ItbU6TmhK+ihhHH1fFmX2Ljp51meevjklPoeQBPtOPxwyUvqNVE ytB6XIqfQ1MVXIrf8VGffFyzrT+9mbGbTw3eI6TLcW6hp3dotsmxK4SmiJStm3DN9FRz AlI5OJNFSwYEyL20BmKknkcKxA/A+VN0DxHX7O6ZTEv3kHOktdXYkYqrsO0EQVgL8/yb 3qOA== ARC-Authentication-Results: i=1; mx.google.com; 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 x15-v6si19383420pll.41.2018.11.05.00.33.45; Mon, 05 Nov 2018 00:34:00 -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; 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 S1727247AbeKERvw (ORCPT + 99 others); Mon, 5 Nov 2018 12:51:52 -0500 Received: from mail.bootlin.com ([62.4.15.54]:55732 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKERvw (ORCPT ); Mon, 5 Nov 2018 12:51:52 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 26E5B207B0; Mon, 5 Nov 2018 09:33:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (aaubervilliers-681-1-93-44.w90-88.abo.wanadoo.fr [90.88.34.44]) by mail.bootlin.com (Postfix) with ESMTPSA id E1087206A1; Mon, 5 Nov 2018 09:33:06 +0100 (CET) Date: Mon, 5 Nov 2018 09:33:07 +0100 From: Maxime Ripard To: Jagan Teki Cc: Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel , Michael Turquette , Stephen Boyd , linux-clk , Michael Trimarchi , linux-arm-kernel , devicetree , linux-kernel , linux-sunxi@googlegroups.com Subject: Re: [PATCH v3 14/25] drm/sun4i: sun6i_mipi_dsi: Increase hfp packet overhead Message-ID: <20181105083307.ambogsg4fopjfrda@flea> References: <20181026144344.27778-1-jagan@amarulasolutions.com> <20181026144344.27778-15-jagan@amarulasolutions.com> <20181029092754.2tl7i5k5qpbn4557@flea> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iazds3sud6k36fef" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --iazds3sud6k36fef Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 29, 2018 at 07:57:56PM +0530, Jagan Teki wrote: > On Mon, Oct 29, 2018 at 2:58 PM Maxime Ripard = wrote: > > > > On Fri, Oct 26, 2018 at 08:13:33PM +0530, Jagan Teki wrote: > > > 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 =3D (hbp-hspw)*dsi_pixel_bits[format]/8 - (4+2); > > > dsi_hact =3D x * dsi_pixel_bits[format]/8; > > > dsi_hblk =3D (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); > > > dsi_hfp =3D dsi_hblk - (4+dsi_hact+2) - (4+dsi_hbp+2); > > > > > > Example, > > > u32 fmt =3D dsi_pixel_bits[format]/8; > > > =3D> ((ht-hspw)*fmt - 10) - (6 + x * fmt) - (6 + (hbp-hspw)*fmt - 6) > > > =3D> (ht - hspw - x - (hbp - hspw)) * fmt - 16 > > > =3D> (ht - x - hbp) * fmt - 16 > > > =3D> (ht - x - (timmings->hor_total_time - timmings->hor_front_porch = - x) > > > * fmt - 16 > > > =3D> (timmings->hor_total_time - x - timmings->hor_total_time + > > > timmings->hor_front_porch + x) * fmt - 16 > > > =3D> 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 =3D dsi->device; > > > unsigned int Bpp =3D mipi_dsi_pixel_format_to_bpp(device->forma= t) / 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 =3D max((unsigned int)HBP_PACKET_OVERHEAD, > > > (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_O= VERHEAD); > > > > > > - /* > > > - * 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 =3D max((unsigned int)HFP_PACKET_OVERHEAD, > > > - (mode->hsync_start - mode->hdisplay) * Bpp - HFP_PACK= ET_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 -=3D HBLK_PACKET_OVERHEAD; > > > hblk =3D 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 o= verhead) > > > + * is adding for hfp packet overhead since hfp depends on hblk. > > > > "According to the BSP code, another 10 bytes (the HBLK packet > > overhead) need to be added to the front porch overhead." > > > > How has this been verified? Since we have registers to set all the > > parameters, this seems kind of weird. >=20 > Verified based on the BSP calculation which I explained in commit > message and tested by validating these numbers with mainline vs bsp > code. So, not verified? Did you have a panel that was broken due to this? Have you found that the timings output on the DSI bus were wrong using an oscilloscope or an analyzer? What makes you say that the Allwinner code is more correct than we are? Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --iazds3sud6k36fef Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW+AAQgAKCRDj7w1vZxhR xeFLAQDEuRB7X3QE4fFt6ewszUtuZMXr/cZWA3GJpOpxLiWdzwD9Fud8EFg6p8DV Kh9Ws5J9I3Q5H7uOUP1r1fNICfQAeQc= =4cHu -----END PGP SIGNATURE----- --iazds3sud6k36fef--