drm/i915/dp: Generalize intel_dp_link_params function to accept arguments to be validated
authorManasi Navare <manasi.d.navare@intel.com>
Thu, 8 Jun 2017 20:41:02 +0000 (13:41 -0700)
committerJani Nikula <jani.nikula@intel.com>
Tue, 15 Aug 2017 07:31:37 +0000 (10:31 +0300)
This function now takes the link rate and lane ocunt to be validated
as an argument so that this can be used for validating even the
compliance test link parameters.

Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@linux.intel.com>
Tested-by: Nathan Ciobanu <nathan.d.ciobanu@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1496954463-18038-1-git-send-email-manasi.d.navare@intel.com
drivers/gpu/drm/i915/intel_dp.c

index 5ba8366ff1e5bcb5c68754e23c013528dcf179cf..de2aaad1971437583e6ccb35509e5aa5b1863c30 100644 (file)
@@ -334,19 +334,20 @@ static int intel_dp_common_len_rate_limit(struct intel_dp *intel_dp,
        return 0;
 }
 
-static bool intel_dp_link_params_valid(struct intel_dp *intel_dp)
+static bool intel_dp_link_params_valid(struct intel_dp *intel_dp, int link_rate,
+                                      uint8_t lane_count)
 {
        /*
         * FIXME: we need to synchronize the current link parameters with
         * hardware readout. Currently fast link training doesn't work on
         * boot-up.
         */
-       if (intel_dp->link_rate == 0 ||
-           intel_dp->link_rate > intel_dp->max_link_rate)
+       if (link_rate == 0 ||
+           link_rate > intel_dp->max_link_rate)
                return false;
 
-       if (intel_dp->lane_count == 0 ||
-           intel_dp->lane_count > intel_dp_max_lane_count(intel_dp))
+       if (lane_count == 0 ||
+           lane_count > intel_dp_max_lane_count(intel_dp))
                return false;
 
        return true;
@@ -4275,7 +4276,8 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
         * Validate the cached values of intel_dp->link_rate and
         * intel_dp->lane_count before attempting to retrain.
         */
-       if (!intel_dp_link_params_valid(intel_dp))
+       if (!intel_dp_link_params_valid(intel_dp, intel_dp->link_rate,
+                                       intel_dp->lane_count))
                return;
 
        /* Retrain if Channel EQ or CR not ok */