From patchwork Tue Nov 13 11:16:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680361 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 0BE881709 for ; Tue, 13 Nov 2018 11:34:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED97629C09 for ; Tue, 13 Nov 2018 11:34:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E159229C1A; Tue, 13 Nov 2018 11:34:37 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 87B6329C09 for ; Tue, 13 Nov 2018 11:34:37 +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=6+h+CJk0w3Lu2Dod01IzxAfU4H3xSg2JhnqiIegR8PI=; b=QsEwFAVjQxjZhK 1p10NFrh/pPMgQ/K4hvcaFMwU//CIAus4Ado78z7t0gv+kX1UkitB3A38IOEa+CS9WrDGmMxHvHYa fBJ+bJ2NBvPy8KPYHaKgLrxg4aIc2usLJuBYW2T30wfYExAjrxE+z8gBf0mNAj0ICV7CmdRbm9vBt oxUR4hRU/EM9NROu5Z3sSMrSjT9ZkcaxpyEiUm9CK6acZdiEHU9dcB7TTcHPssUEdWWNiRnE8Z68I e9e+0exJ9sR/CIu1e7aBT+2JFMTmjArrUebkZ4DVSzbc0ERMKBRUcE+rvpBuAhjFNF6N0jonYyHXE oJjhU95hk1f7IVtTYYtg==; 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 1gMWxg-0002QL-C1; Tue, 13 Nov 2018 11:34:28 +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 1gMWxQ-0001A1-Li for linux-arm-kernel@bombadil.infradead.org; Tue, 13 Nov 2018 11:34:12 +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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=jwKct7jF+J9aV9vu+rBRyxhuTG ca0gpo0VwZkwPqiEtbq18a936KyeLCvBOIaAR8F7eDOqfAM44PGmKlQCornkWSF8i8qOwXRm8xzul O3FzhH49h+eo8tSpmPvDg8xnZzMrqPKUexzgI0jCq9Pb3au+2GkjVXKHiMrs4w1lgQy/Zfq5pDcHS YNBfkB9Scl2v0g4BBHhZlkOrUaiRXnIiWutBQ3KWaUvZjNGfw/c9nARtB+INv0XMArTqYx8Y54/AL k+cTr/SeLc3ugBlX0fqGhqZpny92loXAemJy8HB4mYTIFnPuI1sqyHQEvQ4eIrvAVZTqrF76s7Jjx Y/zosMSA==; Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMWhp-000853-8F for linux-arm-kernel@lists.infradead.org; Tue, 13 Nov 2018 11:18:10 +0000 Received: by mail-pl1-x643.google.com with SMTP id b22-v6so401851pls.7 for ; Tue, 13 Nov 2018 03:17:54 -0800 (PST) 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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=BB0oFzbyBv5R7z1uYdcQbXYHZO2ke8Q0JSzmYAAJZWqmBU7W5Tqu/qJ7oju5yLh+M0 BTgV76I3UqbTdBHAm6BjcOzNihrwYjRHiwEmhnLY77udO6WGyS3Ex0jEM+Ha0K21l5bw cMEldJXuCOXLShiEljxcKqsYpiIALUufk/jAk= 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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=jxQMKyf1UiCwHqeRIgOOpqXpDW6b4IeS2dyoWegcijtKMZPC7msI1IwLfiVv6a1CVR 0xeS8aFSXNK9T1kGivOS+U+5rKnF8gk/s8aY5i65qbsdS/Ql+elBq+Xr8gYj8uuV8Qm9 9AEvU/EjRSMiTctFhqhNHK1KF5vQjZZ6eps4N3HOdKCbxuVpm6dj6UqVblcBnoinfEBb fAsA3LLxzMxcBHKxhcv6hRs3QBEnrNnoE/Dv5CUc3KMU4CX7bMSJTwKnkWQXAXK4H2w4 EUYtruMz3vSZEbnQk+owWVtrIH1V8bWV9vteJaUGJuCunIUcjB2UIVZbq8qc/iflrcUK 2iUA== X-Gm-Message-State: AGRZ1gL4apV8DVyR21Iam8Sj4f0Kx+n0tbsb60fIpSVZXX0JglcfRYzg q3ZJble+pDsEODnsMJi2imzFbw== X-Google-Smtp-Source: AJdET5f+mrDZ5bDWWWhgJXCxIJAe+4fTOZKOyI/2QC3uHKEtUb3GM5vh0xIjgXuvGZyREvsF1uH0fQ== X-Received: by 2002:a17:902:b689:: with SMTP id c9-v6mr4796087pls.306.1542107873098; Tue, 13 Nov 2018 03:17:53 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:52 -0800 (PST) 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, linux-amarula@amarulasolutions.com Subject: [PATCH v4 10/26] drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay Date: Tue, 13 Nov 2018 16:46:17 +0530 Message-Id: <20181113111633.20189-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181113_111805_282262_1D6B4549 X-CRM114-Status: GOOD ( 18.35 ) 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 (from 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 --- 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 fc4252d96c38..f6e3df8d2490 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,