]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/i915: Clean up the CPT DP .get_hw_state() port readout
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 5 May 2015 14:17:30 +0000 (17:17 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 21 May 2015 20:57:12 +0000 (22:57 +0200)
Define a TRANS_DP_PIPE_TO_PORT() to make the CPT DP .get_hw_state()
pipe readout neater.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_dp.c

index c799b993c15d4ddc1d610f874dc103749c7c2f99..85088a3cf2954c0c538b0a9c013f4e6ad162371a 100644 (file)
@@ -6440,6 +6440,7 @@ enum skl_disp_power_wells {
 #define  TRANS_DP_PORT_SEL_D   (2<<29)
 #define  TRANS_DP_PORT_SEL_NONE        (3<<29)
 #define  TRANS_DP_PORT_SEL_MASK        (3<<29)
+#define  TRANS_DP_PIPE_TO_PORT(val)    ((((val) & TRANS_DP_PORT_SEL_MASK) >> 29) + PORT_B)
 #define  TRANS_DP_AUDIO_ONLY   (1<<26)
 #define  TRANS_DP_ENH_FRAMING  (1<<18)
 #define  TRANS_DP_8BPC         (0<<9)
index 4c7c3f3558e199ce80def5691109d9ff4f0fb878..227e77ed879b3b4adb9fda62e6d2ca294ad5618e 100644 (file)
@@ -2186,28 +2186,12 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder,
        if (IS_GEN7(dev) && port == PORT_A) {
                *pipe = PORT_TO_PIPE_CPT(tmp);
        } else if (HAS_PCH_CPT(dev) && port != PORT_A) {
-               u32 trans_sel;
-               u32 trans_dp;
-               int i;
-
-               switch (intel_dp->output_reg) {
-               case PCH_DP_B:
-                       trans_sel = TRANS_DP_PORT_SEL_B;
-                       break;
-               case PCH_DP_C:
-                       trans_sel = TRANS_DP_PORT_SEL_C;
-                       break;
-               case PCH_DP_D:
-                       trans_sel = TRANS_DP_PORT_SEL_D;
-                       break;
-               default:
-                       return true;
-               }
+               enum pipe p;
 
-               for_each_pipe(dev_priv, i) {
-                       trans_dp = I915_READ(TRANS_DP_CTL(i));
-                       if ((trans_dp & TRANS_DP_PORT_SEL_MASK) == trans_sel) {
-                               *pipe = i;
+               for_each_pipe(dev_priv, p) {
+                       u32 trans_dp = I915_READ(TRANS_DP_CTL(p));
+                       if (TRANS_DP_PIPE_TO_PORT(trans_dp) == port) {
+                               *pipe = p;
                                return true;
                        }
                }