Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp395615imu; Mon, 5 Nov 2018 02:42:32 -0800 (PST) X-Google-Smtp-Source: AJdET5finEN01MLqErfMWvtCBsXMN8i6E/MFFTnPCI3MV3WHjpFxCh4vfCkW9npXJ/xuSkjLU5sV X-Received: by 2002:a63:ff62:: with SMTP id s34mr10099559pgk.325.1541414552445; Mon, 05 Nov 2018 02:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541414552; cv=none; d=google.com; s=arc-20160816; b=v0NTvoewp1YYP9dqZEJtgvya+KAkmyB0oIdD7QeeMPoS/Nx2IJL9f15JY3aRvqfWvH pfMKc3uF2cNtghTKt4b5601svF1YI9xmdeTATF/iQn8X/yqBu16Pm9sU7eEEoa3dQgHI S93eIwmPMRV1nJArPLRMlxaO3MtfFP40yoq63burBOmDzJt4nf8D7wsPpJqlAg02Y275 KJIYAA1vo+IyG4VDPaEARArLNXvhqDrHNn7vn+MPf/9jDg/Y2YFvSm3M8AaF+C4KS4U8 Rkjw6h6oA6NQdZKisFYsF9j1XPYtfaj3nARRGzakGSz6lGJ5HhYv1tYydq4ND6oDibh6 LdVg== 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=qFu3cw9cqQmyFNF7TrI9PXOKDjPf1U1XtYOC/lhgqa8=; b=uhC3itLekPubQWfepOvCgWkPJt2aVd/UepR2fXTiJ9nL+55IYhXY15JulPH9Pksqu0 BCCWNFMz7XonmsHFi5usEnNXFIio3LXl+CCpMIqjbZTCos1ID/9OedG2aTbh3iY1E21b ETxvHQgBpIw3kO4IeGFOEiM7vMxEfPiWm+UCeIJln+TONN0yrsL/fKVNjK8ieotIxaLe 1KyQ5A9/IPoaiMSbmISdug+a7djmtuxjaLnnWk5lvkH0Y8PBYJm186fOXqO+d4blxCgk axJenQzAaZyggzC36OBnGP4fb43G55gcZhBKBnJTn0CapWCInw8cfmXCs4lctf/h4yiP HB8A== 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 v2si32300094pgn.451.2018.11.05.02.42.17; Mon, 05 Nov 2018 02:42:32 -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 S1728874AbeKET7k (ORCPT + 99 others); Mon, 5 Nov 2018 14:59:40 -0500 Received: from mail.bootlin.com ([62.4.15.54]:33193 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbeKET7k (ORCPT ); Mon, 5 Nov 2018 14:59:40 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 20263207F4; Mon, 5 Nov 2018 11:40: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 (unknown [185.94.189.188]) by mail.bootlin.com (Postfix) with ESMTPSA id 3FE76207B0; Mon, 5 Nov 2018 11:40:13 +0100 (CET) Date: Mon, 5 Nov 2018 11:40:13 +0100 From: Maxime Ripard To: Jagan Teki Cc: Maarten Lankhorst , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com Subject: Re: [PATCH 03/10] drm/sun4i: sun6i_mipi_dsi: Setup burst mode timings Message-ID: <20181105104013.lvijeim57vojjfip@flea> References: <20181103100900.30313-1-jagan@amarulasolutions.com> <20181103100900.30313-4-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oxno3av5f5bcb3xw" Content-Disposition: inline In-Reply-To: <20181103100900.30313-4-jagan@amarulasolutions.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --oxno3av5f5bcb3xw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 03, 2018 at 03:38:53PM +0530, Jagan Teki wrote: > Burst mode display timings are different from convectional > video mode so update the horizontal and vertical timings. >=20 > Reference code taken from BSP > (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) > dsi_hsa =3D 0; > dsi_hbp =3D 0; > dsi_hact =3D x*dsi_pixel_bits[format]/8; > dsi_hblk =3D dsi_hact; > dsi_hfp =3D 0; > dsi_vblk =3D 0; >=20 > Signed-off-by: Jagan Teki > --- > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 108 ++++++++++++++----------- > 1 file changed, 60 insertions(+), 48 deletions(-) >=20 > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun= 4i/sun6i_mipi_dsi.c > index 077b57ec964c..4965b2c71e4c 100644 > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > @@ -479,59 +479,71 @@ static void sun6i_dsi_setup_timings(struct sun6i_ds= i *dsi, > =20 > /* Do all timing calculations up front to allocate buffer space */ > =20 > - /* > - * A sync period is composed of a blanking packet (4 bytes + > - * payload + 2 bytes) and a sync event packet (4 bytes). Its > - * minimal size is therefore 10 bytes > - */ > + if (device->mode_flags =3D=3D MIPI_DSI_MODE_VIDEO_BURST) { > + hsa =3D 0; > + hbp =3D 0; > + hblk =3D mode->hdisplay * Bpp; > + hfp =3D 0; > + vblk =3D 0; > + } else { > + /* > + * A sync period is composed of a blanking packet (4 bytes + > + * payload + 2 bytes) and a sync event packet (4 bytes). Its > + * minimal size is therefore 10 bytes > + */ > #define HSA_PACKET_OVERHEAD 10 > - hsa =3D max((unsigned int)HSA_PACKET_OVERHEAD, > - (mode->hsync_end - mode->hsync_start) * Bpp - HSA_PACKET_OVERHEAD); > - > - /* > - * The backporch is set using a blanking packet (4 bytes + > - * payload + 2 bytes). Its minimal size is therefore 6 bytes > - */ > + hsa =3D max((unsigned int)HSA_PACKET_OVERHEAD, > + (mode->hsync_end - mode->hsync_start) * Bpp - > + HSA_PACKET_OVERHEAD); > + > + /* > + * The backporch is set using a blanking packet (4 bytes + > + * payload + 2 bytes). Its minimal size is therefore 6 bytes > + */ > #define HBP_PACKET_OVERHEAD 6 > - hbp =3D max((unsigned int)HBP_PACKET_OVERHEAD, > - (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); > - > - /* > - * 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 > - */ > + hbp =3D max((unsigned int)HBP_PACKET_OVERHEAD, > + (mode->htotal - mode->hsync_end) * Bpp - > + HBP_PACKET_OVERHEAD); > + > + /* > + * 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 > + */ > #define HBLK_PACKET_OVERHEAD 10 > - hblk_max =3D (mode->htotal - (mode->hsync_end - mode->hsync_start)) * B= pp; > - hblk_max -=3D HBLK_PACKET_OVERHEAD; > - hblk =3D max_t(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. > - */ > + hblk_max =3D (mode->htotal - > + (mode->hsync_end - mode->hsync_start)) * Bpp; > + hblk_max -=3D HBLK_PACKET_OVERHEAD; > + hblk =3D max_t(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 =3D (HFP_PACKET_OVERHEAD + HBLK_PACKET_OVERHEAD); > - hfp =3D max((unsigned int)hfp_pkt_overhead, > - (mode->hsync_start - mode->hdisplay) * Bpp - > - hfp_pkt_overhead); > - > - /* > - * The vertical blank is set using a blanking packet (4 bytes + > - * payload + 2 bytes). Its minimal size is therefore 6 bytes > - */ > + hfp_pkt_overhead =3D (HFP_PACKET_OVERHEAD + HBLK_PACKET_OVERHEAD); > + hfp =3D max((unsigned int)hfp_pkt_overhead, > + (mode->hsync_start - mode->hdisplay) * Bpp - > + hfp_pkt_overhead); > + > + /* > + * The vertical blank is set using a blanking packet (4 bytes + > + * payload + 2 bytes). Its minimal size is therefore 6 bytes > + */ > #define VBLK_PACKET_OVERHEAD 6 > - if (device->lanes =3D=3D 4) { > - int tmp; > - > - tmp =3D (mode->htotal * Bpp) * mode->vtotal - > - (hblk + VBLK_PACKET_OVERHEAD); > - vblk =3D (device->lanes - tmp % device->lanes); > - } else { > - vblk =3D 0; > + if (device->lanes =3D=3D 4) { > + int tmp; > + > + tmp =3D (mode->htotal * Bpp) * mode->vtotal - > + (hblk + VBLK_PACKET_OVERHEAD); > + vblk =3D (device->lanes - tmp % device->lanes); > + } else { > + vblk =3D 0; > + } > } We should make this a couple of functions to make things more readable. Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --oxno3av5f5bcb3xw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW+AeDQAKCRDj7w1vZxhR xYHJAQCzcpDuQnKovM0bUuEaS44c1YuP0f06cccSNeUzXBrEjAD/U4yoeMnwnp8Q jr8dQQ8uRSXbkbuA8nGR/mo5xpvspw4= =a7j+ -----END PGP SIGNATURE----- --oxno3av5f5bcb3xw--