From patchwork Tue Oct 23 15:50:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10653379 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 A38C514BB for ; Tue, 23 Oct 2018 16:16:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91C6E299C2 for ; Tue, 23 Oct 2018 16:16:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 827C329EAB; Tue, 23 Oct 2018 16:16:26 +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 1A80D299C2 for ; Tue, 23 Oct 2018 16:16:26 +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=Y6sOehSbx55XFnbcNjbhiK0T72msy3Qf4eMtP0SAkBs=; b=qL+DlUTGCf+gXk Tqk1z6s/IjqAStNrWmQdF8dc/0wUHj/v2DdLHuZjrZqxgB8OIGn8bDlLPi0filnEoqUbDltOo0/jk 0W4bwx6Y42c80R+TLMC2riEyTP2dnvZ3mf/umV3EpI5DyNNg2lodm7he9Qayp4AxFTL2NnhJxSoKS 4NWnjnHIWslR/mCrG4pAsyagkU0XhJoGtEokd414CTCKy7GLR76wGfYIN5W7LES8f3AHi2uyNf1uQ DCMgoQ8hL2tSIN/3svpTA6qURWASHZETft38t8NU9Y5d6Hq+JBWhd969zuGp+NZpdx6d+1zYewbR3 Ntx/HBJE6RJSR1BDMBeA==; 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 1gEzLx-0000Tr-Mb; Tue, 23 Oct 2018 16:16:21 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gEyyO-0004Xu-NS for linux-arm-kernel@lists.infradead.org; Tue, 23 Oct 2018 15:54:01 +0000 Received: by mail-pf1-x443.google.com with SMTP id c25-v6so888032pfe.6 for ; Tue, 23 Oct 2018 08:51:50 -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=h3lvXaaEY5R/F0dznPRLXAqH2n34ZCnPFDUOB+iRgwM=; b=iTnr6UYVsIoWa/9U1/cxKRVTlP61bw/A7blbPeW9txXE/4aYxmUTnhhHSllDM+ds6R qAlXmWuCEGixsNkVFuRzXoskq0UCmXwm6/W8bzrB4uACgc1h3rfCAo2kzVmUxEe2qI6A K9lULq0o7B++akpf8bVtO0sg50gwt3iGU1KmU= 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=h3lvXaaEY5R/F0dznPRLXAqH2n34ZCnPFDUOB+iRgwM=; b=dL0N3UM6Q9uviQ6/cgqZcZOArsg1oK5A4e6jXXYmmrFsglsAtI2dNZ+04IrDbImqL2 nT97/NW1cIVbUEri+j7QVU3PLBgxhZph6WAhXMHFsOZkF9yRdU2Heyf1TlypySwo01Rp feLyaDrPsW9SpIOX6zsgdB8Kc4TElv4nLRxxebq6qLnh2Orc7OgrgAhaFFIxsUARltTy y/+iErvoBD3IVQW/MJRAfdohxXM6HvuPu3jJAN+h+lvnaddY908HVa4K3+ZSnOgl+UnH i/gxErZY/eTpovgyucLwkPBCaa8ZgKIBYPPkvj/CNMPOXen1MIKte8Nbiit0zRAdrTUG UXvg== X-Gm-Message-State: ABuFfohTy03cYWMzo9CUO+YsJiferSIwNbWOaDf5zl+YkecG6WVP9CQQ 5KAMx/E4QScB1ADnNOMb02Cijg== X-Google-Smtp-Source: ACcGV613EAo6RhMG6M/4/ULzIQ/11ssY8rphLwn+chPHm9bfbBu+09eI6I2kCKaDSk/Rn4S4FZWoDg== X-Received: by 2002:a62:d085:: with SMTP id p127-v6mr24325213pfg.202.1540309909705; Tue, 23 Oct 2018 08:51:49 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id o75-v6sm7442829pfg.0.2018.10.23.08.51.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 08:51:49 -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 v2 09/15] drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay Date: Tue, 23 Oct 2018 21:20:29 +0530 Message-Id: <20181023155035.9101-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181023155035.9101-1-jagan@amarulasolutions.com> References: <20181023155035.9101-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181023_085200_830724_7113ED1B X-CRM114-Status: GOOD ( 15.85 ) 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 Accordingly to BPI-M64-bsp DE DSI code Video start delay can be computed by subtracting total vertical timing with front porch timing and with adding 1 delay line for TCON. Video start delay is computed in BPI-M64-bsp code as 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 --- Changes for v2: - Add detailed commit message 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,