Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1152456pxb; Fri, 21 Jan 2022 10:59:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx599m8G/CcJv+Cc1Zxe3jJlShsIQ0dNFiyc41wzmbAsIq4oOxKMoFHveUMFb8wyqbjux9y X-Received: by 2002:a62:3893:0:b0:4ba:7246:4830 with SMTP id f141-20020a623893000000b004ba72464830mr4736479pfa.30.1642791560271; Fri, 21 Jan 2022 10:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642791560; cv=none; d=google.com; s=arc-20160816; b=e5FtQPA/bA7OD4qGukbf0wCUnbSDWmLaVMTVOjXD+YvpPl4FU2BnBB6PdKQk/orx6Z nx/B5mMjoITXGsRM25qiRsEcnrejLj3dAEy7aaYKb8imzZm2+AIWZ7XbweOvJIsHEwOV bdvbqgmBfBEJ4xVimjM/fKiSZwcA87jwKVybtnc3kmWHsn3otMAC7CkDVuP+FmXDRISU kEqDpyIqk6fD+BHJPmPClZSrX+CCBC5gaTse2BKkMv2SPJ9TefSJBs6Q2CZ78Zp2tO8i dPHSdRODqaoNT5wvBX4jUgQp3SDedwyTWPTnfj98cFWoliIqA93yrIotoUzetkqTMtK3 G8xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=fOsG6E/RSH6q7OlPzIOgFc7TVNgH1e6lR1oom1ug788=; b=xuMQ16PAtPFREAOFIzouHI5Y2xa7bmEYlavK7jsDRRYWEbZdU/ayxR1J8wWVgJGXeX CcLvCFHT0tpc0SwFyZOj/kOdb0p6cQ4dsa0DnXfpA+SZflHStE5UZbJuo8f65iExtoOc Cw3fAY6NDWVA4z3jKu7z5VcUw10eglTZHZihUjqP82vyqhoqtn81S6jhDeaPM4KpfK5r +ahkBJTas5UidgiSIhxT3i3WhsAa+TXPeFEfpp+2W6AXw9lwybwG1l5cbKqY3iKMogQ0 zA8V0NcRgrPvW/CCYp6jDs4wastZXHbcFhMAdo+3l9gRVA1dGnBzQlkLjj86LrJge2UL 1nDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=B7fnRyEi; 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si2691674pfe.380.2022.01.21.10.59.08; Fri, 21 Jan 2022 10:59:20 -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=@collabora.com header.s=mail header.b=B7fnRyEi; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352294AbiASInU (ORCPT + 99 others); Wed, 19 Jan 2022 03:43:20 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46388 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350075AbiASInP (ORCPT ); Wed, 19 Jan 2022 03:43:15 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 5B9CD1F43EEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1642581794; bh=+B/hBYH7GoT/nMpZGsa7fzqnbMcaX/mKr3HkH43rjNs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=B7fnRyEiv3YXlB6PoTAFo3/4bmFrAPkPYZFXQ9ynaU9m5DUkcG4cTDilG0Z8MXAkB fCNIaIGNgV/V/et8nXtADyCRV1h15fCAkpqkQgiFvrztHWGUkhJzzRhLaObUZDf/gT 56fo+GEB82DGmRemXivmBGri3BrqlGBj9z1IWzaY47v/fETPFfTjxqYaPoITkiH+Yo Dn0SyHHEZwYeCiDo+bg9qvJsTZBb5J/C7PoZD8bQUxwOSrS8Rp5z88453txR9Xzrpb CAgHXlokVWdyN3C61jZiIHHe71rhJClBQnvABRyQTMGMBtidCT14NMP4THvVYn+yal LOto4upOWFIhA== Subject: Re: [v10,2/3] drm/mediatek: implement the DSI HS packets aligned To: Andrzej Hajda , Rex-BC Chen , chunkuang.hu@kernel.org, matthias.bgg@gmail.com, narmstrong@baylibre.com, robert.foss@linaro.org, daniel@ffwll.ch, airlied@linux.ie, p.zabel@pengutronix.de Cc: xji@analogixsemi.com, jitao.shi@mediatek.com, xinlei.lee@mediatek.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com References: <20220119022543.26093-1-rex-bc.chen@mediatek.com> <20220119022543.26093-3-rex-bc.chen@mediatek.com> <4abe1f96-aafd-71bc-5f5e-bfcc4320c8c4@intel.com> From: AngeloGioacchino Del Regno Message-ID: <35821437-8f62-e4f3-0614-2a6a59668938@collabora.com> Date: Wed, 19 Jan 2022 09:43:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <4abe1f96-aafd-71bc-5f5e-bfcc4320c8c4@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 19/01/22 09:35, Andrzej Hajda ha scritto: > > On 19.01.2022 03:25, Rex-BC Chen wrote: >> Some DSI RX devices (for example, anx7625) require last alignment of >> packets on all lanes after each row of data is sent. >> Otherwise, there will be some issues of shift or scroll for screen. >> >> Take horizontal_sync_active_byte for a example, >> we roundup the HSA packet data to lane number, and the subtraction of 2 >> is the packet data value added by the roundup operation, making the >> long packets are integer multiples of lane number. >> This value (2) varies with the lane number, and that is the reason we >> do this operation when the lane number is 4. >> >> In the previous operation of function "mtk_dsi_config_vdo_timing", >> the length of HSA and HFP data packets has been adjusted to an >> integration multiple of lane number. >> Since the number of RGB data packets cannot be guaranteed to be an >> integer multiple of lane number, we modify the data packet length of >> HBP so that the number of HBP + RGB is equal to the lane number. >> So after sending a line of data (HSA + HBP + RGB + HFP), the data >> lanes are aligned. >> >> Signed-off-by: Jitao Shi >> Signed-off-by: Rex-BC Chen >> Signed-off-by: Xinlei Lee > > Reviewed-by: Andrzej Hajda Reviewed-by: AngeloGioacchino Del Regno > > Regards > > Andrzej > >> --- >>   drivers/gpu/drm/mediatek/mtk_dsi.c | 12 ++++++++++++ >>   1 file changed, 12 insertions(+) >> >> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c >> index 5d90d2eb0019..e91b3fff4342 100644 >> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c >> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c >> @@ -500,6 +500,18 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi) >>           DRM_WARN("HFP + HBP less than d-phy, FPS will under 60Hz\n"); >>       } >> +    if ((dsi->mode_flags & MIPI_DSI_HS_PKT_END_ALIGNED) && >> +        (dsi->lanes == 4)) { >> +        horizontal_sync_active_byte = >> +            roundup(horizontal_sync_active_byte, dsi->lanes) - 2; >> +        horizontal_frontporch_byte = >> +            roundup(horizontal_frontporch_byte, dsi->lanes) - 2; >> +        horizontal_backporch_byte = >> +            roundup(horizontal_backporch_byte, dsi->lanes) - 2; >> +        horizontal_backporch_byte -= >> +            (vm->hactive * dsi_tmp_buf_bpp + 2) % dsi->lanes; >> +    } >> + >>       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);