summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJose Abreu <Jose.Abreu@synopsys.com>2017-07-17 13:08:27 +0100
committerAlexey Brodkin <abrodkin@synopsys.com>2017-08-03 00:11:02 +0300
commit22d0be2a557e53a22feb484e8fce255fe09e6ad5 (patch)
treeb4a1b39199e726e9e3c74be585ffd5bb5a87af82 /drivers/gpu
parent0c43ff59e71b37b1fc550e9fdd6399c77b8fee68 (diff)
downloadtalos-obmc-linux-22d0be2a557e53a22feb484e8fce255fe09e6ad5.tar.gz
talos-obmc-linux-22d0be2a557e53a22feb484e8fce255fe09e6ad5.zip
drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback
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 that into account instead of just rejecting the mode. According to the HDMI spec we have a max of +-0.5% for the pixel clock frequency deviation. Lets take that into an advantage and use it to calculate how much deviation we can support. Signed-off-by: Jose Abreu <joabreu@synopsys.com> Acked-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Carlos Palminha <palminha@synopsys.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Dave Airlie <airlied@gmail.com> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/arc/arcpgu_crtc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 1859dd3ad622..55c5d5bd74e1 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) && (rate > 0))
+ return MODE_OK;
- return MODE_OK;
+ return MODE_NOCLOCK;
}
static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc)
OpenPOWER on IntegriCloud