Skip to content

Commit 9f9eef9

Browse files
Hermes Wulumag
authored andcommitted
drm/bridge: it6505: fix HDCP CTS KSV list wait timer
HDCP must disabled encryption and restart authentication after waiting KSV for 5s. The original method uses a counter in a waitting loop that may wait much longer than it is supposed to. Use time_after() for KSV wait timeout. Signed-off-by: Hermes Wu <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-9-e0fdd4844703@ite.corp-partner.google.com
1 parent 0989c02 commit 9f9eef9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/gpu/drm/bridge/ite-it6505.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,12 +2096,13 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
20962096
struct it6505 *it6505 = container_of(work, struct it6505,
20972097
hdcp_wait_ksv_list);
20982098
struct device *dev = it6505->dev;
2099-
unsigned int timeout = 5000;
2100-
u8 bstatus = 0;
2099+
u8 bstatus;
21012100
bool ksv_list_check;
2101+
/* 1B-04 wait ksv list for 5s */
2102+
unsigned long timeout = jiffies +
2103+
msecs_to_jiffies(5000) + 1;
21022104

2103-
timeout /= 20;
2104-
while (timeout > 0) {
2105+
for (;;) {
21052106
if (!it6505_get_sink_hpd_status(it6505))
21062107
return;
21072108

@@ -2110,13 +2111,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
21102111
if (bstatus & DP_BSTATUS_READY)
21112112
break;
21122113

2113-
msleep(20);
2114-
timeout--;
2115-
}
2114+
if (time_after(jiffies, timeout)) {
2115+
DRM_DEV_DEBUG_DRIVER(dev, "KSV list wait timeout");
2116+
goto timeout;
2117+
}
21162118

2117-
if (timeout == 0) {
2118-
DRM_DEV_DEBUG_DRIVER(dev, "timeout and ksv list wait failed");
2119-
goto timeout;
2119+
msleep(20);
21202120
}
21212121

21222122
ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505);

0 commit comments

Comments
 (0)