[1/5] drm/amd/dal: Temporary fix DP hot plug crash.

Submitted by Harry Wentland on Nov. 25, 2016, 9:59 p.m.

Details

Message ID 20161125215941.29972-2-harry.wentland@amd.com
State New
Headers show
Series "dal patches for nov 23, 2016" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Harry Wentland Nov. 25, 2016, 9:59 p.m.
From: Yongqiang Sun <yongqiang.sun@amd.com>

Change-Id: Ic4347e0c772f074fb9efdcff42b3aa42bda1e5ad
Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c       | 12 ++++++++++++
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c |  2 ++
 2 files changed, 14 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
index 9a65b978d07a..b798b7a2231b 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm.c
@@ -828,6 +828,7 @@  static void handle_hpd_irq(void *param)
 	/* In case of failure or MST no need to update connector status or notify the OS
 	 * since (for MST case) MST does this in it's own context.
 	 */
+	mutex_lock(&aconnector->hpd_lock);
 	if (dc_link_detect(aconnector->dc_link, false)) {
 		amdgpu_dm_update_connector_after_detect(aconnector);
 
@@ -839,6 +840,7 @@  static void handle_hpd_irq(void *param)
 		if (aconnector->base.force == DRM_FORCE_UNSPECIFIED)
 			drm_kms_helper_hotplug_event(dev);
 	}
+	mutex_unlock(&aconnector->hpd_lock);
 
 }
 
@@ -929,6 +931,13 @@  static void handle_hpd_rx_irq(void *param)
 	const struct dc_link *dc_link = aconnector->dc_link;
 	bool is_mst_root_connector = aconnector->mst_mgr.mst_state;
 
+	/* TODO:Temporary add mutex to protect hpd interrupt not have a gpio
+	 * conflict, after implement i2c helper, this mutex should be
+	 * retired.
+	 */
+	if (aconnector->dc_link->type != dc_connection_mst_branch)
+		mutex_lock(&aconnector->hpd_lock);
+
 	if (dc_link_handle_hpd_rx_irq(aconnector->dc_link) &&
 			!is_mst_root_connector) {
 		/* Downstream Port status changed. */
@@ -946,6 +955,9 @@  static void handle_hpd_rx_irq(void *param)
 	if ((dc_link->cur_link_settings.lane_count != LANE_COUNT_UNKNOWN) ||
 				(dc_link->type == dc_connection_mst_branch))
 		dm_handle_hpd_rx_irq(aconnector);
+
+	if (aconnector->dc_link->type != dc_connection_mst_branch)
+		mutex_unlock(&aconnector->hpd_lock);
 }
 
 static void register_hpd_handlers(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index fba2bd74f669..e73c658cdfec 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -2041,6 +2041,8 @@  void amdgpu_dm_connector_init_helper(
 	aconnector->base.dpms = DRM_MODE_DPMS_OFF;
 	aconnector->hpd.hpd = AMDGPU_HPD_NONE; /* not used */
 
+	mutex_init(&aconnector->hpd_lock);
+
 	/*configure suport HPD hot plug connector_>polled default value is 0
 	 * which means HPD hot plug not supported*/
 	switch (connector_type) {