Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1916331pxb; Sat, 21 Nov 2020 02:41:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0PUb6cz8UTB7L2dtjrBhnaDp+xkS3Gd7OpjMQjIFOyVROoKgDQGHUzbRIdpPo/PkkNkLt X-Received: by 2002:a17:906:e2c3:: with SMTP id gr3mr35751519ejb.471.1605955265564; Sat, 21 Nov 2020 02:41:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605955265; cv=none; d=google.com; s=arc-20160816; b=t+wBLSHBGHZrf213E1nJA1yFuAEpoRfip5fek/NhLAhL+8hlF2e8rr8UXuZvyugPf2 PFen21QcuHCwvsGAlc0Akm+F2YM29M48Nhwe/5U0q+Fec2XSZi9ihp31+JCiFQqF/ivL 2MWIolKmeWNzteu+or8cjSt/dRdXVnaGEESTLfboVwHyZ0YN35RCJPTKPwAbWRMI5iVH YWbORfLNTZ49eMlhMyf2WB/hFhryq1Dza5lr/AjNlVOBaV+ZJJTTYKQ17ipb57xNEh89 0wdUedMrQeaIBAi4OHwMQR/WGslcTwTFtZ7d5FVY7tqm6JtjgcQaDpnPo86PeEFGWOwQ VZGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sCpwAHLa5mI34KFvHEg31DGS9bBgznBTX4PAQYWMbP0=; b=AiJSYUydB5WUGzEpwCZGvilTVih+hMa3Ul1t4nmzbiE1YemLFgzBTmDZga/Ug6E/++ V2Z2mbq/SqW6nVFbSvOt6LTzmSEvNFMTeyOCN0l6rQcGCT6yZpkElA5R3/v8eqH95x/e Zm3f1VDJsj7ALQsAHHJqDkC97PXDyLGXozj+wgkC+xsxNNWrGsoTx/yPKZXV3RhsQ/+f +Yrdk5QSlltEXpNKVQRMy8e9bBueFmerr+cMA5b8oluF6Vw7QzZHjC6mRD47tfKYOe48 uQWVQB51pWhfhOG+rzojsL5EvK+vVKrQaaXrg3cewQ4VB3Z01eFh/oicSjNspR35RmSQ D3FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z8BGdgIZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz2si3236641ejc.558.2020.11.21.02.40.40; Sat, 21 Nov 2020 02:41:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z8BGdgIZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727358AbgKUKh7 (ORCPT + 99 others); Sat, 21 Nov 2020 05:37:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:54130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbgKUKh6 (ORCPT ); Sat, 21 Nov 2020 05:37:58 -0500 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E82322254 for ; Sat, 21 Nov 2020 10:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605955076; bh=0iPSg8OjIQe2EwLNb/s9nIdiFuPHQuOfmsC85sp8jCg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Z8BGdgIZyJ89SBcXgRK/tQq1W75b7JbcAUk64naWQM60X7zxB3U0u+eh/aukIsBcs ulcPuega36oBIlk4axL2h29qK/76dqZaIjhWtayHaP1spkrX2rnMnpyep3hrPxZgS+ fcreDNGBKMBfMLBGPwGBCpgtNvsQHBhhEVCVAIqg= Received: by mail-wr1-f53.google.com with SMTP id m6so13452957wrg.7 for ; Sat, 21 Nov 2020 02:37:56 -0800 (PST) X-Gm-Message-State: AOAM532AZRgHQXnoS230HptvTmQ5HOGuuulGhHK1zLnOYIhvtJcMbEPH nGuvsJLPidfiovjylk5H1IqnJlb90exnTN1ZHw== X-Received: by 2002:a5d:6689:: with SMTP id l9mr19872241wru.134.1605955074930; Sat, 21 Nov 2020 02:37:54 -0800 (PST) MIME-Version: 1.0 References: <20201119232335.6704-1-chunkuang.hu@kernel.org> <20201120052950.0ca597fb@a-VirtualBox> In-Reply-To: <20201120052950.0ca597fb@a-VirtualBox> From: Chun-Kuang Hu Date: Sat, 21 Nov 2020 18:37:42 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/mediatek: dsi: Modify horizontal front/back porch byte formula To: Bilal Wasim Cc: Chun-Kuang Hu , Jitao Shi , Philipp Zabel , David Airlie , Daniel Vetter , linux-kernel , DRI Development , "moderated list:ARM/Mediatek SoC support" , CK Hu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bilal Wasim =E6=96=BC 2020=E5=B9=B411=E6=9C=8820= =E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8A=E5=8D=888:30=E5=AF=AB=E9=81=93=EF=BC= =9A > > Hi CK, > > On Fri, 20 Nov 2020 07:23:35 +0800 > Chun-Kuang Hu wrote: > > > From: CK Hu > > > > In the patch to be fixed, horizontal_backporch_byte become to large > > for some panel, so roll back that patch. For small hfp or hbp panel, > > using vm->hfront_porch + vm->hback_porch to calculate > > horizontal_backporch_byte would make it negtive, so > > use horizontal_backporch_byte itself to make it positive. Applied to mediatek-drm-fixes [1]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/= log/?h=3Dmediatek-drm-fixes > > > > Fixes: 35bf948f1edb ("drm/mediatek: dsi: Fix scrolling of panel with > > small hfp or hbp") > > > > Signed-off-by: CK Hu > > Signed-off-by: Chun-Kuang Hu > > --- > > drivers/gpu/drm/mediatek/mtk_dsi.c | 61 > > +++++++++++------------------- 1 file changed, 22 insertions(+), 39 > > deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c > > b/drivers/gpu/drm/mediatek/mtk_dsi.c index 4a188a942c38..65fd99c528af > > 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > > @@ -444,7 +444,10 @@ static void mtk_dsi_config_vdo_timing(struct > > mtk_dsi *dsi) u32 horizontal_sync_active_byte; > > u32 horizontal_backporch_byte; > > u32 horizontal_frontporch_byte; > > + u32 horizontal_front_back_byte; > > + u32 data_phy_cycles_byte; > > u32 dsi_tmp_buf_bpp, data_phy_cycles; > > + u32 delta; > > struct mtk_phy_timing *timing =3D &dsi->phy_timing; > > > > struct videomode *vm =3D &dsi->vm; > > @@ -466,50 +469,30 @@ static void mtk_dsi_config_vdo_timing(struct > > mtk_dsi *dsi) horizontal_sync_active_byte =3D (vm->hsync_len * > > dsi_tmp_buf_bpp - 10); > > if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) > > - horizontal_backporch_byte =3D vm->hback_porch * > > dsi_tmp_buf_bpp; > > + horizontal_backporch_byte =3D vm->hback_porch * > > dsi_tmp_buf_bpp - 10; else > > horizontal_backporch_byte =3D (vm->hback_porch + > > vm->hsync_len) * > > - dsi_tmp_buf_bpp; > > + dsi_tmp_buf_bpp - 10; > > > > data_phy_cycles =3D timing->lpx + timing->da_hs_prepare + > > - timing->da_hs_zero + timing->da_hs_exit; > > - > > - if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { > > - if ((vm->hfront_porch + vm->hback_porch) * > > dsi_tmp_buf_bpp > > > - data_phy_cycles * dsi->lanes + 18) { > > - horizontal_frontporch_byte =3D > > - vm->hfront_porch * dsi_tmp_buf_bpp - > > - (data_phy_cycles * dsi->lanes + 18) * > > - vm->hfront_porch / > > - (vm->hfront_porch + vm->hback_porch); > > - > > - horizontal_backporch_byte =3D > > - horizontal_backporch_byte - > > - (data_phy_cycles * dsi->lanes + 18) * > > - vm->hback_porch / > > - (vm->hfront_porch + vm->hback_porch); > > - } else { > > - DRM_WARN("HFP less than d-phy, FPS will > > under 60Hz\n"); > > - horizontal_frontporch_byte =3D > > vm->hfront_porch * > > - dsi_tmp_buf_bpp; > > - } > > + timing->da_hs_zero + timing->da_hs_exit + > > 3; + > > + delta =3D dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST ? 18 : > > 12; + > > + horizontal_frontporch_byte =3D vm->hfront_porch * > > dsi_tmp_buf_bpp; > > + horizontal_front_back_byte =3D horizontal_frontporch_byte + > > horizontal_backporch_byte; > > + data_phy_cycles_byte =3D data_phy_cycles * dsi->lanes + delta; > > + > > + if (horizontal_front_back_byte > data_phy_cycles_byte) { > > + horizontal_frontporch_byte -=3D data_phy_cycles_byte * > > + > > horizontal_frontporch_byte / > > + > > horizontal_front_back_byte; + > > + horizontal_backporch_byte -=3D data_phy_cycles_byte * > > + > > horizontal_backporch_byte / > > + > > horizontal_front_back_byte; } else { > > - if ((vm->hfront_porch + vm->hback_porch) * > > dsi_tmp_buf_bpp > > > - data_phy_cycles * dsi->lanes + 12) { > > - horizontal_frontporch_byte =3D > > - vm->hfront_porch * dsi_tmp_buf_bpp - > > - (data_phy_cycles * dsi->lanes + 12) * > > - vm->hfront_porch / > > - (vm->hfront_porch + vm->hback_porch); > > - horizontal_backporch_byte =3D > > horizontal_backporch_byte - > > - (data_phy_cycles * dsi->lanes + 12) * > > - vm->hback_porch / > > - (vm->hfront_porch + vm->hback_porch); > > - } else { > > - DRM_WARN("HFP less than d-phy, FPS will > > under 60Hz\n"); > > - horizontal_frontporch_byte =3D > > vm->hfront_porch * > > - dsi_tmp_buf_bpp; > > - } > > + DRM_WARN("HFP + HBP less than d-phy, FPS will under > > 60Hz\n"); } > > > > writel(horizontal_sync_active_byte, dsi->regs + DSI_HSA_WC); > > Tested on Chromebook ELM. > > Tested-by: Bilal Wasim > > Thanks, > Bilal