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: 10813585 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 67A0013A4 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 56BE42EEA3 for ; Thu, 14 Feb 2019 19:26:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ACAC2EEE5; 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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 422252EEA3 for ; Thu, 14 Feb 2019 19:26:28 +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=gSnV0iIlLCxlFNZz1ze0ec3eA7DZ/FCfDUi48IDM4xs=; b=g27gKpqC/t0ey1 RiJRB5tIPf17rQAKipHfNN4wddFAmDa2Ep7wIkRv0AOwIU5TUmhaiRRf7ymzJOuzdXd9uRLC4Pxl2 TT7B1APU9UPlp2NnpDlCAyE7adY26AvTAw2oNaMYcU2k37xSEe9e/ujlofNZBIxikH6tZOTvjwzdx Zs+/jdxC1RTlkIwyzE2UQGnmgaDWQBUjwcWipnzlEMdBf/ZPWw3JdoR0EchSeixSMZE8g/b4tKSAD VujXbIgGbzG4yWEZL2PmAxwYaReTeZ4UcfAW6vMG9mh6xnzvtshxAPO1rud4YxLGvPwkZfNCQrDKA 9d8PjGa68gEcVG6WII2g==; 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 1guMeL-0001Qz-SP; Thu, 14 Feb 2019 19:26:21 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMe9-00019J-Od for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:11 +0000 Received: by mail-pl1-x643.google.com with SMTP id bj4so3653232plb.7 for ; Thu, 14 Feb 2019 11:26:09 -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=6RPyU9KlTHdOgkAmLOMKP2ZsiLo1+0ZzZXt5rKrY9KQ=; b=coa3lgKd3W2zLu2VziGXiWdi2qk5QxDTrpA2V0L/4d0k8Na1MyZ7VcBMJzkpIOQmTY bwC+BKOOMMfY/oYkT8xYMgTmOvOa7K2+U0iljl8Ngny+htseLtdLPWUMjdqAVh78LcbF /8qvTLIReYhLio93eNCAvCIo8MzRuYbQ4wSts= 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=renO6TdfQ4M7Ht/h3OsIPmBxA5A+R7ub/Q2J30cn+oNgNgY8QXXg2SJnA9mWbQbaT4 sXVm2j3mIglINRFR5pCSktg8bJIS3XHrKGURCZeVIr+FyFodJuJu/NnM5V3HJpTqIuGn Pr2RNd8uVm8iiweCvQwGXLXn8nJ1h2ahdP5Qz5VHse239NeDBaDJwBBDc4jd7XSXp2/1 GDkeTWC6N2eXg5CsVqY2Jkku/UxFqQ6ifVErLfTOiB94qTHgzyianKCuxnCh4L3sgkzc I7Tf0ILihVew0bvAOHme6YzR8rFk+QfbhmHhZyleZFK6z+HSeSFC49054s60rgYF6Zlj 3dwA== X-Gm-Message-State: AHQUAuadbMlteaSBvFGz4ihDcFVIdNhBR1Wbklde4+1bbzYEB1ZVB2An Oam2m5qIebzTi/cxIsHSQvcD+A== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112609_797992_42F89894 X-CRM114-Status: GOOD ( 13.49 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813591 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 3A06313B4 for ; Thu, 14 Feb 2019 19:26:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 278F62EEA3 for ; Thu, 14 Feb 2019 19:26:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BED52EEDD; 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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 A8B3B2EEA3 for ; Thu, 14 Feb 2019 19:26:34 +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=vm3O05JFD3SwxNe+NLVXpDrjfIw00vnwhOq2bn38AvE=; b=Afo57Q5TVlRRBZ dTIOI3nUNXUDIknFTNx+3lgiB3Z87mXzvxpzfR5kOgsB6U6oJcdMj7alpy7D4fU2/aR9HXGSSLoB7 7Y3/0wa3s7g8Pa76IsECZ1PBpMQUcTe4scqX3FuryUdkKYcEHEWtcteVlDwqg4ExVCb+cEjiL/an5 MuV32yIV+AQh/dNPCjuGSrziP1LA8zo9UH137G4DY4BvQyJeTPBXksd3U0pOnQweIKhyLxH/zu2dZ AdD5pk/p6+SQjo7op6PbM+SLS9J//rCK+yIx3ybmyInL0YPaw9RAt4nBfW5FUSU/HUuAGfbNu2od1 w3Outf29nR2luS55SJUw==; 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 1guMeV-0001do-Ek; Thu, 14 Feb 2019 19:26:31 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMeD-0001BO-AB for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:17 +0000 Received: by mail-pg1-x542.google.com with SMTP id m2so1287639pgl.5 for ; Thu, 14 Feb 2019 11:26:12 -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=2syAOh2G4OGCHhPfMkd8JNfHtkJm8hpP6JpgjrXSNMM=; b=q6e3FOHZTmmQzss3505cT/xH5CkXq+WIO7l/C5e1VQ8BuVvDv+MBGZhwRxd77mW2iI tCG4T7T7Vj4OpCEdiYID/htrKYOksv4q0FZfxtXuw4DXY4Y/0F8Gl/pXPtEBS7Yw7MCA cmdmjziaZOeZxT+g2QsC9oSx7xngknrQLPsWs= 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=WrnPt8BmSij3j+3Ec1wStI3rvRDOUBzsxRvwDlqTAy9UfLOPxhz0f80ACmgbvdCiXa YMYjkD6NYOFcs2dLcSWDa6jphpP6K62LY0gL909HgB59AI3y3BbHLlofJJJctw4J5R21 y7qJzAcqfqKdOmvfNL8SXfZx1+Yg2ADjspkODb3DuOwR3IDkciO9jUf2JSNZOmQo7YF+ CNgmZAs3gG7G1MyVRA++4pIGchz9maihCjbwfZKRMPjs6x/jfwiM2ByAH1sbUkrQCr9J li8Ia8r4WRLDQ2bN9Hma/TGsyycusOkkl4/usPv87ff08DaNhqfrH927B6hUlLNQVxs5 EC5w== X-Gm-Message-State: AHQUAuYV3ST4oHYq0zZ0iuxQLhBOQeulrZIFvcPQYDQglEbAQnpktaRJ iMK6zaGk3GsGBM3867wtwN4/Xg== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112613_593482_B23FCA00 X-CRM114-Status: GOOD ( 13.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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813597 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 1D6D913A4 for ; Thu, 14 Feb 2019 19:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B46F2EEA3 for ; Thu, 14 Feb 2019 19:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFE242EED9; Thu, 14 Feb 2019 19:26:49 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 8A8112EED9 for ; Thu, 14 Feb 2019 19:26:49 +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=ZKEAjVKYz7Tzm5xv/W2kA+A5AMSVzv4oT7Rb/Wm7pQM=; b=SYA9M0cVGUNjBx x63SrgCcPZpgFGFv2fZOhgJu0M+Kadj7dKXFSMV8ukJhFr6TpV/VaZBH6aHlVDIWemgGgm5MXj9Aq UmszyMubjofIiqiIDkswY22E/D0bjJL6VGvmTYMW8Bh4nF7ZFHN3pMOMxiRblitVYnl3d8nEUCLkF g5wwgSEq1KeQIcCKpGWcUGWuw6G18wjh9QSoghlouDWFt/uHdDdXMxeGvuUHQW/PzvjT8yieQk6rM WSosyY++F/1o4DKX5u8rTmLw6luQwLXMy0XPFp2O+qwSJtd3MOvuWudBI5GYt8YTgmu1YTiojUKu0 M6SpCNAnO5nH4q34dbnQ==; 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 1guMeg-0001u4-A3; Thu, 14 Feb 2019 19:26:43 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMeG-0001GM-8u for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:18 +0000 Received: by mail-pf1-x442.google.com with SMTP id u6so3568950pfh.11 for ; Thu, 14 Feb 2019 11:26:16 -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=pAS7zvIWI8WLdUvyOqbvv5PR0m69rmeaJXwVeXQOXIs=; b=Vyk+rJ8HvVAw95K6i0er3o3GNantkwwsjUiLABTAEq6sF0u+4mSOsSfAZ/oI4R7WgP /iJ5gbUmN04+hyYNrPzcHSe32um4i+w4XAccxMIUx/wGn+D5SC7j62hQfUdX4aE6ADDS ZM9FaE3AAv09SKXRnMRi9uQZsv/g5QHruIiO8= 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=MZ+2bhUUpQrAzybeCq47X8QPJTK5nNs7b2NWCi2HXQMZzkU7aiDG4OAtlpZ/5LyXmc Xz7TlXM/rxVr/p74X5/uMeqt5kjZCWWBxQk+PnHTnsfRuMD/AJeHlvGjMYY1siHgRzfn rOim7FplwMhdIHq2bu6rwBDrVtcFG8GnxUQ76b6x95uVRpr9d4FuXf+WeykyX+Ls5+7Y biZI6ziB0rg+ymN44kY+Y0XnUgithue2cgLD3P9qyMn36Cn+YhuAhGeUQz/jA7eIQuZS us1LJIC/nap8QXIVyAlpcSaPhAlEWOQPdZ7ZRkw9CQZ3VaK5gNsvo3oKJsNZX17c0inl 52hA== X-Gm-Message-State: AHQUAualXtZsZ+4qTcX8i89DtMfN6K4lY9/80/zCWFYzx+3MagiW8Lmm fb9VvTG2KB2ppw4/+Tsv3zc82w== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112616_532520_E74EC372 X-CRM114-Status: GOOD ( 14.36 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813601 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 CA76513B4 for ; Thu, 14 Feb 2019 19:26:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7DD52EEA3 for ; Thu, 14 Feb 2019 19:26:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC32A2EEDD; Thu, 14 Feb 2019 19:26:55 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 57B422EEA3 for ; Thu, 14 Feb 2019 19:26:55 +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=b5WQsi6xm/N4gqZhRMznU7AdLqLEo0yu3j4o5n3bUuM=; b=W36aaO2fyZNOgA HyTNLXoDaZHyjrttUvvUkqHFtW1kWiSQppodMn25UpRaag6EZvUI32PTnH4kHyNMKeUJPtCyCHKjr RLDMOoiI1o0AieozMqnhrZ47dvWYG6A9tCN+om5bMz+1nIA1wPj77ovMUJU9Cbxv8KuA9HAeU+GXb vpsnfvBcx5xMLjlrW2IfddtVJ27YDtQLg6U9Xd+qMpDMaWo1roaD0QjXajZcwUsuWT55bPb48vl1v v1PymwrcJUXHn/sa4Ge8M4KhISLsrz79iv5fv+G5pVXN/Gsk1Rn+6/KFkcqdIYQHnn6ttcAba/aPJ 06r8OU3o6F4/KwECG0aA==; 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 1guMer-00029P-Qu; Thu, 14 Feb 2019 19:26:53 +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 1guMeJ-0001NZ-Uc for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:21 +0000 Received: by mail-pf1-x443.google.com with SMTP id b7so3578547pfi.8 for ; Thu, 14 Feb 2019 11:26:19 -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=8bEG0NxK/TkiBajUPiod9cKRuA/aBM9IwOWB4PGFOrI=; b=l45VmOgAS7gmdmqj0kwq0CNxr3FjdmxmX5VCKjF0O1zGcSdzvmPJ4KZtP3D8MQKS5Q Bju+FpfWNcC9MkgAMtOQzfu+0SwUtNwa/522Egshy9HFToZIwme2xASYf4GWBNvLetdW rgRtQ29xehVznd7besQEhuVZQF0zo06VBDY2k= 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=ROPJSuaucFJ13jPeZzmi1g2PF5lzIUuuNlRXizWzruLezoLDBEyI+mRr6HMwClJcZW Qo1KDFDxqNgD99AJA++zWgUrUM+1Fp+CrL9FHiJ84NGO7+cQQKswoVrRwokI+KJB79wb 8+0Yll4kifClULUqkbCKC2IHER5qNAbagX9vEwv9ebHpU8B896WoNmAb8xbE69CQwbDe Fml+twFJZqvFUxGrUAMnvZtMEn2/WO9rYBFHwsn+Z3U64BSoviZxTdoPXlRfiJ+6Isc1 QBRB6uJQaCula/1axz4uSJol05pdvn/zKuNUgtYXvnXjbc5dLFL1g4cUgK9lLcgzMgUq mulw== X-Gm-Message-State: AHQUAub3GhrJDG2iXzAHQwjtJkRU1ermPH6TzwWFWNiAT91S3nZ6VyHT vLAUagcFF/EDDLy7/GL12HJdYA== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112620_010246_A6ECAB6F X-CRM114-Status: GOOD ( 15.21 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813603 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 84B7E13B4 for ; Thu, 14 Feb 2019 19:27:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 700D02EED9 for ; Thu, 14 Feb 2019 19:27:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 600CB2EEDD; Thu, 14 Feb 2019 19:27:34 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 0BB0D2EBCC for ; Thu, 14 Feb 2019 19:27:34 +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=IaaVTvQ8hSvjZWeLO/gvtsG0p7Y10PW/mQ++T9UTGGU=; b=goIXCAUMC8oclD E5rMnTtqc4OVwl7jZup0bmw7mDAjEPleeVvulNX3Wf6jEndoAqzRhiBSs/+krMNDQsqD8b5Mz02sE qsdT36sAJeQ2wkVE0lpSO5O0L8aWoF0LUiPpoXN5QgvLavzcvuFZ24kWBcbhvi5h2S5kG0QN/M/VC GoMFRkalBi/ormc0500Au9x7YnvjFPQ1S81p96wGGx5AqGmfjq7nAm7oW758WYt8u5rOXBFMcdG+n eRtPiKz8Y7gFWqrSzzyD81Zon8ZxHSpLolqukRj6r+5WFNgw8F2si+5JuPshiElMvI5BTl7szfzju OfXRD6wBy2+SCOwkyMPg==; 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 1guMfL-0002cr-Cc; Thu, 14 Feb 2019 19:27:23 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMeO-0001U6-HY for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:30 +0000 Received: by mail-pg1-x544.google.com with SMTP id m2so1287892pgl.5 for ; Thu, 14 Feb 2019 11:26:23 -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=6PA7omnu5a1QEIw1FJbeZKYVUv3ytW4+L6xraVR/pk8=; b=KYg2QwY3pqecw/vKuQF3qTv4P53VS4HpwdC/ZE/zGzuSq9g976SGphyYcygNR8HyXf U/GL+Pr8XuW9N+85KQfr2kCXFa+TD1NXUZwwfyDpwvYze0DbmazlcDqdngc98o08pmXo HcNjMZrQd4Ep/OOF2pYvDZwm4zJkVKnZBvEho= 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=XlBzXGEfhith8NeqEds0Vfujfg5TbkThQ6P7BNd3ls3OK5c1Jbre2zHAkm5RSSRz60 2zKxO2X10efzjAtEDo5Sccfgz6QooRTZ0OlWwe328eB6DGt9X0GivnIaDo8/jZqKg25V 04r2bPvlP6rAKFZTPzOKUeZdeT6qrkORoSvUWghavu/qhaQvAtERmXtdtwC24NzXs9Al VRaSm9zTwZ+LJFCYNpxQlfvHDvX8Cc+kZtktEtq930Wo+ORRgaq7k6fHPgaZR8sZULhd 6ElqCpWXmWK6zDbvCWmEtncn0PJThelYruyJksiZnubERFbUUmm42D+k/dMzxX53uc07 SvYw== X-Gm-Message-State: AHQUAuZQfsVgGFV0iuY9nHu1xT76W2h2jgpgQraFRdeZ3J207+Kkydfq FNk/TY5AF4Ff2CTKUoM4e86q+Q== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112624_915462_48BE9463 X-CRM114-Status: GOOD ( 14.18 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813605 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 A0ABB13A4 for ; Thu, 14 Feb 2019 19:27:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E9C52EBCC for ; Thu, 14 Feb 2019 19:27:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82E4F2EEDD; Thu, 14 Feb 2019 19:27:34 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 1B2942EEA3 for ; Thu, 14 Feb 2019 19:27:34 +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=brAHeyCt0q0uK+QnL3fYWqh6S48hyJy3u2cAoWAvEVQ=; b=RbrnN6haU7752k yasp9rqDSX8iorimQoN9uHZKCgn/K04vIuSXHpsiw/sxrcwmfHfDwf6IGAmZiCHMgIH0F9NVqizxI pZYHb7dSRwj7GXE+lZu/hSGHZPt51WASDhQRLFasDDmlnEkAss5nWyMvJDdbcikhOGB4Na2l1UakA RIuxeMkg99pGrp99FEdda8FXMhjRccHvLS8++KEsL/TyBfGo9xkhCC3AuwFb6l1b37XgKAxwP+3+D WAd5uH2WBMk7XfVUilAb2eStVWOnGmgxKof2Ugsa4fGZqcD4uv+aqdmWsOH1JDbpx23bPN2lRPyux NK+SmF49rtcf6NDcD6HA==; 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 1guMfT-0002nj-Ou; Thu, 14 Feb 2019 19:27:31 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMeR-0001Yn-9A for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:33 +0000 Received: by mail-pf1-x441.google.com with SMTP id j18so3593737pfe.1 for ; Thu, 14 Feb 2019 11:26:27 -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=l45/w0iXjOS/5kE7BbpDMgm34gyLbKfVsq3DBo0xqe0=; b=dbkFqMfikgxyGeQmRCQmyLfUMr1v9qGRB/1u1KREh4PmaL3FKvldPTGzwqHsTAZriR qTNMVBshoZFnhTqq62vjZdUezp6D3LV4DXsQxSoXWlE7w1p5/nz8K9dHVjUI0uewmm/3 Tx6ZYGS+edH/xG+wyuR+MLY2LA5OsTE2FbXxo= 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=mtiSU9CsTesbqTmNRAIjM65t5gIhd0vEP3WeMfD4i+xSG3Jo2c51zfAuaNufikJRs9 2U8xEMKAlDsLUvN6wslWIwVw/tC4dQDBtEbf5dD5wM5rUuCRzA6mvva1CAOUlLv3LnKg 9KxStKVzmXOP6cRRjZ2h1Uo+BSGvbGltMI55czWKFIVstg4muG9TnrAnPjJsgZOxmnVb rSi3iwMZWpqVL6mFlM6XkwTk4oftvuS9cGzfSci7gjg/XKSDc/2uZ3rhi2Bnz4Lqz5m+ +nWVmmWs+CNnyq5J2FehdYblcH/EDTTofhooJISwwGIX1HgSAxz29Sv5jFasOvtQN+Yk Kc7A== X-Gm-Message-State: AHQUAuYES0uuRUHWJUGpWOjcdbv3E7XJW6I0z6YZFP+7/G15ehNibftu iZvrCT3vJEkHZZdThICJEYIoKg== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112627_759593_955253AB X-CRM114-Status: GOOD ( 15.62 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813607 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 1393C13B4 for ; Thu, 14 Feb 2019 19:27:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01B912EBCC for ; Thu, 14 Feb 2019 19:27:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9EBE2EED9; Thu, 14 Feb 2019 19:27:44 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 85F762EBCC for ; Thu, 14 Feb 2019 19:27:44 +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=YbC8WdfqXpjKwkEDzAyCsypbjMUpG9pEW4A3fh78p20=; b=EO2N9mHXgeG8nU Qr/BNvToqDCTvu/gqtDZHCUJIMCAND8qNYdek+/6ka9m/Z27NHt/rlNn4oq+a9IR1l1Pn+qZkGlMg eKuTZisPZFpPZZhUtGWNR67D1ky4CtrCkyAa2chUFGjU77e8xbQUUOg6Coc+i5NGqpzj3Ofq8c6b3 1gbKN99d1jsGAgPhu3saD9bTum0fEzTbKBLEEDvsvI8SyhaHBPREWXH1L4aqSMTnqYgyyJYy9L5uy 24b2y3mLAFUDC/3o706bf1vmdbIwyPCHhg48OKfQ2G5JnupLHzqDjBngtnmfD8+VVslDUz1zD1doj hWUOBhlXPvrwKIiHiKEA==; 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 1guMfe-00033S-Gh; Thu, 14 Feb 2019 19:27:42 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMeU-0001dd-FA for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:43 +0000 Received: by mail-pg1-x544.google.com with SMTP id y1so3537273pgk.11 for ; Thu, 14 Feb 2019 11:26:30 -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=5N07oU2k2LE7t0QlvtqZwD41GQ0JhcM9+FfY0qN6oOk=; b=V+GKYnGRmRLbvW/9tmZOQnqrqzQVvOyAc9i+ybY4q6VXxG4RFFoK8DqK2T+BsWuglr fzRDTS2pzI3jNAYMc68T7vBJC4gSHKsp4sLqVf7YsrB/efnhLsJj1LbwKuj5iZUKyMAQ vnvc9xkb66E+nMMT2llLXX0UGrq8rxSx9+1NY= 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=pC2evg1bm75tn7MtAmIqNyKgsYd0Ma7EqOFejswqaiKx661XK77YAV93U8Ge3aC8nr wynoJEURBniml7l3AFgsuNji77WmZu2pMFPv+V3wNCbeZ4/ZNesHiNFzp3ueWrSDpJkn YoSGvpKzbvJXv+xIK/kn9lIVjHDEehiNJ/doW8Os5+t89uaTtrSwhuGt2QGqmbQfUAB/ P/C3BDkC39q+fdJXeKVxT9ueXr0kY+0P4x1fd+x1obHV1EyGTxG6pqhKvQN+nxdSyAqf OATB+6a0B55p+8nL6XKbGmuzUqUEAzPv+4dmgD+cHRa/tiDu0VP6NW/+Ro8Ki8kXNfXS yAtw== X-Gm-Message-State: AHQUAuaS9ipcpesYbd2Y/Q9Fwcjvh4TDgv9CXj5U70DOYTCJ5RstUAG0 WX6fj5MpnM04xkcfqagYYE89QQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112630_966943_FC10A713 X-CRM114-Status: GOOD ( 15.23 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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: 10813609 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 399F013B4 for ; Thu, 14 Feb 2019 19:27:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26CBB2EBCC for ; Thu, 14 Feb 2019 19:27:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B43B2EED9; Thu, 14 Feb 2019 19:27:55 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 B41162EBCC for ; Thu, 14 Feb 2019 19:27:54 +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=eRYl8ZhD0z8Qr90sLGatsZtnxi9n7JCfZ7uIuz/92v0=; b=L+PWjasHpabueu 4tkrgyGa2OXJKdMr722gTkw8aO+qs72KYO9d36+YzPH8tcWbaliEwZTWQ8qQGeA7yf9mzQAaAmTQ1 h+oRhtL5hAypx50tu4s5/I7E7Inc267pSP2iBaGrL7AhTUmzeM7ezqWIXqboYpfrS0oX5RSoQX8AG 8c1nWv+EHg9ryYcgEy4rvUFgqMRhsLj//P3mj8dDljpSWKZiOcHf0lXCDFWHSl1bOvp20jH93T0sW +d0Hz4ipjzR1Z2lIZtfjpfae3rmJBH9BkhfA+yyCWNR011oaoCdO0o4KJ1CQ2+rG5bYgBWnhnCye5 wdd5RiCHKCKzJIReYxBA==; 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 1guMfo-0003Hd-WF; Thu, 14 Feb 2019 19:27:53 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMeY-0001ij-1M for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:26:53 +0000 Received: by mail-pf1-x444.google.com with SMTP id g6so3567508pfh.13 for ; Thu, 14 Feb 2019 11:26:33 -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=NCL7zOvAf1NWF05m63CPXM37pS/d93C5nu4kd6BUq+I=; b=K9+zw67ufc8DaaJo+tTQydkpSrx5nlGraeqeSAo3n+X5ceMeAcFS+s+lCDqXhZbCAH KEudWGAC2KiR8BjB8qkOw9YxkdTUyNd0mkTg2gtgWQKt/1hifbYXJ10L1t6qBPOXFbE1 W67Bp3DP6NAW4Nt8HFiWxkEnuqEFYqaGYV2bw= 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=SKATz6lsFbdUaU5u7O7xw7LnE5cKDqPS8/J61+OT3hNm4OZLU03A7YLneIzmGc69wJ GJsMiqPAbat2Z0dwaz3YpyTWXceobjM+q181wnKRduVH8wFOix4KKMkfoXhG6qmqDfth 5U5LSPN0rimrgHmretgcEZQ+dbv8VppdjJGVXsJXx49nQmeK3fhNl//qLv2zLacYbzlE gwZGGXFNjxBqgVif84jhA76MuztFKWlTR4jT1/5c8MUWyn/CICflPI5MbedDAXu9PErU 3Zw6Ug0yyZJKCeXT2JGg8qyAzlLkRiyiuSxIRkTNYgtZQPqKqu1PDFxYsnDy6XRuY2lf yzbA== X-Gm-Message-State: AHQUAuar2l/AKxN3vZQLdAiaSv8tG6xVWHo5Sz6ifSDjAKAkFmmcTzu+ 0Wg/MgzEY272/+wbecwSl/EQ6Q== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_112634_785863_C45CA37E X-CRM114-Status: GOOD ( 11.50 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org 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 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;