* [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock
@ 2024-09-04 8:31 Dominique Martinet
2024-09-05 7:49 ` Frieder Schrempf
2024-09-06 1:23 ` Adam Ford
0 siblings, 2 replies; 4+ messages in thread
From: Dominique Martinet @ 2024-09-04 8:31 UTC (permalink / raw)
To: Liu Ying, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam
Cc: Adam Ford, Lucas Stach, Frieder Schrempf, Dominique Martinet,
dri-devel, imx, linux-arm-kernel, linux-kernel
This allows the hdmi driver to pick e.g. 64.8MHz instead of 65Mhz when we
cannot output the exact frequency, enabling the imx8mp HDMI output to
support more modes
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
This completes the patch series sent by Adam Ford here:
https://lkml.kernel.org/r/20240904023310.163371-1-aford173@gmail.com
and makes the cheap screens we recommend work with our imx8mp board
without further kludging.
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
index 13bc570c5473..9431cd5e06c3 100644
--- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
+++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
@@ -23,6 +23,7 @@ imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
const struct drm_display_mode *mode)
{
struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
+ long round_rate;
if (mode->clock < 13500)
return MODE_CLOCK_LOW;
@@ -30,8 +31,9 @@ imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
if (mode->clock > 297000)
return MODE_CLOCK_HIGH;
- if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
- mode->clock * 1000)
+ round_rate = clk_round_rate(hdmi->pixclk, mode->clock * 1000);
+ /* accept 0.5% = 1/200 = 5/1000 tolerance */
+ if (abs(round_rate - mode->clock * 1000) > mode->clock * 5)
return MODE_CLOCK_RANGE;
/* We don't support double-clocked and Interlaced modes */
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock
2024-09-04 8:31 [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock Dominique Martinet
@ 2024-09-05 7:49 ` Frieder Schrempf
2024-09-06 1:23 ` Adam Ford
1 sibling, 0 replies; 4+ messages in thread
From: Frieder Schrempf @ 2024-09-05 7:49 UTC (permalink / raw)
To: Dominique Martinet, Liu Ying, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam
Cc: Adam Ford, Lucas Stach, dri-devel, imx, linux-arm-kernel,
linux-kernel
On 04.09.24 10:31 AM, Dominique Martinet wrote:
> This allows the hdmi driver to pick e.g. 64.8MHz instead of 65Mhz when we
> cannot output the exact frequency, enabling the imx8mp HDMI output to
> support more modes
>
> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
> This completes the patch series sent by Adam Ford here:
> https://lkml.kernel.org/r/20240904023310.163371-1-aford173@gmail.com
>
> and makes the cheap screens we recommend work with our imx8mp board
> without further kludging.
>
>
> drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
> index 13bc570c5473..9431cd5e06c3 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
> @@ -23,6 +23,7 @@ imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
> const struct drm_display_mode *mode)
> {
> struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
> + long round_rate;
>
> if (mode->clock < 13500)
> return MODE_CLOCK_LOW;
> @@ -30,8 +31,9 @@ imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
> if (mode->clock > 297000)
> return MODE_CLOCK_HIGH;
>
> - if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
> - mode->clock * 1000)
> + round_rate = clk_round_rate(hdmi->pixclk, mode->clock * 1000);
> + /* accept 0.5% = 1/200 = 5/1000 tolerance */
> + if (abs(round_rate - mode->clock * 1000) > mode->clock * 5)
> return MODE_CLOCK_RANGE;
>
> /* We don't support double-clocked and Interlaced modes */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock
2024-09-04 8:31 [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock Dominique Martinet
2024-09-05 7:49 ` Frieder Schrempf
@ 2024-09-06 1:23 ` Adam Ford
2024-09-06 7:51 ` Maxime Ripard
1 sibling, 1 reply; 4+ messages in thread
From: Adam Ford @ 2024-09-06 1:23 UTC (permalink / raw)
To: Dominique Martinet
Cc: Liu Ying, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Lucas Stach, Frieder Schrempf, dri-devel, imx,
linux-arm-kernel, linux-kernel
On Wed, Sep 4, 2024 at 3:31 AM Dominique Martinet
<dominique.martinet@atmark-techno.com> wrote:
>
> This allows the hdmi driver to pick e.g. 64.8MHz instead of 65Mhz when we
> cannot output the exact frequency, enabling the imx8mp HDMI output to
> support more modes
>
I went from 19 options on Modetest with my AOC 4K monitor to 31. Of
those 31, three did not appear to sync, but not all the frequencies in
the LUT sync for me either, so I have no objection to moving forward
with this, but I wonder if we should have a note in there about why we
have a 5% tolerance.
> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon
> ---
> This completes the patch series sent by Adam Ford here:
> https://lkml.kernel.org/r/20240904023310.163371-1-aford173@gmail.com
>
> and makes the cheap screens we recommend work with our imx8mp board
> without further kludging.
>
>
> drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
> index 13bc570c5473..9431cd5e06c3 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
> @@ -23,6 +23,7 @@ imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
> const struct drm_display_mode *mode)
> {
> struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
> + long round_rate;
>
> if (mode->clock < 13500)
> return MODE_CLOCK_LOW;
> @@ -30,8 +31,9 @@ imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
> if (mode->clock > 297000)
> return MODE_CLOCK_HIGH;
>
> - if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
> - mode->clock * 1000)
> + round_rate = clk_round_rate(hdmi->pixclk, mode->clock * 1000);
> + /* accept 0.5% = 1/200 = 5/1000 tolerance */
> + if (abs(round_rate - mode->clock * 1000) > mode->clock * 5)
> return MODE_CLOCK_RANGE;
>
> /* We don't support double-clocked and Interlaced modes */
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock
2024-09-06 1:23 ` Adam Ford
@ 2024-09-06 7:51 ` Maxime Ripard
0 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2024-09-06 7:51 UTC (permalink / raw)
To: Adam Ford
Cc: Dominique Martinet, Liu Ying, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Thomas Zimmermann, David Airlie, Daniel Vetter,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Lucas Stach, Frieder Schrempf, dri-devel, imx, linux-arm-kernel,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 733 bytes --]
On Thu, Sep 05, 2024 at 08:23:51PM GMT, Adam Ford wrote:
> On Wed, Sep 4, 2024 at 3:31 AM Dominique Martinet
> <dominique.martinet@atmark-techno.com> wrote:
> >
> > This allows the hdmi driver to pick e.g. 64.8MHz instead of 65Mhz when we
> > cannot output the exact frequency, enabling the imx8mp HDMI output to
> > support more modes
> >
> I went from 19 options on Modetest with my AOC 4K monitor to 31. Of
> those 31, three did not appear to sync, but not all the frequencies in
> the LUT sync for me either, so I have no objection to moving forward
> with this, but I wonder if we should have a note in there about why we
> have a 5% tolerance.
Yeah, I agree, it's something you want a comment for.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-06 7:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 8:31 [PATCH] drm/bridge: imx8mp-hdmi-tx: allow 0.5% margin with selected clock Dominique Martinet
2024-09-05 7:49 ` Frieder Schrempf
2024-09-06 1:23 ` Adam Ford
2024-09-06 7:51 ` Maxime Ripard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox