]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/dp: Respect the sink's max TMDS clock when dealing with DP->HDMI DFPs
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 22 Mar 2022 12:00:05 +0000 (14:00 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 5 Apr 2022 08:11:47 +0000 (11:11 +0300)
Currently we only look at the DFPs max TMDS clock limit when
considering whether the mode is valid, or whether we can do
deep color. The sink's max TMDS clock limit may be lower than
the DFPs, so we need to account for it as well.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4095
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2844
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220322120015.28074-3-ville.syrjala@linux.intel.com
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
drivers/gpu/drm/i915/display/intel_dp.c

index 3611e2cee20aa8447be3558181ea6cafe7bde05d..186b50aa87df2f173287c2a6712c126a34e71aea 100644 (file)
@@ -829,20 +829,34 @@ static bool intel_dp_hdisplay_bad(struct drm_i915_private *dev_priv,
        return hdisplay == 4096 && !HAS_DDI(dev_priv);
 }
 
+static int intel_dp_max_tmds_clock(struct intel_dp *intel_dp)
+{
+       struct intel_connector *connector = intel_dp->attached_connector;
+       const struct drm_display_info *info = &connector->base.display_info;
+       int max_tmds_clock = intel_dp->dfp.max_tmds_clock;
+
+       /* Only consider the sink's max TMDS clock if we know this is a HDMI DFP */
+       if (max_tmds_clock && info->max_tmds_clock)
+               max_tmds_clock = min(max_tmds_clock, info->max_tmds_clock);
+
+       return max_tmds_clock;
+}
+
 static enum drm_mode_status
 intel_dp_tmds_clock_valid(struct intel_dp *intel_dp,
                          int clock, int bpc, bool ycbcr420_output)
 {
-       int tmds_clock;
+       int tmds_clock, min_tmds_clock, max_tmds_clock;
 
        tmds_clock = intel_hdmi_tmds_clock(clock, bpc, ycbcr420_output);
 
-       if (intel_dp->dfp.min_tmds_clock &&
-           tmds_clock < intel_dp->dfp.min_tmds_clock)
+       min_tmds_clock = intel_dp->dfp.min_tmds_clock;
+       max_tmds_clock = intel_dp_max_tmds_clock(intel_dp);
+
+       if (min_tmds_clock && tmds_clock < min_tmds_clock)
                return MODE_CLOCK_LOW;
 
-       if (intel_dp->dfp.max_tmds_clock &&
-           tmds_clock > intel_dp->dfp.max_tmds_clock)
+       if (max_tmds_clock && tmds_clock > max_tmds_clock)
                return MODE_CLOCK_HIGH;
 
        return MODE_OK;