Skip to contentSkip to conversation

drm/i915: Preserve the FDI line reversal override bit on CPT

PATCH Applied Damien Lespiau 4 participants 8 messages Dec 11, 2012 – Feb 14, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/i915: Preserve the FDI line reversal override bit on CPT

From: Damien Lespiau <[email protected]>

The FDI link has supported link reversal to make the PCB layout engineer's life easier for quite a while and we have always presered this bit as we programmed FDI_RX_CTL with a read/modify/write sequence.

We're trying to take a bit more control over what the BIOS leaves in various register and with the introduction of DDI, started to program FDI_RX_CTL fully.

There's a fused bit to indicate DMI link reversal and FDI defaults to mirroring that configuration. We have a bit to override that behaviour that we need to preserve from the BIOS.

---
 drivers/gpu/drm/i915/i915_drv.h  |  2 +-
 drivers/gpu/drm/i915/i915_reg.h  |  2 +-
 drivers/gpu/drm/i915/intel_crt.c | 14 +++++++++-----
 drivers/gpu/drm/i915/intel_ddi.c |  6 ++----
 4 files changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 557843d..31fc37a 100644
@@ -915,7 +915,7 @@ typedef struct drm_i915_private {
 	bool hw_contexts_disabled;
 	uint32_t hw_context_size;
 
-	bool fdi_rx_polarity_reversed;
+	u32 fdi_rx_config;
 
 	struct i915_suspend_saved_registers regfile;
 
drivers/gpu/drm/i915/i915_reg.h +1 -1
index 3f75cfa..ceeac97 100644
@@ -3922,7 +3922,7 @@
 #define  FDI_10BPC                      (1<<16)
 #define  FDI_6BPC                       (2<<16)
 #define  FDI_12BPC                      (3<<16)
-#define  FDI_LINK_REVERSE_OVERWRITE     (1<<15)
+#define  FDI_RX_LINK_REVERSAL_OVERRIDE  (1<<15)
 #define  FDI_DMI_LINK_REVERSE_MASK      (1<<14)
 #define  FDI_RX_PLL_ENABLE              (1<<13)
 #define  FDI_FS_ERR_CORRECT_ENABLE      (1<<11)
drivers/gpu/drm/i915/intel_crt.c +9 -5
index fe20bf7..86b557e 100644
@@ -800,10 +800,14 @@ void intel_crt_init(struct drm_device *dev)
 	dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
 
 	/*
-	 * TODO: find a proper way to discover whether we need to set the
-	 * polarity reversal bit or not, instead of relying on the BIOS.
+	 * TODO: find a proper way to discover whether we need to set the the
+	 * polarity and link reversal bits or not, instead of relying on the
+	 * BIOS.
 	 */
-	if (HAS_PCH_LPT(dev))
-		dev_priv->fdi_rx_polarity_reversed =
-		     !!(I915_READ(_FDI_RXA_CTL) & FDI_RX_POLARITY_REVERSED_LPT);
+	if (HAS_PCH_LPT(dev)) {
+		u32 fdi_config = FDI_RX_POLARITY_REVERSED_LPT |
+				 FDI_RX_LINK_REVERSAL_OVERRIDE;
+
+		dev_priv->fdi_rx_config = I915_READ(_FDI_RXA_CTL) & fdi_config;
+	}
 }
drivers/gpu/drm/i915/intel_ddi.c +2 -4
index 4bad0f7..cb2dcc6 100644
@@ -178,10 +178,8 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
 				  FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90);
 
 	/* Enable the PCH Receiver FDI PLL */
-	rx_ctl_val = FDI_RX_PLL_ENABLE | FDI_RX_ENHANCE_FRAME_ENABLE |
-		     ((intel_crtc->fdi_lanes - 1) << 19);
-	if (dev_priv->fdi_rx_polarity_reversed)
-		rx_ctl_val |= FDI_RX_POLARITY_REVERSED_LPT;
+	rx_ctl_val = dev_priv->fdi_rx_config | FDI_RX_ENHANCE_FRAME_ENABLE |
+		     FDI_RX_PLL_ENABLE | ((intel_crtc->fdi_lanes - 1) << 19);
 	I915_WRITE(_FDI_RXA_CTL, rx_ctl_val);
 	POSTING_READ(_FDI_RXA_CTL);
 	udelay(220);
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/3 drm/i915: Preserve the DDI link reversal configuration

From: Damien Lespiau <[email protected]>

Similarly to:

commit 6a0d1df3d3a0d2370541164eb0595fe35dcd6de3
Author: Damien Lespiau <[email protected]>
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.

---
 drivers/gpu/drm/i915/i915_reg.h  |  1 +
 drivers/gpu/drm/i915/intel_ddi.c | 19 ++++++++++++++++---
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index ceeac97..3f2e6cf 100644
@@ -4519,6 +4519,7 @@
 #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)
drivers/gpu/drm/i915/intel_ddi.c +16 -3
index cb2dcc6..59b778d 100644
@@ -201,7 +201,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) |
@@ -675,8 +678,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
 
 	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;
@@ -1289,11 +1295,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 	int type = intel_encoder->type;
 
 	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);
 
@@ -1455,6 +1465,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;
@@ -1495,6 +1506,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
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 8a1bd4a..afa45a9 100644
@@ -377,6 +377,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;
 };
Signature · 1 line
1.7.11.7
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/i915: Preserve the DDI link reversal configuration

Hi

2012/12/11 Damien Lespiau <[email protected]>:

Quoted 10 lines

From: Damien Lespiau <[email protected]>

Similarly to:

commit 6a0d1df3d3a0d2370541164eb0595fe35dcd6de3
Author: Damien Lespiau <[email protected]>
Date: Tue Dec 11 15:18:28 2012 +0000

drm/i915: Preserve the FDI line reversal override bit on CPT

Quoted 7 lines

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.

Code looks correct, so:

My only optional bikeshedding would be about the fact that we're not making optimal usage of the struct_to_another_struct() conversion macros. Whenever you declare "struct intel_digital_port" you can basically redefine all the other pointers with intel_dig_port->something instead of using the macros that maybe call container_of.

Quoted 100 lines
---
 drivers/gpu/drm/i915/i915_reg.h  |  1 +
 drivers/gpu/drm/i915/intel_ddi.c | 19 ++++++++++++++++---
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index ceeac97..3f2e6cf 100644
@@ -4519,6 +4519,7 @@
 #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)
drivers/gpu/drm/i915/intel_ddi.c +16 -3
index cb2dcc6..59b778d 100644
@@ -201,7 +201,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) |
@@ -675,8 +678,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
 
        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;
@@ -1289,11 +1295,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
        int type = intel_encoder->type;
 
        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);
 
@@ -1455,6 +1465,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;
@@ -1495,6 +1506,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
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 8a1bd4a..afa45a9 100644
@@ -377,6 +377,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;
 };
--

1.7.11.7

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#3 lore raw

Re: [PATCH 2/3] drm/i915: Preserve the DDI link reversal configuration

Quoted 19 lines · Paulo Zanoni

Hi

2012/12/11 Damien Lespiau <[email protected]>:

Quoted 16 lines

From: Damien Lespiau <[email protected]>

Similarly to:

commit 6a0d1df3d3a0d2370541164eb0595fe35dcd6de3
Author: Damien Lespiau <[email protected]>
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.

Quoted 4 lines
Quoted 1 line

Code looks correct, so:

Queued for -next, thanks for the patch.
-Daniel

Quoted 117 lines

My only optional bikeshedding would be about the fact that we're not making optimal usage of the struct_to_another_struct() conversion macros. Whenever you declare "struct intel_digital_port" you can basically redefine all the other pointers with intel_dig_port->something instead of using the macros that maybe call container_of.

Quoted 100 lines
---
 drivers/gpu/drm/i915/i915_reg.h  |  1 +
 drivers/gpu/drm/i915/intel_ddi.c | 19 ++++++++++++++++---
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index ceeac97..3f2e6cf 100644
@@ -4519,6 +4519,7 @@
 #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)
drivers/gpu/drm/i915/intel_ddi.c +16 -3
index cb2dcc6..59b778d 100644
@@ -201,7 +201,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) |
@@ -675,8 +678,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
 
        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;
@@ -1289,11 +1295,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
        int type = intel_encoder->type;
 
        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);
 
@@ -1455,6 +1465,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;
@@ -1495,6 +1506,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
drivers/gpu/drm/i915/intel_drv.h +1 -1
index 8a1bd4a..afa45a9 100644
@@ -377,6 +377,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;
 };
--

1.7.11.7

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 5 lines
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw

PATCH 3/3 drm/i915: Rename intel_digital_port to intel_digital

In reply to Damien Lespiau

From: Damien Lespiau <[email protected]>

With DDI, intel_digital_port was introduced to paper over the fact that this encoder can operate in both DisplayPort and HDMI mode. The later structures are named intel_dp and intel_hdmi, so this newly introduced name somewhat clashes with them.

This patches renames intel_digital_port and related functions to intel_digital.

It is the result of :
sed -i -e "s/intel_digital_port/intel_digital/g;s/_dig_port/_digital/g \
drivers/gpu/drm/i915/*[ch]

and some manual fixes where the shorter name makes things fit in 80 columns again.

---
 drivers/gpu/drm/i915/intel_ddi.c  | 47 +++++++++++------------
 drivers/gpu/drm/i915/intel_dp.c   | 78 +++++++++++++++++++--------------------
 drivers/gpu/drm/i915/intel_drv.h  | 30 +++++++--------
 drivers/gpu/drm/i915/intel_hdmi.c | 46 +++++++++++------------
 4 files changed, 98 insertions(+), 103 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +22 -25
index 59b778d..eb6023a 100644
@@ -65,9 +65,8 @@ static enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
 
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP ||
 	    type == INTEL_OUTPUT_HDMI || type == INTEL_OUTPUT_UNKNOWN) {
-		struct intel_digital_port *intel_dig_port =
-			enc_to_dig_port(encoder);
-		return intel_dig_port->port;
+		struct intel_digital *intel_digital = enc_to_digital(encoder);
+		return intel_digital->port;
 
 	} else if (type == INTEL_OUTPUT_ANALOG) {
 		return PORT_E;
@@ -678,10 +677,9 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
 
 	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);
+		struct intel_digital *intel_digital = enc_to_digital(encoder);
 
-		intel_dp->DP = intel_dig_port->port_reversal |
+		intel_dp->DP = intel_digital->port_reversal |
 			       DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
 		switch (intel_dp->lane_count) {
 		case 1:
@@ -1295,15 +1293,14 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 	int type = intel_encoder->type;
 
 	if (type == INTEL_OUTPUT_HDMI) {
-		struct intel_digital_port *intel_dig_port =
-			enc_to_dig_port(encoder);
+		struct intel_digital *intel_digital = enc_to_digital(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),
-			   intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE);
+			   intel_digital->port_reversal | DDI_BUF_CTL_ENABLE);
 	} else if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
@@ -1358,10 +1355,10 @@ void intel_ddi_pll_init(struct drm_device *dev)
 
 void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder)
 {
-	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
-	struct intel_dp *intel_dp = &intel_dig_port->dp;
+	struct intel_digital *intel_digital = enc_to_digital(encoder);
+	struct intel_dp *intel_dp = &intel_digital->dp;
 	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
-	enum port port = intel_dig_port->port;
+	enum port port = intel_digital->port;
 	bool wait;
 	uint32_t val;
 
@@ -1466,19 +1463,19 @@ 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_digital *intel_digital;
 	struct intel_encoder *intel_encoder;
 	struct drm_encoder *encoder;
 	struct intel_connector *hdmi_connector = NULL;
 	struct intel_connector *dp_connector = NULL;
 
-	intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL);
-	if (!intel_dig_port)
+	intel_digital = kzalloc(sizeof(struct intel_digital), GFP_KERNEL);
+	if (!intel_digital)
 		return;
 
 	dp_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
 	if (!dp_connector) {
-		kfree(intel_dig_port);
+		kfree(intel_digital);
 		return;
 	}
 
@@ -1487,12 +1484,12 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 					 GFP_KERNEL);
 		if (!hdmi_connector) {
 			kfree(dp_connector);
-			kfree(intel_dig_port);
+			kfree(intel_digital);
 			return;
 		}
 	}
 
-	intel_encoder = &intel_dig_port->base;
+	intel_encoder = &intel_digital->base;
 	encoder = &intel_encoder->base;
 
 	drm_encoder_init(dev, encoder, &intel_ddi_funcs,
@@ -1505,14 +1502,14 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->post_disable = intel_ddi_post_disable;
 	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)) &
+	intel_digital->port = port;
+	intel_digital->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);
+		intel_digital->hdmi.sdvox_reg = DDI_BUF_CTL(port);
 	else
-		intel_dig_port->hdmi.sdvox_reg = 0;
-	intel_dig_port->dp.output_reg = DDI_BUF_CTL(port);
+		intel_digital->hdmi.sdvox_reg = 0;
+	intel_digital->dp.output_reg = DDI_BUF_CTL(port);
 
 	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
 	intel_encoder->crtc_mask =  (1 << 0) | (1 << 1) | (1 << 2);
@@ -1520,6 +1517,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->hot_plug = intel_ddi_hot_plug;
 
 	if (hdmi_connector)
-		intel_hdmi_init_connector(intel_dig_port, hdmi_connector);
-	intel_dp_init_connector(intel_dig_port, dp_connector);
+		intel_hdmi_init_connector(intel_digital, hdmi_connector);
+	intel_dp_init_connector(intel_digital, dp_connector);
 }
drivers/gpu/drm/i915/intel_dp.c +39 -39

211 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +15 -15
index afa45a9..15118e0 100644
@@ -374,7 +374,7 @@ struct intel_dp {
 	struct intel_connector *attached_connector;
 };
 
