]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i915: Preserve the DDI link reversal configuration
authorDamien Lespiau <damien.lespiau@intel.com>
Tue, 11 Dec 2012 18:48:30 +0000 (18:48 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 15 Feb 2013 09:30:47 +0000 (10:30 +0100)
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>
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_drv.h

index 64919eee248b0cd8aa22532d8a3f4ab991fbedcd..2593fefd81f3fd841b1d56e3272b73859f2f0e0c 100644 (file)
 #define  DDI_BUF_EMP_800MV_0DB_HSW             (7<<24)   /* Sel7 */
 #define  DDI_BUF_EMP_800MV_3_5DB_HSW           (8<<24)   /* Sel8 */
 #define  DDI_BUF_EMP_MASK                      (0xf<<24)
+#define  DDI_BUF_PORT_REVERSAL                 (1<<16)
 #define  DDI_BUF_IS_IDLE                       (1<<7)
 #define  DDI_A_4_LANES                         (1<<4)
 #define  DDI_PORT_WIDTH_X1                     (0<<1)
index 89bdb1be61e6effcf413887c88c5f4f4bb853edb..816c45c71b722e5da8b8956bfc54e3550f8aa8f2 100644 (file)
@@ -203,7 +203,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
                                        DP_TP_CTL_LINK_TRAIN_PAT1 |
                                        DP_TP_CTL_ENABLE);
 
-               /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */
+               /* Configure and enable DDI_BUF_CTL for DDI E with next voltage.
+                * DDI E does not support port reversal, the functionality is
+                * achieved on the PCH side in FDI_RX_CTL, so no need to set the
+                * port reversal bit */
                I915_WRITE(DDI_BUF_CTL(PORT_E),
                           DDI_BUF_CTL_ENABLE |
                           ((intel_crtc->fdi_lanes - 1) << 1) |
@@ -678,8 +681,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
        intel_crtc->eld_vld = false;
        if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
                struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+               struct intel_digital_port *intel_dig_port =
+                       enc_to_dig_port(encoder);
 
-               intel_dp->DP = DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
+               intel_dp->DP = intel_dig_port->port_reversal |
+                              DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
                switch (intel_dp->lane_count) {
                case 1:
                        intel_dp->DP |= DDI_PORT_WIDTH_X1;
@@ -1302,11 +1308,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
        uint32_t tmp;
 
        if (type == INTEL_OUTPUT_HDMI) {
+               struct intel_digital_port *intel_dig_port =
+                       enc_to_dig_port(encoder);
+
                /* In HDMI/DVI mode, the port width, and swing/emphasis values
                 * are ignored so nothing special needs to be done besides
                 * enabling the port.
                 */
-               I915_WRITE(DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE);
+               I915_WRITE(DDI_BUF_CTL(port),
+                          intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE);
        } else if (type == INTEL_OUTPUT_EDP) {
                struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
@@ -1484,6 +1494,7 @@ static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = {
 
 void intel_ddi_init(struct drm_device *dev, enum port port)
 {
+       struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_digital_port *intel_dig_port;
        struct intel_encoder *intel_encoder;
        struct drm_encoder *encoder;
@@ -1524,6 +1535,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
        intel_encoder->get_hw_state = intel_ddi_get_hw_state;
 
        intel_dig_port->port = port;
+       intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) &
+                                       DDI_BUF_PORT_REVERSAL;
        if (hdmi_connector)
                intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port);
        else
index 006b5aa35bb3b87f79e4d42750b52418163dc4db..005a91f1f8f5eded92cd22b4ca479d145aa9dd83 100644 (file)
@@ -393,6 +393,7 @@ struct intel_dp {
 struct intel_digital_port {
        struct intel_encoder base;
        enum port port;
+       u32 port_reversal;
        struct intel_dp dp;
        struct intel_hdmi hdmi;
 };