Skip to contentSkip to conversation

drm/i915: make sure hotpulg is enabled

PATCH In review Yuanhan Liu 2 participants 2 messages Oct 8, 2010

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

PATCH 1/1 drm/i915: make sure hotpulg is enabled

Make sure hotplug is enabled, or the hotplug interrupt will not be invoked. And, for sandybridge, the bit definition for hotplug on SDE is changed. So, update the code to new definition.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30378

---
 drivers/gpu/drm/i915/i915_irq.c  |   19 ++++++++++++++++---
 drivers/gpu/drm/i915/i915_reg.h  |    4 ++++
 drivers/gpu/drm/i915/intel_crt.c |    3 ++-
 3 files changed, 22 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +16 -3
index 744225e..39a5456 100644
@@ -310,6 +310,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
 	int ret = IRQ_NONE;
 	u32 de_iir, gt_iir, de_ier, pch_iir;
+	u32 hotplug_mask;
 	struct drm_i915_master_private *master_priv;
 	struct intel_ring_buffer *render_ring = &dev_priv->render_ring;
 
@@ -325,6 +326,11 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
 	if (de_iir == 0 && gt_iir == 0 && pch_iir == 0)
 		goto done;
 
+	if (HAS_PCH_CPT(dev))
+		hotplug_mask = SDE_HOTPLUG_MASK_CPT;
+	else
+		hotplug_mask = SDE_HOTPLUG_MASK;
+
 	ret = IRQ_HANDLED;
 
 	if (dev->primary->master) {
@@ -367,7 +373,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
 
 	/* check event from PCH */
 	if ((de_iir & DE_PCH_EVENT) &&
-	    (pch_iir & SDE_HOTPLUG_MASK)) {
+	    (pch_iir & hotplug_mask)) {
 		queue_work(dev_priv->wq, &dev_priv->hotplug_work);
 	}
 
@@ -1424,8 +1430,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 	u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
 			   DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
 	u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT;
-	u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
-			   SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
+	u32 hotplug_mask;
 
 	dev_priv->irq_mask_reg = ~display_mask;
 	dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK;
@@ -1450,6 +1455,14 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 	I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg);
 	(void) I915_READ(GTIER);
 
+	if (HAS_PCH_CPT(dev)) {
+		hotplug_mask = SDE_CRT_HOTPLUG_CPT | SDE_PORTB_HOTPLUG_CPT  |
+			       SDE_PORTC_HOTPLUG_CPT | SDE_PORTD_HOTPLUG_CPT ;
+	} else {
+		hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
+			       SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
+	}
+
 	dev_priv->pch_irq_mask_reg = ~hotplug_mask;
 	dev_priv->pch_irq_enable_reg = hotplug_mask;
 
drivers/gpu/drm/i915/i915_reg.h +4 -0
index 4f5e155..412b38a 100644
@@ -2551,6 +2551,10 @@
 #define SDE_PORTD_HOTPLUG_CPT	(1 << 23)
 #define SDE_PORTC_HOTPLUG_CPT	(1 << 22)
 #define SDE_PORTB_HOTPLUG_CPT	(1 << 21)
+#define SDE_HOTPLUG_MASK_CPT	(SDE_CRT_HOTPLUG_CPT |		\
+				 SDE_PORTD_HOTPLUG_CPT |	\
+				 SDE_PORTC_HOTPLUG_CPT |	\
+				 SDE_PORTB_HOTPLUG_CPT)
 
 #define SDEISR  0xc4000
 #define SDEIMR  0xc4004
drivers/gpu/drm/i915/intel_crt.c +2 -1
index 197d4f3..0f950e7 100644
@@ -191,7 +191,8 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 		DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
 
 	if (turn_off_dac) {
-		I915_WRITE(PCH_ADPA, temp);
+		/* Make sure hotplug is enabled */
+		I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE);
 		(void)I915_READ(PCH_ADPA);
 	}
 
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 3 lines · Yuanhan Liu

Make sure hotplug is enabled, or the hotplug interrupt will not be invoked. And, for sandybridge, the bit definition for hotplug on SDE is changed. So, update the code to new definition.

I split this into the two patches for the two separate issues you described in your commit log and applied to -next.

Thanks,
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre