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: 10666607 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 16E98109C for ; Sat, 3 Nov 2018 10:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 007FD28E06 for ; Sat, 3 Nov 2018 10:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E856129180; Sat, 3 Nov 2018 10:13:35 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1D12928E06 for ; Sat, 3 Nov 2018 10:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jVIUWatlcnkvDcVon05eyldBtX7kDBZt0RfChba7irI=; b=Xo9P7D9c0U83Mk a6Rc9bH2qRPwBiEqFgTAT27N2K99WpU5CjPqvXCjVLU24cKyXvIN5yhKplM5PzS6bBpJBgMn3vGJb 3Qlu+pWohRsMdFuV4NjQLZQZIPc6aWKD4ndNQZrZP2hZ9TwYLMvv9RMhA91V4Ew7Jnt6ddjFTRBQw mnotCyUS6YE7A/YCSfI79oGKDV3V/pD8gKt4bWr5/yu6MU4/2ZRKgk+jbjBuiqHkZ5jMUtQXQxWFu T7VFKIYDOVMSp44sxQ9yZwxRsEFXxtRN1T/J7mnEzi9BqYSwvh92nhglhTg7EyxF/+exrbR16LSjv cxKy2RAgfbsuGsjfqbNg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gIsvs-0005N2-Gd; Sat, 03 Nov 2018 10:13:32 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gIssN-0002n0-9H for linux-arm-kernel@lists.infradead.org; Sat, 03 Nov 2018 10:09:58 +0000 Received: by mail-pl1-x641.google.com with SMTP id f12-v6so955897plo.1 for ; Sat, 03 Nov 2018 03:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tQh0tuZ2hAQEjHoUC9QKXmQksrNiyamIN0Q5qO8zC0c=; b=m8OxtSqNuV73V8tWjYgHpyjiVE/7WW0euNVgtiafVS+UL/gBRFpJztSulsHUqMH6s/ +ir8x8ne92OvGOo78xkxTOgwsqTGjrcz6ueC43QKmkhly2SMHHjXn+nNzKmweQVkug1C aG36zcpFkWEsuzbkk84l0ExrwSXtzvo76wSTk= 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=ih8aH1+eRH80eeGDQmTck5yEhwM3e3Uypm6DcTqByrpLPQcbIHbQpZmgAXgGAGZau3 B0dhjP3J2OPFwJkr4g4up2Ku7rT07Roaub58ek6/Zydq611664dlSOdMokdPTkgaP0l4 ssm9aMZIPhWh/wcjZxJKzaDpTZFAYJzUbEFUyaUBdumicFQ1jiKQ/6lF80q4bkOnsUVS BmkIDYvxtOXAAMIL2BRSg7ZggkErTLMsyBUrIo2yz4zmoe/wTpqGkvjfAmnDqGcPfrfS TUWjZ/hYivmLfUd3XCgMbpHqPCA7E0dIBkXgMm0S25SKkpFxhIeiLqwu71kuqBaTs0AQ aF7A== X-Gm-Message-State: AGRZ1gI9HNMaFUGYvZl6J49iLnbWlvom2ca52/y1Dz1w1zQlR3t3GPfo P4pvz6bOANfTfYqaGaIpZAABnA== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181103_030955_533587_77D4F1C7 X-CRM114-Status: GOOD ( 18.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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? */