Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add an hdmi_hpd_debounce_delay_ms module

[Why&How]
Right now, the HDMI HPD filter is enabled by default at 1500ms.

We want to disable it by default, as most modern displays with HDMI do
not require it for DPMS mode.

The HPD can instead be enabled as a driver parameter with a custom delay
value in ms (up to 5000ms).

Fixes: c918e75e1ed9 ("drm/amd/display: Add an HPD filter for HDMI")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4859
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 6a681cd9034587fe3550868bacfbd639d1c6891f)

authored by

Ivan Lipski and committed by
Alex Deucher
d04f7366 b2426a21

+29 -4
+2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 274 274 extern int amdgpu_wbrf; 275 275 extern int amdgpu_user_queue; 276 276 277 + extern uint amdgpu_hdmi_hpd_debounce_delay_ms; 278 + 277 279 #define AMDGPU_VM_MAX_NUM_CTX 4096 278 280 #define AMDGPU_SG_THRESHOLD (256*1024*1024) 279 281 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 247 247 int amdgpu_umsch_mm_fwlog; 248 248 int amdgpu_rebar = -1; /* auto */ 249 249 int amdgpu_user_queue = -1; 250 + uint amdgpu_hdmi_hpd_debounce_delay_ms; 250 251 251 252 DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, 252 253 "DRM_UT_CORE", ··· 1123 1122 */ 1124 1123 MODULE_PARM_DESC(user_queue, "Enable user queues (-1 = auto (default), 0 = disable, 1 = enable, 2 = enable UQs and disable KQs)"); 1125 1124 module_param_named(user_queue, amdgpu_user_queue, int, 0444); 1125 + 1126 + /* 1127 + * DOC: hdmi_hpd_debounce_delay_ms (uint) 1128 + * HDMI HPD disconnect debounce delay in milliseconds. 1129 + * 1130 + * Used to filter short disconnect->reconnect HPD toggles some HDMI sinks 1131 + * generate while entering/leaving power save. Set to 0 to disable by default. 1132 + */ 1133 + MODULE_PARM_DESC(hdmi_hpd_debounce_delay_ms, "HDMI HPD disconnect debounce delay in milliseconds (0 to disable (by default), 1500 is common)"); 1134 + module_param_named(hdmi_hpd_debounce_delay_ms, amdgpu_hdmi_hpd_debounce_delay_ms, uint, 0644); 1126 1135 1127 1136 /* These devices are not supported by amdgpu. 1128 1137 * They are supported by the mach64, r128, radeon drivers
+12 -3
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 8947 8947 mutex_init(&aconnector->hpd_lock); 8948 8948 mutex_init(&aconnector->handle_mst_msg_ready); 8949 8949 8950 - aconnector->hdmi_hpd_debounce_delay_ms = AMDGPU_DM_HDMI_HPD_DEBOUNCE_MS; 8951 - INIT_DELAYED_WORK(&aconnector->hdmi_hpd_debounce_work, hdmi_hpd_debounce_work); 8952 - aconnector->hdmi_prev_sink = NULL; 8950 + /* 8951 + * If HDMI HPD debounce delay is set, use the minimum between selected 8952 + * value and AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS 8953 + */ 8954 + if (amdgpu_hdmi_hpd_debounce_delay_ms) { 8955 + aconnector->hdmi_hpd_debounce_delay_ms = min(amdgpu_hdmi_hpd_debounce_delay_ms, 8956 + AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS); 8957 + INIT_DELAYED_WORK(&aconnector->hdmi_hpd_debounce_work, hdmi_hpd_debounce_work); 8958 + aconnector->hdmi_prev_sink = NULL; 8959 + } else { 8960 + aconnector->hdmi_hpd_debounce_delay_ms = 0; 8961 + } 8953 8962 8954 8963 /* 8955 8964 * configure support HPD hot plug connector_>polled default value is 0
+4 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
··· 59 59 60 60 #define AMDGPU_HDR_MULT_DEFAULT (0x100000000LL) 61 61 62 - #define AMDGPU_DM_HDMI_HPD_DEBOUNCE_MS 1500 62 + /* 63 + * Maximum HDMI HPD debounce delay in milliseconds 64 + */ 65 + #define AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS 5000 63 66 /* 64 67 #include "include/amdgpu_dal_power_if.h" 65 68 #include "amdgpu_dm_irq.h"