From patchwork Sat Nov 3 10:08:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10666661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4094F17DB for ; Sat, 3 Nov 2018 14:23:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E2E5287C2 for ; Sat, 3 Nov 2018 14:23:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 226BB288BC; Sat, 3 Nov 2018 14:23:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3726287C2 for ; Sat, 3 Nov 2018 14:23:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0045B6EED9; Sat, 3 Nov 2018 14:23:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 326216E682 for ; Sat, 3 Nov 2018 10:09:45 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id f12-v6so955898plo.1 for ; Sat, 03 Nov 2018 03:09:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tQh0tuZ2hAQEjHoUC9QKXmQksrNiyamIN0Q5qO8zC0c=; b=rGq+MWo9kDQZQ7vl+9r54usyNpGqVzGRARGp8uatCY/9eYqdrPx2z/s4AHXMIbilu5 gFSyCOS61/4eB0bD1vU3llk6ip5EM3T7sAV48a6m8RZrNTZUM/zpvnF+uBloNeWUNsMb 6unJum/SY/BV3xwJ04OwEeaKYIcSQF2hW+vplFFB4aGiVd/G//NA/tuirZG7Eqt5GVKr Lwt8ZLrrzyIBZjvkfoTiOT/cP8aJntqf2NtWIYWFivsOd/BV21sRhqAb++80/hapOCFi 9qPEGvM1STTtPvXTS8Edke02vaGU7OMeYXfYxrX2F/ymnCMAGQGOcPxpSmyl8Lh2+p05 W5Cg== X-Gm-Message-State: AGRZ1gLtig2HU6JLqI1mUzo73Q9V2uKVJdfjoiEoHJKeXQi9VZASRIhr cHNUnBdIkZie5hxS4eG8kzSgaA== X-Google-Smtp-Source: AJdET5co6HBSmkyR3+nJstdmG+aMIQ/YeXFBJ5+1R0rTOwg3wKCJwtBITHmn30omsMCoAShKnmAHzg== X-Received: by 2002:a17:902:a5cc:: with SMTP id t12-v6mr6717272plq.298.1541239784745; Sat, 03 Nov 2018 03:09:44 -0700 (PDT) Received: from localhost.localdomain ([2405:204:6094:3f7a:ed0a:fb74:1220:defe]) by smtp.gmail.com with ESMTPSA id z79-v6sm28466823pfl.33.2018.11.03.03.09.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Nov 2018 03:09:44 -0700 (PDT) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , 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: [PATCH 03/10] drm/sun4i: sun6i_mipi_dsi: Setup burst mode timings Date: Sat, 3 Nov 2018 15:38:53 +0530 Message-Id: <20181103100900.30313-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181103100900.30313-1-jagan@amarulasolutions.com> References: <20181103100900.30313-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 03 Nov 2018 14:23:26 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; + } } /* How many bytes do we need to send all payloads? */