Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1103557ybm; Wed, 27 May 2020 16:32:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBsqaNquCY2NJmXkMVlNCwbV3r/Erlza1tiAJnmNgJB0QpjODPXWX5SRWIbDExE0Ru4fO+ X-Received: by 2002:a17:906:cd03:: with SMTP id oz3mr646180ejb.391.1590622348538; Wed, 27 May 2020 16:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590622348; cv=none; d=google.com; s=arc-20160816; b=rJb7Rkwo5Ho0OAu0Bnyq4b2XgkoN0AnEX9Cfej+vnCxUjJMoQ0trEGt5MhNlv+m1Ps qAGAi5ihDhiJ4cj9jFo+9jyQHH9lIIsIc7tONUJrchB9FBlHRdEzolRGpYdD41mLsQbW E9yRL73r9XE6tNCjXtiLRLmJYCp/OWW4phoJdrtwEJrgsjqg+fvmW4Tf4SnhKQ4LRsPo HNXq3qdobg0oV8louz/A6/yh7p3lI/qwTw/mwD+PffAmPlsQf/xtdaG/Ivau7YrGyOx6 dtRn26YpZA+rustZKIxbA4yWI49q07j6+pkY5D74JlGsVhCeB5Vh//e3H6hGU384lcZZ emAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ucGME4GsefIP8+oWMGbsawfhyL7rCWLGIqtDbVjAVNA=; b=YZV/6uk+34+AFsoHSMB2b4dXiglj13kwx/Xaq3A7x0C9542etG3lH4M61+GYi50MCo /WzxCyjLjuCei0luNj6XKIVyAr88AvMjsy2jTtwn6Idknhkg0U6bUpy4fqes3Eonbysf vYvbedUS210/kMepH4vjyezMz4saEgQbWLOX3t921tUj37DSr/4sMS83xIRpg0/sKP9r gCz/KG0FESXg/udHv7b6i1ibmhkNJn2wF5EDOUEFKAsb19Cs2C8KWFtytBCymat9ta8d NSiYJ1Hola3RFXRx6E9qxTg/MzQrwUVqmdI6HCpMGG0deY8LUxucZH1USHw42tlj+g0G uFfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="kwd/vg40"; 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 w5si2800746ejq.420.2020.05.27.16.32.04; Wed, 27 May 2020 16:32:28 -0700 (PDT) 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="kwd/vg40"; 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 S1725834AbgE0X2I (ORCPT + 99 others); Wed, 27 May 2020 19:28:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:43766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725267AbgE0X2H (ORCPT ); Wed, 27 May 2020 19:28:07 -0400 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.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 8BCBB2078C; Wed, 27 May 2020 23:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590622086; bh=ON8PGesyAn+4FmexUP19mmvqNBZwY/TUXpZfPPF4QJ0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kwd/vg40MGTNgBlsGgZ1Ns4+sylbYRSUWSNWkKyvF2LP9p7PPuTN74buHh4ysAfUP kx3KaoRMpZhdY7tjVPWt3N1iEkG2St95fPYcLkiFUc6rRYsmwUdfCmOhbSkxxLlh5i poNDOBeCPqZrqDXH78oVECSagX75utQkwG/6d91Q= Received: by mail-ej1-f53.google.com with SMTP id o15so8684365ejm.12; Wed, 27 May 2020 16:28:06 -0700 (PDT) X-Gm-Message-State: AOAM531FqwZp7VqhUwZ2UEsAaPmwxsqPppWEUfrglQDOJz3mmcMBa5Ss PN+bGrwQL7Puuja/J3mvvm1RggX4qkqXP4MH1Q== X-Received: by 2002:a17:906:bcf8:: with SMTP id op24mr635286ejb.260.1590622084979; Wed, 27 May 2020 16:28:04 -0700 (PDT) MIME-Version: 1.0 References: <20200522101225.62571-1-jitao.shi@mediatek.com> In-Reply-To: <20200522101225.62571-1-jitao.shi@mediatek.com> From: Chun-Kuang Hu Date: Thu, 28 May 2020 07:27:51 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/mediatek: dsi: fix scrolling of panel with small hfp or hbp To: Jitao Shi Cc: Rob Herring , Mark Rutland , Matthias Brugger , Daniel Vetter , David Airlie , DRI Development , linux-kernel , devicetree@vger.kernel.org, srv_heupstream , huijuan.xie@mediatek.com, stonea168@163.com, cawa.cheng@mediatek.com, "moderated list:ARM/Mediatek SoC support" , Bibby Hsieh , CK Hu , yingjoe.chen@mediatek.com, eddie.huang@mediatek.com, Linux ARM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Jitao: Jitao Shi =E6=96=BC 2020=E5=B9=B45=E6=9C=8822=E6= =97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=886:12=E5=AF=AB=E9=81=93=EF=BC=9A > > If panel has too small hfp or hbp, horizontal_frontporch_byte or > horizontal_backporch_byte may become very small value or negative > value. This patch adjusts their values so that they are greater > than minimum value and keep total of them unchanged. > > Signed-off-by: Jitao Shi > --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediate= k/mtk_dsi.c > index 0ede69830a9d..aebaafd90ceb 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -148,6 +148,9 @@ > (type =3D=3D MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM) || \ > (type =3D=3D MIPI_DSI_DCS_READ)) > > +#define MIN_HFP_BYTE 0x02 > +#define MIN_HBP_BYTE 0x02 > + > struct mtk_phy_timing { > u32 lpx; > u32 da_hs_prepare; > @@ -450,6 +453,7 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi = *dsi) > u32 horizontal_sync_active_byte; > u32 horizontal_backporch_byte; > u32 horizontal_frontporch_byte; > + s32 signed_hfp_byte, signed_hbp_byte; > u32 dsi_tmp_buf_bpp, data_phy_cycles; > struct mtk_phy_timing *timing =3D &dsi->phy_timing; > > @@ -519,6 +523,20 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi= *dsi) > } > } > > + signed_hfp_byte =3D (s32)horizontal_frontporch_byte; > + signed_hbp_byte =3D (s32)horizontal_backporch_byte; > + > + if (signed_hfp_byte + signed_hbp_byte < MIN_HFP_BYTE + MIN_HBP_BY= TE) { > + DRM_WARN("Calculated hfp_byte and hbp_byte are too small,= " > + "panel may not work properly.\n"); > + } else if (signed_hfp_byte < MIN_HFP_BYTE) { > + horizontal_frontporch_byte =3D MIN_HFP_BYTE; > + horizontal_backporch_byte -=3D MIN_HFP_BYTE - signed_hfp_= byte; > + } else if (signed_hbp_byte < MIN_HBP_BYTE) { > + horizontal_frontporch_byte -=3D MIN_HBP_BYTE - signed_hbp= _byte; > + horizontal_backporch_byte =3D MIN_HBP_BYTE; > + } > + I think horizontal_frontporch_byte would never be negtive, and horizontal_backporch_byte would be negtive when if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) 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 - 10); If this time it's negtive, the calculation of horizontal_frontporch_byte is so strange. I think processing negtive value should before here. Regards, Chun-Kuang. > writel(horizontal_sync_active_byte, dsi->regs + DSI_HSA_WC); > writel(horizontal_backporch_byte, dsi->regs + DSI_HBP_WC); > writel(horizontal_frontporch_byte, dsi->regs + DSI_HFP_WC); > -- > 2.25.1 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek