Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6171539rwr; Mon, 1 May 2023 18:10:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6T4eoNOFeg/8hqU4EjwRmBJlzv0Mu84A5cXHdPw+kht3jKIQkz/vDLcFrHSuaS9r0rI/fM X-Received: by 2002:a05:6a00:ccc:b0:63f:125f:9595 with SMTP id b12-20020a056a000ccc00b0063f125f9595mr21864286pfv.9.1682989815081; Mon, 01 May 2023 18:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682989815; cv=none; d=google.com; s=arc-20160816; b=k4vV0n57Ia7AiWUBB0k9OOee1clJ4nRS1l1qfgJC545th3iMnUntEN1atu1E9uwAjf vmGP8qAA7i2k2LdjecY4DWByk9tvAxMlDAo5tml9MNCwC2Qcw/hGkffYzZLytxqiZkvk PDq2wIUOZwJubH01T4H5Be48EJa1/pYdv4QKJiu7RQMGh/4kV1VxirPNlY+eHMY6bOM5 y0eK4UxDmfSvhEXYN0r1ZiMNnw+X8nYysvvyPQINgBSK1WuJQKC0sRygwco6oNdSof2l iibHoPaviImC4IzqqBx7E09KtsjqRYQFEhaDeFakfVP0EzLt3Sq8yKcjpOzjzdcv2UA8 435A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5CznWtXBlBAUTzPhoV/NK/Tc5LdU+0am6ActqKsQmdk=; b=prGJclJBQ2ptOvZyCHZa7l7IOv5zEOmYnDxJj09jeKGVrhj1ItMlfx1YtmK4+OL4ZT iFhWmjdDtPVcyybbdY1zCwf1/PL/ltQqB3TIIJTqLkcntPHAOy1BOgiGd5D+HOR61NK3 YCOkLnDyiZz7pa83s/33mtc/iEMwds91cDp2rXTg4/Z/HPygbWQRoqzOAPAZcPp91OUl QsW5v6kWwZzroihlg7c3Y17ys0wYWWfN+pxMTKWs/KDZvDeYjvwjj6392dcsCXCdBpro ZL07oFezC55FegytJeWfCL6SppJLs8YIZIFBZWN1QQbb3YhsflveF3tJZkQvlVmVUJv+ scVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="sGjC/BfH"; 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 u190-20020a6385c7000000b00525037a363asi21999949pgd.328.2023.05.01.18.10.03; Mon, 01 May 2023 18:10:15 -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="sGjC/BfH"; 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 S233329AbjEBBIR (ORCPT + 99 others); Mon, 1 May 2023 21:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbjEBBIM (ORCPT ); Mon, 1 May 2023 21:08:12 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2D211A for ; Mon, 1 May 2023 18:08:09 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3296292e623so26521905ab.2 for ; Mon, 01 May 2023 18:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682989689; x=1685581689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5CznWtXBlBAUTzPhoV/NK/Tc5LdU+0am6ActqKsQmdk=; b=sGjC/BfHQKk3rDUml7ijRHKM0pXWzke2GrLRzRR+xcpFrxO0uohJ0YdskPS1bMLNzh pB8XRGAmSu3fl1blwyYMaa9ezsTd87eBoM3uYUzcaAI2wJtFHff/uVkPfgQEJOhaLr3F bqfPy0oMOnM8dvJfEots5dO3NlUNuj12qD5wC5lA+RSMlHINRHgnPSTpfqfmfBQmqEP4 gJWX08PVIv/gVoNRlQFbPJ3UcHsitAPl8v77r1ER95ZAaid2gSmwZx9iOvDs1WJNSyE1 vkXH5lOe6dbeC/gtSnCREpT8JpCtMIGQqIX3gP6HYGNWkPG+3O51ZM3uOwYFY8MtBmoe kVKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682989689; x=1685581689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5CznWtXBlBAUTzPhoV/NK/Tc5LdU+0am6ActqKsQmdk=; b=LRjM9EDx0jRQ6OOkgqR0Z9dZY6TVdKTxvxAA71FZ5vafptWM9YuoKFr8jMcONnu9WX Zz6OCxJrArhkfT5lOLfLSgWe99ZNq94oA99b9r1q/llQyhvh52pAP4cRlpERBQe9S3pk sHx+O5sZa84iWA2LePdKB3zE3SVmJw353e+O5i+YICNAq/Bu86XbZu6I5myeVbdqBng8 6ZsYR+6QwhqVTptgYzx+5HlgJ8HAH636p8PmdHuO0pEWpaO4KbH0uG+p9bPoXROTKdWy 8Dtn+CdxuHWfdWANlcPjAjgQ3/4Dpr17BPUARp53APJYWvT/D01AlX/fDLid0L7UcOhm fbpw== X-Gm-Message-State: AC+VfDztfY8mI2xxmxrDuDBNUHWJxfPJZT4Y3APvy3XMHxhUIZooI1/U 4lcz/yDSyAkA6bv8EgzJKV0= X-Received: by 2002:a92:d84a:0:b0:32c:c418:9163 with SMTP id h10-20020a92d84a000000b0032cc4189163mr10261202ilq.5.1682989689034; Mon, 01 May 2023 18:08:09 -0700 (PDT) Received: from aford-B741.lan ([2601:447:d001:897f:8257:a536:d7fc:1919]) by smtp.gmail.com with ESMTPSA id f16-20020a056638329000b0040fb5d5429fsm4836329jav.131.2023.05.01.18.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 18:08:08 -0700 (PDT) From: Adam Ford To: dri-devel@lists.freedesktop.org Cc: marex@denx.de, aford@beaconembedded.com, Lucas Stach , Adam Ford , Chen-Yu Tsai , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Inki Dae , Jagan Teki , Marek Szyprowski , Frieder Schrempf , linux-kernel@vger.kernel.org Subject: [PATCH V3 1/7] drm: bridge: samsung-dsim: fix blanking packet size calculation Date: Mon, 1 May 2023 20:07:53 -0500 Message-Id: <20230502010759.17282-2-aford173@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230502010759.17282-1-aford173@gmail.com> References: <20230502010759.17282-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Lucas Stach Scale the blanking packet sizes to match the ratio between HS clock and DPI interface clock. The controller seems to do internal scaling to the number of active lanes, so we don't take those into account. Signed-off-by: Lucas Stach Signed-off-by: Adam Ford Tested-by: Chen-Yu Tsai --- drivers/gpu/drm/bridge/samsung-dsim.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index e0a402a85787..2be3b58624c3 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -874,17 +874,29 @@ static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi) u32 reg; if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { + int byte_clk_khz = dsi->burst_clk_rate / 1000 / 8; + int hfp = (m->hsync_start - m->hdisplay) * byte_clk_khz / m->clock; + int hbp = (m->htotal - m->hsync_end) * byte_clk_khz / m->clock; + int hsa = (m->hsync_end - m->hsync_start) * byte_clk_khz / m->clock; + + /* remove packet overhead when possible */ + hfp = max(hfp - 6, 0); + hbp = max(hbp - 6, 0); + hsa = max(hsa - 6, 0); + + dev_dbg(dsi->dev, "calculated hfp: %u, hbp: %u, hsa: %u", + hfp, hbp, hsa); + reg = DSIM_CMD_ALLOW(0xf) | DSIM_STABLE_VFP(m->vsync_start - m->vdisplay) | DSIM_MAIN_VBP(m->vtotal - m->vsync_end); samsung_dsim_write(dsi, DSIM_MVPORCH_REG, reg); - reg = DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) - | DSIM_MAIN_HBP(m->htotal - m->hsync_end); + reg = DSIM_MAIN_HFP(hfp) | DSIM_MAIN_HBP(hbp); samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) - | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); + | DSIM_MAIN_HSA(hsa); samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); } reg = DSIM_MAIN_HRESOL(m->hdisplay, num_bits_resol) | -- 2.39.2