From patchwork Fri Oct 26 14:43:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10657543 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 B3B315A4 for ; Fri, 26 Oct 2018 14:53:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F62E2C955 for ; Fri, 26 Oct 2018 14:53:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92F522C956; Fri, 26 Oct 2018 14:53:05 +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 232F12C954 for ; Fri, 26 Oct 2018 14:53:05 +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=HRL5rE5R7ugvNQdsa4DKew2Ot05SxsAo9X1oqjR0NZU=; b=jgzfJrp32IqZio r9l8ieXpHlmRgX+N6TFPuounzg5LOKZb8Bn4gaoQI4u/scRO3Ut5b16loA6HxMSOlMyhdtFvWWuN7 KIFQIHvCeeliADlNtGCuu8HMVkswujWZL5HhuJerv2OGtaJynjkCocstO75zjaA9a2K7llomKaYOH bMV5VcarvT3kc2DzrSscWtYOF2FSw7VjYhm3sgsC6Ze4dLzT1najN85ex8y9apPdVzmFHKSLmhpjB 7M15et9TghuqkeGM6tWKmszzQ7rxp8cECGMcGIrKxhG+xsL44U1wO9U5OGl7ua8g8L1gwo5RJHucE v9Mp7DumHiStzhFtGhFg==; 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 1gG3Tw-0006yl-8k; Fri, 26 Oct 2018 14:53:00 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3My-0002b3-2D for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 14:47:48 +0000 Received: by mail-pl1-x643.google.com with SMTP id bh10-v6so628332plb.4 for ; Fri, 26 Oct 2018 07:45:37 -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=UenRKo6OwvlFVAyYotlbn7LHAAkj6pMaa7wSfZK+ZAg=; b=qCn+CrVtnXCEoxMdBkn7/Ql4nXBkUWxhrhSwVTUosuf/V+OH4kIQFcbpvN+Hv1aNF/ bNM0CftpaS6doZ9THR5unnaaaS4ehW65SrhzLsP8bZB/em+6iIvTQv3P4Q2+62KRAZCy 96qifaCVulYjBpIKrIpRlvSnaeMOsa3NXGGFY= 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=UenRKo6OwvlFVAyYotlbn7LHAAkj6pMaa7wSfZK+ZAg=; b=flM9QXitlyOUg3gfS2KDrOZSM8qcQXr1GMyh10w73g0wtA+Wv4pOivjAYqlOUhlxq5 pjd4irYJ+nsrRsNRWoiKiL+c0PaSpqbPTqm4GnDjKTalLF+mA/T6ChF12/IXOq5AUznj EiZcblIq7V7ImVHe1mcm5WE6j0rYRVcJaJzkpVzo6XpvuHBf8tMTJzqPfWckpHr5Np2v 6QzCl1uF0NME4Kb0FBJHPopjDS+Cd/579sFlF56e5LynCwfDNgnHwngK9dMpkzeDNrkw RhYv19TRUi6QUgWJ5vZb50kES/3mAL+dIqlszAV/5IR3KRGnfs0TyH8jR0MiGB4ZFBps HLuQ== X-Gm-Message-State: AGRZ1gIAgs6beZYhk6KmG9+awkmZuynHkQDgRu+p9a3M0CmfrMmFzY+9 9zT8tkWkuRnAYsaP7N2mZQZb7woEJok= X-Google-Smtp-Source: AJdET5fDAHkS/vHusTVMTAA1dHL/rHuu08w6nk79FMLY4a8CZbFU+ntkK0EOPt7KCuk2ibeUTT0tXg== X-Received: by 2002:a17:902:bb96:: with SMTP id m22-v6mr3748802pls.117.1540565136958; Fri, 26 Oct 2018 07:45:36 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:36 -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 15/25] drm/sun4i: sun6i_mipi_dsi: Set proper vblk timing calculation Date: Fri, 26 Oct 2018 20:13:34 +0530 Message-Id: <20181026144344.27778-16-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_074548_221382_E77517ED X-CRM114-Status: GOOD ( 17.34 ) 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 Unlike hblk, the vblk timings should follow an equation to compute the desired value for lane 4 devices and rest of devices it would be 0. BSP code from BPI-M64-bsp is computing vblk as for 4-lane devices (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) tmp = (ht*dsi_pixel_bits[format]/8)*vt-(4+dsi_hblk+2); dsi_vblk = (lane-tmp%lane); So, update the vblk timing calculation accordingly. 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 20e330186b7f..42bd7506abaf 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -511,8 +511,19 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, * Allwinner BSP is using a rather convoluted calculation * there only for 4 lanes. However, using 0 (the !4 lanes * case) even with a 4 lanes screen seems to work... + * + * The vertical blank is set using a blanking packet (4 bytes + + * payload + 2 bytes). Its minimal size is therefore 6 bytes */ - vblk = 0; +#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; + } /* How many bytes do we need to send all payloads? */ bytes = max_t(size_t, max(max(hfp, hblk), max(hsa, hbp)), vblk);