From patchwork Sun Jul 14 07:10:19 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: 3252 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AC70440F59 for ; Sun, 14 Jul 2024 09:10:56 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58c98ce7d00sf2710009a12.1 for ; Sun, 14 Jul 2024 00:10:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941056; cv=pass; d=google.com; s=arc-20160816; b=xYDR3YIMFpRvbo28S+phP8tcARUHW9mUx9MRpa+rA/mtvvb63xWyxS0MripBPdxypq dzIeay6wYvfdKrqhNbzYJzylDPGwayucu06qkety2TMKcI1mqawPOtttua5OJLm00e4g X7M/AocJ1I1kTRcqPiaFIkiB4GGHBTy5zVslYgMcMBflYb36Uu1KIsNvzgylY7tbXRh/ 1Twlh2oYodFAtmP3zp7jrhjUv7tdAuuFBpgHdroBwIqrican24vt3D5mU5HeO6aQv1AK Q55OnxPTdp7ZdHg5GAljhY/wGMPcifau+K8XyDz7HILQaSeV+TfwMksqI0sx5IQupz3N 8R1A== 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=zRFU9Zg/wZicCGbSQs3TVzdpXUX1Zs82SnX4ynPm09Y=; b=Oo1MGqD6VWumtQP/j2oc7I+9EfI83ECZa1Ti0x41LBv3+M51RT4c9Ky7Px5kQjir38 FpLJd+4eFkf7ESM5fkYK0sZAa5rvt/OIosKn9JL1iumBLfx7ErQHN1MHABl7Gkn2Aox2 66P+NZPMDk3CXHKP1rdbP84qygPPpVRuKPRajhoQRuluSGBDSDfRMeM8WA/otrEtO8yX c+P2fBHu+k48OM5dvyav3xiunZ6KDHDC0X7ybFT7bO9dzcNfQHhcfHVV9ACkOwUSyiz+ nIL3Esz0JAtxsIxQ8DIm6+KROdWMXzgiOGLOJL4L9KVU3/yNpcnAZu+RflsVHWXVgx22 KYfg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z+oFSqQG; 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=1720941056; x=1721545856; 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=QWBIsXiN6pa+TgD0iG+ayiwxxi9djckIxbESH0Hv/b/Lf9GbTV6WPtDXMA8Fv76YAn m0+Ie1Ki+JRCxe2Jijd+SzD7hom9jpe3aLSurEoj6SSEDn6wAqnf3wF3qvQzclTCyg4s orKg9gkm8cvaip7EtzHsS0usEfjj39qTw1DbY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941056; x=1721545856; 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=W0mOJHzxL7nW8j5mY7zC+IANYTvuamaoo/AXH7TTKb6YG31qVsfFjeVLYUUTTtDLqU 9g5HkL3QhVf+eK2gtvwtCShJJw4lUsfn96Mk+FVBjXz1vmVN68UGEAh/xgsKm6LzISfs HndOI2mvaJR2qcNQH5jCycw88g/UbjOIS1Ng7dvULWJ3P4N5r5lGFNw7WW7W/IqLblB+ XflY6sReI3t2ZctEmrKcHcOiMvdlJCoUhscCqb7mxIPYSaHl4NLvHCPyK8q5tSIcIaBP 7W+oc1DslCemQ/TknCdmlqOswb/4ar7gHoezZU4aF08Lz/Env/nNY+3T+cBHbUCNwL0B Zbyg== X-Forwarded-Encrypted: i=2; AJvYcCUgxHVc5k7+CB59hO62jlye3cH57xyFSlo8lmgBNDQ6dqnvx5rIlZyGBglwJeHp66ZofVWKNJxzRPZ2HOzxmpetX9dwRUPI0iKisaaG1DrSSIZGZNQTIjP7Pzed9w== X-Gm-Message-State: AOJu0YxHyarXEH+CCN1YXDga9re8tgKp1sZauAXTE7cPsEdxA85T0nTm TEzwI/2Sk19a5wN03PrC+NHS0qw7UY91OaiJun3vb+mOObzFPZULljXz74rGCbCcEA== X-Google-Smtp-Source: AGHT+IHQcGwX4sr9YIJTuJFg/PPRJnA1YeB4J7JDrhvgLt6FYuIqxcwigtK9JXITsJdJTwHyYtd3fw== X-Received: by 2002:aa7:c307:0:b0:57d:1e27:65ea with SMTP id 4fb4d7f45d1cf-594bb869e59mr9478755a12.34.1720941056433; Sun, 14 Jul 2024 00:10:56 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc91:0:b0:58c:3dc1:35d4 with SMTP id 4fb4d7f45d1cf-59821cb697bls1605537a12.0.-pod-prod-01-eu; Sun, 14 Jul 2024 00:10:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0O55qmzW8wF697qCFzc+Q0oA8eul7QJGfknjoG4xo+Mb64iq9KdfK01bu4bsdNjbtBfz3lAKMOwE0xhodisxvmy1qeCylpAgvn4cNqpTIuC5g X-Received: by 2002:a17:906:81d2:b0:a77:c8a8:fd71 with SMTP id a640c23a62f3a-a780b6b30d9mr972882666b.32.1720941054706; Sun, 14 Jul 2024 00:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941054; cv=none; d=google.com; s=arc-20160816; b=DnPFp0oEGDCABxKXF+PELXxBO6sje+3XR7m4x0o7+yRczYPgx9KyDJNt50remLJJef yIA+RvoYLWw2LtOERtMbQhPWZXvukn4ffF38giTZtvmtnf2+e5yHv+ZqsNtjNHxPEFJm tyB+jz99Zb5msIiy7XhXKq/wqRLsjto190KVhL95cEv/22/anenUjH5+WelY9HQBnwDR zyxNzOi1ftLMRGrOWrvAEKawVM0APiM4f4kohc0O/gqhs6JdhgMRsl+f07s35O1zvSLP N9Al6DR+tvERBLb3/lcVsTJQCKxAdWYHaEEyn7ZFdbYK+1M5aLsEYUnHOrvJTO4fBAlj fbkw== 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=c+dnZnjcFElaQVxlBKB6mEYH1XRimgs6GOpBXkplKCQ=; b=vJx3GIWqmCTqpij63s3Gh6/7m6td5LwKY54CrciPtKPyeDfnM4XxzPtPgRtZIifp3p 080z07150V5aPisNrxZtmv1XIbI4WJEq3PS3PofQ6wtF6DLg8Xnz7f17xk9khiP12rRY os8A6k+QvWUDoM1K9nTIkgogifc69gJQZL8I+zPqBywneF5cbe0gdTf+Nzm6YSRzETEB 39xm7WsSAxSOs8lPeGfXUzVF5U8C/AMT91VSzTg6n5VXMstW8MsFCH/0n5eCSVYV14CG zhzQrCk/Rheroro1yD/+K9QVSTC5M7e24mMODNTJ36xrciAdKamTs8oph2dcdLhSJdgX lJlg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z+oFSqQG; 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 a640c23a62f3a-a79bc96e4desor36963866b.21.2024.07.14.00.10.54 for (Google Transport Security); Sun, 14 Jul 2024 00:10:54 -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; AJvYcCWYCamj0e9MkUjZOIV+gjXbnLNBl7BmCy2rnsYfxmwCu6VRMKWyweZYlpzWgYlJ8taKIfIAmfih8SO+g+eha+1ZJ5vqZY/DAYx1p08rjN6oN7WC X-Received: by 2002:a17:906:389:b0:a77:b8d4:ae6e with SMTP id a640c23a62f3a-a780b6b1fa5mr1023043766b.23.1720941053254; Sun, 14 Jul 2024 00:10:53 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:52 -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 09:10:19 +0200 Message-ID: <20240714071023.10417-21-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=Z+oFSqQG; 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;