diff options
author | Jani Nikula <jani.nikula@intel.com> | 2017-10-09 05:29:58 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2017-10-11 15:04:33 -0400 |
commit | fc603ca7f81d729bbec7ced294f25a93113c49f7 (patch) | |
tree | 58808d57648901839bfbc2753787456021833ed9 | |
parent | 3c7b6b3c4f2a4882d9d82365cc122cc8d29f4811 (diff) |
drm/i915/dp: centralize max source rate conditions more
Turn intel_dp_source_supports_hbr2() into a simple helper to query the
pre-filled source rates array, and move the conditions about which
platforms support which rates to the single point of truth in
intel_dp_set_source_rates().
This also reduces the code paths you have to think about in the source
rates initialization in intel_dp_set_source_rates(), making it easier to
grasp.
Cc: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171009092959.29021-2-jani.nikula@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ca48bce23a6f..09d75df497c0 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -254,15 +254,15 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp) | |||
254 | } else if (IS_GEN9_BC(dev_priv)) { | 254 | } else if (IS_GEN9_BC(dev_priv)) { |
255 | source_rates = skl_rates; | 255 | source_rates = skl_rates; |
256 | size = ARRAY_SIZE(skl_rates); | 256 | size = ARRAY_SIZE(skl_rates); |
257 | } else { | 257 | } else if ((IS_HASWELL(dev_priv) && !IS_HSW_ULX(dev_priv)) || |
258 | IS_BROADWELL(dev_priv)) { | ||
258 | source_rates = default_rates; | 259 | source_rates = default_rates; |
259 | size = ARRAY_SIZE(default_rates); | 260 | size = ARRAY_SIZE(default_rates); |
261 | } else { | ||
262 | source_rates = default_rates; | ||
263 | size = ARRAY_SIZE(default_rates) - 1; | ||
260 | } | 264 | } |
261 | 265 | ||
262 | /* This depends on the fact that 5.4 is last value in the array */ | ||
263 | if (!intel_dp_source_supports_hbr2(intel_dp)) | ||
264 | size--; | ||
265 | |||
266 | intel_dp->source_rates = source_rates; | 266 | intel_dp->source_rates = source_rates; |
267 | intel_dp->num_source_rates = size; | 267 | intel_dp->num_source_rates = size; |
268 | } | 268 | } |
@@ -1482,14 +1482,9 @@ intel_dp_aux_init(struct intel_dp *intel_dp) | |||
1482 | 1482 | ||
1483 | bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp) | 1483 | bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp) |
1484 | { | 1484 | { |
1485 | struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); | 1485 | int max_rate = intel_dp->source_rates[intel_dp->num_source_rates - 1]; |
1486 | struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev); | ||
1487 | 1486 | ||
1488 | if ((IS_HASWELL(dev_priv) && !IS_HSW_ULX(dev_priv)) || | 1487 | return max_rate >= 540000; |
1489 | IS_BROADWELL(dev_priv) || (INTEL_GEN(dev_priv) >= 9)) | ||
1490 | return true; | ||
1491 | else | ||
1492 | return false; | ||
1493 | } | 1488 | } |
1494 | 1489 | ||
1495 | static void | 1490 | static void |