Commit adc289d7 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Clean up the CPT DP .get_hw_state() port readout

Define a TRANS_DP_PIPE_TO_PORT() to make the CPT DP .get_hw_state()
pipe readout neater.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 39e5fa88
...@@ -6440,6 +6440,7 @@ enum skl_disp_power_wells { ...@@ -6440,6 +6440,7 @@ enum skl_disp_power_wells {
#define TRANS_DP_PORT_SEL_D (2<<29) #define TRANS_DP_PORT_SEL_D (2<<29)
#define TRANS_DP_PORT_SEL_NONE (3<<29) #define TRANS_DP_PORT_SEL_NONE (3<<29)
#define TRANS_DP_PORT_SEL_MASK (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_AUDIO_ONLY (1<<26)
#define TRANS_DP_ENH_FRAMING (1<<18) #define TRANS_DP_ENH_FRAMING (1<<18)
#define TRANS_DP_8BPC (0<<9) #define TRANS_DP_8BPC (0<<9)
......
...@@ -2186,28 +2186,12 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder, ...@@ -2186,28 +2186,12 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder,
if (IS_GEN7(dev) && port == PORT_A) { if (IS_GEN7(dev) && port == PORT_A) {
*pipe = PORT_TO_PIPE_CPT(tmp); *pipe = PORT_TO_PIPE_CPT(tmp);
} else if (HAS_PCH_CPT(dev) && port != PORT_A) { } else if (HAS_PCH_CPT(dev) && port != PORT_A) {
u32 trans_sel; enum pipe p;
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;
}
for_each_pipe(dev_priv, i) { for_each_pipe(dev_priv, p) {
trans_dp = I915_READ(TRANS_DP_CTL(i)); u32 trans_dp = I915_READ(TRANS_DP_CTL(p));
if ((trans_dp & TRANS_DP_PORT_SEL_MASK) == trans_sel) { if (TRANS_DP_PIPE_TO_PORT(trans_dp) == port) {
*pipe = i; *pipe = p;
return true; return true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment