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: 10657625 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 EA8DD5A4 for ; Fri, 26 Oct 2018 15:50:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D60512CA77 for ; Fri, 26 Oct 2018 15:50:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3D202CAAB; Fri, 26 Oct 2018 15:50:40 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 58CBA2CA9D for ; Fri, 26 Oct 2018 15:50:40 +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=Ed2ZiY8sq4zlB9vf0Np64oPk8hACCnC44CmKPk8oix0=; b=ey22xf30vFOsFJ pknl43GKB6Bgabs8aOrYKkdi5hCG6nEoPtG0skXmoJLoG0JPuBjDaqJo6qWHMpK1fo1xIfZk5vn6/ yFShHhR6Xpcz08RTH0sSkyQe3r0RcyCiauUD9RwgkLGq7IaG+ew2yne3T77/kRT/MBU0/UZNGIyg/ ZTW3GyOS25sqxp7dCi5Fwb8Fv5bJwtsw9QFztzHSbZFy4/7/unlQ/hNAyMfffsKoXfkji16/jkiCj PGmSCcEccMJW/iAXSQC/yEcQzg2V5WOqVjh3eVlOWRKWZ7kGls2e63kNXBCwRGZdzqO7UU4zAe0Ig heIaSIZPyRS1xLKmWBcw==; 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 1gG4Ng-0006U9-5k; Fri, 26 Oct 2018 15:50:36 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG4KT-0003vT-N8 for linux-arm-kernel@bombadil.infradead.org; Fri, 26 Oct 2018 15:47:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4csUWAGh39LPVgyuP+BQQjALYVYKTKyjREVujLRWfRw=; b=XhT1tfxZ3gY7zwTjeRPj3ybrSZ G4fnfUTor7EtM/EM8ZacBMIiKSPn6QVXN9noyC6ahtf8zY9D3Z8+EfySoppmvV+2VOzMoX1v7dWju 3uPj+iwr5Gv2Km+VFATXY1XBDK7Q9RGhAPodORleV8FTDGjOZyPcP3+Ov+zWC60l6MGkZtfTAtdWa KGVIcIHS1nV163Xf2SDjoFqRbSI8529wst/VeByPzhbdxK3N30yzG55Wc1vdXSZW+RE/7ZWscPWr3 QJdN5y3WMk9KVMBqiIhHKeVFYAwLXoraoxnPWRoZa5fpoGhWR4xJw9cLN+5knCqr11hMIW+7n6tns FEIouFhg==; Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3Mi-0002nf-Hg for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 14:45:33 +0000 Received: by mail-pf1-x442.google.com with SMTP id j2-v6so651209pfn.11 for ; Fri, 26 Oct 2018 07:45:22 -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=4csUWAGh39LPVgyuP+BQQjALYVYKTKyjREVujLRWfRw=; b=jxjJGsVQTf4etw0gieZ0E4SLLyhVdfXzLDPUOBbqTFMgj1yDnsshq5HreLLziEINQU eVXpfdh6aUPZJyK1aIK0hQIbJ+KcrGMVYHmH+h3NukXPerPpmNMWhipOw8LpR1h1aVKs T2dRZo68+VnxS0ga8BiznjUjHC9dhOfbSfaEc= 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=dCR59jQB0Jgyawz8Mv5O0kc1ulSgfl04L/nckNcl731NU/jIYhGQsIvA9y8Y/sFBKi IWBwaDJQYovUOTr5d4ANsaBYdSUED9JFlOt9AFvtKBMqtfSvkpCYofRfNwsRT49pb1Wa xLi4g99FKIHixm5pkznObI62xgZ+7sHCUGnKXGpg3nukGGfaU2r3tBeOhpnhWQvuenOY tQG/BYy49GfPSzRpyd0wLpp3YigELYIGn573SBfBff1HBuGQ+5CR/6nE+bnvqp7R64oV yFghBAEtyxU+HheuOino+g38Iot8f815ZW9q/lB506ZwNJ0TAHW7OEcDlHQyRva/+JmQ eBNg== X-Gm-Message-State: AGRZ1gIGt8gc2NNuppFvQMKVb0cqpqxd8gHIxsTgh86kXAn6aHv/GnfB fQ4uzK0sqjOdR29udnLuDhDb7w== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_104532_649390_B7759A7D X-CRM114-Status: GOOD ( 16.91 ) 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 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