From patchwork Wed Dec 2 10:26:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 5117 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 979133F336 for ; Wed, 2 Dec 2026 11:27:54 +0100 (CET) Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48e00f3929bsf7150842f8f.0 for ; Wed, 02 Dec 2026 02:27:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1796207274; cv=pass; d=google.com; s=arc-20260327; b=flrB4evFoRZF4mup4Ux1LFv6oY8DaWxEMXJWUEn0m/rzX4JhBu7Yen3oW3i/ofh9JJ OR3/Dpz75N7wf/uCeFFT+U1Szx47puyGjy75p6E34WVS4JyOCR1m4d9LCAwW9dSkKTH7 4ntOxi3VUnRJtuFpldkjxlBM9aTM6XDbNU20E3NlvYnUDs5lau8tgpFHWjM3rhSwgFno RmEywji7NPutsgXXSHAQY/fWT62dOzf6DhFXsqQA/3C9BmNN64PnEPIYhQZJUYGU+HdE YJMFutfh9we9EzNvxxrSDHYK1U6OpOVu5H11z1OfRHhepEZKlcUvSfv9NhC8MMeMiIBP rw1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=j196NainrchWMzzaOHrsWMWf2+enOL/aXGcaLBACrcM=; fh=TFWOn48zEqA3VbpVcjF5XplLC0OJSt9tyNCqqYwq4iY=; b=HXWwBiII6ousHnhgp9bUU/Pg4Nmfl+IqfhDeKeu6gTGc8k+jyrZE+LuxNHdelGgOBK TJzZtK2Rh3E28eZb6YB4qyiUqKiCE8UHv+97Mb1wke9YDZYnNpqECqPgahlFYYKCbl2Q /RXqsPi20pNKOz71NaALI5k6HiTSCEVfzWx4rQzoMWFrNjFSDud9pHBSYSNDJMdZGlCG qhSQYhS+nzwKLnVO+w/psTDBmrWE4CGtEeefR5nPjOtV2LqP6X93jiIl5Xb35Yhcvre+ 2qkcGikAldVZMOiCNqZwl8jX+Kg2x2ijNmKHFlbpkfVWowGc5iUSaYLH6kBGFHc25BEf pXYQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="faJD/bLB"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1796207274; x=1796812074; 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:content-type :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=j196NainrchWMzzaOHrsWMWf2+enOL/aXGcaLBACrcM=; b=e0Vlk6v+tuSsmUF0S4Br7aD/vh3GeMmK99YCl93Q9bbUA9DMXwtcN8Kzl3qr1xgUTv rjk/LIJervI87ClPC9FWh0GZu3m/aXYDhmyD1GDggMLBiGVXsUyHzgMGFKQURPhTS8h8 c4cqa/hrTSbgZ33eBgcJkm1Mr9iinbVYruopI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796207274; x=1796812074; 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:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=j196NainrchWMzzaOHrsWMWf2+enOL/aXGcaLBACrcM=; b=J70VWGP8Njq539nNlFy6iW3ZpXXGkHlgqfqV+0/0ygIJUJowxuSb6CYtuZbm502YTy w0F1WBL9SmxgVBHRps1dB+48dLBta6ya84NWaX7JI8CrKdFQtnH4sHGhh+jXuSEut2i3 RaNS+AI/c/nN6+iZ0AVdZAxoUzPOXHICJOGRfd2F3oyiFIe9s9UXhEBOLcM4SkbjzDeE 9HST5tsIx8qaknTcCjJwBzS09mu4LkVz6vARUQ8/r2YO6cIPdlRa62lgdvnaNd7rWsny Djs1ay209awFdYkZxYqmOQrtQ7+8FluxaGC4evl1M75HYiHCIcRWmfUMeusMNxOytK8D tLcw== X-Forwarded-Encrypted: i=2; AL+hErG10q9SnwAdRafCXcSrbaAWe1TMJTXp7540i67Sd8Ui/BawRSQ04zl3y5YHtKU7rOOOYKMWOT+ftNe986cV@patchwork.amarulasolutions.com X-Gm-Message-State: APuU4Z+0QvJ3IQmQ/rrV/ZJisvMMJB0o9O6r6ugWm6SBWXo97W7YCFji ffnvi6U5H9qUHw/anPQvKGqDcB/lLgj/cN6mTODTTBYD9+xdbCh0xBhurgweNEWeCpQ5dg== X-Received: by 2002:a05:6000:2383:b0:492:aff5:da4d with SMTP id ffacd0b85a97d-4aa545e244fmr105581637f8f.7.1796207274300; Wed, 02 Dec 2026 02:27:54 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com; h="ATskLddk2evgVne6H4fMRw4eoOHpzDvdQCcNb9Gx1/wY5b+lFg==" Received: by 2002:a5d:4e8e:0:b0:4a3:54b5:3caf with SMTP id ffacd0b85a97d-4a8ee5852d3ls3532640f8f.1.-pod-prod-00-eu-canary; Wed, 02 Dec 2026 02:27:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErH5pCtsyX9dq5FPla9cDIGCR5OEA2+xRzvuYU/CuwWlgpxgrGliCT5R+Dl5UOIz8xq3rme1OOTfwZ2Wkt+5@amarulasolutions.com X-Received: by 2002:a05:6000:1acb:b0:4bc:38c7:aad1 with SMTP id ffacd0b85a97d-4bc38d6eec8mr44758626f8f.23.1796207272566; Wed, 02 Dec 2026 02:27:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796207272; cv=none; d=google.com; s=arc-20260327; b=jHJST60aApngM67afKLw9gW3xV18WZ//+s4tsnckJHZsD7gE5U/QJDoLego5PmEnSw cb53+1GUcnytxb5Zdi/ZY80Ce2fabFy8HPbuyZbfW7WqwsJ4S5enRTcsCwFZ42OYVzke 7ytaaRSSNydVYuIrtUQhgtUuGuQHkDz3ubCbGh6Vy/YBZ+7kiXJP8FSxDySi6xPFH5b6 qYks/lmbAwgJ0has9clJWYnDAGhOCuJ0CEUYuSHC3HHM7zV4vuoGp24tDnX6wL/GuIWC WAbGIUVi8wDEX75pHN+/bbYkQV2HhhoVCBZ1eYWE2qHPSH1JK/8vPsjpK7AFl4lgt0EX Z1AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=u0n+YNFcmMyOeqNS629GEoFYUxyDiF7wnnMtBbUZqLM=; fh=1JFNx02YQUsTTovNAtTz64D93tP+NWZQydZoEdahxtM=; b=aLQhUVej89ngYt0DLXQfT5VTmvW+Xa9N5/TvP+Ovkxmax2fgWX4pCj2sQunMFLvJ+w 18QTU4f2p6vCCInJecbpsMVWSdVvQT/ctt1XGD6JOeP3tWDrGC7v8W+RlM2qj4HqGGO7 hnzSdA9JR3IpAtHHvWWBFRnWBACQOvyZZQ59LZZowr11wyHW7OJlrA12Aa3U2gZAIA20 cw89hm/Blq0pSmyhSzr8oTM4+kyT25yZ+D6S5gD8HFhhAB9s0X5TN+5mgLbWnpsfdo1c OZk1Kj+WodbDpJCSJnrvnjwCqXW4DmZRWiiAtPsJPuyjh+5Ip4+dexvz6SHc0aqozBTm XtGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="faJD/bLB"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral 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 ffacd0b85a97d-4a9fff894d1sor3997943f8f.1.2026.12.02.02.27.52 for (Google Transport Security); Wed, 02 Dec 2026 02:27:52 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AL+hErFY3H+HnbwjghBDiqnedL5n1VfVZYkFiYXrNQbiqtivx2SHlQoIafwlnaOkFVKx5yUrXdJ/kV2ELiOJu05Z@amarulasolutions.com X-Gm-Gg: AZFdTZcSmFi0KsqTiaHT0vTKramhX28yJNHxr8NA1R5UzdJj8YSSDI3Er7o5Htfb1dD /t0p0QLCKwEZATTZeEUvqNREZzNkzVUfaoSACUd2S3TtkTLdhl6F+dubAshw6AE1n/AWVpjpB4V mKR3+njqYnD9Z+LETsPOm6PZhcn4qD++/b1DIOkkDclP4SaCtcnpwFeu5OgAbGDma895/fx6Df6 i5M7icpwff3HZusS6LlYBj2uxtjLWZ9fdrZa1ma1bJB39CTcGLpBU4VRuGtRpfHz6FZRCuq5BJb lEoBlecvi+6EbEPkbZN6vVH+XxWTUGLwoHkH78mY+0T7SEdHnmWomRU95e+7Vpa+n6S/U6K4FVu MhIJOw8RDxDH3qtRiHA951LDNsckHH+TQWwZw35qirqnuDNNns6dJl/U4Y0IAhfVyTd3vODmTD+ MIi3fgiaViBTb7BOuGDwYvj+W0vXEHsnFKntJSxT8XmZef3B4HdJ5y9r14eiuRF+JPmOT8AE9ik +Ns1N3URLIqVDHXKmFY/baC4uOQj42jul8Yz0482zW4qBY0TTRNBFasaWPzUsFZVPWH5GPp0j47 nqSWYonZssVEqmWDYDOkTpP6mEfFpcLNHRCQKK/Scv4241LtOWPBpTwwvk7BjKt6yWOl2Gbl4pZ vIdq/kKkkhs6Gx7uevnXV X-Received: by 2002:a05:600c:c086:b0:4bb:ab2c:67f7 with SMTP id 5b1f17b1804b1-4bbab2c6d69mr310779525e9.8.1796207272155; Wed, 02 Dec 2026 02:27:52 -0800 (PST) Received: from localhost.localdomain ([2001:b07:6474:ebbf:6962:3ebc:7df:e6bf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbbaeb1e4csm366823865e9.13.2026.12.02.02.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:27:51 -0800 (PST) From: Dario Binacchi To: u-boot@lists.u-boot-project.org Cc: Heiko Schocher , linux-amarula@amarulasolutions.com, Peng Fan , simon.holesch@bshg.com, Marek Vasut , Valeriy.Yatsenko@bshg.com, Leonhard Hesse , michael@amarulasolutions.com, Miquel Raynal , Liu Ying , Andrzej Hajda , Neil Armstrong , =?utf-8?q?Guido_G=C3=BCnther?= , Laurent Pinchart , Vinod Koul , Dario Binacchi , Joe Hershberger , Neil Armstrong , Tom Rini , u-boot-amlogic@groups.io Subject: [PATCH v3 17/26] phy: dphy: Correct clk_pre parameter Date: Wed, 2 Dec 2026 11:26:28 +0100 Message-ID: <20261202102716.572884-18-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202102716.572884-1-dario.binacchi@amarulasolutions.com> References: <20261202102716.572884-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="faJD/bLB"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral 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: , From: Michael Trimarchi 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 Signed-off-by: Dario Binacchi --- (no changes since v1) 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 3f89de19970b..fb10ccca6ac1 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 79cab9125002..27cff85709d9 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;