From: Dominique Martinet <dominique.martinet@atmark-techno.com>
To: Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>
Cc: "Adam Ford" <aford173@gmail.com>,
"Frieder Schrempf" <frieder.schrempf@kontron.de>,
"Marco Felsch" <m.felsch@pengutronix.de>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org,
"Makoto Sato" <makoto.sato@atmark-techno.com>,
"Dominique Martinet" <dominique.martinet@atmark-techno.com>
Subject: [PATCH] phy: freescale: fsl-samsung-hdmi: return closest rate instead LUT
Date: Mon, 10 Mar 2025 10:21:32 +0900 [thread overview]
Message-ID: <20250310-8ulp_hdmi-v1-1-a2f231e31987@atmark-techno.com> (raw)
From: Makoto Sato <makoto.sato@atmark-techno.com>
If the requested rate is not an exact match of the integer divider
phy_clk_round_rate() would return the look up table value,
but phy_clk_set_rate() can still use the integer divider if it results
in a frequency that is closer than the look up table.
In particular, not returning the actually used value here made the hdmi
bridge driver reject a frequency that has an integer divider rate
within 0.5% of the target:
for 83.5mHz, the integer divider generates 83.2mHz (-0.36%), but the
next LUT value (82.5mHz) is 1.2% off which incorrectly rejects modes
requiring this frequency.
This commit updates phy_clk_round_rate() to use the same logic as the
set operation.
Signed-off-by: Makoto Sato <makoto.sato@atmark-techno.com>
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
We're finally using this rewrite in our (outdated) tree and noticed the
"best" mode missing on one of our picky displays.
It all looks good with this fix, thanks again!
---
drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index e4c0a82d16d9ef0f64ebf9e505b8620423cdc416..91c4d27a31f48fc49f1e8417d7089f5519b8a0a2 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -557,8 +557,9 @@ static long phy_clk_round_rate(struct clk_hw *hw,
if (int_div_clk == rate)
return int_div_clk;
- /* If neither rate is an exact match, use the value from the LUT */
- return fract_div_phy->pixclk;
+ /* If neither rate is an exact match, use the closest value */
+ return fsl_samsung_hdmi_phy_get_closest_rate(rate, int_div_clk,
+ fract_div_phy->pixclk);
}
static int phy_use_fract_div(struct fsl_samsung_hdmi_phy *phy, const struct phy_config *fract_div_phy)
---
base-commit: 80e54e84911a923c40d7bee33a34c1b4be148d7a
change-id: 20250310-8ulp_hdmi-f8deac08611e
Best regards,
--
Dominique Martinet <dominique.martinet@atmark-techno.com>
next reply other threads:[~2025-03-10 1:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 1:21 Dominique Martinet [this message]
2025-03-10 9:14 ` Uwe Kleine-König
2025-03-10 9:48 ` Dominique Martinet
2025-03-10 16:12 ` Uwe Kleine-König
2025-03-31 13:45 ` Adam Ford
2025-05-04 20:44 ` Adam Ford
2025-05-05 7:55 ` Uwe Kleine-König
2025-05-05 10:31 ` Adam Ford
2025-03-31 13:43 ` Adam Ford
2025-03-31 21:58 ` Dominique Martinet
2025-04-01 13:59 ` Adam Ford
2025-03-10 9:32 ` Frieder Schrempf
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=20250310-8ulp_hdmi-v1-1-a2f231e31987@atmark-techno.com \
--to=dominique.martinet@atmark-techno.com \
--cc=aford173@gmail.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=makoto.sato@atmark-techno.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®