From ac64281d9d9735d49a1bf7ee882512cc8b790db5 Mon Sep 17 00:00:00 2001 From: Bob Zhou <bob.zhou@amd.com> Date: Tue, 18 Jul 2023 16:55:33 +0800 Subject: [PATCH] drm/amdkcl: test whether drm_dp_mst_topology_cbs->poll_hpd_irq is available It's caused by ed8496801ab71fdfb9c9fdcbef058aa20a549ebd "drm/amd/display: Add polling method to handle MST reply packet" Signed-off-by: Bob Zhou <bob.zhou@amd.com> Reviewed-by: Leslie Shi <Yuliang.Shi@amd.com> --- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 4 ++++ drivers/gpu/drm/amd/dkms/config/config.h | 3 +++ .../amd/dkms/m4/drm-dp-mst-topology-cbs.m4 | 23 +++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index ac6b89d018565..1151e785c8b2a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -863,14 +863,18 @@ void dm_handle_mst_sideband_msg_ready_event( DRM_DEBUG_DRIVER("Loop exceeded max iterations\n"); } +#ifdef HAVE_DRM_DP_MST_TOPOLOGY_CBS_POLL_HPD_IRQ static void dm_handle_mst_down_rep_msg_ready(struct drm_dp_mst_topology_mgr *mgr) { dm_handle_mst_sideband_msg_ready_event(mgr, DOWN_REP_MSG_RDY_EVENT); } +#endif static const struct drm_dp_mst_topology_cbs dm_mst_cbs = { .add_connector = dm_dp_add_mst_connector, +#ifdef HAVE_DRM_DP_MST_TOPOLOGY_CBS_POLL_HPD_IRQ .poll_hpd_irq = dm_handle_mst_down_rep_msg_ready, +#endif #ifdef HAVE_DRM_DP_MST_TOPOLOGY_CBS_DESTROY_CONNECTOR .destroy_connector = dm_dp_destroy_mst_connector, #endif diff --git a/drivers/gpu/drm/amd/dkms/config/config.h b/drivers/gpu/drm/amd/dkms/config/config.h index 300b02d3740d1..56acef694a5b7 100644 --- a/drivers/gpu/drm/amd/dkms/config/config.h +++ b/drivers/gpu/drm/amd/dkms/config/config.h @@ -332,6 +332,9 @@ /* struct drm_dp_mst_topology_cbs has hotplug member */ /* #undef HAVE_DRM_DP_MST_TOPOLOGY_CBS_HOTPLUG */ +/* struct drm_dp_mst_topology_cbs->poll_hpd_irq is available */ +#define HAVE_DRM_DP_MST_TOPOLOGY_CBS_POLL_HPD_IRQ 1 + /* struct drm_dp_mst_topology_cbs->register_connector is available */ /* #undef HAVE_DRM_DP_MST_TOPOLOGY_CBS_REGISTER_CONNECTOR */ diff --git a/drivers/gpu/drm/amd/dkms/m4/drm-dp-mst-topology-cbs.m4 b/drivers/gpu/drm/amd/dkms/m4/drm-dp-mst-topology-cbs.m4 index 683d563cfc7bb..02dac4390e913 100644 --- a/drivers/gpu/drm/amd/dkms/m4/drm-dp-mst-topology-cbs.m4 +++ b/drivers/gpu/drm/amd/dkms/m4/drm-dp-mst-topology-cbs.m4 @@ -68,10 +68,33 @@ AC_DEFUN([AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS_DESTROY_CONNECTOR], [ ]) ]) +dnl # +dnl # commit v5.7-rc1-646-g471bdd0df0d5 +dnl # drm/i915/dp_mst: Work around out-of-spec adapters filtering short pulses +dnl # +AC_DEFUN([AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS_POLL_HPD_IRQ], [ + AC_KERNEL_TRY_COMPILE([ + #if defined(HAVE_DRM_DISPLAY_DRM_DP_MST_HELPER_H) + #include <drm/display/drm_dp_mst_helper.h> + #elif defined(HAVE_DRM_DP_DRM_DP_MST_HELPER_H) + #include <drm/dp/drm_dp_mst_helper.h> + #else + #include <drm/drm_dp_mst_helper.h> + #endif + ], [ + struct drm_dp_mst_topology_cbs *dp_mst_cbs = NULL; + dp_mst_cbs->poll_hpd_irq(NULL); + ], [ + AC_DEFINE(HAVE_DRM_DP_MST_TOPOLOGY_CBS_POLL_HPD_IRQ, 1, + [struct drm_dp_mst_topology_cbs->poll_hpd_irq is available]) + ]) +]) + AC_DEFUN([AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS], [ AC_KERNEL_DO_BACKGROUND([ AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS_HOTPLUG AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS_REGISTER_CONNECTOR AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS_DESTROY_CONNECTOR + AC_AMDGPU_DRM_DP_MST_TOPOLOGY_CBS_POLL_HPD_IRQ ]) ]) -- GitLab