Skip to contentSkip to conversation

drm/i915: dsi: fix pipe-off timeout due to port vs. pipe disable ordering

PATCH In review Imre Deak 2 participants 7 messages May 27, 2014

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915: dsi: fix pipe-off timeout due to port vs. pipe disable ordering

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

---
 drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +8 -1
index e73bec6..3756af1 100644
@@ -206,6 +206,11 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 	 */
 }
 
+static void intel_dsi_disable_nop(struct intel_encoder *encoder)
+{
+	DRM_DEBUG_KMS("\n");
+}
+
 static void intel_dsi_disable(struct intel_encoder *encoder)
 {
 	struct drm_device *dev = encoder->base.dev;
@@ -293,6 +298,8 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 
 	DRM_DEBUG_KMS("\n");
 
+	intel_dsi_disable(encoder);
+
 	intel_dsi_clear_device_ready(encoder);
 
 	val = I915_READ(DSPCLK_GATE_D);
@@ -691,7 +698,7 @@ bool intel_dsi_init(struct drm_device *dev)
 	intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable;
 	intel_encoder->pre_enable = intel_dsi_pre_enable;
 	intel_encoder->enable = intel_dsi_enable_nop;
-	intel_encoder->disable = intel_dsi_disable;
+	intel_encoder->disable = intel_dsi_disable_nop;
 	intel_encoder->post_disable = intel_dsi_post_disable;
 	intel_encoder->get_hw_state = intel_dsi_get_hw_state;
 	intel_encoder->get_config = intel_dsi_get_config;
Signature · 1 line
1.8.4
#1 lore raw
Quoted 19 lines · Imre Deak

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

---
  drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -0
index e73bec6..3756af1 100644

drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_enable_nop(struct intel_encoder *encoder) · line 213

Quoted 8 lines
drivers/gpu/drm/i915/intel_dsi.c +5 -0
@@ -206,6 +206,11 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
  	 */
  }
 
+static void intel_dsi_disable_nop(struct intel_encoder *encoder)
+{
+	DRM_DEBUG_KMS("\n");
+}
+

Make this as *_pre_disable and the SHUTDOWN command should be sent in this function. That is the recommended sequence in disable path. First thing is to shutdown the panel. Remove that bit from the intel_dsi_disable.

Quoted 13 lines
drivers/gpu/drm/i915/intel_dsi.c +2 -0
  static void intel_dsi_disable(struct intel_encoder *encoder)
  {
  	struct drm_device *dev = encoder->base.dev;
@@ -293,6 +298,8 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_dsi_disable(encoder);
+
  	intel_dsi_clear_device_ready(encoder);
 
  	val = I915_READ(DSPCLK_GATE_D);

drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 701

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +1 -1
@@ -691,7 +698,7 @@ bool intel_dsi_init(struct drm_device *dev)
  	intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable;
  	intel_encoder->pre_enable = intel_dsi_pre_enable;
  	intel_encoder->enable = intel_dsi_enable_nop;
-	intel_encoder->disable = intel_dsi_disable;
+	intel_encoder->disable = intel_dsi_disable_nop;

intel_encoder->disable = intel_dsi_pre_disable
as suggested above

drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 704

Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.c +0 -0
  	intel_encoder->post_disable = intel_dsi_post_disable;
  	intel_encoder->get_hw_state = intel_dsi_get_hw_state;
  	intel_encoder->get_config = intel_dsi_get_config;

Regards
Shobhit

author
#2 lore raw
Quoted 23 lines · Shobhit
Quoted 22 lines · Imre Deak

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

---
  drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -0
index e73bec6..3756af1 100644
@@ -206,6 +206,11 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
  	 */
  }
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_enable_nop(struct intel_encoder *encoder) · line 213

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +5 -0
+static void intel_dsi_disable_nop(struct intel_encoder *encoder)
+{
+	DRM_DEBUG_KMS("\n");
+}
+

Make this as *_pre_disable and the SHUTDOWN command should be sent in this function. That is the recommended sequence in disable path. First thing is to shutdown the panel. Remove that bit from the intel_dsi_disable.

I tried this, but it results in a "Timeout waiting for DPI FIFO empty" error when sending the SHUTDOWN command. This order would be also asymmetric with the enabling sequence where we first turn on the panel and only then enable the pipe. So I would need more explanation for the above before moving the SHUTDOWN command earlier.

--Imre

Quoted 22 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_dsi.c +2 -0
  static void intel_dsi_disable(struct intel_encoder *encoder)
  {
  	struct drm_device *dev = encoder->base.dev;
@@ -293,6 +298,8 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_dsi_disable(encoder);
+
  	intel_dsi_clear_device_ready(encoder);
 
  	val = I915_READ(DSPCLK_GATE_D);

drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 701

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +1 -1
@@ -691,7 +698,7 @@ bool intel_dsi_init(struct drm_device *dev)
  	intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable;
  	intel_encoder->pre_enable = intel_dsi_pre_enable;
  	intel_encoder->enable = intel_dsi_enable_nop;
-	intel_encoder->disable = intel_dsi_disable;
+	intel_encoder->disable = intel_dsi_disable_nop;

intel_encoder->disable = intel_dsi_pre_disable
as suggested above

Quoted 7 lines

drivers/gpu/drm/i915/intel_dsi.c bool intel_dsi_init(struct drm_device *dev) · line 704

Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.c +0 -0
  	intel_encoder->post_disable = intel_dsi_post_disable;
  	intel_encoder->get_hw_state = intel_dsi_get_hw_state;
  	intel_encoder->get_config = intel_dsi_get_config;

Regards
Shobhit

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

#3 lore raw
Quoted 34 lines · Imre Deak
Quoted 23 lines · Shobhit
Quoted 22 lines · Imre Deak

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

---
   drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++-
   1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -0
index e73bec6..3756af1 100644
@@ -206,6 +206,11 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
   	 */
   }
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_enable_nop(struct intel_encoder *encoder) · line 213

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +5 -0
+static void intel_dsi_disable_nop(struct intel_encoder *encoder)
+{
+	DRM_DEBUG_KMS("\n");
+}
+

Make this as *_pre_disable and the SHUTDOWN command should be sent in this function. That is the recommended sequence in disable path. First thing is to shutdown the panel. Remove that bit from the intel_dsi_disable.

Quoted 6 lines

I tried this, but it results in a "Timeout waiting for DPI FIFO empty" error when sending the SHUTDOWN command. This order would be also asymmetric with the enabling sequence where we first turn on the panel and only then enable the pipe. So I would need more explanation for the above before moving the SHUTDOWN command earlier.

I think checking DPI FIFO empty before sending DPI commands is wrong. Unless pipe is stopped DPI FIFO will not be empty. Basically we should test for DPI FIFO full in case of error. I was planning to look into that correction.

Regards
Shobhit

author
#4 lore raw
Quoted 41 lines · Shobhit
Quoted 34 lines · Imre Deak
Quoted 23 lines · Shobhit
Quoted 22 lines · Imre Deak

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

---
   drivers/gpu/drm/i915/intel_dsi.c | 9 ++++++++-
   1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -0
index e73bec6..3756af1 100644
@@ -206,6 +206,11 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
   	 */
   }
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_dsi.c static void intel_dsi_enable_nop(struct intel_encoder *encoder) · line 213

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.c +5 -0
+static void intel_dsi_disable_nop(struct intel_encoder *encoder)
+{
+	DRM_DEBUG_KMS("\n");
+}
+

Make this as *_pre_disable and the SHUTDOWN command should be sent in this function. That is the recommended sequence in disable path. First thing is to shutdown the panel. Remove that bit from the intel_dsi_disable.

Quoted 6 lines

I tried this, but it results in a "Timeout waiting for DPI FIFO empty" error when sending the SHUTDOWN command. This order would be also asymmetric with the enabling sequence where we first turn on the panel and only then enable the pipe. So I would need more explanation for the above before moving the SHUTDOWN command earlier.

Quoted 4 lines

I think checking DPI FIFO empty before sending DPI commands is wrong. Unless pipe is stopped DPI FIFO will not be empty. Basically we should test for DPI FIFO full in case of error. I was planning to look into that correction.

Ok, makes sense, I'll update the patch.

--Imre

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

author
#5 lore raw

PATCH 1/1 drm/i915: dsi: fix pipe-off timeout due to port vs. pipe disable ordering

In reply to Imre Deak

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

v2:
- send the panel shutdown command before stopping the pipe, since this is the recommended sequence (Shobhit)

---
 drivers/gpu/drm/i915/intel_dsi.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +18 -7
index 3ea3839..b397465 100644
@@ -207,14 +207,9 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 	 */
 }
 
-static void intel_dsi_disable(struct intel_encoder *encoder)
+static void intel_dsi_pre_disable(struct intel_encoder *encoder)
 {
-	struct drm_device *dev = encoder->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
-	int pipe = intel_crtc->pipe;
-	u32 temp;
 
 	DRM_DEBUG_KMS("\n");
 
@@ -222,7 +217,21 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
 		/* Send Shutdown command to the panel in LP mode */
 		dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN);
 		msleep(10);
+	}
+}
 
+static void intel_dsi_disable(struct intel_encoder *encoder)
+{
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	int pipe = intel_crtc->pipe;
+	u32 temp;
+
+	DRM_DEBUG_KMS("\n");
+
+	if (is_vid_mode(intel_dsi)) {
 		/* de-assert ip_tg_enable signal */
 		temp = I915_READ(MIPI_PORT_CTRL(pipe));
 		I915_WRITE(MIPI_PORT_CTRL(pipe), temp & ~DPI_ENABLE);
@@ -294,6 +303,8 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 
 	DRM_DEBUG_KMS("\n");
 
+	intel_dsi_disable(encoder);
+
 	intel_dsi_clear_device_ready(encoder);
 
 	val = I915_READ(DSPCLK_GATE_D);
@@ -692,7 +703,7 @@ bool intel_dsi_init(struct drm_device *dev)
 	intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable;
 	intel_encoder->pre_enable = intel_dsi_pre_enable;
 	intel_encoder->enable = intel_dsi_enable_nop;
-	intel_encoder->disable = intel_dsi_disable;
+	intel_encoder->disable = intel_dsi_pre_disable;
 	intel_encoder->post_disable = intel_dsi_post_disable;
 	intel_encoder->get_hw_state = intel_dsi_get_hw_state;
 	intel_encoder->get_config = intel_dsi_get_config;
Signature · 1 line
1.8.4
Reviewed-by on v1 1/1
#6 lore raw
Quoted 9 lines · Imre Deak

If we disable first the port (by disabling DPI) and only then the display pipe the pipe-off flag will never be set, possibly leading to a hanged pipe state at the next modeset-enable.

Note that according to the VLV2 display cluster HAS, we should disable the port before the pipe. This doesn't seem to match reality based on the above and it's also asymmetric with the enabling sequence, where we first enable the port and then the pipe.

Quoted 5 lines

v2:
- send the panel shutdown command before stopping the pipe, since this is the recommended sequence (Shobhit)

Regards
Shobhit

Quoted 65 lines
---
  drivers/gpu/drm/i915/intel_dsi.c | 25 ++++++++++++++++++-------
  1 file changed, 18 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +18 -7
index 3ea3839..b397465 100644
@@ -207,14 +207,9 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
  	 */
  }
 
-static void intel_dsi_disable(struct intel_encoder *encoder)
+static void intel_dsi_pre_disable(struct intel_encoder *encoder)
  {
-	struct drm_device *dev = encoder->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
-	int pipe = intel_crtc->pipe;
-	u32 temp;
 
  	DRM_DEBUG_KMS("\n");
 
@@ -222,7 +217,21 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
  		/* Send Shutdown command to the panel in LP mode */
  		dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN);
  		msleep(10);
+	}
+}
 
+static void intel_dsi_disable(struct intel_encoder *encoder)
+{
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	int pipe = intel_crtc->pipe;
+	u32 temp;
+
+	DRM_DEBUG_KMS("\n");
+
+	if (is_vid_mode(intel_dsi)) {
  		/* de-assert ip_tg_enable signal */
  		temp = I915_READ(MIPI_PORT_CTRL(pipe));
  		I915_WRITE(MIPI_PORT_CTRL(pipe), temp & ~DPI_ENABLE);
@@ -294,6 +303,8 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_dsi_disable(encoder);
+
  	intel_dsi_clear_device_ready(encoder);
 
  	val = I915_READ(DSPCLK_GATE_D);
@@ -692,7 +703,7 @@ bool intel_dsi_init(struct drm_device *dev)
  	intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable;
  	intel_encoder->pre_enable = intel_dsi_pre_enable;
  	intel_encoder->enable = intel_dsi_enable_nop;
-	intel_encoder->disable = intel_dsi_disable;
+	intel_encoder->disable = intel_dsi_pre_disable;
  	intel_encoder->post_disable = intel_dsi_post_disable;
  	intel_encoder->get_hw_state = intel_dsi_get_hw_state;
  	intel_encoder->get_config = intel_dsi_get_config;