[Intel-gfx] [PATCH 3/9] drm/i915: Check pixel clock when setting mode for LVDS
Mika Kahola
mika.kahola at intel.com
Fri Jul 3 04:35:51 PDT 2015
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 LVDS.
Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
drivers/gpu/drm/i915/intel_lvds.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index ea85547..3280413 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -262,13 +262,31 @@ static void intel_disable_lvds(struct intel_encoder *encoder)
POSTING_READ(lvds_encoder->reg);
}
+static int
+intel_lvds_max_pixclk(struct drm_connector *connector)
+{
+ struct drm_i915_private *dev_priv = to_i915(connector->dev);
+
+ if (IS_CHERRYVIEW(connector->dev))
+ return DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 95);
+ else if (IS_VALLEYVIEW(connector->dev))
+ return DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 90);
+ else
+ return dev_priv->max_cdclk_freq;
+}
+
static enum drm_mode_status
intel_lvds_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct intel_connector *intel_connector = to_intel_connector(connector);
struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
+ int max_pixclk;
+
+ max_pixclk = intel_lvds_max_pixclk(connector);
+ if (mode->clock > max_pixclk)
+ return MODE_PANEL;
if (mode->hdisplay > fixed_mode->hdisplay)
return MODE_PANEL;
if (mode->vdisplay > fixed_mode->vdisplay)
--
1.9.1
More information about the Intel-gfx
mailing list