Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3883406rwe; Mon, 17 Apr 2023 05:08:57 -0700 (PDT) X-Google-Smtp-Source: AKy350bQZFF5BAOvl0cerFkTQY2BwPMSvVWFMNe59rRoH+Xlncipx6g5b1D8lc+2FaJ887CJ3GDj X-Received: by 2002:a17:903:187:b0:1a2:87a2:c910 with SMTP id z7-20020a170903018700b001a287a2c910mr15237324plg.53.1681733337349; Mon, 17 Apr 2023 05:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681733337; cv=none; d=google.com; s=arc-20160816; b=nMuherUdf26FObewfRcQg8RFtsRDvxjb3CXOEqj/zVKwThnzVppJJb0BP8/hw0Zusk ItrjOo4WLy3b1llGt3BuUS2sx6tTCldjjvQZ7G9KASsplwqZE9/3O7S/rHuZxpNt+DDR hXMWWdSJb9yXlfgNqtwMq423lK/x5NWYq2ZIBEM7//jYTryeLZmmV14Fbxxmbo+dWULg HPREGpg2vA9ey9Knmu+EF95I64Zm4Xgo5q0AzH6m/Erp8wBSS/VDaYoxvLxstpomApch zcmY1ViXXeqEUjKkz0x+DapcGcUBpDtGXVo5ooP8CdHh3eTPCWbrT1UMgtwoTfj1iosz 0/Ig== 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=8rqDdbdrZCzvlXd4a22A9799gLzxZLsBm6lXLdNfBVE=; b=ZtGecZW/tKV3QfSIOLAJYfgFxuw9T7emjXMp7dW4P4suB5//hKCqSTCkY9/84vvTIp 3tayz4HzacBH2hAa6gmfJwyT6HWscrKIRnfgW8Lo86Lhu9WB7PF1mEJWtDMgs6paiFcG iWix7KgYX9zetWthbwb9Kpg8o1exOegS1FVjtT7j0kpcJY8ugxpv6FlehDdFA6GFumJg 2xx8Am7z9C+IyWHEUVpSlduwRT39sEjDNq7OZTx8GTzMI7UY5AUjkBuY7xM6E0l4u8fj 91dpKbSlXOtAzdDwsqGpPcB6Yiea5jOV1fo2NYGh4YXDUEELYRwVZHQuX9F38WQFo+1r HcJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=a14fK1OG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a17090341d100b001a6955c6318si10367234ple.440.2023.04.17.05.08.44; Mon, 17 Apr 2023 05:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=a14fK1OG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230120AbjDQL5D (ORCPT + 99 others); Mon, 17 Apr 2023 07:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbjDQL5A (ORCPT ); Mon, 17 Apr 2023 07:57:00 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BFB26A6A; Mon, 17 Apr 2023 04:55:58 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id k36-20020a17090a4ca700b0024770df9897so4503256pjh.4; Mon, 17 Apr 2023 04:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681732542; x=1684324542; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8rqDdbdrZCzvlXd4a22A9799gLzxZLsBm6lXLdNfBVE=; b=a14fK1OGxrvNNDA/XUSfo1+sVGVXYCltmoxv1yGssHviautywCV9WIy8qTBrTOtwn7 Bn2b+w2y8sJF+MbAiVBakeGlHzDTRSyUhq1Lez6MAwiV5uDMYqtz1O8CRMa1/g8pxTVw 7E+Eg26pEm6b/uyldi4np+5N0pR5ZwEJlObtzDE/YTuu3lidY1n3bykdyA0D9C33DmIF ljVsKTyojP9PXRGmGZOl1DoqAH7giwirLU/FGBeayEe39/7tTZbpYbG5TRXaN0m1lIWu 2YUn3CjNG9F5lvjLZ3Hw/rocILl37UFJDLF21qXtJlNia8WjQqkLmeiMkF1Hg4c7l0eU Qtog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681732542; x=1684324542; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8rqDdbdrZCzvlXd4a22A9799gLzxZLsBm6lXLdNfBVE=; b=ADiWr783ZftzfxBS4MHPl0qyNfHwdQX4a/XEA3rchM/E+erIP6f3g+4GAq9CGTquV+ whQK5HeJQhbohm+AyF2FYUDb7oWf8H7oFKpfCxx5xK356m2Jbtdxf4QP0lw9AlEvV/0f FeKFHbPa56J2LzDR9eWkLZYE1oJwPNarPvZm3w2l1lDcCKel0vl4cdEb0c1WUgjItekM YclvZXQ1ifjbStGTs+D1cxX4MfT6IoOHVRAX9u33U+4KXYf8cs76SUksV2fcYtx2pSFE ORC7+ZLk46DCErtzyKyzNoUVltqUUzXexVcdb0oDM6vNtkReH166aWWpYPDcCAz2v8bA ouHw== X-Gm-Message-State: AAQBX9daTiYocfN3UjNPZSgn2vlO+jw5WfCjkPBrhnJCZl8tSboaS+ZP Bi2doPRZFmavd5DjdTJsHSbEMPjjqU1HoicvmIw= X-Received: by 2002:a17:902:7793:b0:1a6:54c6:9428 with SMTP id o19-20020a170902779300b001a654c69428mr3352631pll.3.1681732541765; Mon, 17 Apr 2023 04:55:41 -0700 (PDT) MIME-Version: 1.0 References: <20230415104104.5537-1-aford173@gmail.com> <3e47f0d1017fe4c9f71a5de65f32c6ba1662efe2.camel@pengutronix.de> In-Reply-To: <3e47f0d1017fe4c9f71a5de65f32c6ba1662efe2.camel@pengutronix.de> From: Adam Ford Date: Mon, 17 Apr 2023 06:55:30 -0500 Message-ID: Subject: Re: [PATCH 1/6] drm: bridge: samsung-dsim: Support multi-lane calculations To: Lucas Stach Cc: dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , aford@beaconembedded.com, Laurent Pinchart , Andrzej Hajda , Fabio Estevam , m.szyprowski@samsung.com, marex@denx.de, Robert Foss , David Airlie , Jernej Skrabec , Jagan Teki , NXP Linux Team , devicetree@vger.kernel.org, Daniel Vetter , Jonas Karlman , Sascha Hauer , Inki Dae , Rob Herring , linux-arm-kernel@lists.infradead.org, Neil Armstrong , linux-kernel@vger.kernel.org, Pengutronix Kernel Team , Shawn Guo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 17, 2023 at 3:43=E2=80=AFAM Lucas Stach wrote: > > Hi Adam, > > Am Samstag, dem 15.04.2023 um 05:40 -0500 schrieb Adam Ford: > > If there is more than one lane, the HFP, HBP, and HSA is calculated in > > bytes/pixel, then they are divided amongst the different lanes with som= e > > additional overhead. This is necessary to achieve higher resolutions wh= ile > > keeping the pixel clocks lower as the number of lanes increase. > > > > In the testing I did to come up with my patch "drm: bridge: samsung- > dsim: fix blanking packet size calculation" the number of lanes didn't > make any difference. My testing might be flawed, as I could only > measure the blanking after translation from MIPI DSI to DPI, so I'm > interested to know what others did here. How did you validate the > blanking with your patch? Would you have a chance to test my patch and > see if it works or breaks in your setup? Mine was purely by trial and error. I don't have a scope, nor do I have a copy of the MIPI DSI spec, so if the image sync'd with my monitor, I treated it as successful. I can give yours a try, but it might be a few days since I've only been working on this stuff a bit in my spare time. adam > > Regards, > Lucas > > > Signed-off-by: Adam Ford > > --- > > drivers/gpu/drm/bridge/samsung-dsim.c | 40 +++++++++++++++++++++++---- > > 1 file changed, 34 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/br= idge/samsung-dsim.c > > index e0a402a85787..1ccbad4ea577 100644 > > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > > @@ -215,6 +215,7 @@ > > #define DSI_RX_FIFO_SIZE 256 > > #define DSI_XFER_TIMEOUT_MS 100 > > #define DSI_RX_FIFO_EMPTY 0x30800002 > > +#define DSI_HSYNC_PKT_OVERHEAD 6 > > > > #define OLD_SCLK_MIPI_CLK_NAME "pll_clk" > > > > @@ -879,13 +880,40 @@ static void samsung_dsim_set_display_mode(struct = samsung_dsim *dsi) > > | DSIM_MAIN_VBP(m->vtotal - m->vsync_end); > > samsung_dsim_write(dsi, DSIM_MVPORCH_REG, reg); > > > > - reg =3D DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) > > - | DSIM_MAIN_HBP(m->htotal - m->hsync_end); > > - samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); > > + /* > > + * If there is more than one lane, the HFP, HBP, and HSA > > + * is calculated in bytes/pixel, then they are divided > > + * amongst the different lanes with some additional > > + * overhead correction > > + */ > > + if (dsi->lanes > 1) { > > + u32 hfp, hbp, hsa; > > + int bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->for= mat) / 8; > > + > > + hfp =3D ((m->hsync_start - m->hdisplay) * bpp) / = dsi->lanes; > > + hfp -=3D (hfp > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSY= NC_PKT_OVERHEAD : 0; > > + > > + hbp =3D ((m->htotal - m->hsync_end) * bpp) / dsi-= >lanes; > > + hbp -=3D (hbp > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSY= NC_PKT_OVERHEAD : 0; > > > > - reg =3D DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) > > - | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); > > - samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); > > + hsa =3D ((m->hsync_end - m->hsync_start) * bpp) /= dsi->lanes; > > + hsa -=3D (hsa > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSY= NC_PKT_OVERHEAD : 0; > > + > > + reg =3D DSIM_MAIN_HFP(hfp) | DSIM_MAIN_HBP(hbp); > > + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); > > + > > + reg =3D DSIM_MAIN_VSA(m->vsync_end - m->vsync_sta= rt) > > + | DSIM_MAIN_HSA(hsa); > > + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); > > + } else { > > + reg =3D DSIM_MAIN_HFP(m->hsync_start - m->hdispla= y) > > + | DSIM_MAIN_HBP(m->htotal - m->hsync_end)= ; > > + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); > > + > > + reg =3D DSIM_MAIN_VSA(m->vsync_end - m->vsync_sta= rt) > > + | DSIM_MAIN_HSA(m->hsync_end - m->hsync_s= tart); > > + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); > > + } > > } > > reg =3D DSIM_MAIN_HRESOL(m->hdisplay, num_bits_resol) | > > DSIM_MAIN_VRESOL(m->vdisplay, num_bits_resol); >