* [PATCH] drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback
@ 2017-06-27 14:36 Jose Abreu
2017-07-12 17:06 ` Alexey Brodkin
0 siblings, 1 reply; 2+ messages in thread
From: Jose Abreu @ 2017-06-27 14:36 UTC (permalink / raw)
To: dri-devel, linux-kernel
Cc: Jose Abreu, Carlos Palminha, Alexey Brodkin, Daniel Vetter,
Dave Airlie
Currently we expect that clock driver produces the exact same value
as we are requiring. There can, and will, be some deviation however
so we need to take into account that instead of rejecting the mode.
According to HDMI spec we have a max of +-0.5% for the pixel clock
frequency variation. Lets take that into an advantage and use it
to calculate how much deviation we can support.
This patch was based on today's drm-misc-next.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Carlos Palminha <palminha@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@linux.ie>
---
drivers/gpu/drm/arc/arcpgu_crtc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 611af74..20528ba 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -69,12 +69,13 @@ static enum drm_mode_status arc_pgu_crtc_mode_valid(struct drm_crtc *crtc,
{
struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
long rate, clk_rate = mode->clock * 1000;
+ long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec*/
rate = clk_round_rate(arcpgu->clk, clk_rate);
- if (rate != clk_rate)
- return MODE_NOCLOCK;
+ if ((max(rate, clk_rate) - min(rate, clk_rate)) < diff)
+ return MODE_OK;
- return MODE_OK;
+ return MODE_NOCLOCK;
}
static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback
2017-06-27 14:36 [PATCH] drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback Jose Abreu
@ 2017-07-12 17:06 ` Alexey Brodkin
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Brodkin @ 2017-07-12 17:06 UTC (permalink / raw)
To: Jose Abreu
Cc: Carlos Palminha, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, daniel.vetter@ffwll.ch,
airlied@linux.ie
Hi Jose,
On Tue, 2017-06-27 at 15:36 +0100, Jose Abreu wrote:
> Currently we expect that clock driver produces the exact same value
> as we are requiring. There can, and will, be some deviation however
> so we need to take into account that instead of rejecting the mode.
>
> According to HDMI spec we have a max of +-0.5% for the pixel clock
> frequency variation. Lets take that into an advantage and use it
> to calculate how much deviation we can support.
>
> This patch was based on today's drm-misc-next.
>
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>
> Cc: Carlos Palminha <palminha@synopsys.com>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@linux.ie>
Finally our problem with EDID-less monitor is fixed
with that patch.
Thus,
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-12 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27 14:36 [PATCH] drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback Jose Abreu
2017-07-12 17:06 ` Alexey Brodkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox