From patchwork Fri Sep 13 09:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3484 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 BE6E341280 for ; Fri, 13 Sep 2024 11:57:21 +0200 (CEST) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2f75ea32971sf6838611fa.1 for ; Fri, 13 Sep 2024 02:57:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221441; cv=pass; d=google.com; s=arc-20240605; b=Lg1Kj7VPGJML818O5CSdSuuChprDVFA6UHt0Wbw5yPKLwazL8bUzhvVcdrE9t4jr/s ATSV7qr0irZ4n+YoT7sJjkHXBneiP31nTtspBwM/cdFO/G66vxEDdtnihzURdHcFZWow UnFaSSyU7eHTlsVgFZVSP7YsYF3bOq1/jX04BitwWIYzS2hcRyLXWW+KrCjDmuwzQFgn cQkeZx2Hfxg9uoECngEHb4kIAR2b4Bti9gpaB0t/c2gW7WjOf2saySHKhyaXY5oUdvNq /M8iAWol0lGZmKlRxWa/MVNNKtnjnWqSvNwD1pbMBT4TBtVL0+oU1EQqWal2aI/YOyjG 70oA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=W0EHT0h/TTNP95rM4CkU2i5KVDthbO8IMIz0xlRCHks=; fh=lCACNT4PduREOfO701qsvfzVfJMbbFs6smooLTS8iU4=; b=HFY1Ir1dD2QVqavbWqC7xEvJrWHtdMevAMslaqzk306PI7dRnvrUaXBZDIcXvoLgeQ DTTRoIIJA+LIRK92JgNQvNTPEGsOmmGBBjuTNvQGG3odS44cjLhvYjIWcy/OhRQN85wk CUZEMpoGPgKsgeFqV5GVuyanOkp8oKDPBIGSDHaucOiV+mjkL3xhoYU8XDuXFKAnhRpf qjlcd6zWC383MDteA1StfIfr+6nhYVVDj4iWqY3fRm7OVGwmfIqJDuCsUrLXDwDs9j0s DTJ/lh/fuo8TWnVwNjf8Al3o/NQRIqoPTRLmWpDBT/SNQeriA8C+uZqPabwZ98+QEIBX sHvA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fI6j78l0; 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=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221441; x=1726826241; 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=W0EHT0h/TTNP95rM4CkU2i5KVDthbO8IMIz0xlRCHks=; b=SDW4IJpphByd0d7BlIc8sO0SNBGJm8EnFtVmMUR9JljFMRWsTjd1RZrwJGgm+2CfrJ i/GLGZIhvT4UR+PAmWAZXz2KLO0vNYv/OPdZmriYxMmTtEe0Xj77zHHWP4NrzjLv3tkr DsWeX34TQiuPBFjzM4S1mG+pEKfZ0rpo5YzVY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221441; x=1726826241; 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=W0EHT0h/TTNP95rM4CkU2i5KVDthbO8IMIz0xlRCHks=; b=Q4EBNjjQbenHf5ULs3F6bEW7Bwm2tlEkOXGQp/q5SHxYoXAJI/KCeT+0Ay5hSYXFOk NPTuwS5+YkgpzUtNpDCjMT7RDwN8C7769Gcpdm9pLN4nB2eDdBDeLbLJhMWGZFSZ8avX 1I4jL6ju8U/AeIWcLNCoFT1SiX3xew3WvOWNYMnnDyoAA0xH97cVFpcZROddEY810q5T bleodwhDf8wQnqWxrcrVdiUeiUa2nQFp9eHC5MC3MJo49WrNDTgFLylrp+sWzCFAz4it nvkcv+BI/bUzAV6XOY22KjEbKfxwL26LnkPafsmsoODYLXLKzyxaLw5vWXZAvqb8qyW8 NtDQ== X-Forwarded-Encrypted: i=2; AJvYcCXkTFIeRVswWVcYDoKLr8BDjc0pGyOsqovuFHgMsAHcLFeCxAnpZ44pqLCJlZr3kL9S8+qyCFd2/LTaLzBp@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxM889w3cAXbf23TkqMy/HewfSfCvVExwBiMQJgjcdxj8hObRaW /lwPpVNZzNsJUJ0YKFDFHizZLN5lv1Mg59cNjcwb+pu8sg00bWZMEAuHjDIHG8rz/A== X-Google-Smtp-Source: AGHT+IEineS+9YGeNiIWNI+HbtEuiPC9FG6rcImRx58djYqGr3rps7bJ0SF7tAszvGibKfGXePN37w== X-Received: by 2002:a2e:a584:0:b0:2ef:248a:aed4 with SMTP id 38308e7fff4ca-2f791b5cc2emr13381351fa.42.1726221441056; Fri, 13 Sep 2024 02:57:21 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:50d3:b0:5c4:1370:8039 with SMTP id 4fb4d7f45d1cf-5c414089f70ls134389a12.1.-pod-prod-04-eu; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX1OHlRgHnvXVh+6Tvzo8JDk5XXz+ib5pGPTM6CkpR+IR/jEVwfUdVWMrH7Mb3d48Fk8yhQHNdImK9HvtMX@amarulasolutions.com X-Received: by 2002:a17:907:36c8:b0:a86:7199:af37 with SMTP id a640c23a62f3a-a9048151092mr155390166b.58.1726221439466; Fri, 13 Sep 2024 02:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221439; cv=none; d=google.com; s=arc-20160816; b=XZOb4ePj2aYoaqsBtaF0dnIhCcRDMhIg929/C121NbYWAXmg3h2NcZio1vOD73z/cV gY6Q3T6esRZtHGHcqxo2uwlGDHiKFxxDevPaqAFVeNAFX88k7aTJFnJWgXVCCmiy5PHO E7wKQ6EyyKkuduBa78Nazs7qw9vmGL+PTAAjTlu0iEu73DGYjZh+vjKawENZfvz//Z2U 3qorfnGA/F7NjbF8vYAmEA75g0XAIyVbYg90ZkGRaFBITPy9Ku/Rce1unJCQPE6QUlSX 0jFChpm7uKt8M2exo2e9g8JwvpzU0/Ae+5Kc5pNvf3ayY3R2LhgqpCAOvX86f7FxvpyF ic3Q== 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=fJ6Zjs8lUX/jMH8JhmryfFLNpN3PXuow+IQQ28EHkRM=; fh=UKOsHSZZt1EFOy2ECsruEI6TyiF1qYXyeNMtwIP/2oI=; b=1AWOJMRumU6iYmUqMcafWAC17msM/jifSh3iVT/cby6EBZ5tCdoXaCHXk2v7N+rJrQ HT/Sa5/gkm2YsxwEnBXcUddupwEQc1lcZeF4+PkOHTRWudFOrIJsio6/O8Yub0LK+d0m BtRRAkKcUXeUA45LUTIX6JDPB0xEB2S+uN6Zb/QR7C6fpEZZyb2MF1iw3yB0MULNeSgE klsKqfh3sLoFqLQsH0Hf+UjyXQ/PCrb3D2N1pbd3Aet1kDJHnPKsNoQvt5iPpbMXrjgj QsGAXCXL/srFka9sbWtK4v4dt30ofDd+p93T98DLdOPqvI2w8e1R04qX3iaZl3kccQSw pd+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fI6j78l0; 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=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 a640c23a62f3a-a8d25ccab27sor430294466b.19.2024.09.13.02.57.19 for (Google Transport Security); Fri, 13 Sep 2024 02:57:19 -0700 (PDT) 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; AJvYcCUtiNJtlcbZmckpogeXhl0F1eiI7/iQtlKTxZIeHfk789livoEk2Ls1pdGQTkG9pHs5JtZX82jF575XhlOs@amarulasolutions.com X-Received: by 2002:a17:906:c113:b0:a8a:835f:4cb9 with SMTP id a640c23a62f3a-a9048105fd9mr184073166b.46.1726221438905; Fri, 13 Sep 2024 02:57:18 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:18 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Liu Ying , Andrzej Hajda , Neil Armstrong , =?utf-8?q?Guido_G=C3=BCnther?= , Laurent Pinchart , Vinod Koul , Dario Binacchi , Igor Prusov , Joe Hershberger , Neil Armstrong , Sakari Ailus , Sean Anderson , Tom Rini , u-boot-amlogic@groups.io Subject: [PATCH 16/26] phy: dphy: Correct clk_pre parameter Date: Fri, 13 Sep 2024 11:55:58 +0200 Message-ID: <20240913095622.72377-17-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" 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=fI6j78l0; 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=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: , 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 --- 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;