From patchwork Tue Nov 13 11:16:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680279 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 6614E14E2 for ; Tue, 13 Nov 2018 11:18:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5333C29A6B for ; Tue, 13 Nov 2018 11:18:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 433DF29A73; Tue, 13 Nov 2018 11:18: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC10829A6B for ; Tue, 13 Nov 2018 11:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732814AbeKMVP5 (ORCPT ); Tue, 13 Nov 2018 16:15:57 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41191 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732432AbeKMVP4 (ORCPT ); Tue, 13 Nov 2018 16:15:56 -0500 Received: by mail-pl1-f194.google.com with SMTP id p16-v6so5842329plr.8 for ; Tue, 13 Nov 2018 03:18:18 -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=y5PF+ZGgoffIRFFiAIPy5mU3TbDRA/z2eo11P9T0YNI=; b=jneNIuEv5or0LRXyR00yO91ezjvQhxMqVnleLvUvb0qMxNyG7xVaXRqtVmOLpeQ8y7 bM/uw98MojKBM5zVoHRwhs91BKOucHHDQa90ESFAlQNDH3U9BRF2f24ULc+h8U9eC0ut 7MrMG+wjGzZJpoAo/mTqqjh24Q0oiMiGgJAjE= 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=y5PF+ZGgoffIRFFiAIPy5mU3TbDRA/z2eo11P9T0YNI=; b=LHfRhxQ+H5wm/Tf1y/fdNszcTR+GA+Ms1DRjIwF8fND5MALafZy5FSCLz362CWtdAD 4WS/WJUsyIuG/AvHX0ZlqhkPRRcK0OI4SctZGYiS0ZByKSh2zj+9cZSj8ZNJyM6ETP72 FKWxVzQIg2CUQwMdiV0mbDMDESzvfxdSnMMUGB4Nxi/wfW5tzJantLzV0BJC8yaSocWp yBlmXDfqmS6rpQpj5GkywTP1fL/FGhNOiGAO/q8WjY82p7wN/oE5cO6XZkIc2mqFl/oA 6+SGLhTyn4EHEWMPQv/M/FAPHELOKyzCZh97aRX5wXy2SS+2IqybG+OVmR+BolnJMfQA H26Q== X-Gm-Message-State: AGRZ1gLJw7z1ERJPEslT8e/+PTGQNaHsfBx8FWtydzYBWrvEWNRatPGN Pd6Y4r55M9EdzKjZj8IN72LeLQ== X-Google-Smtp-Source: AJdET5fl9EAyHLgxZVFheUocNrQY6STwhD2s/FM85M3Md5hDM5+9EYN+0fPkeAqE/mOqLUveOeLBdQ== X-Received: by 2002:a17:902:9681:: with SMTP id n1-v6mr4660594plp.126.1542107898182; Tue, 13 Nov 2018 03:18:18 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:17 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 14/26] drm/sun4i: sun6i_mipi_dsi: Fix DSI hfp timing value Date: Tue, 13 Nov 2018 16:46:21 +0530 Message-Id: <20181113111633.20189-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.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 (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 DSI hfp timing accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- 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 1a3cdd5b72a0..63b924b89bd7 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -490,7 +490,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.