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@xxxxxxxxx> Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@xxxxxxxxx> --- 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 de9ea18..77882ac 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -4099,6 +4099,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) { @@ -4144,14 +4153,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 b9f1304..7da13b5 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1335,6 +1335,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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx