Skip to content

Commit 417e822

Browse files
committed
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>
1 parent 93f62da commit 417e822

2 files changed

Lines changed: 72 additions & 34 deletions

File tree

‎drivers/gpu/drm/i915/intel_display.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2933,7 +2933,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
29332933

29342934
/* For PCH DP, enable TRANS_DP_CTL */
29352935
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))) {
29372938
u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5;
29382939
reg = TRANS_DP_CTL(pipe);
29392940
temp = I915_READ(reg);

‎drivers/gpu/drm/i915/intel_dp.c‎

Lines changed: 70 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,10 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
766766
continue;
767767

768768
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)) {
770770
lane_count = intel_dp->lane_count;
771771
break;
772-
} else if (is_edp(intel_dp)) {
772+
} else if (is_cpu_edp(intel_dp)) {
773773
lane_count = dev_priv->edp.lanes;
774774
break;
775775
}
@@ -808,6 +808,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
808808
struct drm_display_mode *adjusted_mode)
809809
{
810810
struct drm_device *dev = encoder->dev;
811+
struct drm_i915_private *dev_priv = dev->dev_private;
811812
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
812813
struct drm_crtc *crtc = intel_dp->base.base.crtc;
813814
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,
820821
ironlake_edp_pll_off(encoder);
821822
}
822823

823-
intel_dp->DP = DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0;
824-
intel_dp->DP |= intel_dp->color_range;
824+
/*
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+
*/
825839

826-
if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
827-
intel_dp->DP |= DP_SYNC_HS_HIGH;
828-
if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
829-
intel_dp->DP |= DP_SYNC_VS_HIGH;
840+
/* Preserve the BIOS-computed detected bit. This is
841+
* supposed to be read-only.
842+
*/
843+
intel_dp->DP = I915_READ(intel_dp->output_reg) & DP_DETECTED;
844+
intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0;
830845

831-
if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp))
832-
intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT;
833-
else
834-
intel_dp->DP |= DP_LINK_TRAIN_OFF;
846+
/* Handle DP bits in common between all three register formats */
847+
848+
intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0;
835849

836850
switch (intel_dp->lane_count) {
837851
case 1:
@@ -850,32 +864,45 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
850864
intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
851865
intel_write_eld(encoder, adjusted_mode);
852866
}
853-
854867
memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE);
855868
intel_dp->link_configuration[0] = intel_dp->link_bw;
856869
intel_dp->link_configuration[1] = intel_dp->lane_count;
857870
intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B;
858-
859871
/*
860872
* Check for DPCD version > 1.1 and enhanced framing support
861873
*/
862874
if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
863875
(intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) {
864876
intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
865-
intel_dp->DP |= DP_ENHANCED_FRAMING;
866877
}
867878

868-
/* CPT DP's pipe select is decided in TRANS_DP_CTL */
869-
if (intel_crtc->pipe == 1 && !HAS_PCH_CPT(dev))
870-
intel_dp->DP |= DP_PIPEB_SELECT;
879+
/* Split out the IBX/CPU vs CPT settings */
871880

872-
if (is_cpu_edp(intel_dp)) {
873-
/* don't miss out required setting for eDP */
874-
intel_dp->DP |= DP_PLL_ENABLE;
875-
if (adjusted_mode->clock < 200000)
876-
intel_dp->DP |= DP_PLL_FREQ_160MHZ;
877-
else
878-
intel_dp->DP |= DP_PLL_FREQ_270MHZ;
881+
if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) {
882+
intel_dp->DP |= intel_dp->color_range;
883+
884+
if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
885+
intel_dp->DP |= DP_SYNC_HS_HIGH;
886+
if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
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;
879906
}
880907
}
881908

@@ -1341,6 +1368,7 @@ static char *link_train_names[] = {
13411368
* a maximum voltage of 800mV and a maximum pre-emphasis of 6dB
13421369
*/
13431370
#define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800
1371+
#define I830_DP_VOLTAGE_MAX_CPT DP_TRAIN_VOLTAGE_SWING_1200
13441372

13451373
static uint8_t
13461374
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
13781406
p = this_p;
13791407
}
13801408

1381-
if (v >= I830_DP_VOLTAGE_MAX)
1382-
v = I830_DP_VOLTAGE_MAX | DP_TRAIN_MAX_SWING_REACHED;
1409+
if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp))
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;
13831415

13841416
if (p >= intel_dp_pre_emphasis_max(v))
13851417
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)
15701602
/* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */
15711603
uint8_t link_status[DP_LINK_STATUS_SIZE];
15721604
uint32_t signal_levels;
1573-
if (IS_GEN6(dev) && is_edp(intel_dp)) {
1605+
1606+
if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) {
15741607
signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]);
15751608
DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels;
15761609
} else {
@@ -1650,12 +1683,11 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
16501683
break;
16511684
}
16521685

1653-
if (IS_GEN6(dev) && is_edp(intel_dp)) {
1686+
if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) {
16541687
signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]);
16551688
DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels;
16561689
} else {
16571690
signal_levels = intel_dp_signal_levels(intel_dp->train_set[0]);
1658-
DRM_DEBUG_KMS("training pattern 1 signal levels %08x\n", signal_levels);
16591691
DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels;
16601692
}
16611693

@@ -1741,8 +1773,12 @@ intel_dp_link_down(struct intel_dp *intel_dp)
17411773

17421774
msleep(17);
17431775

1744-
if (is_edp(intel_dp))
1745-
DP |= DP_LINK_TRAIN_OFF;
1776+
if (is_edp(intel_dp)) {
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+
}
17461782

17471783
if (!HAS_PCH_CPT(dev) &&
17481784
I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {
@@ -2186,7 +2222,8 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
21862222
continue;
21872223

21882224
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)
21902227
return intel_dp->output_reg;
21912228
}
21922229

0 commit comments

Comments
 (0)