Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3463114imd; Mon, 29 Oct 2018 07:31:57 -0700 (PDT) X-Google-Smtp-Source: AJdET5fUfFTy4q8XMbX1H5gwpljyuBaH4UvlaY9snZvXhuQ8j9LmvFsIvqgvAHA9cnmX+kvAtJzJ X-Received: by 2002:a62:6801:: with SMTP id d1-v6mr15350235pfc.7.1540823517700; Mon, 29 Oct 2018 07:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540823517; cv=none; d=google.com; s=arc-20160816; b=wWwi5uZjcxtQlx1KKQIDwHZxB5XUJ6I5w0fGkvMc0Et+DErdYpi/mI6Eezv7lW2smx wWjA7xyAcSSRuN1iYF9pVt0eNSyDNJU/CjUz/rvPViFk7ZqXn1PeuYqgqixSIyH7FjDC 1OU+hOVAc6ZjY4EeOETURpELW+Z9T5EjOyIYFANFZ3sdim1YMvhfxUCNoW61D51a++WN ANc0UGWmwT1E5oWfauTigekQLGBCmMVTFOXAVfIhFByRxUTcuGWPe0CvbipwyIIrl6Ma WFSiAVrGQ6kVx04oJk9dKCXlV66t6jDy2hi28Ugrl+EoZffOevDUe/KlVgmxfRbfdl/r HDXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=csIQGmJZW/l9oIw4NG0CrTd9Cu8XhuD8enkaPjecEOQ=; b=S+404rLdggCkD914kHQxFpPSaAFDqYUfRujZl/A7M/0XNVzCUVtEaZzUcplCB8AY2l J4xRTIeGEqMDb92fYnDiiIlHKgYKqdpj5bHUv6fNKMcoO4/gr0yRT2M0+DJYhLHTwJOZ PCceSoKU0Vdq54ZR4iWS0Af/vUK7z1ntqxiX5VJZGVSFoqdSSPo1lLwyHnac9ztuyk/S nKcK80rlY02OUBeDGbKvUJf+UYLAwLcfkqvJ5gPD4Xd6dui43NflMiCZprDqrACXJLZe pkvrWwvJyt518uc4ynxwUUXaTnSMkHGW2GMibu2uf7Tfjhc7zWNw8E3dqPFgZIPp9ESL 7ecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iKZ2wHaT; 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 f7-v6si9230012plb.362.2018.10.29.07.31.41; Mon, 29 Oct 2018 07:31:57 -0700 (PDT) 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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iKZ2wHaT; 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 S1727308AbeJ2XRA (ORCPT + 99 others); Mon, 29 Oct 2018 19:17:00 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:36149 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbeJ2XRA (ORCPT ); Mon, 29 Oct 2018 19:17:00 -0400 Received: by mail-it1-f193.google.com with SMTP id t4-v6so1275707itf.1 for ; Mon, 29 Oct 2018 07:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=csIQGmJZW/l9oIw4NG0CrTd9Cu8XhuD8enkaPjecEOQ=; b=iKZ2wHaTvE6ksFUFqShoFkngC/STPgBDWs2hcguLbzLZ4nnwOXBV55Io9yOrnjVDRP A8D0rscbbtt5lc/YhuaOPNF+dAC3rKYM3JCa3eXKBCfvEcd+XqLdMWeJW91eyspZEbar PSZHe/jQoMXeKckz6dNitLi+Whoi2zwV8gsgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=csIQGmJZW/l9oIw4NG0CrTd9Cu8XhuD8enkaPjecEOQ=; b=nPY7byLu61IvJmydu5XUBaizxH/gwfH2kbwXdnIwTkCMh0Xj5+4YSxbYgvFxjaY1FO M3+cTdiAp08JVa+xl05ppH/w8MYTyaTQQ5xGKDAL6+wgfie7M65cZHvr88lS1BowEyg5 Na+IW5M9euHHjOJZpw941jpHuF2+y91ctOpWuAhEhViP2yYHCfYGcR9bFNKABHGZpORJ ZorWVHrD9ryH43NZh/BDJH6nWI/W8fdsab5r29Xv+0enGjH0wKH7Ocw8N01w7k6M1Cb0 BtfHY1+fgq5pzUgwbRGwRTCgIMHwjRFLeF8V0Q/0+22QXflnrSSSxk5hOM0WjwAzFJhJ W9mQ== X-Gm-Message-State: AGRZ1gKtDxYBC4JI2koGfSv7isa3PFkLrGEz4q4wyISXGWyhZbXqP3fS Y+oJ+8qY03iMMcI1s63sDa3apF2U35nZC4qbJWd9aA== X-Received: by 2002:a02:94d:: with SMTP id f74-v6mr10579109jad.85.1540823287094; Mon, 29 Oct 2018 07:28:07 -0700 (PDT) MIME-Version: 1.0 References: <20181026144344.27778-1-jagan@amarulasolutions.com> <20181026144344.27778-15-jagan@amarulasolutions.com> <20181029092754.2tl7i5k5qpbn4557@flea> In-Reply-To: <20181029092754.2tl7i5k5qpbn4557@flea> From: Jagan Teki Date: Mon, 29 Oct 2018 19:57:56 +0530 Message-ID: Subject: Re: [PATCH v3 14/25] drm/sun4i: sun6i_mipi_dsi: Increase hfp packet overhead To: Maxime Ripard 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = (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. > > "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. Verified based on the BSP calculation which I explained in commit message and tested by validating these numbers with mainline vs bsp code.