From patchwork Fri Oct 26 14:43:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10659115 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 6AE6113B5 for ; Mon, 29 Oct 2018 11:11:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C86129732 for ; Mon, 29 Oct 2018 11:11:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5018429868; Mon, 29 Oct 2018 11:11:59 +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 F18D929732 for ; Mon, 29 Oct 2018 11:11:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDDC189D84; Mon, 29 Oct 2018 11:11:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AE856E4A7 for ; Fri, 26 Oct 2018 14:45:20 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id h4-v6so655345pfi.10 for ; Fri, 26 Oct 2018 07:45:20 -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=4csUWAGh39LPVgyuP+BQQjALYVYKTKyjREVujLRWfRw=; b=qrIb+GDuSwvHe+xZ6ASLw6DK6Nhga/8KjxgNGjIirz6tKIiJ4vW7aJrAMkbt0AJ3jx SOzarNWQrv4m2U74zbOZYt57eSjSRshFKm2TORirGBvXVL9x01epZ8p8s82RUzPwEKDi 4kbDlQZ+o88Cs8SSEpCsDbw0z6ULRrV79WhO4pUM1qzgD6nnT+mTcy5wnrYOXEEqWAhk wwmElsUNwqbPeFSi0T5BcK5GvG+B17AXNx8U7bq1yjDgavjmf1tTt9fNBUuZpVbV7z2P 5JkvEzxnpTP8xUdqB6zQPM/Po7wfxZxbNY9BTsEQGDoyHYiqTqtMTObOVsfPKYHTM22w /lVA== X-Gm-Message-State: AGRZ1gI5KIbfr04b7VfG4GdWSqyPjsJfX3Nbd2WYy0W0UsylJRD7zcKh OyFq2jEnHH9dw4m3jw+fCqoXkA== X-Google-Smtp-Source: AJdET5c0tXb2s+1FRPYuGryZehtZmX1lbn3/l7r7tI90/Q924c3f00RKXW9dcyKBilDNBUefaClUeQ== X-Received: by 2002:a63:cd45:: with SMTP id a5-v6mr3833382pgj.43.1540565119859; Fri, 26 Oct 2018 07:45:19 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id z22-v6sm12044467pgv.24.2018.10.26.07.45.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:19 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 12/25] drm/sun4i: sun6i_mipi_dsi: Add DSI hblk packet overhead Date: Fri, 26 Oct 2018 20:13:31 +0530 Message-Id: <20181026144344.27778-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181026144344.27778-1-jagan@amarulasolutions.com> References: <20181026144344.27778-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 29 Oct 2018 11:10:30 +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 Add 10 bytes packet overhead for hblk where blank is set using a blanking packet like (4 bytes + 4 bytes + payload + 2 bytes) This is according to BSP code from BPI-M64-bsp (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); So, add 10 bytes packet overhead for DSI hblk. 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 596e560263bf..cf42be1f1ba1 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, vblk; + u16 hbp, hfp, hsa, hblk_max, hblk, vblk; size_t bytes; u8 *buffer; @@ -494,8 +494,13 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* * 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 */ - hblk = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp; +#define HBLK_PACKET_OVERHEAD 10 + hblk_max = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp; + hblk_max -= HBLK_PACKET_OVERHEAD; + hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, hblk_max); /* * And I'm not entirely sure what vblk is about. The driver in