Skip to content

Commit d04f736

Browse files
Ivan Lipskialexdeucher
authored andcommitted
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: c918e75 ("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 6a681cd)
1 parent b2426a2 commit d04f736

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ extern int amdgpu_rebar;
274274
extern int amdgpu_wbrf;
275275
extern int amdgpu_user_queue;
276276

277+
extern uint amdgpu_hdmi_hpd_debounce_delay_ms;
278+
277279
#define AMDGPU_VM_MAX_NUM_CTX 4096
278280
#define AMDGPU_SG_THRESHOLD (256*1024*1024)
279281
#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ int amdgpu_damage_clips = -1; /* auto */
247247
int amdgpu_umsch_mm_fwlog;
248248
int amdgpu_rebar = -1; /* auto */
249249
int amdgpu_user_queue = -1;
250+
uint amdgpu_hdmi_hpd_debounce_delay_ms;
250251

251252
DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
252253
"DRM_UT_CORE",
@@ -1123,6 +1124,16 @@ module_param_named(rebar, amdgpu_rebar, int, 0444);
11231124
MODULE_PARM_DESC(user_queue, "Enable user queues (-1 = auto (default), 0 = disable, 1 = enable, 2 = enable UQs and disable KQs)");
11241125
module_param_named(user_queue, amdgpu_user_queue, int, 0444);
11251126

1127+
/*
1128+
* DOC: hdmi_hpd_debounce_delay_ms (uint)
1129+
* HDMI HPD disconnect debounce delay in milliseconds.
1130+
*
1131+
* Used to filter short disconnect->reconnect HPD toggles some HDMI sinks
1132+
* generate while entering/leaving power save. Set to 0 to disable by default.
1133+
*/
1134+
MODULE_PARM_DESC(hdmi_hpd_debounce_delay_ms, "HDMI HPD disconnect debounce delay in milliseconds (0 to disable (by default), 1500 is common)");
1135+
module_param_named(hdmi_hpd_debounce_delay_ms, amdgpu_hdmi_hpd_debounce_delay_ms, uint, 0644);
1136+
11261137
/* These devices are not supported by amdgpu.
11271138
* They are supported by the mach64, r128, radeon drivers
11281139
*/

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8947,9 +8947,18 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
89478947
mutex_init(&aconnector->hpd_lock);
89488948
mutex_init(&aconnector->handle_mst_msg_ready);
89498949

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+
}
89538962

89548963
/*
89558964
* configure support HPD hot plug connector_>polled default value is 0

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@
5959

6060
#define AMDGPU_HDR_MULT_DEFAULT (0x100000000LL)
6161

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
6366
/*
6467
#include "include/amdgpu_dal_power_if.h"
6568
#include "amdgpu_dm_irq.h"

0 commit comments

Comments
 (0)