public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Cc: Maarten Lankhorst
	<maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>,
	Jernej Skrabec <jernej.skrabec-gGgVlfcn5nU@public.gmane.org>,
	Vasily Khoruzhick
	<anarsoul-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Michael Trimarchi
	<michael-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>,
	TL Lim <tllim-F7SikzrIcFYdnm+yROfE0A@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH 03/10] drm/sun4i: sun6i_mipi_dsi: Setup burst mode timings
Date: Mon, 5 Nov 2018 11:40:13 +0100	[thread overview]
Message-ID: <20181105104013.lvijeim57vojjfip@flea> (raw)
In-Reply-To: <20181103100900.30313-4-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 5241 bytes --]

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.
> 
> Reference code taken from BSP
> (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c)
> dsi_hsa  = 0;
> dsi_hbp  = 0;
> dsi_hact = x*dsi_pixel_bits[format]/8;
> dsi_hblk = dsi_hact;
> dsi_hfp  = 0;
> dsi_vblk = 0;
> 
> Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
> ---
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 108 ++++++++++++++-----------
>  1 file changed, 60 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/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_dsi *dsi,
>  
>  	/* Do all timing calculations up front to allocate buffer space */
>  
> -	/*
> -	 * 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 == MIPI_DSI_MODE_VIDEO_BURST) {
> +		hsa = 0;
> +		hbp = 0;
> +		hblk = mode->hdisplay * Bpp;
> +		hfp = 0;
> +		vblk = 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 = 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 = 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 = 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 = 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 = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp;
> -	hblk_max -= HBLK_PACKET_OVERHEAD;
> -	hblk = 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 = (mode->htotal -
> +			   (mode->hsync_end - mode->hsync_start)) * Bpp;
> +		hblk_max -= HBLK_PACKET_OVERHEAD;
> +		hblk = 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 = (HFP_PACKET_OVERHEAD + HBLK_PACKET_OVERHEAD);
> -	hfp = 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 = (HFP_PACKET_OVERHEAD + HBLK_PACKET_OVERHEAD);
> +		hfp = 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 == 4) {
> -		int tmp;
> -
> -		tmp = (mode->htotal * Bpp) * mode->vtotal -
> -		      (hblk + VBLK_PACKET_OVERHEAD);
> -		vblk = (device->lanes - tmp % device->lanes);
> -	} else {
> -		vblk = 0;
> +		if (device->lanes == 4) {
> +			int tmp;
> +
> +			tmp = (mode->htotal * Bpp) * mode->vtotal -
> +			      (hblk + VBLK_PACKET_OVERHEAD);
> +			vblk = (device->lanes - tmp % device->lanes);
> +		} else {
> +			vblk = 0;
> +		}
>  	}

We should make this a couple of functions to make things more
readable.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2018-11-05 10:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03 10:08 [PATCH 00/10] drm/sun4i: Allwinner MIPI-DSI Burst mode support Jagan Teki
2018-11-03 10:08 ` [PATCH 01/10] drm/sun4i: sun6i_mipi_dsi: Compute burst mode loop N1 instruction delay Jagan Teki
2018-11-03 15:23   ` Sergey Suloev
     [not found]     ` <8365df14-3397-b395-48eb-3070da3b65fc-RHPENKW2UW+1Z/+hSey0Gg@public.gmane.org>
2018-11-04 16:45       ` Jagan Teki
     [not found]   ` <20181103100900.30313-2-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2018-11-04 17:57     ` Priit Laes
2018-11-05 10:38   ` Maxime Ripard
     [not found] ` <20181103100900.30313-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2018-11-03 10:08   ` [PATCH 02/10] drm/sun4i: sun6i_mipi_dsi: Support instruction loop selection Jagan Teki
     [not found]     ` <20181103100900.30313-3-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2018-11-05 10:38       ` Maxime Ripard
2018-11-05 11:26         ` Jagan Teki
2018-11-06 15:52           ` Maxime Ripard
2018-11-03 10:08   ` [PATCH 03/10] drm/sun4i: sun6i_mipi_dsi: Setup burst mode timings Jagan Teki
     [not found]     ` <20181103100900.30313-4-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2018-11-05 10:40       ` Maxime Ripard [this message]
2018-11-03 10:08   ` [PATCH 06/10] drm/sun4i: sun6i_mipi_dsi: Enable 2byte trail for 4-lane burst mode Jagan Teki
2018-11-03 10:08   ` [PATCH 07/10] drm/sun4i: sun6i_mipi_dsi: Enable burst mode HBP, HSA_HSE Jagan Teki
2018-11-05 10:46     ` Maxime Ripard
2018-11-03 10:08   ` [PATCH 08/10] dt-bindings: panel: Add Feiyang FY07024DI26A30-D MIPI-DSI LCD panel Jagan Teki
2018-11-12 23:37     ` Rob Herring
2018-11-03 10:08   ` [PATCH 09/10] drm/panel: " Jagan Teki
2018-11-04 20:43     ` Sam Ravnborg
     [not found]       ` <20181104204354.GA12651-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
2018-11-05  6:53         ` Jagan Teki
2018-11-03 10:08 ` [PATCH 04/10] drm/sun4i: sun6i_mipi_dsi: Setup burst mode Jagan Teki
     [not found]   ` <20181103100900.30313-5-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2018-11-05 10:44     ` Maxime Ripard
2018-11-03 10:08 ` [PATCH 05/10] drm/sun4i: sun6i_mipi_dsi: Enable " Jagan Teki
     [not found]   ` <20181103100900.30313-6-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2018-11-05 10:45     ` Maxime Ripard
2018-11-03 10:09 ` [PATCH 10/10] [DO NOT MERGE] arm64: allwinner: a64: pine64-lts: Enable Feiyang FY07024DI26A30-D DSI panel Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181105104013.lvijeim57vojjfip@flea \
    --to=maxime.ripard-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=anarsoul-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=icenowy-h8G6r0blFSE@public.gmane.org \
    --cc=jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org \
    --cc=jernej.skrabec-gGgVlfcn5nU@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=michael-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tllim-F7SikzrIcFYdnm+yROfE0A@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox