Message ID | 20231212033259.189718-1-aford173@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7489974vqy; Mon, 11 Dec 2023 19:33:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXShbwzLh0c7zZ+qog0cghwCUTc03GSGnlKsPtmkauXYfDmTGLwaRs9e8dM202/OqECrtC X-Received: by 2002:a9d:734b:0:b0:6d9:f753:efd7 with SMTP id l11-20020a9d734b000000b006d9f753efd7mr5364273otk.71.1702352004993; Mon, 11 Dec 2023 19:33:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702352004; cv=none; d=google.com; s=arc-20160816; b=VlKLKtHM78bTXWCbMgSoKtmIsGvM1w5QldtBUB4AT3uDc7s5HmFidQ0fYHXw7pN+94 X8MjDKeUuYy+BRKZyiFTlA9WSsgdBSMchYeon4qdX1Vsr971588NJxU/8VZIRd6+8z8r +F6lhfr7g0q4N7Qhl84AnDMTfeUZWUV7qlOgA4WYxEPQAfWbasxvqrOJyFYgD78XjYSe pe8loIg1MTTgzzSJUluTPBUOSdCWHRsxCz/GycpKHOQXDLe5hok6/lGCha9cjmbIXmqZ vQQ4IhT7D2NrdZh9pO0is4HaGW2ujRDRajYV8YrpCKS443zDYV5b1vVDPRyIxkKdVgPV Y77Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3W+vl1pPQ5xbJbOBYqTUjLnDDv5t03VNIfECEsk3uHs=; fh=VLt18vAyf8yLlRWZNfk7sG/MXgFsp6bUw5wXT+72evg=; b=0H8ANL78AigDut+i8VMbaLfdCZujz+BvaCAa32fZYAoL5i1IWuvu3d7mNZ3GNTcgH/ cYxWYgvgRPitsjCf+Ez0bL2ZOx2cGfaGnyvNdix5MzQ58VyXWu4tjOaO0JECZL6bYS0U crddmfK/m5b9+HRmntTM+ebnis1JYpWNOIF3H+BMz5Cx+yImXEuwCKEo5ylR5iVCFT0m DBHN+9xxDv4IMx24IaTGwji1gyjgw8eTwGgUVtSCEbbdw7H5jRahtcQC0eLFHV9NB5LK awaqueVpc7E6AKkwBnruHhYiv1leOvCaznod1HKyFysOoGUHWLWHrNswDSyR2qlR1iRE jUUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R8MtVXai; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id v7-20020a655687000000b005be14925624si6771253pgs.714.2023.12.11.19.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 19:33:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R8MtVXai; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C62BA803D5A8; Mon, 11 Dec 2023 19:33:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231416AbjLLDdK (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 22:33:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjLLDdJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 22:33:09 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02E588F for <linux-kernel@vger.kernel.org>; Mon, 11 Dec 2023 19:33:15 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7b435966249so237792539f.0 for <linux-kernel@vger.kernel.org>; Mon, 11 Dec 2023 19:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702351994; x=1702956794; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3W+vl1pPQ5xbJbOBYqTUjLnDDv5t03VNIfECEsk3uHs=; b=R8MtVXaiPyZuICvuusMWaZh7QU0U4+OY/QWLeVEjrQXoqbVxQW6cKz07k+IzqTacML qtmcpzODwBdoOSwgHpfFzxaNFfQY4+C6m6swJnqTwlgXP1w/3Cl60SONS/Ee/NTvzCoI 23v9eFNIV4k2tq/jCKkqyErz4hyoIzS/I3PrA3Lv51PD6KKt7MrkGTqvEfKaFx70sCX7 BdWXp3JGxAuqXKPSfsJ9Ybqg0ELgUSFb73YhVKtuMi6/11lAxhpnLORNqXV22c/maUjx iXT9di+sbYw/jaYxy3j0nnze1XFVVnzcaOgtN5H+HWjDagrjFR/2FsSlYiAZY8auidY5 +H2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702351994; x=1702956794; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3W+vl1pPQ5xbJbOBYqTUjLnDDv5t03VNIfECEsk3uHs=; b=fEK2BwNC7UiZnVem6NbsebY84LYJ5I6V0U2iK1otSVcZQycRYkkROZxlPRCO6c5BRG 4MyXoosudjXmYdVewffNljPgqHrjSnm9PcPVbiJSBc/9v5rloNxzIkjEEM5DEuasavGb vx+GydPygUZwlJ2QbjAA7qs23xHV1KIDfRjP8nzuYyJ/Q4yfQlA7k6DcITRFIj7hNQvQ 7iM0RWdEx1OG2wpvA8oNLvANTLNBBk4Sszu4Da+YXWigmuK8ufFsJCtP2G72wOgQJZrN SCgfAnsXJzxczg1lqNFx8kwJBsOW/ZX2g8oV6bTfM79JPiCgSXUDV5m0wtaHlzBNO7YN Vpag== X-Gm-Message-State: AOJu0YyhCkja83yhqkMxeJ6kovNz/M0Gf4jKllDOk0hVfaS3LCiqs0lb WyiCMRdFS0z2SCkTPeBK/jQ= X-Received: by 2002:a05:6602:274d:b0:7b7:e9f:b93f with SMTP id b13-20020a056602274d00b007b70e9fb93fmr6164628ioe.0.1702351994112; Mon, 11 Dec 2023 19:33:14 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:6068:4690:ab38:4373]) by smtp.gmail.com with ESMTPSA id y23-20020a5e8717000000b007b457153a6bsm2590049ioj.28.2023.12.11.19.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 19:33:13 -0800 (PST) From: Adam Ford <aford173@gmail.com> To: dri-devel@lists.freedesktop.org Cc: aford@beaconembedded.com, Adam Ford <aford173@gmail.com>, Inki Dae <inki.dae@samsung.com>, Jagan Teki <jagan@amarulasolutions.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Marco Felsch <m.felsch@pengutronix.de>, Michael Tretter <m.tretter@pengutronix.de>, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/bridge: samsung-dsim: Set P divider based on min/max of fin pll Date: Mon, 11 Dec 2023 21:32:58 -0600 Message-Id: <20231212033259.189718-1-aford173@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 11 Dec 2023 19:33:19 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785045455701761612 X-GMAIL-MSGID: 1785045455701761612 |
Series |
[1/2] drm/bridge: samsung-dsim: Set P divider based on min/max of fin pll
|
|
Commit Message
Adam Ford
Dec. 12, 2023, 3:32 a.m. UTC
The P divider should be set based on the min and max values of
the fin pll which may vary between different platforms.
These ranges are defined per platform, but hard-coded values
were used instead which resulted in a smaller range available
on the i.MX8M[MNP] than what was possible.
Fixes: 846307185f0f ("drm/bridge: samsung-dsim: update PLL reference clock")
Signed-off-by: Adam Ford <aford173@gmail.com>
Comments
Hi Adam, On 12.12.23 04:32, Adam Ford wrote: > The P divider should be set based on the min and max values of > the fin pll which may vary between different platforms. > These ranges are defined per platform, but hard-coded values > were used instead which resulted in a smaller range available > on the i.MX8M[MNP] than what was possible. > > Fixes: 846307185f0f ("drm/bridge: samsung-dsim: update PLL reference clock") > Signed-off-by: Adam Ford <aford173@gmail.com> > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c > index be5914caa17d..239d253a7d71 100644 > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > @@ -573,8 +573,8 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi, > u16 _m, best_m; > u8 _s, best_s; > > - p_min = DIV_ROUND_UP(fin, (12 * MHZ)); > - p_max = fin / (6 * MHZ); > + p_min = DIV_ROUND_UP(fin, (driver_data->pll_fin_max * MHZ)); > + p_max = fin / (driver_data->pll_fin_min * MHZ); I did some tinkering with the PLL settings the other day and this is literally one of the things I came up with. So I'm happy to provide: Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de> Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de> Regarding the P divider, I'm also wondering if there is an upper limit for the p-value (not for the resulting fin_pll) that we should take into account, too. The problem is that we have conflicts in the documentation (again) so we don't really know what the correct limit would be. There are the following ranges given in the RMs: * 1..63 (i.MX8MM RM 13.7.8.18.4) * 1..33 (i.MX8MM RM 13.7.10.1) * 1..63 (i.MX8MP RM 13.2.3.1.5.2) * 1..63 (i.MX8MP RM 13.7.2.4) Unfortunately there are similar discrepancies for the other parameters and limits. Thanks Frieder > > for (_p = p_min; _p <= p_max; ++_p) { > for (_s = 0; _s <= 5; ++_s) {
On Tue, Dec 12, 2023 at 2:25 AM Frieder Schrempf <frieder.schrempf@kontron.de> wrote: > > Hi Adam, > > On 12.12.23 04:32, Adam Ford wrote: > > The P divider should be set based on the min and max values of > > the fin pll which may vary between different platforms. > > These ranges are defined per platform, but hard-coded values > > were used instead which resulted in a smaller range available > > on the i.MX8M[MNP] than what was possible. > > > > Fixes: 846307185f0f ("drm/bridge: samsung-dsim: update PLL reference clock") > > Signed-off-by: Adam Ford <aford173@gmail.com> > > > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c > > index be5914caa17d..239d253a7d71 100644 > > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > > @@ -573,8 +573,8 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi, > > u16 _m, best_m; > > u8 _s, best_s; > > > > - p_min = DIV_ROUND_UP(fin, (12 * MHZ)); > > - p_max = fin / (6 * MHZ); > > + p_min = DIV_ROUND_UP(fin, (driver_data->pll_fin_max * MHZ)); > > + p_max = fin / (driver_data->pll_fin_min * MHZ); > > I did some tinkering with the PLL settings the other day and this is > literally one of the things I came up with. > > So I'm happy to provide: > > Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de> > Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de> > Thank you! > Regarding the P divider, I'm also wondering if there is an upper limit > for the p-value (not for the resulting fin_pll) that we should take into > account, too. The problem is that we have conflicts in the documentation > (again) so we don't really know what the correct limit would be. > > There are the following ranges given in the RMs: > > * 1..63 (i.MX8MM RM 13.7.8.18.4) > * 1..33 (i.MX8MM RM 13.7.10.1) > * 1..63 (i.MX8MP RM 13.2.3.1.5.2) > * 1..63 (i.MX8MP RM 13.7.2.4) 1...63 (i.IMX8MN RM 13.7.2.4) > > Unfortunately there are similar discrepancies for the other parameters > and limits. For what it's worth, I compared these values to the NXP downstream branch [1], and they seemed to indicate the values were as follows: .p = { .min = 1, .max = 63, }, .m = { .min = 64, .max = 1023, }, .s = { .min = 0, .max = 5, }, .k = { .min = 0, .max = 32768, }, /* abs(k) */ .fin = { .min = 6000, .max = 300000, }, /* in KHz */ .fpref = { .min = 2000, .max = 30000, }, /* in KHz */ .fvco = { .min = 1050000, .max = 2100000, }, /* in KHz */ In a previous commit [2], I mentioned the fact that I reached out to NXP asking about the discrepancies and my NXP Rep and I received the response: "Yes it is definitely wrong, the one that is part of the NOTE in MIPI_DPHY_M_PLLPMS register table against PMS_P, PMS_M and PMS_S is not correct. I will report this to Doc team, the one customer should be take into account is the Table 13-40 DPHY PLL Parameters and the Note above." adam [1] - https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/drivers/gpu/drm/imx/sec_mipi_pll_1432x.h#L38C1-L47C1 [2] - https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/gpu/drm/bridge/samsung-dsim.c?h=next-20231212&id=54f1a83c72250b182fa7722b0c5f6eb5e769598d > > Thanks > Frieder > > > > > for (_p = p_min; _p <= p_max; ++_p) { > > for (_s = 0; _s <= 5; ++_s) { >
diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index be5914caa17d..239d253a7d71 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -573,8 +573,8 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi, u16 _m, best_m; u8 _s, best_s; - p_min = DIV_ROUND_UP(fin, (12 * MHZ)); - p_max = fin / (6 * MHZ); + p_min = DIV_ROUND_UP(fin, (driver_data->pll_fin_max * MHZ)); + p_max = fin / (driver_data->pll_fin_min * MHZ); for (_p = p_min; _p <= p_max; ++_p) { for (_s = 0; _s <= 5; ++_s) {