From patchwork Thu Feb 14 19:25:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813575 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 B4C9C13B4 for ; Thu, 14 Feb 2019 19:26:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A49082EEA3 for ; Thu, 14 Feb 2019 19:26:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 989AC2EEDD; Thu, 14 Feb 2019 19:26:13 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 53B662EEA3 for ; Thu, 14 Feb 2019 19:26:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21CD76EAA7; Thu, 14 Feb 2019 19:26:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B6356EAA7 for ; Thu, 14 Feb 2019 19:26:09 +0000 (UTC) Received: by mail-pl1-x642.google.com with SMTP id k15so3652383pls.8 for ; Thu, 14 Feb 2019 11:26:09 -0800 (PST) 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=6RPyU9KlTHdOgkAmLOMKP2ZsiLo1+0ZzZXt5rKrY9KQ=; b=Qc456ZY3vvdu6+LptQN27Fg0bx5/LuiTjjrf78HKsEE7AXLEbyE1KXFpTy4SQLuOmT EzfEgJK5/KL/hxE054sE3HXHgIFFHwKrSKhedRs5zsc8mM6ZBTdJmqJ/bNMIlkPUnb5C /OUloBcafMudflK2t3k4P/lPnykbgxwYrSG4HCRPZ2fjSiLBe+ISHK8eQDOJbbGJIdr7 VHPmYIVdcxQrr9l5DjH36T6WsdEo/5RXyDQ+vRIGF2lw0a+HKZJ/EgLhz6ttpRB9QYxi Z2AZokH5T2OkIBb2ax9fgx2jABrYj724waEyMZOqJmRM0WmMzT9oRrDQNzwhwDIuZ4fJ Lrng== X-Gm-Message-State: AHQUAuZnbxEQ+5c/aMf4nYvmFatA2gBVTNnYx7YzZdD4jK8RKPisbxej urJKshhgUNWJPjUMbf4tZ7rKow== X-Google-Smtp-Source: AHgI3IaiBOPW+CBlLrKkP81yfT4FIZkOlPh6b4UXVprpinR0lR+vBgoOU825d/GhH4kDRSvMHMelvA== X-Received: by 2002:a17:902:b087:: with SMTP id p7mr3905888plr.56.1550172368856; Thu, 14 Feb 2019 11:26:08 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:08 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 1/8] drm/sun4i: sun6i_mipi_dsi: Fix VBP size calculation Date: Fri, 15 Feb 2019 00:55:37 +0530 Message-Id: <20190214192544.7314-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=6RPyU9KlTHdOgkAmLOMKP2ZsiLo1+0ZzZXt5rKrY9KQ=; b=coa3lgKd3W2zLu2VziGXiWdi2qk5QxDTrpA2V0L/4d0k8Na1MyZ7VcBMJzkpIOQmTY bwC+BKOOMMfY/oYkT8xYMgTmOvOa7K2+U0iljl8Ngny+htseLtdLPWUMjdqAVh78LcbF /8qvTLIReYhLio93eNCAvCIo8MzRuYbQ4wSts= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The horizontal and vertical back porch calculation in BSP code is simply following the Linux drm comment diagram, in include/drm/drm_modes.h which is [hv]back porch = [hv]total - [hv]sync_end BSP code form BPI-M64-bsp is calculating vertical back porch as (from linux-sunxi/drivers/video/sunxi/disp2/disp/de/disp_lcd.c) timmings->ver_sync_time= panel_info->lcd_vspw; timmings->ver_back_porch= panel_info->lcd_vbp-panel_info->lcd_vspw; vbp = panel->lcd_vbp; vspw = panel->lcd_vspw; dsi_dev[sel]->dsi_basic_size0.bits.vbp = vbp-vspw; dsi_dev[sel]->dsi_basic_size0.bits.vbp = panel->lcd_vbp - panel->lcd_vspw; => timmings->ver_back_porch + panel_info->lcd_vspw - panel_info->lcd_vspw => timmings->ver_back_porch => mode->vtotal - mode->end Which evatually same as mode->vtotal - mode->vsync_end so fix the VBP value in SUN6I_DSI_BASIC_SIZE0_VBP On the information note, existing SUN6I_DSI_BASIC_SIZE0_VSA is proper value. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 318994cd1b85..d70a8c43a4b8 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -526,8 +526,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE0_REG, SUN6I_DSI_BASIC_SIZE0_VSA(mode->vsync_end - mode->vsync_start) | - SUN6I_DSI_BASIC_SIZE0_VBP(mode->vsync_start - - mode->vdisplay)); + SUN6I_DSI_BASIC_SIZE0_VBP(mode->vtotal - + mode->vsync_end)); regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE1_REG, SUN6I_DSI_BASIC_SIZE1_VACT(mode->vdisplay) | From patchwork Thu Feb 14 19:25:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813577 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 4486A13B4 for ; Thu, 14 Feb 2019 19:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33CE62EED9 for ; Thu, 14 Feb 2019 19:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 281932EEE5; Thu, 14 Feb 2019 19:26:16 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C65C42EED9 for ; Thu, 14 Feb 2019 19:26:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 610DC6EAA8; Thu, 14 Feb 2019 19:26:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8DF16EAA8 for ; Thu, 14 Feb 2019 19:26:12 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id s22so3588186pfh.4 for ; Thu, 14 Feb 2019 11:26:12 -0800 (PST) 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=2syAOh2G4OGCHhPfMkd8JNfHtkJm8hpP6JpgjrXSNMM=; b=kIwAt0KpoYGEKJSehyvFarHbwStlty2gE6TfcZQEOpyX1dJ0t/Inzzw7IBfs0L8ki6 2bYKqX7mXm4yT/YYCYYmALCLtS6vA68OwzBFhgBLavG81ybH/5IKlv2zqJGwjXv6W97o Ls7BvhuLjTu3SuYbdfz1U/PD3JwhmRpEFlXDtyvNtaFxsrAd0SyHyXruyaJ+wDbQc2nk qfhhvc8i7JjpzaqGBuyDj4Gy1ZCMlp+rF5uMPR4bmYlBqJRuohqAo+AIoLH6DGBC/Gzz sRugyE7wfGorj5FmoZ8p/KgEnrbIjDiDDYlcbRGxDKglAtB/7rJqhekW+Rd0O/EcSUP9 beCA== X-Gm-Message-State: AHQUAubHr+d3rhwZz/CT50+LNcCQ7zx8iB5hSZhqpRuePGBstV6wYIAv 4+Ijd9K4WKdr06OSKWcmDdxWfA== X-Google-Smtp-Source: AHgI3IaUIaaLaj0DjeiCs9lzTeYUZpLtwK6r4ls8yW9TJXb/UuzR7SBlm25xLXoG5M+AVVSqZSJKJg== X-Received: by 2002:a62:380a:: with SMTP id f10mr5929791pfa.100.1550172372276; Thu, 14 Feb 2019 11:26:12 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:11 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 2/8] drm/sun4i: sun6i_mipi_dsi: Fix DSI hbp timing value Date: Fri, 15 Feb 2019 00:55:38 +0530 Message-Id: <20190214192544.7314-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=2syAOh2G4OGCHhPfMkd8JNfHtkJm8hpP6JpgjrXSNMM=; b=q6e3FOHZTmmQzss3505cT/xH5CkXq+WIO7l/C5e1VQ8BuVvDv+MBGZhwRxd77mW2iI tCG4T7T7Vj4OpCEdiYID/htrKYOksv4q0FZfxtXuw4DXY4Y/0F8Gl/pXPtEBS7Yw7MCA cmdmjziaZOeZxT+g2QsC9oSx7xngknrQLPsWs= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Current driver is calculating hbp maximum value by subtracting hsync_start with hdisplay which is front porch value, but the hbp refers to back porch. Back porch value is calculating by subtracting htotal with hsync_end as per drm_mode timings, and BSP code from BPI-M64-bsp is eventually following the same. BPI-M64-bsp is computing hbp as (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hbp = (hbp-hspw)*dsi_pixel_bits[format]/8 - (4+2); => (panel->lcd_hbp - timmings->hor_sync_time) => (timmings->hor_back_porch + timmings->hor_sync_time - timmings->hor_sync_time) => timmings->hor_back_porch => mode->htotal - mode->hsync_end So, update the hbp value accordingly in sun6i_dsi_setup_timings. Tested on 2-lane, 4-lane DSI LCD panels. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index d70a8c43a4b8..982ae6b17654 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -472,7 +472,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, */ #define HBP_PACKET_OVERHEAD 6 hbp = max((unsigned int)HBP_PACKET_OVERHEAD, - (mode->hsync_start - mode->hdisplay) * Bpp - HBP_PACKET_OVERHEAD); + (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); /* * The frontporch is set using a blanking packet (4 bytes + From patchwork Thu Feb 14 19:25:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813579 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 BA40E13A4 for ; Thu, 14 Feb 2019 19:26:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A93712EEA3 for ; Thu, 14 Feb 2019 19:26:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D46D2EEDD; Thu, 14 Feb 2019 19:26:19 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52EF92EEA3 for ; Thu, 14 Feb 2019 19:26:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BEBB6EAA9; Thu, 14 Feb 2019 19:26:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 317A36EAA9 for ; Thu, 14 Feb 2019 19:26:16 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id v28so3538877pgk.10 for ; Thu, 14 Feb 2019 11:26:16 -0800 (PST) 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=pAS7zvIWI8WLdUvyOqbvv5PR0m69rmeaJXwVeXQOXIs=; b=hamGir9i1OOXGExOI3D47OCoDyddze8el9ZsczfIw9cXpou5NlqVibN32KQV0HnYT9 yAIdN/PW2wZkidbqjR5mgCIIatE7Gx/ZJYNd8mvAdEmFcHul+rfRsmGLh+vdDPo0r0m6 vliWJykupgPfYJ0Kdg4fUNcgfvMQ32EPziaCMiHZQvBBvnMFy18a/yz2rKgnE8qQ9LNk FH+P5nbGGn0zndy9Ki0EF5M/WZLOKnpB2cq/YwzZPB126B+6ErgjDhrXLCzYqkrVFt5b jubHI/GbnErLae8X9qkmlMgN6qUOLRjK4rjBwcDVBTlQAzBtY2B1seagmzR/yidEj4PC C9LA== X-Gm-Message-State: AHQUAuaILC3zA+b7aPHvFheKoyMCcmrFBdYqbQUfwtIIw9a1TrE6vd+5 JCuaMRFQlSdiC1oJH1A07Ccuy0VGhB1+aQ== X-Google-Smtp-Source: AHgI3IZW3Ke01qP/UcsGyJ+t0jFHnf1csxubvY1+0IvrmamyU3fpmC2bQHR9lusbB5SS1SjeFuh2FQ== X-Received: by 2002:a63:7402:: with SMTP id p2mr1397042pgc.360.1550172375719; Thu, 14 Feb 2019 11:26:15 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:15 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 3/8] drm/sun4i: sun6i_mipi_dsi: Fix DSI hfp timing value Date: Fri, 15 Feb 2019 00:55:39 +0530 Message-Id: <20190214192544.7314-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=pAS7zvIWI8WLdUvyOqbvv5PR0m69rmeaJXwVeXQOXIs=; b=Vyk+rJ8HvVAw95K6i0er3o3GNantkwwsjUiLABTAEq6sF0u+4mSOsSfAZ/oI4R7WgP /iJ5gbUmN04+hyYNrPzcHSe32um4i+w4XAccxMIUx/wGn+D5SC7j62hQfUdX4aE6ADDS ZM9FaE3AAv09SKXRnMRi9uQZsv/g5QHruIiO8= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Current driver is calculating hfp maximum value by subtracting htotal with hsync_end which is back porch value, but the hfp refers to front porch. Front porch value is calculating by subtracting hsync_start with hdisplay as per drm_mode timings, and BSP code from BPI-M64-bsp is eventually following the same. BPI-M64-bsp is computing hfp as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hbp = (hbp-hspw)*dsi_pixel_bits[format]/8 - (4+2); dsi_hact = x * dsi_pixel_bits[format]/8; dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); dsi_hfp = dsi_hblk - (4+dsi_hact+2) - (4+dsi_hbp+2); Example, u32 fmt = dsi_pixel_bits[format]/8; => ((ht-hspw)*fmt - 10) - (6 + x * fmt) - (6 + (hbp-hspw)*fmt - 6) => (ht - hspw - x - (hbp - hspw)) * fmt - 16 => (ht - x - hbp) * fmt - 16 => (ht - x - (timmings->hor_total_time - timmings->hor_front_porch - x) * fmt - 16 => (timmings->hor_total_time - x - timmings->hor_total_time + timmings->hor_front_porch + x) * fmt - 16 => timmings->hor_front_porch * fmt - 16 So, update the hfp value accordingly in sun6i_dsi_setup_timings. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 982ae6b17654..21f39f11a8de 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -480,7 +480,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, */ #define HFP_PACKET_OVERHEAD 6 hfp = max((unsigned int)HFP_PACKET_OVERHEAD, - (mode->htotal - mode->hsync_end) * Bpp - HFP_PACKET_OVERHEAD); + (mode->hsync_start - mode->hdisplay) * Bpp - + HFP_PACKET_OVERHEAD); /* * hblk seems to be the line + porches length. From patchwork Thu Feb 14 19:25:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813581 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 D9F1F13B4 for ; Thu, 14 Feb 2019 19:26:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8E962EEA3 for ; Thu, 14 Feb 2019 19:26:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD31F2EEDD; Thu, 14 Feb 2019 19:26:23 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 785362EEA3 for ; Thu, 14 Feb 2019 19:26:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B5576EAAB; Thu, 14 Feb 2019 19:26:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id D922A6EAAB for ; Thu, 14 Feb 2019 19:26:19 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id n74so3576136pfi.9 for ; Thu, 14 Feb 2019 11:26:19 -0800 (PST) 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=8bEG0NxK/TkiBajUPiod9cKRuA/aBM9IwOWB4PGFOrI=; b=WzbX5s7tQ/feRVU7NY6AaaSY1vCpvChKnHtb41XxKyQqouqEY51W6GLAvQmE85Glgr okmYHt+bxsRfnpJVEg9/o5Br/KhBZOrX0/0KowhGLPxLAcu7EllnLppDy9Mpqp5tK3L/ gwsnBXugb8s10qbSSSDW9xyfNlLZVfioubdvM3XMr6+3DzKnrbiXm/XkZlKDESZkkdvV X3MLmBsAl2mRcTogP+FB7MXbpqyMbaoX+P8hJWn1q+fI1QOwOQgWDpJ9JmstV/HTw5Sm R/W8tAvn2i6xKeM11kupB10BWn9vGX780AaJn/FxxZLMb7PQFZnTcdPcESHVw+tIQOSL D52w== X-Gm-Message-State: AHQUAuZun08JgGZRqAZ5+X1cfPTxuxWnoqVLgSPBVpn6I4Osjkvg2HxO 6jkuggt5TCKWiKxUHjJSVEuCD/DihkfNlQ== X-Google-Smtp-Source: AHgI3Ia0CDs3p5oMKUDDJam7CZ/l0xCiETZ3cSv8nrroWNdU6m6h7kQy+w24xsl0DYun6uSOM0FAIA== X-Received: by 2002:a62:442:: with SMTP id 63mr5632258pfe.156.1550172379131; Thu, 14 Feb 2019 11:26:19 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:18 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 4/8] drm/sun4i: sun6i_mipi_dsi: Fix DSI hblk timing calculation Date: Fri, 15 Feb 2019 00:55:40 +0530 Message-Id: <20190214192544.7314-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=8bEG0NxK/TkiBajUPiod9cKRuA/aBM9IwOWB4PGFOrI=; b=l45VmOgAS7gmdmqj0kwq0CNxr3FjdmxmX5VCKjF0O1zGcSdzvmPJ4KZtP3D8MQKS5Q Bju+FpfWNcC9MkgAMtOQzfu+0SwUtNwa/522Egshy9HFToZIwme2xASYf4GWBNvLetdW rgRtQ29xehVznd7besQEhuVZQF0zo06VBDY2k= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP horizontal blank is computed by adding all porch timing values, or htotal total timing value without sync time. Based on "DRM kernel-internal display mode structure" from include/drm/drm_modes.h hblk = htotal - (hsync value); hblk = htotal - (hsync_end - hsync_start); Current driver is subtracting htotal with hsa, but the hsa is bounded with packet overhead. So subtract htotal with hsync value(hsync_end - hsync_start) proper hblk computation. BPI-M64-bsp is computing hbp as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); => (timmings->hor_total_time - timmings->hor_sync_time) => (mode->htotal - (mode->hsync_end - mode->hsync_start)) So, update the hblk value accordingly in sun6i_dsi_setup_timings. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 21f39f11a8de..6b26dba883e8 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -486,7 +486,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* * hblk seems to be the line + porches length. */ - hblk = mode->htotal * Bpp - hsa; + hblk = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp; /* * And I'm not entirely sure what vblk is about. The driver in From patchwork Thu Feb 14 19:25:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813583 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 733C113B4 for ; Thu, 14 Feb 2019 19:26:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E8F72EEA3 for ; Thu, 14 Feb 2019 19:26:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51B2F2EEDD; Thu, 14 Feb 2019 19:26: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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09D112EEA3 for ; Thu, 14 Feb 2019 19:26:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E054F6EAAD; Thu, 14 Feb 2019 19:26:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7971E6EAAC for ; Thu, 14 Feb 2019 19:26:23 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id y4so3536453pgc.12 for ; Thu, 14 Feb 2019 11:26:23 -0800 (PST) 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=6PA7omnu5a1QEIw1FJbeZKYVUv3ytW4+L6xraVR/pk8=; b=BMFRFS12sJ8YvFqnoOcoSlNsMCjhTEZddTTuolaRDyqLSaOut1ki6XSxPViK26hqPl P6xL28To0TPLaWdR0839gLGrQlyV8v1aa1eylHyi2MLmi7pLbNzuUwZqJtClF8ZMocgH JAnDHAia96pvGC+bOvmaT9PEtAcuPodntZpUhSD2yXBJFdBpU3yfbZc5VvxGUBVbKa0j pjTIlBOnY8mLzMV04OGrYNgecxDNgci7B5afdj3rviQT87xiy9PaRFvcXx8hhVCQVTqO NIa1VA53Tov6BrUofusAlE46zAC4/y7K1ZSzp0hfkHC1FyDriCYma7xFCSqGxVp581TM Rg5Q== X-Gm-Message-State: AHQUAub5dljUX1p46zo1vMJWsAhQDWpJJ10lZkgFtHtjr9B7TGWAg8Tx PqfsEGBzPVRSB1NfA+kx9PB3OQ== X-Google-Smtp-Source: AHgI3IbaKLGN1hq/z5LYB5B808XAS18IAysXSaBZfFEbEqN8Uw/C0DjJD1mDDwX+NZEGlxX6a1y7ZQ== X-Received: by 2002:a63:d347:: with SMTP id u7mr1443184pgi.383.1550172383057; Thu, 14 Feb 2019 11:26:23 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:22 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 5/8] drm/sun4i: sun6i_mipi_dsi: Add DSI hblk packet overhead Date: Fri, 15 Feb 2019 00:55:41 +0530 Message-Id: <20190214192544.7314-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=6PA7omnu5a1QEIw1FJbeZKYVUv3ytW4+L6xraVR/pk8=; b=KYg2QwY3pqecw/vKuQF3qTv4P53VS4HpwdC/ZE/zGzuSq9g976SGphyYcygNR8HyXf U/GL+Pr8XuW9N+85KQfr2kCXFa+TD1NXUZwwfyDpwvYze0DbmazlcDqdngc98o08pmXo HcNjMZrQd4Ep/OOF2pYvDZwm4zJkVKnZBvEho= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Like other dsi setup timings, hblk would also require to add packet overhead. Add 10 bytes packet overhead for hblk, so the blank is set using a blanking packet like (4 bytes + 4 bytes + payload + 2 bytes) The value 10 bytes are refereed from Allwinner BSP like how other dsi setup timings grabs in existing driver. This is according to BSP code from BPI-M64-bsp (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); So, add 10 bytes packet overhead for DSI hblk. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 6b26dba883e8..a64e6ec00f22 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -485,8 +485,13 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* * hblk seems to be the line + porches length. + * The blank is set using a blanking packet (4 bytes + 4 bytes + + * payload + 2 bytes). So minimal size is 10 bytes */ - hblk = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp; +#define HBLK_PACKET_OVERHEAD 10 + hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, + (mode->htotal - (mode->hsync_end - mode->hsync_start)) * + Bpp - HBLK_PACKET_OVERHEAD); /* * And I'm not entirely sure what vblk is about. The driver in From patchwork Thu Feb 14 19:25:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813587 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 A56D417E0 for ; Thu, 14 Feb 2019 19:26:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93B702EEA3 for ; Thu, 14 Feb 2019 19:26:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 877762EED9; Thu, 14 Feb 2019 19:26:29 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33B742EEDD for ; Thu, 14 Feb 2019 19:26:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23E4E6EAAC; Thu, 14 Feb 2019 19:26:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 360C26EAAC for ; Thu, 14 Feb 2019 19:26:27 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id n22so3590335pfa.3 for ; Thu, 14 Feb 2019 11:26:27 -0800 (PST) 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=l45/w0iXjOS/5kE7BbpDMgm34gyLbKfVsq3DBo0xqe0=; b=PDCTvTg73jIT2Rnjp8Ipp3hk6wCY4Kc3zTV/cBYRAqFKWatCpciBGXZ/wMDWOZjn+X NN1fi9OL3QJ79RynEJRog7+DpdPM2ILBJmDQKEoeNKDSgWhzp3ENwP1Racn2cAd2rxBC e7+W0mBBrIEygGFLCVI5BOgSDbBfjkbHHnPMT4DjmEs/9mqgzcYvlCZjScGUl8XV55kg 6v88JPyaG7er7EvhG4bxJyTFAPfYehUd02+9+Xafxy2yyvx6HJ/LSIsGi+WD8Ufn8Flx /95iXVHKsk2XZwzfjrhhiVk3L639zDYmpGxnoCC0n5QCZzzYoGu9A/RIr51tNofmeKei vgYQ== X-Gm-Message-State: AHQUAub5xysnoN2tbn0ojzQ8G3XSALq199bV+zkS86pyzJN+wO2mUcKs 8sgsJjq2mP1myDYcJhu6HskZeg== X-Google-Smtp-Source: AHgI3Ia7Twnq5r7dgW0TFcIF1mUc1g5B8v31Ffn2m2aFBQM1Cv15c3uxxsag0SXtBDHRvwgLsyoMtA== X-Received: by 2002:a62:a1a:: with SMTP id s26mr5742054pfi.31.1550172386534; Thu, 14 Feb 2019 11:26:26 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:25 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 6/8] drm/sun4i: sun6i_mipi_dsi: Set proper vblk timing calculation Date: Fri, 15 Feb 2019 00:55:42 +0530 Message-Id: <20190214192544.7314-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=l45/w0iXjOS/5kE7BbpDMgm34gyLbKfVsq3DBo0xqe0=; b=dbkFqMfikgxyGeQmRCQmyLfUMr1v9qGRB/1u1KREh4PmaL3FKvldPTGzwqHsTAZriR qTNMVBshoZFnhTqq62vjZdUezp6D3LV4DXsQxSoXWlE7w1p5/nz8K9dHVjUI0uewmm/3 Tx6ZYGS+edH/xG+wyuR+MLY2LA5OsTE2FbXxo= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Like other dsi setup timings, or hblk for that matter vblk would also require compute the timings based payload equation along with packet overhead. But, on the other hand vblk computation is also depends on device lane number. - for 4 lane devices, it is computed based on vtotal, packet overhead along with hblk value. - for others devices, it is simply 0 BSP code from BPI-M64-bsp is computing vblk as for 4-lane devices (from linux-sunxi drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) tmp = (ht*dsi_pixel_bits[format]/8)*vt-(4+dsi_hblk+2); dsi_vblk = (lane-tmp%lane); So, update the vblk timing calculation accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 29 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index a64e6ec00f22..a08dfdcbe9e8 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -446,6 +446,27 @@ static void sun6i_dsi_setup_format(struct sun6i_dsi *dsi, SUN6I_DSI_PIXEL_CTL0_FORMAT(fmt)); } +static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, + struct drm_display_mode *mode, u16 hblk) +{ + struct mipi_dsi_device *device = dsi->device; + unsigned int Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8; + int tmp; + + if (device->lanes != 4) + return 0; + + /* + * The vertical blank is set using a blanking packet (4 bytes + + * payload + 2 bytes). Its minimal size is therefore 6 bytes + */ +#define VBLK_PACKET_OVERHEAD 6 + tmp = (mode->htotal * Bpp) * mode->vtotal - + (hblk + VBLK_PACKET_OVERHEAD); + + return (device->lanes - tmp % device->lanes); +} + static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { @@ -493,13 +514,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - HBLK_PACKET_OVERHEAD); - /* - * And I'm not entirely sure what vblk is about. The driver in - * Allwinner BSP is using a rather convoluted calculation - * there only for 4 lanes. However, using 0 (the !4 lanes - * case) even with a 4 lanes screen seems to work... - */ - vblk = 0; + vblk = sun6i_dsi_get_timings_vblk(dsi, mode, hblk); /* How many bytes do we need to send all payloads? */ bytes = max_t(size_t, max(max(hfp, hblk), max(hsa, hbp)), vblk); From patchwork Thu Feb 14 19:25:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813589 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 072F313B4 for ; Thu, 14 Feb 2019 19:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E92A32EEA3 for ; Thu, 14 Feb 2019 19:26:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD2442EEE5; Thu, 14 Feb 2019 19:26:32 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 915812EEA3 for ; Thu, 14 Feb 2019 19:26:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB7596EAAE; Thu, 14 Feb 2019 19:26:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id B76466EAAF for ; Thu, 14 Feb 2019 19:26:30 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id q206so3556216pgq.4 for ; Thu, 14 Feb 2019 11:26:30 -0800 (PST) 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=5N07oU2k2LE7t0QlvtqZwD41GQ0JhcM9+FfY0qN6oOk=; b=kBQxxagEOtX1uSwnmelZScMK2QJdbkkDQjCDc0ri7ocsrTzS1DirpNdnTHvkAP9pLK Uz3iM3Yjc5olSANpr+wVBml2qRkbvYTbVx8MvskDg0f6fWe7OYEDwOwcr644NZjrX9l7 B5up3HMeMRL+HUqaVcC19ZQ5T3xxKEcVtNZ7Z/lbXNqtVFIvmYJ7Zqy5DaN3KA9OJv8l SnRrKS1qhjAnjTpdhBjCC86n2ZrFaK+0ULOEYWN2uh2qydvphGtDjv5eAIVGXyRDFW3I NeqZQZXtstwlVc35hvoL38fXRTp583eQqOuZjHAAx7rE9MfcehDnFMlgANhxXh/ZRk9F LQ7Q== X-Gm-Message-State: AHQUAuYNXypSkIJZYdoHUrLLR7SdCTP5bMzK6QM+XAuFUT+jfx+AhZ90 bjX5mnYAoyqIgfQ0zJFkGrEZBw== X-Google-Smtp-Source: AHgI3IYa3jkq2zGmzYMgdNauEe0uYUJbfzKwzALB7vINehRpWgxtagKi09HgO0hbmCn1Lw5pM+LpXA== X-Received: by 2002:a62:168e:: with SMTP id 136mr5787813pfw.116.1550172389962; Thu, 14 Feb 2019 11:26:29 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:29 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 7/8] drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay Date: Fri, 15 Feb 2019 00:55:43 +0530 Message-Id: <20190214192544.7314-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=5N07oU2k2LE7t0QlvtqZwD41GQ0JhcM9+FfY0qN6oOk=; b=V+GKYnGRmRLbvW/9tmZOQnqrqzQVvOyAc9i+ybY4q6VXxG4RFFoK8DqK2T+BsWuglr fzRDTS2pzI3jNAYMc68T7vBJC4gSHKsp4sLqVf7YsrB/efnhLsJj1LbwKuj5iZUKyMAQ vnvc9xkb66E+nMMT2llLXX0UGrq8rxSx9+1NY= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Vertical video start delay is computed by excluding vertical porch value from total vertical timings, but the current driver excluding vertical porch along with vertical sync values from total vertical timings resulting wrong start delay. This patch trying to update the video start delay by subtracting vertical porch from vertical total, on the other hand it added 1 extra start_delay line for TCON based on the Allwinner BSP reference. 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 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index a08dfdcbe9e8..31cf9c58e98d 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -358,7 +358,24 @@ 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, start_delay; + + /* vertical front porch */ + vfp = mode->vsync_start - mode->vdisplay; + + /* start_delay = vertical total - vertical front porch */ + start_delay = mode->vtotal - vfp; + + /* add extra 1 delay line for TCON, as per Allwinner BSP */ + start_delay = 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, From patchwork Thu Feb 14 19:25:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813593 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 00C8313A4 for ; Thu, 14 Feb 2019 19:26:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E50662EEA3 for ; Thu, 14 Feb 2019 19:26:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D95972EEDD; Thu, 14 Feb 2019 19:26:35 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9ECE92EEA3 for ; Thu, 14 Feb 2019 19:26:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73C476EAAF; Thu, 14 Feb 2019 19:26:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 198586EAAF for ; Thu, 14 Feb 2019 19:26:34 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id u9so19080pgo.7 for ; Thu, 14 Feb 2019 11:26:34 -0800 (PST) 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=NCL7zOvAf1NWF05m63CPXM37pS/d93C5nu4kd6BUq+I=; b=RqcVTaqh3EXqomAJ+uTvzFE4X4CFsNVNBMg+zgzAari2Mzx9NACj5ZUzn/0Sif/b7y eUNsnPsNaL7+ALF6rBtcP36WOFf1JhpFVfFWkXzLc5mEmKh4ldwGwAfGzZOwwbKD9VTL BBAUG9oU4GXytVRr7Mdv/+1mmjI26X3jiXsVuksGmdMvCPQs/OS0weHef4BtiCpynpuk rccV7ubC1HHen8uu4dep9xbB/3nlYRH3DsM8kt26zIVoGjBBH1jzSQI8nhCW+dqBiI+J zVu+veL2iev4ZGYJ1VEel/ftL87RIgO0Se/FXQLwWULx0oHyW9hBJ5B9DJ24fhV3A33K 4b9Q== X-Gm-Message-State: AHQUAuZhyvC8/uPDDtx5ei8+nxtQP1yVkeN/R4rKt/lH+g4Z6PxSgBqM Jb4Qi3lnwHv10m+N+s8Zs/T7pQ== X-Google-Smtp-Source: AHgI3IbMiL/gS1qmVCENxTGERlXMbdvyTc5nPHlKAL3EzoaLl3D4CI3+JAB3CJNEUS0DDrPFt54fxg== X-Received: by 2002:a63:fa48:: with SMTP id g8mr1447618pgk.203.1550172393490; Thu, 14 Feb 2019 11:26:33 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id k71sm8390100pga.44.2019.02.14.11.26.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:26:32 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 8/8] drm/sun4i: sun6i_mipi_dsi: Add DSI Generic short write 2 param transfer Date: Fri, 15 Feb 2019 00:55:44 +0530 Message-Id: <20190214192544.7314-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214192544.7314-1-jagan@amarulasolutions.com> References: <20190214192544.7314-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Original-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=NCL7zOvAf1NWF05m63CPXM37pS/d93C5nu4kd6BUq+I=; b=K9+zw67ufc8DaaJo+tTQydkpSrx5nlGraeqeSAo3n+X5ceMeAcFS+s+lCDqXhZbCAH KEudWGAC2KiR8BjB8qkOw9YxkdTUyNd0mkTg2gtgWQKt/1hifbYXJ10L1t6qBPOXFbE1 W67Bp3DP6NAW4Nt8HFiWxkEnuqEFYqaGYV2bw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Short transfer write support for DCS and Generic transfer types share similar way to process command sequence in DSI block so add generic write 2 param transfer type macro so-that the panels which are requesting similar transfer type may process properly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 31cf9c58e98d..3a28d70dbdc1 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -918,6 +918,7 @@ static ssize_t sun6i_dsi_transfer(struct mipi_dsi_host *host, switch (msg->type) { case MIPI_DSI_DCS_SHORT_WRITE: case MIPI_DSI_DCS_SHORT_WRITE_PARAM: + case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM: ret = sun6i_dsi_dcs_write_short(dsi, msg); break;