aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2012-04-10 14:58:03 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-04-12 15:14:10 -0400
commite3aef17286850a77f11a6dac28d972f65cde2235 (patch)
treeb8ecd91b847acd15a17a6642a4730b3217e7282d
parent0136db586c028f71e7cc21cc183064ff0d5919c8 (diff)
drm/i915: make DP configuration vars less confusing in ironlake_crtc_mode_se
Both PCH and CPU eDP are DP, so set the is_dp flag to true. Add is_cpu_edp and is_pch_edp bools to make checking for each less verbose (rather than has_edp_encoder && !intel_encoder_is_pch_edp() sprinkled everywhere). And rename the "has_edp_encoder" variable to just "edp_encoder". With the above variables cleaned up, the rest of the code becomes a bit more readable and clear. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5b8b3d15d0e..743ec6b9847 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5963,9 +5963,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5963 u32 dpll, fp = 0, fp2 = 0, dspcntr, pipeconf; 5963 u32 dpll, fp = 0, fp2 = 0, dspcntr, pipeconf;
5964 bool ok, has_reduced_clock = false, is_sdvo = false; 5964 bool ok, has_reduced_clock = false, is_sdvo = false;
5965 bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false; 5965 bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false;
5966 struct intel_encoder *has_edp_encoder = NULL;
5967 struct drm_mode_config *mode_config = &dev->mode_config; 5966 struct drm_mode_config *mode_config = &dev->mode_config;
5968 struct intel_encoder *encoder; 5967 struct intel_encoder *encoder, *edp_encoder = NULL;
5969 const intel_limit_t *limit; 5968 const intel_limit_t *limit;
5970 int ret; 5969 int ret;
5971 struct fdi_m_n m_n = {0}; 5970 struct fdi_m_n m_n = {0};
@@ -5974,6 +5973,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5974 int target_clock, pixel_multiplier, lane, link_bw, factor; 5973 int target_clock, pixel_multiplier, lane, link_bw, factor;
5975 unsigned int pipe_bpp; 5974 unsigned int pipe_bpp;
5976 bool dither; 5975 bool dither;
5976 bool is_cpu_edp = false, is_pch_edp = false;
5977 5977
5978 list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { 5978 list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
5979 if (encoder->base.crtc != crtc) 5979 if (encoder->base.crtc != crtc)
@@ -5999,7 +5999,12 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5999 is_dp = true; 5999 is_dp = true;
6000 break; 6000 break;
6001 case INTEL_OUTPUT_EDP: 6001 case INTEL_OUTPUT_EDP:
6002 has_edp_encoder = encoder; 6002 is_dp = true;
6003 if (intel_encoder_is_pch_edp(&encoder->base))
6004 is_pch_edp = true;
6005 else
6006 is_cpu_edp = true;
6007 edp_encoder = encoder;
6003 break; 6008 break;
6004 } 6009 }
6005 6010
@@ -6062,15 +6067,13 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
6062 lane = 0; 6067 lane = 0;
6063 /* CPU eDP doesn't require FDI link, so just set DP M/N 6068 /* CPU eDP doesn't require FDI link, so just set DP M/N
6064 according to current link config */ 6069 according to current link config */
6065 if (has_edp_encoder && 6070 if (is_cpu_edp) {
6066 !intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
6067 target_clock = mode->clock; 6071 target_clock = mode->clock;
6068 intel_edp_link_config(has_edp_encoder, 6072 intel_edp_link_config(edp_encoder, &lane, &link_bw);
6069 &lane, &link_bw);
6070 } else { 6073 } else {
6071 /* [e]DP over FDI requires target mode clock 6074 /* [e]DP over FDI requires target mode clock
6072 instead of link clock */ 6075 instead of link clock */
6073 if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) 6076 if (is_dp)
6074 target_clock = mode->clock; 6077 target_clock = mode->clock;
6075 else 6078 else
6076 target_clock = adjusted_mode->clock; 6079 target_clock = adjusted_mode->clock;
@@ -6161,7 +6164,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
6161 } 6164 }
6162 dpll |= DPLL_DVO_HIGH_SPEED; 6165 dpll |= DPLL_DVO_HIGH_SPEED;
6163 } 6166 }
6164 if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) 6167 if (is_dp && !is_cpu_edp)
6165 dpll |= DPLL_DVO_HIGH_SPEED; 6168 dpll |= DPLL_DVO_HIGH_SPEED;
6166 6169
6167 /* compute bitmask from p1 value */ 6170 /* compute bitmask from p1 value */
@@ -6206,8 +6209,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
6206 6209
6207 /* PCH eDP needs FDI, but CPU eDP does not */ 6210 /* PCH eDP needs FDI, but CPU eDP does not */
6208 if (!intel_crtc->no_pll) { 6211 if (!intel_crtc->no_pll) {
6209 if (!has_edp_encoder || 6212 if (!is_cpu_edp) {
6210 intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
6211 I915_WRITE(PCH_FP0(pipe), fp); 6213 I915_WRITE(PCH_FP0(pipe), fp);
6212 I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE); 6214 I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
6213 6215
@@ -6285,7 +6287,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
6285 pipeconf |= PIPECONF_DITHER_EN; 6287 pipeconf |= PIPECONF_DITHER_EN;
6286 pipeconf |= PIPECONF_DITHER_TYPE_SP; 6288 pipeconf |= PIPECONF_DITHER_TYPE_SP;
6287 } 6289 }
6288 if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { 6290 if (is_dp && !is_cpu_edp) {
6289 intel_dp_set_m_n(crtc, mode, adjusted_mode); 6291 intel_dp_set_m_n(crtc, mode, adjusted_mode);
6290 } else { 6292 } else {
6291 /* For non-DP output, clear any trans DP clock recovery setting.*/ 6293 /* For non-DP output, clear any trans DP clock recovery setting.*/
@@ -6295,9 +6297,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
6295 I915_WRITE(TRANSDPLINK_N1(pipe), 0); 6297 I915_WRITE(TRANSDPLINK_N1(pipe), 0);
6296 } 6298 }
6297 6299
6298 if (!intel_crtc->no_pll && 6300 if (!intel_crtc->no_pll && (!edp_encoder || is_pch_edp)) {
6299 (!has_edp_encoder ||
6300 intel_encoder_is_pch_edp(&has_edp_encoder->base))) {
6301 I915_WRITE(PCH_DPLL(pipe), dpll); 6301 I915_WRITE(PCH_DPLL(pipe), dpll);
6302 6302
6303 /* Wait for the clocks to stabilize. */ 6303 /* Wait for the clocks to stabilize. */
@@ -6375,10 +6375,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
6375 I915_WRITE(PIPE_LINK_M1(pipe), m_n.link_m); 6375 I915_WRITE(PIPE_LINK_M1(pipe), m_n.link_m);
6376 I915_WRITE(PIPE_LINK_N1(pipe), m_n.link_n); 6376 I915_WRITE(PIPE_LINK_N1(pipe), m_n.link_n);
6377 6377
6378 if (has_edp_encoder && 6378 if (is_cpu_edp)
6379 !intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
6380 ironlake_set_pll_edp(crtc, adjusted_mode->clock); 6379 ironlake_set_pll_edp(crtc, adjusted_mode->clock);
6381 }
6382 6380
6383 I915_WRITE(PIPECONF(pipe), pipeconf); 6381 I915_WRITE(PIPECONF(pipe), pipeconf);
6384 POSTING_READ(PIPECONF(pipe)); 6382 POSTING_READ(PIPECONF(pipe));