diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-07-06 09:39:15 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-08-14 12:16:37 -0400 |
commit | 90a6b7b052b1aa17fbb98b049e9c8b7f729c35a7 (patch) | |
tree | d15f9594f940374eb1c7809f543255cc010b049a /drivers/gpu/drm | |
parent | b81e34c29e67f5b3e5ce28b5055ae2ca59c36f7b (diff) |
drm/i915: Move intel_dp->lane_count into pipe_config
Currently we clobber intel_dp->lane_count in compute config, which means
after a rejected modeset we may no longer be able to retrain the current
link. Move lane_count into pipe_config to avoid that.
v2: Add missing ':' to the pipe config debug dump
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ddi.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 60 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp_mst.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 3 |
6 files changed, 61 insertions, 28 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 88f20cc5ab8e..f22aca3218c2 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -4108,6 +4108,7 @@ enum skl_disp_power_wells { | |||
4108 | /* How many wires to use. I guess 3 was too hard */ | 4108 | /* How many wires to use. I guess 3 was too hard */ |
4109 | #define DP_PORT_WIDTH(width) (((width) - 1) << 19) | 4109 | #define DP_PORT_WIDTH(width) (((width) - 1) << 19) |
4110 | #define DP_PORT_WIDTH_MASK (7 << 19) | 4110 | #define DP_PORT_WIDTH_MASK (7 << 19) |
4111 | #define DP_PORT_WIDTH_SHIFT 19 | ||
4111 | 4112 | ||
4112 | /* Mystic DPCD version 1.1 special mode */ | 4113 | /* Mystic DPCD version 1.1 special mode */ |
4113 | #define DP_ENHANCED_FRAMING (1 << 18) | 4114 | #define DP_ENHANCED_FRAMING (1 << 18) |
@@ -7148,6 +7149,8 @@ enum skl_disp_power_wells { | |||
7148 | #define DDI_BUF_IS_IDLE (1<<7) | 7149 | #define DDI_BUF_IS_IDLE (1<<7) |
7149 | #define DDI_A_4_LANES (1<<4) | 7150 | #define DDI_A_4_LANES (1<<4) |
7150 | #define DDI_PORT_WIDTH(width) (((width) - 1) << 1) | 7151 | #define DDI_PORT_WIDTH(width) (((width) - 1) << 1) |
7152 | #define DDI_PORT_WIDTH_MASK (7 << 1) | ||
7153 | #define DDI_PORT_WIDTH_SHIFT 1 | ||
7151 | #define DDI_INIT_DISPLAY_DETECTED (1<<0) | 7154 | #define DDI_INIT_DISPLAY_DETECTED (1<<0) |
7152 | 7155 | ||
7153 | /* DDI Buffer Translations */ | 7156 | /* DDI Buffer Translations */ |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index b6d1ab27e5ba..56d778f00460 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -728,11 +728,11 @@ void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder) | |||
728 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | 728 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
729 | struct intel_digital_port *intel_dig_port = | 729 | struct intel_digital_port *intel_dig_port = |
730 | enc_to_dig_port(&encoder->base); | 730 | enc_to_dig_port(&encoder->base); |
731 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
731 | 732 | ||
732 | intel_dp->DP = intel_dig_port->saved_port_bits | | 733 | intel_dp->DP = intel_dig_port->saved_port_bits | |
733 | DDI_BUF_CTL_ENABLE | DDI_BUF_TRANS_SELECT(0); | 734 | DDI_BUF_CTL_ENABLE | DDI_BUF_TRANS_SELECT(0); |
734 | intel_dp->DP |= DDI_PORT_WIDTH(intel_dp->lane_count); | 735 | intel_dp->DP |= DDI_PORT_WIDTH(crtc->config->lane_count); |
735 | |||
736 | } | 736 | } |
737 | 737 | ||
738 | static struct intel_encoder * | 738 | static struct intel_encoder * |
@@ -1918,7 +1918,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) | |||
1918 | } else | 1918 | } else |
1919 | temp |= TRANS_DDI_MODE_SELECT_DP_SST; | 1919 | temp |= TRANS_DDI_MODE_SELECT_DP_SST; |
1920 | 1920 | ||
1921 | temp |= DDI_PORT_WIDTH(intel_dp->lane_count); | 1921 | temp |= DDI_PORT_WIDTH(intel_crtc->config->lane_count); |
1922 | } else if (type == INTEL_OUTPUT_DP_MST) { | 1922 | } else if (type == INTEL_OUTPUT_DP_MST) { |
1923 | struct intel_dp *intel_dp = &enc_to_mst(encoder)->primary->dp; | 1923 | struct intel_dp *intel_dp = &enc_to_mst(encoder)->primary->dp; |
1924 | 1924 | ||
@@ -1927,7 +1927,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) | |||
1927 | } else | 1927 | } else |
1928 | temp |= TRANS_DDI_MODE_SELECT_DP_SST; | 1928 | temp |= TRANS_DDI_MODE_SELECT_DP_SST; |
1929 | 1929 | ||
1930 | temp |= DDI_PORT_WIDTH(intel_dp->lane_count); | 1930 | temp |= DDI_PORT_WIDTH(intel_crtc->config->lane_count); |
1931 | } else { | 1931 | } else { |
1932 | WARN(1, "Invalid encoder type %d for pipe %c\n", | 1932 | WARN(1, "Invalid encoder type %d for pipe %c\n", |
1933 | intel_encoder->type, pipe_name(pipe)); | 1933 | intel_encoder->type, pipe_name(pipe)); |
@@ -3094,6 +3094,8 @@ void intel_ddi_get_config(struct intel_encoder *encoder, | |||
3094 | case TRANS_DDI_MODE_SELECT_DP_SST: | 3094 | case TRANS_DDI_MODE_SELECT_DP_SST: |
3095 | case TRANS_DDI_MODE_SELECT_DP_MST: | 3095 | case TRANS_DDI_MODE_SELECT_DP_MST: |
3096 | pipe_config->has_dp_encoder = true; | 3096 | pipe_config->has_dp_encoder = true; |
3097 | pipe_config->lane_count = | ||
3098 | ((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1; | ||
3097 | intel_dp_get_m_n(intel_crtc, pipe_config); | 3099 | intel_dp_get_m_n(intel_crtc, pipe_config); |
3098 | break; | 3100 | break; |
3099 | default: | 3101 | default: |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dc3e6b2e5663..40e70f20787f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -11902,14 +11902,16 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, | |||
11902 | pipe_config->fdi_m_n.gmch_m, pipe_config->fdi_m_n.gmch_n, | 11902 | pipe_config->fdi_m_n.gmch_m, pipe_config->fdi_m_n.gmch_n, |
11903 | pipe_config->fdi_m_n.link_m, pipe_config->fdi_m_n.link_n, | 11903 | pipe_config->fdi_m_n.link_m, pipe_config->fdi_m_n.link_n, |
11904 | pipe_config->fdi_m_n.tu); | 11904 | pipe_config->fdi_m_n.tu); |
11905 | DRM_DEBUG_KMS("dp: %i, gmch_m: %u, gmch_n: %u, link_m: %u, link_n: %u, tu: %u\n", | 11905 | DRM_DEBUG_KMS("dp: %i, lanes: %i, gmch_m: %u, gmch_n: %u, link_m: %u, link_n: %u, tu: %u\n", |
11906 | pipe_config->has_dp_encoder, | 11906 | pipe_config->has_dp_encoder, |
11907 | pipe_config->lane_count, | ||
11907 | pipe_config->dp_m_n.gmch_m, pipe_config->dp_m_n.gmch_n, | 11908 | pipe_config->dp_m_n.gmch_m, pipe_config->dp_m_n.gmch_n, |
11908 | pipe_config->dp_m_n.link_m, pipe_config->dp_m_n.link_n, | 11909 | pipe_config->dp_m_n.link_m, pipe_config->dp_m_n.link_n, |
11909 | pipe_config->dp_m_n.tu); | 11910 | pipe_config->dp_m_n.tu); |
11910 | 11911 | ||
11911 | DRM_DEBUG_KMS("dp: %i, gmch_m2: %u, gmch_n2: %u, link_m2: %u, link_n2: %u, tu2: %u\n", | 11912 | DRM_DEBUG_KMS("dp: %i, lanes: %i, gmch_m2: %u, gmch_n2: %u, link_m2: %u, link_n2: %u, tu2: %u\n", |
11912 | pipe_config->has_dp_encoder, | 11913 | pipe_config->has_dp_encoder, |
11914 | pipe_config->lane_count, | ||
11913 | pipe_config->dp_m2_n2.gmch_m, | 11915 | pipe_config->dp_m2_n2.gmch_m, |
11914 | pipe_config->dp_m2_n2.gmch_n, | 11916 | pipe_config->dp_m2_n2.gmch_n, |
11915 | pipe_config->dp_m2_n2.link_m, | 11917 | pipe_config->dp_m2_n2.link_m, |
@@ -12416,6 +12418,7 @@ intel_pipe_config_compare(struct drm_device *dev, | |||
12416 | PIPE_CONF_CHECK_M_N(fdi_m_n); | 12418 | PIPE_CONF_CHECK_M_N(fdi_m_n); |
12417 | 12419 | ||
12418 | PIPE_CONF_CHECK_I(has_dp_encoder); | 12420 | PIPE_CONF_CHECK_I(has_dp_encoder); |
12421 | PIPE_CONF_CHECK_I(lane_count); | ||
12419 | 12422 | ||
12420 | if (INTEL_INFO(dev)->gen < 8) { | 12423 | if (INTEL_INFO(dev)->gen < 8) { |
12421 | PIPE_CONF_CHECK_M_N(dp_m_n); | 12424 | PIPE_CONF_CHECK_M_N(dp_m_n); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 3a9b8e4b8683..3d3a908ac2f2 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1499,7 +1499,7 @@ found: | |||
1499 | intel_dp->limited_color_range; | 1499 | intel_dp->limited_color_range; |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | intel_dp->lane_count = lane_count; | 1502 | pipe_config->lane_count = lane_count; |
1503 | 1503 | ||
1504 | if (intel_dp->num_sink_rates) { | 1504 | if (intel_dp->num_sink_rates) { |
1505 | intel_dp->link_bw = 0; | 1505 | intel_dp->link_bw = 0; |
@@ -1515,7 +1515,7 @@ found: | |||
1515 | pipe_config->port_clock = common_rates[clock]; | 1515 | pipe_config->port_clock = common_rates[clock]; |
1516 | 1516 | ||
1517 | DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", | 1517 | DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", |
1518 | intel_dp->link_bw, intel_dp->lane_count, | 1518 | intel_dp->link_bw, pipe_config->lane_count, |
1519 | pipe_config->port_clock, bpp); | 1519 | pipe_config->port_clock, bpp); |
1520 | DRM_DEBUG_KMS("DP link bw required %i available %i\n", | 1520 | DRM_DEBUG_KMS("DP link bw required %i available %i\n", |
1521 | mode_rate, link_avail); | 1521 | mode_rate, link_avail); |
@@ -1610,7 +1610,7 @@ static void intel_dp_prepare(struct intel_encoder *encoder) | |||
1610 | 1610 | ||
1611 | /* Handle DP bits in common between all three register formats */ | 1611 | /* Handle DP bits in common between all three register formats */ |
1612 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | 1612 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; |
1613 | intel_dp->DP |= DP_PORT_WIDTH(intel_dp->lane_count); | 1613 | intel_dp->DP |= DP_PORT_WIDTH(crtc->config->lane_count); |
1614 | 1614 | ||
1615 | if (crtc->config->has_audio) | 1615 | if (crtc->config->has_audio) |
1616 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; | 1616 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; |
@@ -2313,6 +2313,9 @@ static void intel_dp_get_config(struct intel_encoder *encoder, | |||
2313 | 2313 | ||
2314 | pipe_config->has_dp_encoder = true; | 2314 | pipe_config->has_dp_encoder = true; |
2315 | 2315 | ||
2316 | pipe_config->lane_count = | ||
2317 | ((tmp & DP_PORT_WIDTH_MASK) >> DP_PORT_WIDTH_SHIFT) + 1; | ||
2318 | |||
2316 | intel_dp_get_m_n(crtc, pipe_config); | 2319 | intel_dp_get_m_n(crtc, pipe_config); |
2317 | 2320 | ||
2318 | if (port == PORT_A) { | 2321 | if (port == PORT_A) { |
@@ -3338,13 +3341,15 @@ static void | |||
3338 | intel_get_adjust_train(struct intel_dp *intel_dp, | 3341 | intel_get_adjust_train(struct intel_dp *intel_dp, |
3339 | const uint8_t link_status[DP_LINK_STATUS_SIZE]) | 3342 | const uint8_t link_status[DP_LINK_STATUS_SIZE]) |
3340 | { | 3343 | { |
3344 | struct intel_crtc *crtc = | ||
3345 | to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc); | ||
3341 | uint8_t v = 0; | 3346 | uint8_t v = 0; |
3342 | uint8_t p = 0; | 3347 | uint8_t p = 0; |
3343 | int lane; | 3348 | int lane; |
3344 | uint8_t voltage_max; | 3349 | uint8_t voltage_max; |
3345 | uint8_t preemph_max; | 3350 | uint8_t preemph_max; |
3346 | 3351 | ||
3347 | for (lane = 0; lane < intel_dp->lane_count; lane++) { | 3352 | for (lane = 0; lane < crtc->config->lane_count; lane++) { |
3348 | uint8_t this_v = drm_dp_get_adjust_request_voltage(link_status, lane); | 3353 | uint8_t this_v = drm_dp_get_adjust_request_voltage(link_status, lane); |
3349 | uint8_t this_p = drm_dp_get_adjust_request_pre_emphasis(link_status, lane); | 3354 | uint8_t this_p = drm_dp_get_adjust_request_pre_emphasis(link_status, lane); |
3350 | 3355 | ||
@@ -3513,8 +3518,10 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
3513 | uint8_t dp_train_pat) | 3518 | uint8_t dp_train_pat) |
3514 | { | 3519 | { |
3515 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 3520 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
3516 | struct drm_device *dev = intel_dig_port->base.base.dev; | 3521 | struct drm_i915_private *dev_priv = |
3517 | struct drm_i915_private *dev_priv = dev->dev_private; | 3522 | to_i915(intel_dig_port->base.base.dev); |
3523 | struct intel_crtc *crtc = | ||
3524 | to_intel_crtc(intel_dig_port->base.base.crtc); | ||
3518 | uint8_t buf[sizeof(intel_dp->train_set) + 1]; | 3525 | uint8_t buf[sizeof(intel_dp->train_set) + 1]; |
3519 | int ret, len; | 3526 | int ret, len; |
3520 | 3527 | ||
@@ -3530,8 +3537,8 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
3530 | len = 1; | 3537 | len = 1; |
3531 | } else { | 3538 | } else { |
3532 | /* DP_TRAINING_LANEx_SET follow DP_TRAINING_PATTERN_SET */ | 3539 | /* DP_TRAINING_LANEx_SET follow DP_TRAINING_PATTERN_SET */ |
3533 | memcpy(buf + 1, intel_dp->train_set, intel_dp->lane_count); | 3540 | memcpy(buf + 1, intel_dp->train_set, crtc->config->lane_count); |
3534 | len = intel_dp->lane_count + 1; | 3541 | len = crtc->config->lane_count + 1; |
3535 | } | 3542 | } |
3536 | 3543 | ||
3537 | ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_PATTERN_SET, | 3544 | ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_PATTERN_SET, |
@@ -3555,8 +3562,10 @@ intel_dp_update_link_train(struct intel_dp *intel_dp, uint32_t *DP, | |||
3555 | const uint8_t link_status[DP_LINK_STATUS_SIZE]) | 3562 | const uint8_t link_status[DP_LINK_STATUS_SIZE]) |
3556 | { | 3563 | { |
3557 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 3564 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
3558 | struct drm_device *dev = intel_dig_port->base.base.dev; | 3565 | struct drm_i915_private *dev_priv = |
3559 | struct drm_i915_private *dev_priv = dev->dev_private; | 3566 | to_i915(intel_dig_port->base.base.dev); |
3567 | struct intel_crtc *crtc = | ||
3568 | to_intel_crtc(intel_dig_port->base.base.crtc); | ||
3560 | int ret; | 3569 | int ret; |
3561 | 3570 | ||
3562 | intel_get_adjust_train(intel_dp, link_status); | 3571 | intel_get_adjust_train(intel_dp, link_status); |
@@ -3566,9 +3575,9 @@ intel_dp_update_link_train(struct intel_dp *intel_dp, uint32_t *DP, | |||
3566 | POSTING_READ(intel_dp->output_reg); | 3575 | POSTING_READ(intel_dp->output_reg); |
3567 | 3576 | ||
3568 | ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET, | 3577 | ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET, |
3569 | intel_dp->train_set, intel_dp->lane_count); | 3578 | intel_dp->train_set, crtc->config->lane_count); |
3570 | 3579 | ||
3571 | return ret == intel_dp->lane_count; | 3580 | return ret == crtc->config->lane_count; |
3572 | } | 3581 | } |
3573 | 3582 | ||
3574 | static void intel_dp_set_idle_link_train(struct intel_dp *intel_dp) | 3583 | static void intel_dp_set_idle_link_train(struct intel_dp *intel_dp) |
@@ -3607,6 +3616,8 @@ void | |||
3607 | intel_dp_start_link_train(struct intel_dp *intel_dp) | 3616 | intel_dp_start_link_train(struct intel_dp *intel_dp) |
3608 | { | 3617 | { |
3609 | struct drm_encoder *encoder = &dp_to_dig_port(intel_dp)->base.base; | 3618 | struct drm_encoder *encoder = &dp_to_dig_port(intel_dp)->base.base; |
3619 | struct intel_crtc *crtc = | ||
3620 | to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc); | ||
3610 | struct drm_device *dev = encoder->dev; | 3621 | struct drm_device *dev = encoder->dev; |
3611 | int i; | 3622 | int i; |
3612 | uint8_t voltage; | 3623 | uint8_t voltage; |
@@ -3619,7 +3630,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
3619 | 3630 | ||
3620 | /* Write the link configuration data */ | 3631 | /* Write the link configuration data */ |
3621 | link_config[0] = intel_dp->link_bw; | 3632 | link_config[0] = intel_dp->link_bw; |
3622 | link_config[1] = intel_dp->lane_count; | 3633 | link_config[1] = crtc->config->lane_count; |
3623 | if (drm_dp_enhanced_frame_cap(intel_dp->dpcd)) | 3634 | if (drm_dp_enhanced_frame_cap(intel_dp->dpcd)) |
3624 | link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; | 3635 | link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; |
3625 | drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config, 2); | 3636 | drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config, 2); |
@@ -3653,7 +3664,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
3653 | break; | 3664 | break; |
3654 | } | 3665 | } |
3655 | 3666 | ||
3656 | if (drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) { | 3667 | if (drm_dp_clock_recovery_ok(link_status, crtc->config->lane_count)) { |
3657 | DRM_DEBUG_KMS("clock recovery OK\n"); | 3668 | DRM_DEBUG_KMS("clock recovery OK\n"); |
3658 | break; | 3669 | break; |
3659 | } | 3670 | } |
@@ -3676,10 +3687,10 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
3676 | } | 3687 | } |
3677 | 3688 | ||
3678 | /* Check to see if we've tried the max voltage */ | 3689 | /* Check to see if we've tried the max voltage */ |
3679 | for (i = 0; i < intel_dp->lane_count; i++) | 3690 | for (i = 0; i < crtc->config->lane_count; i++) |
3680 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 3691 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
3681 | break; | 3692 | break; |
3682 | if (i == intel_dp->lane_count) { | 3693 | if (i == crtc->config->lane_count) { |
3683 | ++loop_tries; | 3694 | ++loop_tries; |
3684 | if (loop_tries == 5) { | 3695 | if (loop_tries == 5) { |
3685 | DRM_ERROR("too many full retries, give up\n"); | 3696 | DRM_ERROR("too many full retries, give up\n"); |
@@ -3716,6 +3727,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
3716 | void | 3727 | void |
3717 | intel_dp_complete_link_train(struct intel_dp *intel_dp) | 3728 | intel_dp_complete_link_train(struct intel_dp *intel_dp) |
3718 | { | 3729 | { |
3730 | struct intel_crtc *crtc = | ||
3731 | to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc); | ||
3719 | bool channel_eq = false; | 3732 | bool channel_eq = false; |
3720 | int tries, cr_tries; | 3733 | int tries, cr_tries; |
3721 | uint32_t DP = intel_dp->DP; | 3734 | uint32_t DP = intel_dp->DP; |
@@ -3751,7 +3764,8 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
3751 | } | 3764 | } |
3752 | 3765 | ||
3753 | /* Make sure clock is still ok */ | 3766 | /* Make sure clock is still ok */ |
3754 | if (!drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) { | 3767 | if (!drm_dp_clock_recovery_ok(link_status, |
3768 | crtc->config->lane_count)) { | ||
3755 | intel_dp->train_set_valid = false; | 3769 | intel_dp->train_set_valid = false; |
3756 | intel_dp_start_link_train(intel_dp); | 3770 | intel_dp_start_link_train(intel_dp); |
3757 | intel_dp_set_link_train(intel_dp, &DP, | 3771 | intel_dp_set_link_train(intel_dp, &DP, |
@@ -3761,7 +3775,8 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
3761 | continue; | 3775 | continue; |
3762 | } | 3776 | } |
3763 | 3777 | ||
3764 | if (drm_dp_channel_eq_ok(link_status, intel_dp->lane_count)) { | 3778 | if (drm_dp_channel_eq_ok(link_status, |
3779 | crtc->config->lane_count)) { | ||
3765 | channel_eq = true; | 3780 | channel_eq = true; |
3766 | break; | 3781 | break; |
3767 | } | 3782 | } |
@@ -4259,6 +4274,8 @@ update_status: | |||
4259 | static int | 4274 | static int |
4260 | intel_dp_check_mst_status(struct intel_dp *intel_dp) | 4275 | intel_dp_check_mst_status(struct intel_dp *intel_dp) |
4261 | { | 4276 | { |
4277 | struct intel_crtc *crtc = | ||
4278 | to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc); | ||
4262 | bool bret; | 4279 | bool bret; |
4263 | 4280 | ||
4264 | if (intel_dp->is_mst) { | 4281 | if (intel_dp->is_mst) { |
@@ -4271,7 +4288,8 @@ go_again: | |||
4271 | if (bret == true) { | 4288 | if (bret == true) { |
4272 | 4289 | ||
4273 | /* check link status - esi[10] = 0x200c */ | 4290 | /* check link status - esi[10] = 0x200c */ |
4274 | if (intel_dp->active_mst_links && !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) { | 4291 | if (intel_dp->active_mst_links && |
4292 | !drm_dp_channel_eq_ok(&esi[10], crtc->config->lane_count)) { | ||
4275 | DRM_DEBUG_KMS("channel EQ not ok, retraining\n"); | 4293 | DRM_DEBUG_KMS("channel EQ not ok, retraining\n"); |
4276 | intel_dp_start_link_train(intel_dp); | 4294 | intel_dp_start_link_train(intel_dp); |
4277 | intel_dp_complete_link_train(intel_dp); | 4295 | intel_dp_complete_link_train(intel_dp); |
@@ -4326,6 +4344,8 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
4326 | { | 4344 | { |
4327 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 4345 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
4328 | struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; | 4346 | struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; |
4347 | struct intel_crtc *crtc = | ||
4348 | to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc); | ||
4329 | u8 sink_irq_vector; | 4349 | u8 sink_irq_vector; |
4330 | u8 link_status[DP_LINK_STATUS_SIZE]; | 4350 | u8 link_status[DP_LINK_STATUS_SIZE]; |
4331 | 4351 | ||
@@ -4361,7 +4381,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
4361 | DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n"); | 4381 | DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n"); |
4362 | } | 4382 | } |
4363 | 4383 | ||
4364 | if (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count)) { | 4384 | if (!drm_dp_channel_eq_ok(link_status, crtc->config->lane_count)) { |
4365 | DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n", | 4385 | DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n", |
4366 | intel_encoder->base.name); | 4386 | intel_encoder->base.name); |
4367 | intel_dp_start_link_train(intel_dp); | 4387 | intel_dp_start_link_train(intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index f4fe1183bae6..fdb5e31fedaa 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c | |||
@@ -65,7 +65,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, | |||
65 | intel_dp->rate_select = 0; | 65 | intel_dp->rate_select = 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | intel_dp->lane_count = lane_count; | 68 | pipe_config->lane_count = lane_count; |
69 | 69 | ||
70 | pipe_config->pipe_bpp = 24; | 70 | pipe_config->pipe_bpp = 24; |
71 | pipe_config->port_clock = rate; | 71 | pipe_config->port_clock = rate; |
@@ -276,6 +276,10 @@ static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder, | |||
276 | break; | 276 | break; |
277 | } | 277 | } |
278 | pipe_config->base.adjusted_mode.flags |= flags; | 278 | pipe_config->base.adjusted_mode.flags |= flags; |
279 | |||
280 | pipe_config->lane_count = | ||
281 | ((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1; | ||
282 | |||
279 | intel_dp_get_m_n(crtc, pipe_config); | 283 | intel_dp_get_m_n(crtc, pipe_config); |
280 | 284 | ||
281 | intel_ddi_clock_get(&intel_dig_port->base, pipe_config); | 285 | intel_ddi_clock_get(&intel_dig_port->base, pipe_config); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index e2456bc089b8..0a11041232e4 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -423,6 +423,8 @@ struct intel_crtc_state { | |||
423 | /* Used by SDVO (and if we ever fix it, HDMI). */ | 423 | /* Used by SDVO (and if we ever fix it, HDMI). */ |
424 | unsigned pixel_multiplier; | 424 | unsigned pixel_multiplier; |
425 | 425 | ||
426 | uint8_t lane_count; | ||
427 | |||
426 | /* Panel fitter controls for gen2-gen4 + VLV */ | 428 | /* Panel fitter controls for gen2-gen4 + VLV */ |
427 | struct { | 429 | struct { |
428 | u32 control; | 430 | u32 control; |
@@ -712,7 +714,6 @@ struct intel_dp { | |||
712 | bool color_range_auto; | 714 | bool color_range_auto; |
713 | uint8_t link_bw; | 715 | uint8_t link_bw; |
714 | uint8_t rate_select; | 716 | uint8_t rate_select; |
715 | uint8_t lane_count; | ||
716 | uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; | 717 | uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; |
717 | uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE]; | 718 | uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE]; |
718 | uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; | 719 | uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; |