Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2505358rwr; Sat, 6 May 2023 12:26:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6w0vA6az8NtXsD1CSdMWtYE7LxxaRsE854SEUUepVkAZQq/f+UBYEtv3VrJ2JVQF1TA2X5 X-Received: by 2002:a05:6a00:1486:b0:63d:4358:9140 with SMTP id v6-20020a056a00148600b0063d43589140mr7874878pfu.34.1683401177091; Sat, 06 May 2023 12:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683401177; cv=none; d=google.com; s=arc-20160816; b=F2zQlLLMuNCp9ulZSfCBX+3ie64oTPfkbY7lI2vxMiC+s7COxEzkIN45E03WTDP2DW nj8tcYKMGw+LpGawoM54UtUWMZaVABVopyUWRynV7n+Ek22U2MT6dlJYGvry29bnBCTy Yg60JjoWB34ZSy+kWKDhisZ7hP752p5C+jr1djrr0gPxFGtIFP2NVoOuIFofWiAv7am2 8U6KRvMkuv833MVHnn7jGR+r6FyS00c0kIxW3i+PD74UKxXyNmMSRP2H7pVS1YiIYbJk EZrZie4LPLQ7wmboFDVrx/PFPrlMl2VbbENxOkbJb8rrnbaMUmDsDBvst/rJlRWu3HgL N9hQ== 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=W4neXHqhJqcm9byGRE9Vn1/Ju8hMICBJVJJfDVMIuVcMIlYO0efGplYzlisHlkzeo6 2/EhmmHZen2qQ0x80X7ZYSu3pFmQrqKJgq6x3lLJNP5e6cqfMDowdjaEoMVIW7Uqx+6m GBBb4FFXPJODSvPlWmUD6egGcO2LKYZFGM9VXgljR9A1MvwnltkMLJAQfHlaHwiA3qCj Ne7TUsaN4di652VEII4+xw5IBUMF5SdOkm96lRAgrELjHG7qQ/+dXv6E6A9s8FiYvoJQ GK/2RPXysc/h+l4ZVBRQxj52jP/fohvE2mjMQwUn9rpfGFewxxsL2MYhyTgjgYzVFwW9 Cf3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=H5PigfyG; 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 q27-20020aa7961b000000b006453ad4ff39si250854pfg.147.2023.05.06.12.26.02; Sat, 06 May 2023 12:26:17 -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=H5PigfyG; 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 S229736AbjEFTZX (ORCPT + 99 others); Sat, 6 May 2023 15:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjEFTZV (ORCPT ); Sat, 6 May 2023 15:25:21 -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 9B3324234 for ; Sat, 6 May 2023 12:25:20 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-769a530a892so82998139f.0 for ; Sat, 06 May 2023 12:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683401120; x=1685993120; 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=H5PigfyG9oRnNxodKmNzLaAP9VtSQhKlEdYbUUlyN9weXF0pSZ793X45J21cstr8B0 YKN/Zllv5ezdTRJPThz+qtDuskoHPSKqh5f9XJTtTcQlSr1LXbt82uznqghmgsZKxR3g J8/1frtv3TzM2KcQrAV5VTmr016lw2xhVMxMZfjuvMpgi1/ybeRLjo3l6pzEcHj+f6OY 2Zaac2GmUjrJZ2JMiMyj64SdJKaOkxFb2fUis0BE9yMsCuI0RrV8P0WXfEs7jQkWnU/1 cyaJNRtakpOs76DiS+Bnp292VXuc1s/DIEeHfnmhBfUJ/nDm2bbUK1+ENyKM17j1nVGM 2nSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683401120; x=1685993120; 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=ctZnPM8hGHEHOo/nGIfHT7wgtCXYY6eJEgOP6CytxDFZPqkN7IE3eyCL1k0ueJLWMI c5TAzmTF9Hsgm/EyjwCIP02dOtA8id5l5qmq7N2WcYJ0oHD7dXsfE31YbZx4BNOZ8sjT MqyA+qpRKkfiK+M6OE0w9JG6R/6pysROdo5ZuLvUF3Hz1bTfjae3irZYxWtDmFBq4c8A znqd30hgVqsvlUsHHhP74tWlcAq2NPvflAoBm4np+wio7HzWCueqriGPqXr+QfsjhMpP mRptojTPlrfiBPGhGjrVK6nwsvNH24e3mgxussROgeAu3lqIrzB6m7HFu+chQIALpUS/ iOAQ== X-Gm-Message-State: AC+VfDwq1cFDIltZg0xymgl0vWR1MyU++D1jf8KnU2N2YtdA3L7CCQ0a vqAG2KXqvU0N/rU0u8jwcds= X-Received: by 2002:a05:6e02:4cd:b0:331:8f55:15b8 with SMTP id f13-20020a056e0204cd00b003318f5515b8mr3135194ils.3.1683401119844; Sat, 06 May 2023 12:25:19 -0700 (PDT) Received: from aford-B741.lan ([2601:447:d001:897f:5e49:1bed:79d0:5c25]) by smtp.gmail.com with ESMTPSA id z18-20020a05663822b200b0041631393ac9sm847824jas.18.2023.05.06.12.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 May 2023 12:25:19 -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 V5 1/6] drm: bridge: samsung-dsim: fix blanking packet size calculation Date: Sat, 6 May 2023 14:24:48 -0500 Message-Id: <20230506192453.725621-2-aford173@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230506192453.725621-1-aford173@gmail.com> References: <20230506192453.725621-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