diff mbox

[3/5] drm/i915: Cleanup panel IRQ handling

Message ID 1461572670-32421-3-git-send-email-shubhangi.shrivastava@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shubhangi Shrivastava April 25, 2016, 8:24 a.m. UTC
IRQ bits are set by panel in DPCD 0x201 to perform various requests.
Current code clears all bits in one go and then handles them, but
this is not proper since some scenarios require full detection and
if we clear such bits the test request may not be detected in the
later part.

It is always good to clear the bits only when handled, so this patch
moves the IRQ clearing bit post handling code.

Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 387800b..de9ea18 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4144,9 +4144,14 @@  static void intel_dp_handle_test_request(struct intel_dp *intel_dp,
 	}
 
 update_status:
+	/* Clear interrupt first */
+	drm_dp_dpcd_writeb(&intel_dp->aux,
+			   DP_DEVICE_SERVICE_IRQ_VECTOR,
+			   DP_AUTOMATED_TEST_REQUEST);
 	status = drm_dp_dpcd_write(&intel_dp->aux,
 				   DP_TEST_RESPONSE,
 				   &response, 1);
+
 	if (status <= 0)
 		DRM_DEBUG_KMS("Could not write test response to sink\n");
 }
@@ -4283,15 +4288,22 @@  intel_dp_short_pulse(struct intel_dp *intel_dp)
 	/* Try to read the source of the interrupt */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
 	    intel_dp_get_sink_irq(intel_dp, &sink_irq_vector)) {
-		/* Clear interrupt source */
-		drm_dp_dpcd_writeb(&intel_dp->aux,
-				   DP_DEVICE_SERVICE_IRQ_VECTOR,
-				   sink_irq_vector);
-
-		if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
+		if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST) {
 			intel_dp_handle_test_request(intel_dp, true);
+			sink_irq_vector &= ~DP_AUTOMATED_TEST_REQUEST;
+		}
+
 		if (sink_irq_vector & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ))
 			DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
+
+		/* Clear interrupt source */
+		if (sink_irq_vector) {
+			DRM_DEBUG_KMS("ATR requests not handled for %x\n",
+				      sink_irq_vector);
+			drm_dp_dpcd_writeb(&intel_dp->aux,
+					   DP_DEVICE_SERVICE_IRQ_VECTOR,
+					   sink_irq_vector);
+		}
 	}
 
 	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);