Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp290332imu; Mon, 5 Nov 2018 00:32:13 -0800 (PST) X-Google-Smtp-Source: AJdET5ck4n4JQcQfqky/BhFsT2W4WpJVxN0R3rf3o5+A9wP+JOeK1IYL47CQlnlpf+AEOJHr2nXV X-Received: by 2002:a63:d818:: with SMTP id b24mr7480895pgh.174.1541406733581; Mon, 05 Nov 2018 00:32:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541406733; cv=none; d=google.com; s=arc-20160816; b=TkSjk8kAfkAuZ7xNEGYj+itkyxtFJjRXFWXSVLQgCuCOTjwY4QrAhoGkcGawipBJHe a1AqpKBwqIwkbEXzZR4+xuVT1Q5eHxye92nNk1o/aTKUgvfcNYefIv4VGoD31t6VumY7 YbrBPYNQqDe4Njb+3dWYrTNmyRw89dUUCyeJi9m3s6/wJ6dlTHv+zaT0p631+nd1f9Hd Pvqcmsa80nxpKjaz5BDUl4Bsg0zxOt7MnsOCZ2ETOPL5bsbsVHpKhP8Rfvnp3VW3KJKz QvYYn/K1H2Lea3kcxsdSt5J3/vm6NY8gKl1/3Df0xG+cEhWaRZeIJiLGMRWm9dVMgFRZ YmCw== 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=nl0FnbbC2qX03eEsNRmghy6f4/sXtcQ03DysCqQ3L2Y=; b=WP5HqpPnvLbxCpJ45aPomjfTzkLI4CUVTwFzuSfGauAVPleY+V0nLmxQA+ismq3G3+ QeCntBU2qSW7XkOFdn4Up9DN6hEsSH3fjBNU8N9FoOMpAb2o8EORfPB0vvwnfJgA94l0 xzPt9Ym75ixj9v/i9yA/gswociNPZJ8jgFZCPqgm2KMRra7sp9AunuEOmyOx0bq6291D oN7c00qRAA7/2FcCL5t5Y6NF/ij8q685LRAMRkOlcWY7u7sBr5NfiB2YqCl25pEr2fjK tAQzETVzD4TOdDB6LNghh0pNBvxvpjUygk9agUUU6Ff0kYnEe0mkIbROpbXrRnW4QPRd WBFQ== 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 e73-v6si43439232pfb.98.2018.11.05.00.31.58; Mon, 05 Nov 2018 00:32:13 -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 S1726706AbeKERuJ (ORCPT + 99 others); Mon, 5 Nov 2018 12:50:09 -0500 Received: from mail.bootlin.com ([62.4.15.54]:55625 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKERuJ (ORCPT ); Mon, 5 Nov 2018 12:50:09 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 7106F2080A; Mon, 5 Nov 2018 09:31:35 +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 38CBA207CF; Mon, 5 Nov 2018 09:31:25 +0100 (CET) Date: Mon, 5 Nov 2018 09:31:25 +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 12/25] drm/sun4i: sun6i_mipi_dsi: Add DSI hblk packet overhead Message-ID: <20181105083125.xyfwdrkrjzrltfzf@flea> References: <20181026144344.27778-1-jagan@amarulasolutions.com> <20181026144344.27778-13-jagan@amarulasolutions.com> <20181029092227.mdxgvg5aqzh22j72@flea> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ci7q6bhdxh7l4w2f" 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 --ci7q6bhdxh7l4w2f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 29, 2018 at 07:56:27PM +0530, Jagan Teki wrote: > On Mon, Oct 29, 2018 at 2:52 PM Maxime Ripard = wrote: > > > > On Fri, Oct 26, 2018 at 08:13:31PM +0530, Jagan Teki wrote: > > > Add 10 bytes packet overhead for hblk where blank is set using > > > a blanking packet like (4 bytes + 4 bytes + payload + 2 bytes) > > > > > > This is according to BSP code from BPI-M64-bsp > > > (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) > > > dsi_hblk =3D (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); > > > > > > So, add 10 bytes packet overhead for DSI hblk. > > > > > > 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 | 9 +++++++-- > > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm= /sun4i/sun6i_mipi_dsi.c > > > index 596e560263bf..cf42be1f1ba1 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, vblk; > > > + u16 hbp, hfp, hsa, hblk_max, hblk, vblk; > > > size_t bytes; > > > u8 *buffer; > > > > > > @@ -494,8 +494,13 @@ static void sun6i_dsi_setup_timings(struct sun6i= _dsi *dsi, > > > > > > /* > > > * hblk seems to be the line + porches length. > > > + * The blank is set using a blanking packet (4 bytes + 4 bytes + > > > + * payload + 2 bytes). So minimal size is 10 bytes > > > */ > > > - hblk =3D (mode->htotal - (mode->hsync_end - mode->hsync_start))= * Bpp; > > > +#define HBLK_PACKET_OVERHEAD 10 > > > + hblk_max =3D (mode->htotal - (mode->hsync_end - mode->hsync_sta= rt)) * Bpp; > > > + hblk_max -=3D HBLK_PACKET_OVERHEAD; > > > + hblk =3D max((unsigned int)HBLK_PACKET_OVERHEAD, hblk_max); > > > > I'd rather use the same convention than the other assignments done > > before in that function. >=20 > Yes, old code did use hsa. but it's added 10 bytes packet head instead > of subtracting it. >=20 > hblk =3D mode->htotal * Bpp - hsa; > =3D> mode->htotal * Bpp - (mode->hsync_end - mode->hsync_start) * Bpp - > HSA_PACKET_OVERHEAD); > =3D> (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp + > HSA_PACKET_OVERHEAD; >=20 > And it should be > (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - > HSA_PACKET_OVERHEAD; >=20 > This patch is simply doing the same by explicitly adding packet over > ahead macro, which again used in hfp. That's not my point. The rest of the driver uses a construct that would be: hblk =3D max((unsigned int)HBLK_PACKET_OVERHEAD, (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - H= BLK_PACKET_OVERHEAD); We want to remain consistent. Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --ci7q6bhdxh7l4w2f Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW9//3QAKCRDj7w1vZxhR xXDlAQCy41zJkLARcZDuRMle7LiwCzB51w1Y9O1/0zZ7+XJpwwEA/W21ByuwF0lq b4vhD9U6mdnJ7ri/04Us9m1k9pKHMgw= =oSFB -----END PGP SIGNATURE----- --ci7q6bhdxh7l4w2f--