diff options
author | Keith Packard <keithp@keithp.com> | 2011-11-01 22:54:11 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-11-16 23:26:26 -0500 |
commit | 417e822deee1d2bcd8a8a60660c40a0903713f2b (patch) | |
tree | cdd0aa71a0ea4392a6b3be49237eadc201d69903 /drivers | |
parent | 93f62dad5ffe0962d83772fd16c0c1a9dd69767d (diff) |
drm/i915: Treat PCH eDP like DP in most places
PCH eDP has many of the same needs as regular PCH DP connections,
including the DP_CTl bit settings, the TRANS_DP_CTL register.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 103 |
2 files changed, 72 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 591eb0ed3110..e77a863a3833 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2933,7 +2933,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) | |||
2933 | 2933 | ||
2934 | /* For PCH DP, enable TRANS_DP_CTL */ | 2934 | /* For PCH DP, enable TRANS_DP_CTL */ |
2935 | if (HAS_PCH_CPT(dev) && | 2935 | if (HAS_PCH_CPT(dev) && |
2936 | intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { | 2936 | (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) || |
2937 | intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { | ||
2937 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5; | 2938 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5; |
2938 | reg = TRANS_DP_CTL(pipe); | 2939 | reg = TRANS_DP_CTL(pipe); |
2939 | temp = I915_READ(reg); | 2940 | temp = I915_READ(reg); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2c0c482222e1..d1eabd4165c4 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -766,10 +766,10 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
766 | continue; | 766 | continue; |
767 | 767 | ||
768 | intel_dp = enc_to_intel_dp(encoder); | 768 | intel_dp = enc_to_intel_dp(encoder); |
769 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) { | 769 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || is_pch_edp(intel_dp)) { |
770 | lane_count = intel_dp->lane_count; | 770 | lane_count = intel_dp->lane_count; |
771 | break; | 771 | break; |
772 | } else if (is_edp(intel_dp)) { | 772 | } else if (is_cpu_edp(intel_dp)) { |
773 | lane_count = dev_priv->edp.lanes; | 773 | lane_count = dev_priv->edp.lanes; |
774 | break; | 774 | break; |
775 | } | 775 | } |
@@ -808,6 +808,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
808 | struct drm_display_mode *adjusted_mode) | 808 | struct drm_display_mode *adjusted_mode) |
809 | { | 809 | { |
810 | struct drm_device *dev = encoder->dev; | 810 | struct drm_device *dev = encoder->dev; |
811 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
811 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 812 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
812 | struct drm_crtc *crtc = intel_dp->base.base.crtc; | 813 | struct drm_crtc *crtc = intel_dp->base.base.crtc; |
813 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 814 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -820,18 +821,31 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
820 | ironlake_edp_pll_off(encoder); | 821 | ironlake_edp_pll_off(encoder); |
821 | } | 822 | } |
822 | 823 | ||
823 | intel_dp->DP = DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | 824 | /* |
824 | intel_dp->DP |= intel_dp->color_range; | 825 | * There are three kinds of DP registers: |
826 | * | ||
827 | * IBX PCH | ||
828 | * CPU | ||
829 | * CPT PCH | ||
830 | * | ||
831 | * IBX PCH and CPU are the same for almost everything, | ||
832 | * except that the CPU DP PLL is configured in this | ||
833 | * register | ||
834 | * | ||
835 | * CPT PCH is quite different, having many bits moved | ||
836 | * to the TRANS_DP_CTL register instead. That | ||
837 | * configuration happens (oddly) in ironlake_pch_enable | ||
838 | */ | ||
825 | 839 | ||
826 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 840 | /* Preserve the BIOS-computed detected bit. This is |
827 | intel_dp->DP |= DP_SYNC_HS_HIGH; | 841 | * supposed to be read-only. |
828 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 842 | */ |
829 | intel_dp->DP |= DP_SYNC_VS_HIGH; | 843 | intel_dp->DP = I915_READ(intel_dp->output_reg) & DP_DETECTED; |
844 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | ||
830 | 845 | ||
831 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 846 | /* Handle DP bits in common between all three register formats */ |
832 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | 847 | |
833 | else | 848 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; |
834 | intel_dp->DP |= DP_LINK_TRAIN_OFF; | ||
835 | 849 | ||
836 | switch (intel_dp->lane_count) { | 850 | switch (intel_dp->lane_count) { |
837 | case 1: | 851 | case 1: |
@@ -850,32 +864,45 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
850 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; | 864 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; |
851 | intel_write_eld(encoder, adjusted_mode); | 865 | intel_write_eld(encoder, adjusted_mode); |
852 | } | 866 | } |
853 | |||
854 | memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE); | 867 | memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE); |
855 | intel_dp->link_configuration[0] = intel_dp->link_bw; | 868 | intel_dp->link_configuration[0] = intel_dp->link_bw; |
856 | intel_dp->link_configuration[1] = intel_dp->lane_count; | 869 | intel_dp->link_configuration[1] = intel_dp->lane_count; |
857 | intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B; | 870 | intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B; |
858 | |||
859 | /* | 871 | /* |
860 | * Check for DPCD version > 1.1 and enhanced framing support | 872 | * Check for DPCD version > 1.1 and enhanced framing support |
861 | */ | 873 | */ |
862 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 && | 874 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 && |
863 | (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) { | 875 | (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) { |
864 | intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; | 876 | intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; |
865 | intel_dp->DP |= DP_ENHANCED_FRAMING; | ||
866 | } | 877 | } |
867 | 878 | ||
868 | /* CPT DP's pipe select is decided in TRANS_DP_CTL */ | 879 | /* Split out the IBX/CPU vs CPT settings */ |
869 | if (intel_crtc->pipe == 1 && !HAS_PCH_CPT(dev)) | ||
870 | intel_dp->DP |= DP_PIPEB_SELECT; | ||
871 | 880 | ||
872 | if (is_cpu_edp(intel_dp)) { | 881 | if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { |
873 | /* don't miss out required setting for eDP */ | 882 | intel_dp->DP |= intel_dp->color_range; |
874 | intel_dp->DP |= DP_PLL_ENABLE; | 883 | |
875 | if (adjusted_mode->clock < 200000) | 884 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
876 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | 885 | intel_dp->DP |= DP_SYNC_HS_HIGH; |
877 | else | 886 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
878 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | 887 | intel_dp->DP |= DP_SYNC_VS_HIGH; |
888 | intel_dp->DP |= DP_LINK_TRAIN_OFF; | ||
889 | |||
890 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) | ||
891 | intel_dp->DP |= DP_ENHANCED_FRAMING; | ||
892 | |||
893 | if (intel_crtc->pipe == 1) | ||
894 | intel_dp->DP |= DP_PIPEB_SELECT; | ||
895 | |||
896 | if (is_cpu_edp(intel_dp)) { | ||
897 | /* don't miss out required setting for eDP */ | ||
898 | intel_dp->DP |= DP_PLL_ENABLE; | ||
899 | if (adjusted_mode->clock < 200000) | ||
900 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
901 | else | ||
902 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
903 | } | ||
904 | } else { | ||
905 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | ||
879 | } | 906 | } |
880 | } | 907 | } |
881 | 908 | ||
@@ -1341,6 +1368,7 @@ static char *link_train_names[] = { | |||
1341 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB | 1368 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB |
1342 | */ | 1369 | */ |
1343 | #define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800 | 1370 | #define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800 |
1371 | #define I830_DP_VOLTAGE_MAX_CPT DP_TRAIN_VOLTAGE_SWING_1200 | ||
1344 | 1372 | ||
1345 | static uint8_t | 1373 | static uint8_t |
1346 | intel_dp_pre_emphasis_max(uint8_t voltage_swing) | 1374 | intel_dp_pre_emphasis_max(uint8_t voltage_swing) |
@@ -1378,8 +1406,12 @@ intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_ST | |||
1378 | p = this_p; | 1406 | p = this_p; |
1379 | } | 1407 | } |
1380 | 1408 | ||
1381 | if (v >= I830_DP_VOLTAGE_MAX) | 1409 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) |
1382 | v = I830_DP_VOLTAGE_MAX | DP_TRAIN_MAX_SWING_REACHED; | 1410 | voltage_max = I830_DP_VOLTAGE_MAX_CPT; |
1411 | else | ||
1412 | voltage_max = I830_DP_VOLTAGE_MAX; | ||
1413 | if (v >= voltage_max) | ||
1414 | v = voltage_max | DP_TRAIN_MAX_SWING_REACHED; | ||
1383 | 1415 | ||
1384 | if (p >= intel_dp_pre_emphasis_max(v)) | 1416 | if (p >= intel_dp_pre_emphasis_max(v)) |
1385 | p = intel_dp_pre_emphasis_max(v) | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; | 1417 | p = intel_dp_pre_emphasis_max(v) | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; |
@@ -1570,7 +1602,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1570 | /* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */ | 1602 | /* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */ |
1571 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | 1603 | uint8_t link_status[DP_LINK_STATUS_SIZE]; |
1572 | uint32_t signal_levels; | 1604 | uint32_t signal_levels; |
1573 | if (IS_GEN6(dev) && is_edp(intel_dp)) { | 1605 | |
1606 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | ||
1574 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1607 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1575 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1608 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1576 | } else { | 1609 | } else { |
@@ -1650,12 +1683,11 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1650 | break; | 1683 | break; |
1651 | } | 1684 | } |
1652 | 1685 | ||
1653 | if (IS_GEN6(dev) && is_edp(intel_dp)) { | 1686 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { |
1654 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1687 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1655 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1688 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1656 | } else { | 1689 | } else { |
1657 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]); | 1690 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]); |
1658 | DRM_DEBUG_KMS("training pattern 1 signal levels %08x\n", signal_levels); | ||
1659 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1691 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1660 | } | 1692 | } |
1661 | 1693 | ||
@@ -1741,8 +1773,12 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1741 | 1773 | ||
1742 | msleep(17); | 1774 | msleep(17); |
1743 | 1775 | ||
1744 | if (is_edp(intel_dp)) | 1776 | if (is_edp(intel_dp)) { |
1745 | DP |= DP_LINK_TRAIN_OFF; | 1777 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) |
1778 | DP |= DP_LINK_TRAIN_OFF_CPT; | ||
1779 | else | ||
1780 | DP |= DP_LINK_TRAIN_OFF; | ||
1781 | } | ||
1746 | 1782 | ||
1747 | if (!HAS_PCH_CPT(dev) && | 1783 | if (!HAS_PCH_CPT(dev) && |
1748 | I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { | 1784 | I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { |
@@ -2186,7 +2222,8 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc) | |||
2186 | continue; | 2222 | continue; |
2187 | 2223 | ||
2188 | intel_dp = enc_to_intel_dp(encoder); | 2224 | intel_dp = enc_to_intel_dp(encoder); |
2189 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT) | 2225 | if (intel_dp->base.type == INTEL_OUTPUT_DISPLAYPORT || |
2226 | intel_dp->base.type == INTEL_OUTPUT_EDP) | ||
2190 | return intel_dp->output_reg; | 2227 | return intel_dp->output_reg; |
2191 | } | 2228 | } |
2192 | 2229 | ||