Skip to content

Commit 6341abe

Browse files
Ivan Lipskiheftig
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-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/178
1 parent d14a90e commit 6341abe

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

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
@@ -246,6 +246,7 @@ int amdgpu_damage_clips = -1; /* auto */
246246
int amdgpu_umsch_mm_fwlog;
247247
int amdgpu_rebar = -1; /* auto */
248248
int amdgpu_user_queue = -1;
249+
uint amdgpu_hdmi_hpd_debounce_delay_ms;
249250

250251
DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
251252
"DRM_UT_CORE",
@@ -1128,6 +1129,16 @@ module_param_named(rebar, amdgpu_rebar, int, 0444);
11281129
MODULE_PARM_DESC(user_queue, "Enable user queues (-1 = auto (default), 0 = disable, 1 = enable, 2 = enable UQs and disable KQs)");
11291130
module_param_named(user_queue, amdgpu_user_queue, int, 0444);
11301131

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

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

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

8718-
aconnector->hdmi_hpd_debounce_delay_ms = AMDGPU_DM_HDMI_HPD_DEBOUNCE_MS;
8719-
INIT_DELAYED_WORK(&aconnector->hdmi_hpd_debounce_work, hdmi_hpd_debounce_work);
8720-
aconnector->hdmi_prev_sink = NULL;
8718+
/*
8719+
* If HDMI HPD debounce delay is set, use the minimum between selected
8720+
* value and AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS
8721+
*/
8722+
if (amdgpu_hdmi_hpd_debounce_delay_ms) {
8723+
aconnector->hdmi_hpd_debounce_delay_ms = min(amdgpu_hdmi_hpd_debounce_delay_ms,
8724+
AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS);
8725+
INIT_DELAYED_WORK(&aconnector->hdmi_hpd_debounce_work, hdmi_hpd_debounce_work);
8726+
aconnector->hdmi_prev_sink = NULL;
8727+
} else {
8728+
aconnector->hdmi_hpd_debounce_delay_ms = 0;
8729+
}
87218730

87228731
/*
87238732
* 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)