[Intel-gfx] [PATCH 1/2] drm/i915: Simplify intel_dp_voltage_max()

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Mon Oct 5 07:44:36 PDT 2015


The function intel_dp_voltage_max() returns either voltage swing level 2
or level 3 for a few special cases. Simplify the if ladder by grouping
the few special cases that cause it return level 3. Make it clearer that
level 2 is the default by putting it out of the else condition.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b785f1f..3fa8a55 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3066,20 +3066,17 @@ intel_dp_voltage_max(struct intel_dp *intel_dp)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum port port = dp_to_dig_port(intel_dp)->port;
 
-	if (IS_BROXTON(dev))
+	if (IS_BROXTON(dev) || IS_VALLEYVIEW(dev))
 		return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
-	else if (INTEL_INFO(dev)->gen >= 9) {
-		if (dev_priv->edp_low_vswing && port == PORT_A)
-			return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
-		return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
-	} else if (IS_VALLEYVIEW(dev))
+
+	if (INTEL_INFO(dev)->gen >= 9 &&
+	    dev_priv->edp_low_vswing && port == PORT_A)
 		return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
-	else if (IS_GEN7(dev) && port == PORT_A)
-		return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
-	else if (HAS_PCH_CPT(dev) && port != PORT_A)
+
+	if (HAS_PCH_CPT(dev) && port != PORT_A)
 		return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
-	else
-		return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
+
+	return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
 }
 
 uint8_t
-- 
2.4.3



More information about the Intel-gfx mailing list