[Intel-gfx] [PATCH 4/5] drm/i915: Extract test reply to separate function

Shubhangi Shrivastava shubhangi.shrivastava at intel.com
Thu Apr 21 08:40:30 UTC 2016


Replying for automated test request must be done only when we
are ready for the request. This patch extracts this reply to
separate function as it is needed in other places in the
upcoming patches.

Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani at intel.com>
Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava at intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c  | 18 ++++++++++--------
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a528804..93a29b7 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4134,6 +4134,15 @@ static uint8_t intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)
 	return test_result;
 }
 
+int intel_dp_write_test_reply(struct intel_dp *intel_dp, uint8_t reply)
+{
+	/* Clear interrupt first */
+	drm_dp_dpcd_writeb(&intel_dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
+			   DP_AUTOMATED_TEST_REQUEST);
+
+	return drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_RESPONSE, &reply, 1);
+}
+
 static void intel_dp_handle_test_request(struct intel_dp *intel_dp,
 					 bool short_pulse)
 {
@@ -4179,14 +4188,7 @@ 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);
-
+	status = intel_dp_write_test_reply(intel_dp, response);
 	if (status <= 0)
 		DRM_DEBUG_KMS("Could not write test response to sink\n");
 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index beed9e8..bf11237 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1333,6 +1333,7 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
 bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
 bool
 intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]);
+int intel_dp_write_test_reply(struct intel_dp *intel_dp, uint8_t reply);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
-- 
2.6.1



More information about the Intel-gfx mailing list