From: Adam Ford <aford173@gmail.com>
To: linux-phy@lists.infradead.org
Cc: aford@beaconembedded.com, sandor.yu@nxp.com,
	"Adam Ford" <aford173@gmail.com>,
	"Frieder Schrempf" <frieder.schrempf@kontron.de>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Dominique Martinet" <dominique.martinet@atmark-techno.com>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH V2 1/3] phy: freescale: fsl-samsung-hdmi: Expand Integer divider range
Date: Sat, 26 Oct 2024 08:19:57 -0500	[thread overview]
Message-ID: <20241026132014.73050-1-aford173@gmail.com> (raw)

The Integer divder uses values of P,M, and S to determine the PLL
rate.  Currently, the range of M was set based on a series of
table entries where the range was limited.  Since the ref manual
shows it is 8-bit wide, expand the range to be up to 255.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
V2:  Fix typo in comment

diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index 2c8038864357..412c03b7dcd6 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -406,16 +406,15 @@ static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1
 				continue;
 
 			/*
-			 * TODO: Ref Manual doesn't state the range of _m
-			 * so this should be further refined if possible.
-			 * This range was set based on the original values
-			 * in the lookup table
+			 * The Ref manual doesn't explicitly state the range of M,
+			 * but it does show it as an 8-bit value, so reject
+			 * any value above 255.
 			 */
 			tmp = (u64)fout * (_p * _s);
 			do_div(tmp, 24 * MHZ);
-			_m = tmp;
-			if (_m < 0x30 || _m > 0x7b)
+			if (tmp > 255)
 				continue;
+			_m = tmp;
 
 			/*
 			 * Rev 2 of the Ref Manual states the
-- 
2.45.2


WARNING: multiple messages have this Message-ID (diff)
From: Adam Ford <aford173@gmail.com>
To: linux-phy@lists.infradead.org
Cc: aford@beaconembedded.com, sandor.yu@nxp.com,
	"Adam Ford" <aford173@gmail.com>,
	"Frieder Schrempf" <frieder.schrempf@kontron.de>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Dominique Martinet" <dominique.martinet@atmark-techno.com>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH V2 1/3] phy: freescale: fsl-samsung-hdmi: Expand Integer divider range
Date: Sat, 26 Oct 2024 08:19:57 -0500	[thread overview]
Message-ID: <20241026132014.73050-1-aford173@gmail.com> (raw)

The Integer divder uses values of P,M, and S to determine the PLL
rate.  Currently, the range of M was set based on a series of
table entries where the range was limited.  Since the ref manual
shows it is 8-bit wide, expand the range to be up to 255.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
V2:  Fix typo in comment

diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index 2c8038864357..412c03b7dcd6 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -406,16 +406,15 @@ static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 *p, u1
 				continue;
 
 			/*
-			 * TODO: Ref Manual doesn't state the range of _m
-			 * so this should be further refined if possible.
-			 * This range was set based on the original values
-			 * in the lookup table
+			 * The Ref manual doesn't explicitly state the range of M,
+			 * but it does show it as an 8-bit value, so reject
+			 * any value above 255.
 			 */
 			tmp = (u64)fout * (_p * _s);
 			do_div(tmp, 24 * MHZ);
-			_m = tmp;
-			if (_m < 0x30 || _m > 0x7b)
+			if (tmp > 255)
 				continue;
+			_m = tmp;
 
 			/*
 			 * Rev 2 of the Ref Manual states the
-- 
2.45.2


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

             reply	other threads:[~2024-10-26 13:20 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-26 13:19 Adam Ford [this message]
2024-10-26 13:19 ` [PATCH V2 1/3] phy: freescale: fsl-samsung-hdmi: Expand Integer divider range Adam Ford
2024-10-26 13:19 ` [PATCH V2 2/3] phy: freescale: fsl-samsung-hdmi: Stop searching when exact match is found Adam Ford
2024-10-26 13:19   ` Adam Ford
2024-10-26 13:19 ` [PATCH V2 3/3] phy: freescale: fsl-samsung-hdmi: Clean up fld_tg_code calculation Adam Ford
2024-10-26 13:19   ` Adam Ford
2024-12-13 14:13   ` Geert Uytterhoeven
2024-12-13 14:13     ` Geert Uytterhoeven
2024-12-13 14:57     ` Adam Ford
2024-12-13 14:57       ` Adam Ford
2024-12-13 15:16       ` Geert Uytterhoeven
2024-12-13 15:16         ` Geert Uytterhoeven
2024-12-30  2:11         ` [PATCH] phy: freescale: fsl-samsung-hdmi: fix build error in fsl_samsung_hdmi_phy_configure_pll_lock_det Pei Xiao
2024-12-30  2:11           ` Pei Xiao
2024-12-31  2:11           ` Adam Ford
2024-12-31  2:11             ` Adam Ford
2024-12-31  2:19             ` Pei Xiao
2024-12-31  2:19               ` Pei Xiao
2024-12-31 17:02               ` Adam Ford
2024-12-31 17:02                 ` Adam Ford
2025-01-02  2:14                 ` Pei Xiao
2025-01-02  2:14                   ` Pei Xiao
2025-01-02  2:32                   ` Pei Xiao
2025-01-02  2:32                     ` Pei Xiao
2025-01-02 12:15             ` Dominique Martinet
2025-01-02 12:15               ` Dominique Martinet
2025-01-02 15:04               ` Adam Ford
2025-01-02 15:04                 ` Adam Ford
2025-01-03  1:34                 ` Pei Xiao
2025-01-03  1:34                   ` Pei Xiao
2025-01-09  8:45                   ` Pei Xiao
2025-01-09  8:45                     ` Pei Xiao
2025-01-09 15:03                     ` Adam Ford
2025-01-09 15:03                       ` Adam Ford
2025-01-10 10:04                       ` Geert Uytterhoeven
2025-01-10 10:04                         ` Geert Uytterhoeven
2025-01-11  0:07                         ` Adam Ford
2025-01-11  0:07                           ` Adam Ford
2024-11-07 17:33 ` [PATCH V2 1/3] phy: freescale: fsl-samsung-hdmi: Expand Integer divider range Adam Ford
2024-11-07 17:33   ` Adam Ford
2024-12-04 14:21 ` Adam Ford
2024-12-04 14:21   ` Adam Ford
2024-12-08 17:03 ` Vinod Koul
2024-12-08 17:03   ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241026132014.73050-1-aford173@gmail.com \
    --to=aford173@gmail.com \
    --cc=aford@beaconembedded.com \
    --cc=dominique.martinet@atmark-techno.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=kishon@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    --cc=sandor.yu@nxp.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.