Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1635207rwr; Fri, 5 May 2023 18:11:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7XMFhYHBuqLVzozFyblKceGgMRLaybS+JGS+nqePrybPN1LirVo+jAzkCHQNjzKxcVdhm4 X-Received: by 2002:a05:6a00:1696:b0:633:c311:c70d with SMTP id k22-20020a056a00169600b00633c311c70dmr4716146pfc.14.1683335519486; Fri, 05 May 2023 18:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683335519; cv=none; d=google.com; s=arc-20160816; b=CIyz5/yRLI+4eLY4KzPZ5fC4OcDUoi2/TbZu1vOLfv46A6BJZxirQHbDyNKGEXZ/eb eMPETD5y8wtitpdOowWtNzVILmElwTQ5dwwxxjNZr7sH3W5/czcgD7NnUg8in+TDgubc ZYpvN9svtWBwIi/0RchIjTijPFqh4/yR9ymNDKVt6GaObuZlRN2jTo3cdbyF4Tqv5hJb OKd0KnBA9VakVb2lDFt+5ytO6UpsMMAcvYhIYYoAIFrTslxJpeDCBH5fBqqKkTTdDh2R /il3fGIL+E7atzv+GPdzSk6Is/eqpHYcGp7lv4BH7N0qo6H7OVw9imw6r5AzWj0WbctC Ss+w== 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=dygmSIeKyL1Qr6osm0gPJv6LRBfSTNTnVZ/IpsRKoBs=; b=t2K2Idp6DzEVKUH0kWi3fFoWsfN2ItwAxpZy1exxeb0O6qJtPEJb+N/M7Gid39UsEs BWAXOwPP786leNYTpqK/cdveUZyEg+g3PPpUpGdVQW8X7DY+w/ioT+9ePuOIzAeU0gt2 R1HLkxhEg7OZ9JkPAp2v3J2xBR0fhf8yEWVr/6IDdIDw9TmA4tW1voRcrNRh9ebijM5e rkbupcD7NOnk2rK88Ipk0YrQI4/u+tlUgzFb3+ZG2odRidLwRI447+Za2WeokqBfyxvo t81ZlFJN2lBee8VUo04MIHp+IDUjmjLtKA6CGTGla5sSaV3TEEOh5xImLuZJU760nssL +oEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ECqinSGC; 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 a15-20020aa795af000000b0063afd8a5b8dsi3183016pfk.186.2023.05.05.18.11.47; Fri, 05 May 2023 18:11:59 -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=ECqinSGC; 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 S229947AbjEFBJq (ORCPT + 99 others); Fri, 5 May 2023 21:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbjEFBJo (ORCPT ); Fri, 5 May 2023 21:09:44 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20F31992 for ; Fri, 5 May 2023 18:09:43 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-7665e607d1bso58814939f.3 for ; Fri, 05 May 2023 18:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683335383; x=1685927383; 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=dygmSIeKyL1Qr6osm0gPJv6LRBfSTNTnVZ/IpsRKoBs=; b=ECqinSGCsX0qECfmy038ywMxEDwdpTB190ZZqG5QL1XmuGVCktNau+CsIl4GIYM9OI gjkBObZL7341QL8Jaqw5EU5YVGF3SrNnjHy9COUKrlpZOd/v0pqf1FkH4+p2H5IEqF8n Oskj2y9WJrHu2HUVJz98kEQB6gj531C1fwdHDGnJuZEqSXjAmZDJ8iYbyZQkWGuwRaDD kl138V3pPgJioZe65KuRg1gUAF67H3k577ME6aURmKdw5rcTcTaiaezncdCOjg/8sWQE t0XWyJvil0UmK0Mn8FAhGv/3pU66nVnTn0er45WgJ69j0pOhMjeqKUMLaZsUYAzwXeGj 45Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683335383; x=1685927383; 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=dygmSIeKyL1Qr6osm0gPJv6LRBfSTNTnVZ/IpsRKoBs=; b=g6adONjFsqb5iCkQmS2htUaKVsopngRpq00lgH4eXEhMZ4/0HRG8KkQYQ+QWD00lAS SA2ufSwqPYTMg7PDmfTQUZvBFQNTT5GC21PVbe+e4osuuRaV/itIZ4/BNvk7/LDnUg8g Uv8fEhDgALHK1nG3H9WmIs4+N+Fs5jXFLP+LPdFa/Rt2lMbdW8H3MoRejKFTnLBb9gNS ClSTCyJYG3TVRvDw/fKmtioysxlUyD9eNn9uZjbx1tT4u9/iANAfhz2hbcw0DboI78hW aNVxnAlg8alNqHoJ9HZDXGDyHI6w5Zm7aUX/T2jtbFTEvrsU/MfHDz14U8gPSeypcF4J eEjg== X-Gm-Message-State: AC+VfDyYL4r5wrQoxiSeKjWkIJr0PSh5XADv8VTxTvtT5TVYPfGKk+oI qzRhSmVicSgy9j/smHGZmBmL6gb3iay0vQ== X-Received: by 2002:a5d:9c09:0:b0:763:92eb:f81e with SMTP id 9-20020a5d9c09000000b0076392ebf81emr1978405ioe.8.1683335383115; Fri, 05 May 2023 18:09:43 -0700 (PDT) Received: from aford-B741.lan ([2601:447:d001:897f:34a2:3894:45cc:c002]) by smtp.gmail.com with ESMTPSA id r11-20020a5e950b000000b00760ed929d0bsm335735ioj.2.2023.05.05.18.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 18:09:42 -0700 (PDT) From: Adam Ford To: dri-devel@lists.freedesktop.org Cc: aford@beaconembedded.com, Lucas Stach , Adam Ford , Chen-Yu Tsai , Frieder Schrempf , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Inki Dae , Jagan Teki , Marek Szyprowski , Marek Vasut , linux-kernel@vger.kernel.org Subject: [PATCH V4 1/6] drm: bridge: samsung-dsim: fix blanking packet size calculation Date: Fri, 5 May 2023 20:09:28 -0500 Message-Id: <20230506010933.170939-2-aford173@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230506010933.170939-1-aford173@gmail.com> References: <20230506010933.170939-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 Tested-by: Frieder Schrempf --- 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