From patchwork Wed Sep 11 15:10:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3447 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5675642E8B for ; Wed, 11 Sep 2024 17:10:59 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cb808e9fcsf24006215e9.0 for ; Wed, 11 Sep 2024 08:10:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067459; cv=pass; d=google.com; s=arc-20240605; b=MBcDUJxxggyAb9HHSHGGsZJATUJuNwMF2pBmZn9kL7S/TLP2HrtjXG40Eu6nRHgmcX Oz3x+37I3nxvMh3laQG+EnzjJDoDidkyXb0pWgbc8jouTm/XJK4RTziYP5Kjv99Mjf0l p6sLXKn5E82Qa7PxOjsXTWV2c/DkDc+FzK2mTtskEcSZDN3RG0KG6XOK0jNey0J8++Gi 1n32bZxV+l35cwuPJXNNcLRpp/kSXfAahqQOFUu1R/Dro8B6VQ3uPIwPFMAN/GPPmJlD N01NBheWP5eddnI9VvU3HAURpH/m1fIyeNGFZErBmZrIJ8Gb0VOODrDZdQDpxaIUZJzd LkLQ== 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:to:from :dkim-signature; bh=dPn9fUSeLS/3B5nD9h/rslOuEetTp3itjVCqKxFV0Ok=; fh=JArklfTyLEngQIrO0SQsRmRE8EaZdaE+mqUcm41P1po=; b=lE5WvMkIxxGMI3nepGLSBJ8waAYzNL/RPikrGUhGlDyETNaXxeDvA0LqTckrVH6mla Ih5U+zN3xWNVT8mZTKBEYWOgZBj1XDqttWTyTOpPo76jgUmnGJ4fufi3vbfIfKpLsnX6 Dbzen0IWgXBB0L1bcIpPn+hrOVTnO0sgOX+AEE2ki8dTYrJjtrYkD08oCHOkuX9iYbVM dwXk+gUGih3ndGPrNyU8b0EKmNb5e80jDu0zdXBAGAx7/5MTxqYPUAvOmtCQ0DW3r0kU kqRaEVD2KKzTtYYyFc6ZZcoGf/SgqOsINyAnng2i5+09Yg5UDco7PI1q/YykJ+9q+WbR dlGQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b6HHh7Yf; 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=1726067459; x=1726672259; 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:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dPn9fUSeLS/3B5nD9h/rslOuEetTp3itjVCqKxFV0Ok=; b=GxndP8kYwwLbKISw6N6t6BsvZwl49rOiYdV+Ru50Lr2KhtvQs2qMX1e1xwPFsadoJZ PTbKrMuIuilcikf7rWVWyv7Q9HVA6RPSaBkHs4fMc/pbiTuV7RWLSB1dIGBSq+9FI3Ff zVGqjZyA1jnNzqo3Kn6P9l1QYvh7ji+W5d5vc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067459; x=1726672259; 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:to:from:x-beenthere:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dPn9fUSeLS/3B5nD9h/rslOuEetTp3itjVCqKxFV0Ok=; b=nRrulQIVtypNYGC7LsF1lEn+Jd/B32r8QszdF4arRP6JMUx7fsmJvSwaF1i7Y1Bzpj h46DVS2Og/gZgfqmcNUZMCKgILWWjelmX/o6gg4nGeRZ59PVr0Vg2xzGyUMz+Ov13rnG LtFXzeNaQ3R9lwMSnBopWA+Zz305Os6++vUAGHwPafl1tTOFiyAl8OH+xXtt0ZktAtww HfT/UYKHyLgc2/tJ3ZNlNc6PSqGiqBSFlSeS5dka6R1wJu6KV7QR87oq9eTb5iInWvBb NQsUE63WZC1G0c+M8mTg8rmSIXxRylvmRF07r8Z/XmwCTWkGfEa8I1trEjv9JWvLA+z7 y+VA== X-Forwarded-Encrypted: i=2; AJvYcCUP+0uHe8usL/e4fXDIATh1DNoVhjDSoYPMQw7/fKiXH3bEOsOKzH/kxpvw4f4MRc/DHtrnmXh5kighEp3a@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwwjEiK3PGmBqjY8RVki4BLvwBf0hwIpYCIMFr6VeCknrD1OX8C zSTJwqFyduP4dxy/Fb3HrtcgfYCoD/rW/zmYj8WasEdV7foTr7tCwjs/lVv86a3uEg== X-Google-Smtp-Source: AGHT+IErHF87raEs5hXWMuWzDXBIhVgZNAOKxoA7X1Fzlq2LnMEbxVmRaQmpyAuVS+1rFwb9Mrxpuw== X-Received: by 2002:a05:600c:1d13:b0:426:5440:8541 with SMTP id 5b1f17b1804b1-42cae76d033mr97117955e9.27.1726067458901; Wed, 11 Sep 2024 08:10:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:5f82:0:b0:374:ce97:5b7e with SMTP id ffacd0b85a97d-378c1d0c041ls23640f8f.2.-pod-prod-06-eu; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) X-Received: by 2002:a05:6000:2ac:b0:374:c2cf:c01c with SMTP id ffacd0b85a97d-37894a52a4fmr11323452f8f.48.1726067457454; Wed, 11 Sep 2024 08:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067457; cv=none; d=google.com; s=arc-20160816; b=qbOK1JUqHmcnPIc5603aIJ4J9GtMHniM7IQktM4r689x6CGnHs48JPED8trWykS+LB Kn2/CiV5jO1hpmuw4SCGWr6LgYH87p0mYGKS8gdRKLcmJlhYuWZnbv3MEB+00mr88G20 gGIP7+Lvv5t7JB6t5/QI2g2sK9htFoJpUETaja4wFfpUSpxSXOOsjhSGQFfwzA0ExQoX +l/XjVnnuA1KRaVGWVN/CvztSi34NlPoBh4xWJq1C7Bs2ryYmTrJiHS6QGkSo7VkuyEH xTrbafEvPkEVgoykVekB+iLTgChaDbZN1SmeS6Y/+O4R2fUpvyb9lvb/648rcuFQrmxx bGxg== 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:to:from:dkim-signature; bh=sMoy9Seih1wvvH2n9n2dryAliQeG+qx1G+lhic58brk=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=eL02O6LvyI4KKYo5HT+eUWhup8KIZAVybM20CrErA1rk1mCzJ/bg9M3GoYZCkRoTMw AZqw0adyCPy9Oa8+RYVznodCGcdUeIz13yyZzE1zmlo5pTrRDKnbkwEU/6oOqEqknMwT 8IwEpyKDEZspYpzj3Md2BXqCnVgbmvCZQwdoRF/v6rYvAP9ifzXrbytCUghv3oI7T0M4 cptCPbwa6ab/XaKWcJqvvoKex17t2Gb3EYAjMXICPZtQplUg9vspKjLwSHv4NASW94iA rMIoEgDhcWzygivNroY9Fb5rrDmx3HGLQdNq7kt4lQcSyo+tDb0lUOcwJ2jaZ2wOFy09 DWvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=b6HHh7Yf; 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 5b1f17b1804b1-42caf2b16a1sor36292965e9.4.2024.09.11.08.10.57 for (Google Transport Security); Wed, 11 Sep 2024 08:10:57 -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-Received: by 2002:a05:600c:1d14:b0:426:63b4:73b0 with SMTP id 5b1f17b1804b1-42cae79d2c2mr109172875e9.34.1726067456621; Wed, 11 Sep 2024 08:10:56 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:56 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 17/27] phy: dphy: Correct clk_pre parameter Date: Wed, 11 Sep 2024 17:10:29 +0200 Message-ID: <20240911151039.2914886-17-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-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=b6HHh7Yf; 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 --- 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 7a7cc4dc5bdf..8341b78e0dd8 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;