From patchwork Tue Sep 3 15:30:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3389 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 02CE341742 for ; Tue, 3 Sep 2024 17:31:20 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-374c25d886asf1961513f8f.3 for ; Tue, 03 Sep 2024 08:31:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725377479; cv=pass; d=google.com; s=arc-20240605; b=RBrKrhP7wXFYAvNQ/j1J16rbZIAiTSIgcKqbRk6pyy5C+3W8pXgTz4Dq996+86w9ox Rp77p29fbDUp/mAblxUUInLBbjGUYPYL3+BIWj0LNkZUBPz7AnPL+rj1BCnlYNmbV64h eDy9KhWbZyDIOExwPELQEmYUgyIm52orRyiyI75nSy1R2a6yNM589uhhnwUgx5NU3XPA l8eVQ+8ijgVZ66MSmGw1jaLsRf4y5NjU0vAb5hTQFrpeTptTp/cuLdbBuGC1jIt1D9zQ sc8q+e1lE8D3i3ZBf4YEHMNjU5aXrUCg6hyGOSebkneYA2KpPK7fofUvRWACS0D/ZHvb 0WJA== 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=BdDalGh0rPXQIzULId22yEXhqccNbZBoNJz7VRRYUUg=; b=GS/zbjKVzYl+6b8sPAkzKt16+vQl8E1Zad6c45gwJflfKlS8zRoyhJRwnW/gZH9AHy qA6uiFHjfz0OQlidD13IgVTLExoAabUG3khG9AJUA94fyEBqytLXpHpmAOG6iCpauCp+ GlGp1H7T5LdgERUd4L//DmpF38BpnqUHPGuLoP1k3qpASZ4tNR7AOS2Da/q0p+6A6JW7 HnUbbmVlwOtzLZNuc7mw/r13laCPQY4yPgPB2ep0CYmhexGGopw+maufecVJtqyvZ4Yz ujItO7KMEYEY0x6EWjxZ0HLGtHkzDZLlEg0A8+r/fr27jxZ7UWYJMH/0tCzLmBGby88J QU9Q==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NriH1i+X; 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=1725377479; x=1725982279; 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=KIMy6QT8i1P5GC6O7S632tyU0joINXhgLyMge9k33AnpafXJriAgppZPhqdA5wWzWP 2JcZ4G9j4DeDK4Mpb3Uxe34y4UVnprBf+xc0D3F9FNo/AggPRZ4iJYXZxPaRlZzJai2v CJnziKK+T4+7NhK+7iWEJQ8mMCDwdAeHbl4WQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725377479; x=1725982279; 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=hjRiah/ipntTgid7nTTMkHqD/t2RsKi0VgP32Ne5NWiufnqBri3qDdGewuaombIGBh lhzRsCfnt9UWi/QF4SSiUJTaQ3cXJYXQmBGifsQwUQBKeYsr7pBRkRZC8h6lUI2cr++E L+PdHnDi1vYjG/F9P3YVIALkFsbmc8UC9BKLusohGklG/8Lh8pDEQe/gnyHQbWiNqvB+ g79QFdBR7/kOWV0nL2I0RHIo9KPjdeqS/1+40mqJSWFN3Pvns2/zQd+KvuS6Q0+yc+BH 4QYryWoEFq9DuJP/aU6noURKc82ujdmI5SMDzIkldJ663oUfwtg5hFv1uvpGDvP7FTYZ B3jw== X-Forwarded-Encrypted: i=2; AJvYcCV8zfLmo0Dd5502UfYNhq0JwllryU9HtNILPf5c8krRCdHUAf8fXf3TAiuRb75zDZenek25fLue1PJVHUvj@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxUl1Q1tauOc/+tCaTlFoU2WEh/oicM+vDTm/AI48mbqnJAdaG2 exGKceFdt2DoI9vi+vTctcL6Hh/Cn3+vU46U4umh+EdH5IM8mS1zcvJwP5pzfYCdSQ== X-Google-Smtp-Source: AGHT+IGACu2wp9x2kRkeHd0xR561NEF9CAw745+oCawSIj+qy+F7JlRBD1Ir1dH9Syoi9VweeBRAqw== X-Received: by 2002:adf:eac7:0:b0:374:cbe8:6f43 with SMTP id ffacd0b85a97d-374cbe8703bmr4499360f8f.33.1725377479471; Tue, 03 Sep 2024 08:31:19 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:4506:b0:428:7aa:dab5 with SMTP id 5b1f17b1804b1-42bb283e022ls16720755e9.0.-pod-prod-07-eu; Tue, 03 Sep 2024 08:31:18 -0700 (PDT) X-Received: by 2002:a05:600c:4fd6:b0:426:6eb9:db07 with SMTP id 5b1f17b1804b1-42bbb205b0emr103205645e9.13.1725377477726; Tue, 03 Sep 2024 08:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725377477; cv=none; d=google.com; s=arc-20160816; b=h3efm+BkY53/9+TrEiaaxGRQBTQQ4xtQRH9xfu6J0CzuOGzS8aosT3AqpmYvdSPQgL ZzTlRO9I6ZE7zy61fIoPbdDKLL50gkfAWAQdt2vls3lExGqOY7JL313ZrmEQ/Y21X733 iVHvVFEj4G+ab0UXlYev08WgeTVVPdYfxkhR+011u3W/g0cwlcxzX+QE5VvrUvsFIXG8 hBKHqJ5rtsJbHMCBLnkzaHf+oGJY3J5psOn3hOzntAiCPSeXBkN5xBznQtosH4emFJ7o srpgnCPGS32iWIg7BZYsd4OztbK1PJwnCdQ3bPkuR1bRrq+gRc6F8xeaSOIA2bhL5CfC vBOQ== 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=Zv+Dmb3Cy4oIz15TjKc7xCqRwGZljMn+0r1vAzrgZ6M0PXmxIhA4WpTuyoHVQjjN3P 6QTpYX23liL6deW6kPg5ZpodpA/NQwX8f2nTmIY7oCcXkqAhf77mZ71pMzbYsRUG1RjM KXaZfp1Ge3/yu2YqiVt0ZIV/Yrom7VwS7WGkmgahxfoxmveydFZ2cbXb0GEBaCbFlpRB aknVRF9u507ZAH8NvnC7gaKXoHilEbezJ9XaFYuLtZimmkhdDetB8LUt0GhHaMk5EMx2 cOPrMYYyyCUh8Oid3WmD5gulV8dVY2Ou9nQkkFyt2RD89096HlMgFzgJSEuslX0Ticlh 08Hg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NriH1i+X; 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-42c878efa26sor12078035e9.3.2024.09.03.08.31.17 for (Google Transport Security); Tue, 03 Sep 2024 08:31:17 -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:510d:b0:42b:af52:2525 with SMTP id 5b1f17b1804b1-42bbb21603amr93264205e9.16.1725377477104; Tue, 03 Sep 2024 08:31:17 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.42.65]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e273e3sm174168685e9.30.2024.09.03.08.31.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 08:31:16 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH 17/29] phy: dphy: Correct clk_pre parameter Date: Tue, 3 Sep 2024 17:30:48 +0200 Message-ID: <20240903153100.918077-17-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903153100.918077-1-dario.binacchi@amarulasolutions.com> References: <20240903153100.918077-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=NriH1i+X; 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;