From patchwork Fri Oct 26 14:43:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10657621 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 6B61414BD for ; Fri, 26 Oct 2018 15:50:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 589532C99D for ; Fri, 26 Oct 2018 15:50:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C0332CA04; Fri, 26 Oct 2018 15:50:05 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 AC9212C99D for ; Fri, 26 Oct 2018 15:50:04 +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=Icxkmr9XfaDDWdySXbJtKRWkF7iTnbeUraQo5R/gnXQ=; b=JmiDIWHA/rWD2E 2cc9xJX/Ej7W99A9XGh/L2oMRZS5t3vogWFX+WCXyD+YZYRP7tF/WD/T6XgefwKdRJHVIrkPGrb9J UvSm9HQ4HXqjdxTSmTHWk9UFq7UF+eI1oEti6BK5medvQLF/uw3f8CHatxywZV6W6UMu8Tw/jXC6N jajEkzR/na+9swj+r2+EymKmWTAIIVbl0SWpHh7GWr5JBlkYKIj95A50K9nteSJi7hnFzjoTvNsE6 WwJcTCkts2aYxAj2L8t79z1gyLwPDhP533JFyqekDnAan8C0qCZgQkJuO4/gFCG/vE9NukRTrSxm/ 1+PJd+mRY2yOUUCzYnPQ==; 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 1gG4Mx-0004zh-3x; Fri, 26 Oct 2018 15:49:51 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG4KS-0003vT-58 for linux-arm-kernel@bombadil.infradead.org; Fri, 26 Oct 2018 15:47:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gStIo7NjdB+TGqHNblRTUUqjFPTn5lbRTmfmm273Bxc=; b=XtgYh7/kmP5cJVGQsnY6h+XMMY jeoI83Hkfi+aGOptqEzXa7E5Piwyk0MgCvFAO2j+dAdv4fLEfbCVNq+qlLiQZq/OLawDYWBy4u4gT ef23wu0Qshi6yuJcD+IThgZPgV+vHVVst/nyyFvUJRYYe37Lsqk8rTaGSVd41AGUqCqWHfK48GLuL 9rFw8b6gIuuMv/6j0g/Tw+5D+JjNH8tV0LhxoF3obZbaNYIVIVMKhR2j6kpQ8TpSXdcVKeW9R4BlJ e4XG6KQzJHAAApej7z7jYJbWl6Io6vm3U4lp+4SdnM87D2yxdb3TEGLVabOphIz2TmlKNeCIHlmy+ nXG4PuCw==; Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3Mn-0002o1-Mx for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 14:45:38 +0000 Received: by mail-pf1-x441.google.com with SMTP id g21-v6so663755pfi.7 for ; Fri, 26 Oct 2018 07:45:27 -0700 (PDT) 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=gStIo7NjdB+TGqHNblRTUUqjFPTn5lbRTmfmm273Bxc=; b=Yf5VhCYNunBsPm3e5TIp1NrtyNuZROnCExwWWP+jnKIHm/8MdKp3HleEcNYZvbuCHY ygswg13ZW87y3w5GYwhMds9ymeERXjpJSE/u8Xv/NyRUW6+QXOI5d1hn2GnZrMol6SUL gs1ZU94O9ECeCVRNBgDdaKvljgbrQXRsCNsvI= 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=gStIo7NjdB+TGqHNblRTUUqjFPTn5lbRTmfmm273Bxc=; b=Bgkn+tbpYoQda2e4W2LgBlMbQLu0ZXDUFzdCGJHhiUCYE8ZBtOUxeuwKIvSRLcxsQo qL3862QLJm+TyD96H1i1VBPRix5VJwt2Un41lZbVFc05guEfDIUk6U4FkGVA02plIwlH anFwtDsUyoEOFvBQ8cj4PvNEwH4frGGC+SORD2Iqdt9VQ6J00bV+TruAtBYds4i+mJ87 70tgTtEc3WgqaxWKWkkTRUMkqlJy1qjLGl81KL2KFadYhlsXjM2h9CoL7AaNCC4owaxY RaUGqYJVO2zym154S5xL0aIJ6aLJfj94aq3+tW2t6oUnhynEVMOByj+4p9AEDU/l2nbg YiHw== X-Gm-Message-State: AGRZ1gIHMLBibxLeNBXupbwXTBNZq+KJcePOc+xE96fuLHcWI+Y1aF78 SEWvqXd0d9CyUGHWeMUda/DhAw== X-Google-Smtp-Source: AJdET5f2tELebo7pA+gv81OluwfXob4rp1XQeVgf2g02+EfXF3ZDPpSJJx7eZAew0I6nmSg/Yy8auA== X-Received: by 2002:a63:b218:: with SMTP id x24mr3608910pge.223.1540565125481; Fri, 26 Oct 2018 07:45:25 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id z22-v6sm12044467pgv.24.2018.10.26.07.45.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:25 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 13/25] drm/sun4i: sun6i_mipi_dsi: Fix DSI hfp timing value Date: Fri, 26 Oct 2018 20:13:32 +0530 Message-Id: <20181026144344.27778-14-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181026144344.27778-1-jagan@amarulasolutions.com> References: <20181026144344.27778-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_104537_778961_AB581FDB X-CRM114-Status: GOOD ( 17.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: Jagan Teki Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Current driver is calculating hfp maximum value by subtracting htotal with hsync_end which is front back value, but the hpp 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 (in 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 DSI hfp timing accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki Tested-by: Jagan Teki --- Changes for v3: - new patch Changes for v2: - none 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 cf42be1f1ba1..6584b51736a9 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -490,7 +490,7 @@ 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.