From patchwork Fri Oct 26 14:43:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10657587 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 37CCF13A4 for ; Fri, 26 Oct 2018 15:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A4472C9DB for ; Fri, 26 Oct 2018 15:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E9742C9DD; Fri, 26 Oct 2018 15:19:14 +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 A7C962C9DB for ; Fri, 26 Oct 2018 15:19:13 +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=RM3FKzp14Z6OGTLamLL/SqGmLUSLIxlMuorSuX3indQ=; b=tu4QT+J5DPbta9 wcFcrKPuaZNkCK473VnULq5w3EfF4NFb4uQKfha37kiYV0+S7S/VFPY9IsZEvNX+srmbsm/N4ezLT DNcQXzYq+3tDachK3KF0axcevnBKObJpf2mhqBSkVkM4Bs5uSzudQ1M46xnczm3FMxwNxFBffnm3s Y9bz9Ym2H/IGOetMr3EFDPK33SneBnhqfHexrDcU1ciEEOe0ri4GlEmtMwOa1RHY9/IgtBD7rtBzt /TrmEpDociBEBQXERZEhw8HmYcm4VAqTSRXaEIfxjIQyV4JGyEPAfH9BJTH7TTVn8Rb8QyeTnC2ji /2Xw3uluuifJACo4tO4Q==; 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 1gG3tE-0000uk-KJ; Fri, 26 Oct 2018 15:19:08 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3bt-00012G-Vr for linux-arm-kernel@bombadil.infradead.org; Fri, 26 Oct 2018 15:01:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=ygp+3SnprJhnbmLUgRdGawXUPjC/BTULTbCFbZ067cc=; b=uknX8x/YVRmzeQGkXhNxA3Pva3 gVdFVNB3TEP5FE9ZpIajv+J+8Xq9ty5zPQRckBVzFWEsXRD6Mdc8dz6+rUW0ANEMjHKALtxrEb9m3 sjv25ZRYAktdthcjbcMORNzzw//Uzv26hXWd5cwE1bg8nma0/rChN4NHTjuFc4MvT5oZUciRjeWO1 2aPUTNT7hkVXwW68d574foZ6nXHyiSBcstfdvGGn1p9mm6XkyN1GYt99VyUAa30TPM0KZ5XpDhsi+ ziaY+KD8qcQ945J2z8Fr4Cdcw/QclEcEhxwiBYEnj+1yGvQRldsENlgOrLasRnSoyguu1GdwbPqyJ XxS/geEA==; Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3MR-0008IJ-Ai for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 14:45:16 +0000 Received: by mail-pl1-x641.google.com with SMTP id p7-v6so624684plk.5 for ; Fri, 26 Oct 2018 07:45:04 -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=ygp+3SnprJhnbmLUgRdGawXUPjC/BTULTbCFbZ067cc=; b=cc1ITzOq6renkXS39VEzpzI9qforSXwKRu53A3Jcd2aCV7FRFjv31cecPUaNvVxUoL vb93mpt2cy4W48WhC3IIdA1VhwXjL11I7qAOmITITn5nM8BLtMby3xvQ4GVbMg1hPp4g I71GuCE7HLRpkqcMqlpl34E9OTCvPCgTWLQhI= 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=ygp+3SnprJhnbmLUgRdGawXUPjC/BTULTbCFbZ067cc=; b=gNsci3hbc9Zg71c7TQ1bXRcxKeakokc/inE5qtseWRdW2YuiPK18JH+Kmj2YtoYS6j PjGwTJwGp8Qb6F3byQoxYAJAoZB5LfVRf5zTdeAYHp6JTaxmeHfj0UMgn9mSgUeETIio /eShYHRjuZKqgdCmeKYSynrXgZ+kfIpQTrbIZerTI0GZ34CaijXpE64Kd8yTewzHUJe6 ssdxeOusCYE6QuQLId6Z0iYGIhW3UlRc6VS3CnFVMJYKRykqw/Wt0c5GTgd6IRDtq+aB 0u9jl3CQTR/pJPUdCeYghJauiutPsNv5inBtx+X+lzpivAMsbHGu47V533/+U/99BSty 5MEA== X-Gm-Message-State: AGRZ1gJuBi1f/WDOW99b+qVas4yxqDW1ul7f2Br91F7V/oCRpd2XYruk 1CfDkIgz93KLZ8DDOZLX8JjO3Q== X-Google-Smtp-Source: AJdET5f7igh1BKVvkMSAzIy+VfsF+TBLbwiw5FU55gW9N+8bQAN/icqoyRMN9cvvaQDvln/5hpjAyw== X-Received: by 2002:a17:902:aa45:: with SMTP id c5-v6mr3889262plr.100.1540565103086; Fri, 26 Oct 2018 07:45:03 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id z22-v6sm12044467pgv.24.2018.10.26.07.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:02 -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 09/25] drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay Date: Fri, 26 Oct 2018 20:13:28 +0530 Message-Id: <20181026144344.27778-10-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_154515_362997_69B52E01 X-CRM114-Status: GOOD ( 18.46 ) 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 Video start delay can be computed by subtracting total vertical timing with front porch timing and with adding 1 delay line for TCON. BSP code form BPI-M64-bsp is computing video start delay as (in linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y) - panel->lcd_y - (panel->lcd_vbp) => timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y - panel->lcd_y - panel->lcd_vbp => timmings->ver_front_porch So, update the start delay computation accordingly. Signed-off-by: Jagan Teki Tested-by: Jagan Teki --- Changes for v3: - Fixed proper commit message - add tested credit Changes for v2: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 8d154cf2e6d6..6bece492b1f7 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -358,7 +358,17 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - return mode->vtotal - (mode->vsync_end - mode->vdisplay) + 1; + u32 vfp = mode->vsync_start - mode->vdisplay; + u32 start_delay; + + start_delay = mode->vtotal - vfp + 1; + if (start_delay > mode->vtotal) + start_delay -= mode->vtotal; + + if (!start_delay) + start_delay = 1; + + return start_delay; } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,