-struct intel_digital_port {
+struct intel_digital {
 	struct intel_encoder base;
 	enum port port;
 	u32 port_reversal;
@@ -428,7 +428,7 @@ extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector)
 extern void intel_crt_init(struct drm_device *dev);
 extern void intel_hdmi_init(struct drm_device *dev,
 			    int sdvox_reg, enum port port);
-extern void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
+extern void intel_hdmi_init_connector(struct intel_digital *intel_digital,
 				      struct intel_connector *intel_connector);
 extern struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
 extern bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
@@ -446,7 +446,7 @@ extern void intel_mark_fb_idle(struct drm_i915_gem_object *obj);
 extern bool intel_lvds_init(struct drm_device *dev);
 extern void intel_dp_init(struct drm_device *dev, int output_reg,
 			  enum port port);
-extern void intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
+extern void intel_dp_init_connector(struct intel_digital *intel_digital,
 				    struct intel_connector *intel_connector);
 void
 intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
@@ -524,27 +524,27 @@ static inline struct intel_encoder *intel_attached_encoder(struct drm_connector
 
 static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
 {
-	struct intel_digital_port *intel_dig_port =
-		container_of(encoder, struct intel_digital_port, base.base);
-	return &intel_dig_port->dp;
+	struct intel_digital *intel_digital =
+		container_of(encoder, struct intel_digital, base.base);
+	return &intel_digital->dp;
 }
 
-static inline struct intel_digital_port *
-enc_to_dig_port(struct drm_encoder *encoder)
+static inline struct intel_digital *
+enc_to_digital(struct drm_encoder *encoder)
 {
-	return container_of(encoder, struct intel_digital_port, base.base);
+	return container_of(encoder, struct intel_digital, base.base);
 }
 
-static inline struct intel_digital_port *
-dp_to_dig_port(struct intel_dp *intel_dp)
+static inline struct intel_digital *
+dp_to_digital(struct intel_dp *intel_dp)
 {
-	return container_of(intel_dp, struct intel_digital_port, dp);
+	return container_of(intel_dp, struct intel_digital, dp);
 }
 
-static inline struct intel_digital_port *
-hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
+static inline struct intel_digital *
+hdmi_to_digital(struct intel_hdmi *intel_hdmi)
 {
-	return container_of(intel_hdmi, struct intel_digital_port, hdmi);
+	return container_of(intel_hdmi, struct intel_digital, hdmi);
 }
 
 extern void intel_connector_attach_encoder(struct intel_connector *connector,
drivers/gpu/drm/i915/intel_hdmi.c +22 -24

109 lines not on this page · raw message

Signature · 1 line
1.7.11.7
Reviewed-by on v1 1/3
#5 lore raw
In reply to Damien Lespiau
Quoted 1 line · Damien Lespiau

FDI_RX_PLL_ENABLE

I noticed that we have a restriction on PLL_ENABLE:
"After enabling the FDI PLL, software must wait for a warmup period before enabling the link"

warmup for this is 25us.
Are we covered already with this 220 or should we increase it? I'm not sure.

Other than that, feel free to use

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

Reviewed-by
#6 lore raw

Hi

2012/12/18 Rodrigo Vivi <[email protected]>:

Quoted 10 lines
Quoted 1 line · Damien Lespiau

FDI_RX_PLL_ENABLE

I noticed that we have a restriction on PLL_ENABLE:
"After enabling the FDI PLL, software must wait for a warmup period before enabling the link"

warmup for this is 25us.
Are we covered already with this 220 or should we increase it? I'm not sure.

Yes. On the Haswell doc, mode set sequence for CRT: "Enable PCH FDI Receiver PLL, wait 200 µs for warmup plus 20 µs DMI latency".

Quoted 15 lines

Other than that, feel free to use

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#7 lore raw
Quoted 10 lines · Paulo Zanoni

Hi

2012/12/18 Rodrigo Vivi <[email protected]>:

Quoted 7 lines
Quoted 1 line · Damien Lespiau

FDI_RX_PLL_ENABLE

I noticed that we have a restriction on PLL_ENABLE:
"After enabling the FDI PLL, software must wait for a warmup period before enabling the link"

Quoted 8 lines
Quoted 3 lines

warmup for this is 25us.
Are we covered already with this 220 or should we increase it? I'm not sure.

Yes. On the Haswell doc, mode set sequence for CRT: "Enable PCH FDI Receiver PLL, wait 200 µs for warmup plus 20 µs DMI latency".

Picked up the first patch of this series. Or does that r-b also how for the DDI patch in here? The 3rd one likely doesn't apply any more, and I don't really have an opinion about that particular bikeshed. -Daniel

Quoted 25 lines
Quoted 16 lines

Other than that, feel free to use

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 5 lines
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch