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: 18 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id F16602E5422 for ; Tue, 13 Nov 2018 12:17:54 +0100 (CET) Received: by mail-pg1-f197.google.com with SMTP id v72sf7846391pgb.10 for ; Tue, 13 Nov 2018 03:17:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1542107873; cv=pass; d=google.com; s=arc-20160816; b=vryztDCWnVyvgP2be1MyaZBbkYmvoYH+PM+TKJcRz7w+xeqUDJQGiDlQEk2zFPuLOv HfSkf3EQqv+oxohJXSc2BGx5eP5Z2spl6KZwBsXVqWc5jBDdsxcUAc0tNs1cVzXXt+fm 0dX+Lbr7qBh/28LLPhPNT8+WBsyJbSv+rFDjsFIgFMqBZxrjWga7LkPKc9i680P1UCcQ fg10/crEBqDdrblK66tdEXpBEF69jIdtcRfd4luyIEgjyv2xXX/IwEIq3r+RRg/ivCF8 jiA/sRd0Jp1Kh+YByoz1G1OFFWRNhw00eRCveIWFhqWAcHuisqVpjp0aDIo9quJ7HVOY nkXw== 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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=UQBjfRPr5FoFOBdO5nSLMc9Yt2q4exS1/PfcmoSbGjSl1Szxyc4PYoeDMXBY/HePsv TPtqfFQxYkePje+YDM9CN31sJgfH8mIPeN9t9Z+YfYiwvSD96ogn7cydJZoI7CzJK9Dt JKtYAR0VBqpIG2MUKzGTe5HCt8F5ZJD7YtdcL1nYOWGv00pFdXqQ2mMVqWCP3wmL57HV QEjAaB6WrgQYPJ4IUau32J+RiMi9vBNOOmNlD/B9iEsOgTyxdYbi21nQ17iC2PkxW5gq Bq4jkTAQ59j0J5qSP825iRtVkEmECuI3yLaEEEJvvAoesGFhu1GHOlyXt0HTwekl8LxJ 84Pg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BB0oFzby; 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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=dJWnmXIw8VwyGVzJU166fOe+UpqNMm4v+9IsyS3bvEin3KJ9pR+wteUwEVcavTytDd SR52McG8DMPKUvGUcdkus7Lw5/ZRDH5MnByYBUMVzh853NfZBAOrnpfr7QKflc6hYalG e110VFYCywWYJ4SYNFl/H56AlLV0hmZw/qUTU= 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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=r40GcMgEy9XZuX86WwOxkWoShfKsIlXkgsVuOptEn0ZTItvQYotj20zrQREp6aGjGO 8Z/d4fHU0QJFtzqwzDUYYZbVHD1vNghd+9njr09y9IF4wlD/DdQfAkhHMCL4wOOokGUS dBcHEqS+GWOJAE7b4Ry+pUdCoKxKktsQZHyhmL9rSpHA+atzauVeVuZ+aNuKDxMO+KDX UG/Crh+0JDJigX3v5FgtH8bvkjHeeS/PsmkmR8OVq5ouLjYD/lyJgHLmMPKpjnw8iFY6 VfuHHUUPmoFSSEEtjSjj5hSJ36o3gzT41I9ee6SVV14VfphJj+rI3g3Tfuxagpsrf6Rf aWvA== X-Gm-Message-State: AGRZ1gKwVNlH6/HfxCHzndhkxDFfP7A3D/0Wqh6Tyo6pL7BsBr+6ePak hb7FV+nCTPWsK9pjaY7Oh/phzHR5 X-Google-Smtp-Source: AJdET5fTx6ufyvuHGoArZoRLwl01Scbsbx9NePQaP/ijQ7vwfJ1geHnJt8+06D+1KkUUtLi1BJ0fJw== X-Received: by 2002:aa7:8157:: with SMTP id d23-v6mr1519206pfn.136.1542107873690; Tue, 13 Nov 2018 03:17:53 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:6a0a:: with SMTP id f10ls956259pgc.0.gmail; Tue, 13 Nov 2018 03:17:53 -0800 (PST) X-Received: by 2002:a62:8742:: with SMTP id i63-v6mr788931pfe.41.1542107873398; Tue, 13 Nov 2018 03:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542107873; cv=none; d=google.com; s=arc-20160816; b=Y+sYV31oLYOIzns3Na0FzXI3avr7F6SBFdFdvJdv8EyxZrIzPqyYJU07g2Hd4iDW+x GFwITasno3r89opLf7sf8aSSMOz7ypLMs0P+dip0PmetDmvctfQcn+jQN9jjkYlXHAKD FHqZddv6IubMw88Rg1Argppg3m77Ths73vnIps0K+TfrXlwLuJbbYD/GUV9qS+hoSiH8 aqoAlOeLMKLVXS9RklgwKgza9nA4uanAgA1myznLlaWvMlRccd/btB76pXOP08TxlAMS uGQZuYNFmwtWCdTKhWSS/Jn8UuAPXc8bvkDc9yqYyKdMZwBVX1RuxZlr2C2N+3co2pXj fiyQ== 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=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=R2SZ1ZzyEaI4n4PSPpBhGVGY4XmFYM5XpWY8G5l7jR+yROy1knCA3hwOi3NtNNn0IZ obsEo1o18zUk/2xG2O+cwmSEz+/lRTe3+C/sCEteIkRBLCvTB4JKNedc+rWVOic/T8+C XQGwTvOO6L//oMMIVCAASLF8QIh0lCxOpyTm6PQvw/Iv8cXiqAV4LrSm6UD+KvFVfu9l ksCFrfnBvaLKXI3SfJw9O4uJ9blAyRYOCxBGJafnYH72lDKfZs8NCltpIpigI7Ak0w2r Qo7Ts9UBRo5973HKDu1T14ZhKLxQJM8AbxL0rCvaHnIlyFarLeoDabF17wrhG4w4eALR o1tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BB0oFzby; 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 a10-v6sor23172298pla.29.2018.11.13.03.17.53 for (Google Transport Security); Tue, 13 Nov 2018 03:17:53 -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: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 Cc: Jagan Teki 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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BB0oFzby; 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 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,