drm/i915: Fix max link rate in intel_dp_mode_valid()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 12 Mar 2015 15:10:34 +0000 (17:10 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 20 Mar 2015 10:48:07 +0000 (11:48 +0100)
Consider the link rates reported by the sink via
DP_SUPPORTED_LINK_RATES when checking modes against the max link
rate.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h

index 45c35681eb480e8559b2427a5e7b94c164fb5097..5d8ec3a3350272cda0ceaaa01a7a68a36ba5d64c 100644 (file)
@@ -206,7 +206,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
                target_clock = fixed_mode->clock;
        }
 
-       max_link_clock = drm_dp_bw_code_to_link_rate(intel_dp_max_link_bw(intel_dp));
+       max_link_clock = intel_dp_max_link_rate(intel_dp);
        max_lanes = intel_dp_max_lane_count(intel_dp);
 
        max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes);
@@ -1242,6 +1242,19 @@ static int rate_to_index(int find, const int *rates)
        return i;
 }
 
+int
+intel_dp_max_link_rate(struct intel_dp *intel_dp)
+{
+       int rates[DP_MAX_SUPPORTED_RATES] = {};
+       int len;
+
+       len = intel_supported_rates(intel_dp, rates);
+       if (WARN_ON(len <= 0))
+               return 162000;
+
+       return rates[rate_to_index(0, rates) - 1];
+}
+
 bool
 intel_dp_compute_config(struct intel_encoder *encoder,
                        struct intel_crtc_state *pipe_config)
index 69c8437be61184806d643fe49593f8fc55f321cf..d5a1f1f46ce5387669e3f22ee28102ece4ffb74f 100644 (file)
@@ -1062,6 +1062,7 @@ void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *co
 void intel_dp_mst_suspend(struct drm_device *dev);
 void intel_dp_mst_resume(struct drm_device *dev);
 int intel_dp_max_link_bw(struct intel_dp *intel_dp);
+int intel_dp_max_link_rate(struct intel_dp *intel_dp);
 void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
 void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
 uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);