All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/9] drm/i915: Check pixel clock when setting mode for HDMI
Date: Fri,  3 Jul 2015 14:35:50 +0300	[thread overview]
Message-ID: <1435923357-3821-3-git-send-email-mika.kahola@intel.com> (raw)
In-Reply-To: <1435923357-3821-1-git-send-email-mika.kahola@intel.com>

It is possible the we request to have a mode that has
higher pixel clock than our HW can support. This patch
checks if requested pixel clock is lower than the one
supported by the HW. The requested mode is discarded
if we cannot support the requested pixel clock.

This patch applies to HDMI.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 00c4b40..1886cd4c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1163,14 +1163,40 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit)
 		return 225000;
 }
 
+static int
+intel_hdmi_max_pixclk(struct intel_hdmi *hdmi)
+{
+	struct intel_encoder *encoder =	&hdmi_to_dig_port(hdmi)->base;
+	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
+
+	if (IS_CHERRYVIEW(dev))
+		return  DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 95);
+	else if (IS_VALLEYVIEW(dev))
+		return  DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 90);
+	else if (IS_BROADWELL(dev) && intel_crtc->config->ips_enabled)
+		return  DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 95);
+	else
+		return dev_priv->max_cdclk_freq;
+}
+
 static enum drm_mode_status
 intel_hdmi_mode_valid(struct drm_connector *connector,
 		      struct drm_display_mode *mode)
 {
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+
 	int clock = mode->clock;
+	int max_pixclk = intel_hdmi_max_pixclk(intel_hdmi);
 
-	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
+	if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
 		clock *= 2;
+		max_pixclk *= 2;
+	}
+
+	if (clock > max_pixclk)
+		return MODE_CLOCK_HIGH;
 
 	if (clock > hdmi_portclock_limit(intel_attached_hdmi(connector),
 					 true))
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-07-03 11:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 11:35 [PATCH 0/9] drm/i915: Check pixel clock when setting mode Mika Kahola
2015-07-03 11:35 ` [PATCH 1/9] drm/i915: Check pixel clock when setting mode for DP Mika Kahola
2015-07-03 12:57   ` Ville Syrjälä
2015-07-06  6:45     ` Sivakumar Thulasimani
2015-07-06  9:23       ` Ville Syrjälä
2015-07-28  7:36     ` Mika Kahola
2015-07-03 11:35 ` Mika Kahola [this message]
2015-07-03 11:35 ` [PATCH 3/9] drm/i915: Check pixel clock when setting mode for LVDS Mika Kahola
2015-07-03 12:35   ` Chris Wilson
2015-07-03 11:35 ` [PATCH 4/9] drm/i915: Check pixel clock when setting mode for DVO Mika Kahola
2015-07-03 11:35 ` [PATCH 5/9] drm/i915: Check pixel clock when setting mode for SDVO Mika Kahola
2015-07-03 11:35 ` [PATCH 6/9] drm/i915: Check pixel clock when setting mode for DSI Mika Kahola
2015-07-03 12:38   ` Chris Wilson
2015-07-27 11:47     ` Mika Kahola
2015-07-03 11:35 ` [PATCH 7/9] drm/i915: Check pixel clock when setting mode for CRT Mika Kahola
2015-07-03 11:35 ` [PATCH 8/9] drm/i915: Check pixel clock when setting mode for TV Mika Kahola
2015-07-03 11:35 ` [PATCH 9/9] drm/i915: Check pixel clock when setting mode for DP-MST Mika Kahola
2015-07-04 23:24   ` shuang.he
2015-07-03 12:49 ` [PATCH 0/9] drm/i915: Check pixel clock when setting mode Chris Wilson
2015-07-06 15:21   ` Daniel Vetter
2015-07-06 15:28     ` Ville Syrjälä
2015-07-06 18:00       ` Daniel Vetter
2015-07-06 15:35     ` Chris Wilson

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=1435923357-3821-3-git-send-email-mika.kahola@intel.com \
    --to=mika.kahola@intel.com \
    --cc=intel-gfx@lists.freedesktop.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.