aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2012-12-11 13:48:30 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-02-19 18:21:45 -0500
commit876a8cdf92b23d268275cdce4397df0c37dac3fe (patch)
tree041bd17045aa829a3bd83d026ac0332ddb142ba2
parent3e68320ef84528604d971afc3cadfbe208bef001 (diff)
drm/i915: Preserve the DDI link reversal configuration
Similarly to: commit 6a0d1df3d3a0d2370541164eb0595fe35dcd6de3 Author: Damien Lespiau <damien.lespiau@intel.com> Date: Tue Dec 11 15:18:28 2012 +0000 drm/i915: Preserve the FDI line reversal override bit on CPT DDI port support lane reversal to easy the PCB layouting work. Let's preserve the bit configured by the BIOS (until we find how to correctly retrieve the information from the VBT, but this does sound more fragile then just relying on the BIOS that has, hopefully, been validated already. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h1
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c19
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
3 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 64919eee248b..2593fefd81f3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4510,6 +4510,7 @@
4510#define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */ 4510#define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */
4511#define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */ 4511#define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */
4512#define DDI_BUF_EMP_MASK (0xf<<24) 4512#define DDI_BUF_EMP_MASK (0xf<<24)
4513#define DDI_BUF_PORT_REVERSAL (1<<16)
4513#define DDI_BUF_IS_IDLE (1<<7) 4514#define DDI_BUF_IS_IDLE (1<<7)
4514#define DDI_A_4_LANES (1<<4) 4515#define DDI_A_4_LANES (1<<4)
4515#define DDI_PORT_WIDTH_X1 (0<<1) 4516#define DDI_PORT_WIDTH_X1 (0<<1)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 89bdb1be61e6..816c45c71b72 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -203,7 +203,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
203 DP_TP_CTL_LINK_TRAIN_PAT1 | 203 DP_TP_CTL_LINK_TRAIN_PAT1 |
204 DP_TP_CTL_ENABLE); 204 DP_TP_CTL_ENABLE);
205 205
206 /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */ 206 /* Configure and enable DDI_BUF_CTL for DDI E with next voltage.
207 * DDI E does not support port reversal, the functionality is
208 * achieved on the PCH side in FDI_RX_CTL, so no need to set the
209 * port reversal bit */
207 I915_WRITE(DDI_BUF_CTL(PORT_E), 210 I915_WRITE(DDI_BUF_CTL(PORT_E),
208 DDI_BUF_CTL_ENABLE | 211 DDI_BUF_CTL_ENABLE |
209 ((intel_crtc->fdi_lanes - 1) << 1) | 212 ((intel_crtc->fdi_lanes - 1) << 1) |
@@ -678,8 +681,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
678 intel_crtc->eld_vld = false; 681 intel_crtc->eld_vld = false;
679 if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { 682 if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
680 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 683 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
684 struct intel_digital_port *intel_dig_port =
685 enc_to_dig_port(encoder);
681 686
682 intel_dp->DP = DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW; 687 intel_dp->DP = intel_dig_port->port_reversal |
688 DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
683 switch (intel_dp->lane_count) { 689 switch (intel_dp->lane_count) {
684 case 1: 690 case 1:
685 intel_dp->DP |= DDI_PORT_WIDTH_X1; 691 intel_dp->DP |= DDI_PORT_WIDTH_X1;
@@ -1302,11 +1308,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
1302 uint32_t tmp; 1308 uint32_t tmp;
1303 1309
1304 if (type == INTEL_OUTPUT_HDMI) { 1310 if (type == INTEL_OUTPUT_HDMI) {
1311 struct intel_digital_port *intel_dig_port =
1312 enc_to_dig_port(encoder);
1313
1305 /* In HDMI/DVI mode, the port width, and swing/emphasis values 1314 /* In HDMI/DVI mode, the port width, and swing/emphasis values
1306 * are ignored so nothing special needs to be done besides 1315 * are ignored so nothing special needs to be done besides
1307 * enabling the port. 1316 * enabling the port.
1308 */ 1317 */
1309 I915_WRITE(DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE); 1318 I915_WRITE(DDI_BUF_CTL(port),
1319 intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE);
1310 } else if (type == INTEL_OUTPUT_EDP) { 1320 } else if (type == INTEL_OUTPUT_EDP) {
1311 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 1321 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
1312 1322
@@ -1484,6 +1494,7 @@ static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = {
1484 1494
1485void intel_ddi_init(struct drm_device *dev, enum port port) 1495void intel_ddi_init(struct drm_device *dev, enum port port)
1486{ 1496{
1497 struct drm_i915_private *dev_priv = dev->dev_private;
1487 struct intel_digital_port *intel_dig_port; 1498 struct intel_digital_port *intel_dig_port;
1488 struct intel_encoder *intel_encoder; 1499 struct intel_encoder *intel_encoder;
1489 struct drm_encoder *encoder; 1500 struct drm_encoder *encoder;
@@ -1524,6 +1535,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
1524 intel_encoder->get_hw_state = intel_ddi_get_hw_state; 1535 intel_encoder->get_hw_state = intel_ddi_get_hw_state;
1525 1536
1526 intel_dig_port->port = port; 1537 intel_dig_port->port = port;
1538 intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) &
1539 DDI_BUF_PORT_REVERSAL;
1527 if (hdmi_connector) 1540 if (hdmi_connector)
1528 intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port); 1541 intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port);
1529 else 1542 else
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 006b5aa35bb3..005a91f1f8f5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -393,6 +393,7 @@ struct intel_dp {
393struct intel_digital_port { 393struct intel_digital_port {
394 struct intel_encoder base; 394 struct intel_encoder base;
395 enum port port; 395 enum port port;
396 u32 port_reversal;
396 struct intel_dp dp; 397 struct intel_dp dp;
397 struct intel_hdmi hdmi; 398 struct intel_hdmi hdmi;
398}; 399};