From patchwork Sun Jul 14 11:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 3303 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E7039412C7 for ; Sun, 14 Jul 2024 13:33:31 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2eee96e7dc2sf3539831fa.3 for ; Sun, 14 Jul 2024 04:33:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956811; cv=pass; d=google.com; s=arc-20160816; b=Dub7GiI2RN9TDsDr83yqGFnKR25uzIHe7o+VgraWTkXrvNbd0nbk2Y+AIv0qtzwvWx dcNKxKHVAqP5VWW3JTZTEwTXU/1kLoXFMy8xuAT+aJW2SgR/u7bCun7dFSjnLu1R4Pii I5zocA0wZeR2xeALtI2Ik4NFskpMr2/Mh/X2GufeWPexYOL9Tf+UzJy4HqwCFZtC77ub CL45Y+dSVydueQFriLKlTH6Hy4wKrLXkCFpbJvcVyV0vidaYhaPpWtrmXT5Q0fNkTJDc XELvt5x4tSVB6I5Ty6Co1yUn75klz4qrW+u33vnsHK1rv6SsN1b4WQeYJ3KnpDbVMBFn yYNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e/RPqzzKrC8KkhhfqoobinWC79JKSHi8lfntzaLm5a0=; fh=sHBOdZe1iBU1L/TV/P5koBFn7mU/qeYZyeAqNq+Nmaw=; b=l6P6hZ/ADRljqqSsOCsMfdStbLOwB/2aZkXxMIW6F460i5+m0IvDw0RUnuxoi/uad2 GETBPdih8CjunYsWQ+5SDEsweKHaqcNz0PRwgSjVfw7j+g7VZWa5Po7BQsniuMZ4e1kh KpExhWz7lfA5xZXGGiubCAyHr9uyHEjT2zLu9uS+P/4NY79EB/26kO7jj+sNVx6W2Aou gEakwNw6CeHJ6Cl05WyHsWK5HnYJ6Hikz611K2O+AGwl5+HlTWu0eCzKfD/MLlTiK8tY QP9YyHHfIRWeH7lUFX5UHFoR4xG+MNvxKLO4nZC3qsGOerL7+dOxwoXtEvQxlmJ4vqai +gZg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qGqV2DOQ; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1720956811; x=1721561611; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender: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=e/RPqzzKrC8KkhhfqoobinWC79JKSHi8lfntzaLm5a0=; b=ARgqJIYKdhdSq7vxT51kkElxVo3QkwYyCI9zx4ti2G85ftfqaC8qw4n8fNre/IvufR zPKT3RNvf8Jao43S0g4EjktLno09ijdypA7DlHPyLELsh8NUK09jijFoF2XkTDlsfteL WxOPT+q3iIc5r/5YSFNXUCerGK9/7egk5873M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956811; x=1721561611; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e/RPqzzKrC8KkhhfqoobinWC79JKSHi8lfntzaLm5a0=; b=LdZkZzJ3aKE/49bKYeAaF9TUoc4d+H4m8I0YumcJxAlskuGT0UCMzemKJ4eMMTRi// iu4A4/oc9Tb7RrBdm4MEw7fHqoskywJR0o43bcCZZ1t48+yp7q9jwwlesRB/YLfJleeR QHmjD+9+c4VlKzgJsyzT1IYkCUvfM2yQrk8ZnaDU/HyUmoyAJS1IGTAAfw+BYKC9804g 8RxtlQokZT+PFcuW51KFuuZ8iXNSBBLQ4S9BjIjRP0xyLrrk7CZ7lLByjL+4pVbdM61t dNv+Y8WjtdKyvvLqYWBEld49b0qjD3i60l2XTU4pYwG9xOYHq+AO0kqNyjQG4J6Q774j PNRA== X-Forwarded-Encrypted: i=2; AJvYcCUdPDzBOyxyNDg+sfoYUckwSR+WpdgXHgd0YD1eqR7oxPFds+gJT504+VVZpsXFjOABizefoZeXhW8o38elZx/Oa2ohOzFXJNkgOG4A1NiIi5yp6wkkaIy0ndpfcA== X-Gm-Message-State: AOJu0YzN8e/Cdl2vxH75eVFWMqIZeq8IDgZdH15gO8VQd2d+bQe9Nkwd l6SAI/F8or9fxzqiXitRMN0J2jQOU8bKOu7UxTADR0C88T3tcL8u3kUZJrHCbbK2lw== X-Google-Smtp-Source: AGHT+IFLkHCR77RbqCLpR/UsWDp8jzbTxlxS4HUOEUNClIy6xbQoICo/uhz9aeiX+9xNz3MpyJiMvg== X-Received: by 2002:a2e:3315:0:b0:2ec:543a:b629 with SMTP id 38308e7fff4ca-2eeb318a0f7mr101049991fa.34.1720956811358; Sun, 14 Jul 2024 04:33:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1286676a12.2.-pod-prod-04-eu; Sun, 14 Jul 2024 04:33:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOHZKHGvIxazfv63Nf9Y1NhuwyTc7+qlBLO/vkDRieddAInnMBG01pSw1Y2vGs3L7azwXFYtBS+2IOANPjCIczEdGZP/Uwb57XI1nldoPtGqWO X-Received: by 2002:a05:6402:4408:b0:58c:ccc1:17ec with SMTP id 4fb4d7f45d1cf-594baf9110amr13202084a12.13.1720956809698; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956809; cv=none; d=google.com; s=arc-20160816; b=Le+omDhkUB8IrH6nhF2NeIQpbP271gqox+rUwl7WtV4xRdmOuz1hghBzb5+ZQiirsd K+fDngR1nd466CLlo866djyPO0GgPsYB00DCBw6oSXuJvg22LdJlDS6MHTUnNrv4cjKy 4uccC2exUMbBAN5Tu7YsWXPvnOBjEmyX75ynQaqUl8uDSiwOfjKX+h/RN5KeXzc/HEbg J77eZz3agcaqVM9A0L9aYrnbxmCMqVI+RZdn4l6UxK9PgdB5a8squlap3PXUgFTN4rHL kK7ySkyU0aQvT6FPaXvGwjlnROQ0vqJm/kPx4aR1i7h6RhzALgUhpkIL3UCA3cF6cheF 3XFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ExSEdrVHAuGJCeNa1DulbUhbsfDuL+nFSoEwjoPzUm8=; fh=IJ/zQD4ke/ryMBbB6veYLmkeM3hoxLQ1KsLD1o2LUew=; b=sqoGh6170Cldp9YRTSx9Z8eKih+WF361FBRWJyfZjlTe5mJ5XjpOUMrrSqdp+2BpYo XfXWlxEAv/j76ObAvGSTXwioS/zx/+UytrE1Ur1x/ALPvRjP7un7ZSwDP2oJzuzeWWx9 TJhRKXnNxuLLbiEt9NK/jZ+hVUUOp8Rri6L1lSJKUAUMFWFcZBiokLy716F8fJWU8tAo mP9d2+3gLUg/8H03SvlOi+PL2yxnkyqjaL8bOBH1Jc0DS/9OPt1Emb85eAoP5wBgyi+2 yeEoZt1YxAbtiERvoBpgm12KqhDBhkG6MUT/mmRpvzOPx3vMA6u9e8P5KW099vRlq0kl S7sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qGqV2DOQ; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 4fb4d7f45d1cf-59b26f652f0sor507856a12.10.2024.07.14.04.33.29 for (Google Transport Security); Sun, 14 Jul 2024 04:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVanXrPIcrvQ7Aid5p7X0vxZh7lMuSaBGa289vX5nyQ/MYf96c2pF6tT88GiLQ0H7IbYt2wOvm/Oc9eculDoJrn8nX+T+2OqJue6srGDkc593DM X-Received: by 2002:a05:6402:3588:b0:57c:a4a8:70f0 with SMTP id 4fb4d7f45d1cf-594baf8752dmr13538905a12.15.1720956809376; Sun, 14 Jul 2024 04:33:29 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:29 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 21/25] phy: dphy: Correct clk_pre parameter Date: Sun, 14 Jul 2024 13:32:58 +0200 Message-ID: <20240714113302.133399-21-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-1-michael@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qGqV2DOQ; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Upstream linux commit 9a8406ba1a9a29. The D-PHY specification (v1.2) explicitly mentions that the T-CLK-PRE parameter's unit is Unit Interval(UI) and the minimum value is 8. Also, kernel doc of the 'clk_pre' member of struct phy_configure_opts_mipi_dphy mentions that it should be in UI. However, the dphy core driver wrongly sets 'clk_pre' to 8000, which seems to hint that it's in picoseconds. So, let's fix the dphy core driver to correctly reflect the T-CLK-PRE parameter's minimum value according to the D-PHY specification. I'm assuming that all impacted custom drivers shall program values in TxByteClkHS cycles into hardware for the T-CLK-PRE parameter. The D-PHY specification mentions that the frequency of TxByteClkHS is exactly 1/8 the High-Speed(HS) bit rate(each HS bit consumes one UI). So, relevant custom driver code is changed to program those values as DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE), then. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Tested-by: Liu Ying # RM67191 DSI panel on i.MX8mq EVK Reviewed-by: Andrzej Hajda Reviewed-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Neil Armstrong # for phy-meson-axg-mipi-dphy.c Tested-by: Guido Günther # Librem 5 (imx8mq) with it's rather picky panel Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220124024007.1465018-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Michael Trimarchi --- drivers/phy/meson-axg-mipi-dphy.c | 2 +- drivers/phy/phy-core-mipi-dphy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/meson-axg-mipi-dphy.c b/drivers/phy/meson-axg-mipi-dphy.c index 3f89de1997..fb10ccca6a 100644 --- a/drivers/phy/meson-axg-mipi-dphy.c +++ b/drivers/phy/meson-axg-mipi-dphy.c @@ -237,7 +237,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, - DIV_ROUND_UP(priv->config.clk_pre, temp)); + DIV_ROUND_UP(priv->config.clk_pre, BITS_PER_BYTE)); regmap_write(priv->regmap, MIPI_DSI_HS_TIM, DIV_ROUND_UP(priv->config.hs_exit, temp) | diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 7a7cc4dc5b..8341b78e0d 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -36,7 +36,7 @@ static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, cfg->clk_miss = 0; cfg->clk_post = 60000 + 52 * ui; - cfg->clk_pre = 8000; + cfg->clk_pre = 8; cfg->clk_prepare = 38000; cfg->clk_settle = 95000; cfg->clk_term_en = 0;