From patchwork Mon Dec 10 16:17:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 79 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f70.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id 4D6C12E54AF for ; Mon, 10 Dec 2018 17:17:57 +0100 (CET) Received: by mail-wm1-f70.google.com with SMTP id r11sf4873854wmg.1 for ; Mon, 10 Dec 2018 08:17:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1544458677; cv=pass; d=google.com; s=arc-20160816; b=sA7MSKELfeuuIOHsEXRTZIj8hPVj5yh3/NTp6RoK/ci/mDiLXOhjdKVlgCbi651Ny/ iPAb8vY3HhMTXlFXRnvIc2tJuwr0vATUXn0xnYnyUjJ3aO+PgFTQOfExivFRDrAnkTA7 eyny13o1AhWOwX4z6ybKT3YR+O+WcOgeVYrRBGlUfTd6kATZaxlYDkblUYwcw07nbftT nOxPePlRsO3BOwFjsJ4WlZaTvBiaZpSDNIXKiVwd8TTcVt/SsmR8NOozAKNyOdpXySdL ChEpCqbsq9oa0da152m6DrqP81kTV1aVfhlOW4vZ3gxkpxhhwcOVS0F5gYlw4wjnsIvt IFqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TxNgORGPoSCn3Oq9HEn9GoMFiwahxDYqmWRf1K3P8O8=; b=wJpmjytatzWJ9FrWDQbjptozVgMBcpWXwurHsn+1Fv8FXoUY28ltLs4SVmD2YhKO2w 7lRDhwEYbZcPg4hVxESAiZEECgL80PkENKO6fuWj341/QOMtV2c0a/1gC5sUZfigGcTi 4CX3JfbSbEQ2ZiSQ116ozMLPLoJzEEfZL2Nrf2e8vHLzvJRErenisXBQ6VYVWMtJPiK7 MGR2sxMm0K2/looBEDlHS4jRDiwFMBOH2yIQFLjgYzYlTq4qFmoc2IZGmioNheDxmxM4 4ejjtP7KwD2ugR5y49pVFQ4dbfkdqQJJx7/zjRfvpiXpznUSzQSGrbicf6unP8mUT5Ic O+xg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lvquzrG0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=TxNgORGPoSCn3Oq9HEn9GoMFiwahxDYqmWRf1K3P8O8=; b=Ro2SH/CqHvzbmayQbercyqqrf016K9xq7GI8kP0zPopoQKz999moX+8MkJzmyE5H+d s8M9sOV2Y0PLJRohlgKELxzn3mfQvvcY5aXTzo7eTp1/TJCl9f79D2rf19JJ+lLYg0m6 R9fPjRZ+p3Zg7fwBkeVeBGvQhWd9z8FlCC9i4= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=TxNgORGPoSCn3Oq9HEn9GoMFiwahxDYqmWRf1K3P8O8=; b=DLyj3SumunDHBe9dwkNyJwlktj23O8G5Chvfz6xv1+v4/3czpxqvMSz618CJQa8BKi DfxNnNepm8gCteXcHZVncaHmFV9UyU84DiysRYwCUAR9bfB8nphDhBNxYzz2/I01lICm vB4B0g6Tinaf/PQA6nw+UJENqNA6qNJ9wLk7fDRsbsxnmCA4r4/BZ3OyMEmW1FHARFBj X+8qRd3dqY9Drw/PH9ru6KLHm6bl9QlaLO5vBckCbOK3x3gF45Gvv0z28errM5lm3wcT COQYz0HCYkBruuozavgp164bpokvK0bxLikXRqoa+RUPkJc/zojAH7Yebt2WUGU5b4JK 0uJA== X-Gm-Message-State: AA+aEWZ9/YYyCvg+jXlknvCwbt0I7/ouo3KOwBXVgtK/eIyB1StUIa9K KLXFF/zydmbpYIXkDpKN4jxhfg/4 X-Google-Smtp-Source: AFSGD/V2BzqC09QJLMHyjF7wc3s2vVEl0MDQuueXKSjRQv99X8P7c+dhp4GmzUwPrBnm+bd7bXnnWw== X-Received: by 2002:a7b:cc04:: with SMTP id f4mr1401940wmh.16.1544458677060; Mon, 10 Dec 2018 08:17:57 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a1c:c7cc:: with SMTP id x195ls1855657wmf.4.canary-gmail; Mon, 10 Dec 2018 08:17:56 -0800 (PST) X-Received: by 2002:a1c:a485:: with SMTP id n127mr11531152wme.15.1544458676650; Mon, 10 Dec 2018 08:17:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544458676; cv=none; d=google.com; s=arc-20160816; b=ntp2CLwxH0l4VgPs/JqhudopkRfgu4BteuCDB/CdVFRA5MVlDoF/gFO+dLPPKbjfRT d5krrdHlzOHMs2wMW2KViBkMrwWk+RZ9oKBF2NMt869qdxBE3rzf7szJ5q45MSh5z6k+ KbQT+62q3ytD5cXFxuPAAlpR0c7iirei7etteYzIjP1LXS8BUdP9kkiJwOCRurFt8nrz lwc6nxinMbunAtxYmyhV8OKCuYdfGK8Q7yuvRykD6oiGukae3HD2DXZkSXU+1RobEHG7 EEF+1ouVNFQF51BL6AHEg00G2s2iOzPzyMGwbBZLUMJ4bdcExTUfFebKwwwrb3D7Rntd fG2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TxNgORGPoSCn3Oq9HEn9GoMFiwahxDYqmWRf1K3P8O8=; b=wQEP4Qun8588VQ+Isy4plGfHFlrSiVBRCKdqcx0mwDF86d/qDYdFaasx5QkdVHvWvP pAH/iRbSYr2tggiLuRZLLrB49uRoNUYyvfW7kDg1CJg7IyUz+DiPn2cE/E7SlTO/Sljq O/I/JNlZYhsmLgMG96owc/ZnAiJ1MxYpeo9g2EG+cknzboSR2XF/1Jkd4TysDnASKjIW lEJ1x+r8c0tx36HkMu10lPryyZCAltbkArreznDMp4jc39a64k7DQnUb/EtQY7tUW+Jb SndBp//OkNrifaiFbAdz4KRambfQlmKoP/v8Th/N7XB1SRSp0V9685zvMb43hovI0w3n 9V3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lvquzrG0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o4sor7564439wrj.2.2018.12.10.08.17.56 for (Google Transport Security); Mon, 10 Dec 2018 08:17:56 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a5d:4c8a:: with SMTP id z10mr10124004wrs.75.1544458676335; Mon, 10 Dec 2018 08:17:56 -0800 (PST) Received: from localhost.localdomain (ip-162-59.sn-213-198.clouditalia.com. [213.198.162.59]) by smtp.gmail.com with ESMTPSA id b13sm8397503wrn.28.2018.12.10.08.17.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:17:55 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michael Trimarchi , linux-sunxi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v5 07/17] drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay Date: Mon, 10 Dec 2018 21:47:19 +0530 Message-Id: <20181210161729.29720-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181210161729.29720-1-jagan@amarulasolutions.com> References: <20181210161729.29720-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lvquzrG0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 c9b0222ebcd4..cb41fea4f3ee 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,