Skip to content

Commit a8ba6e5

Browse files
Kuogee Hsiehrobclark
authored andcommitted
drm/msm/dp: promote irq_hpd handle to handle link training correctly
Some dongles require link training done at irq_hpd request instead of plugin request. This patch promote irq_hpd handler to handle link training and setup hpd_state correctly. Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org> Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent 9050944 commit a8ba6e5

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,9 @@ static int dp_display_handle_irq_hpd(struct dp_display_private *dp)
449449
sink_request = dp->link->sink_request;
450450

451451
if (sink_request & DS_PORT_STATUS_CHANGED) {
452-
dp_add_event(dp, EV_USER_NOTIFICATION, false, 0);
453452
if (dp_display_is_sink_count_zero(dp)) {
454453
DRM_DEBUG_DP("sink count is zero, nothing to do\n");
455-
return 0;
454+
return -ENOTCONN;
456455
}
457456

458457
return dp_display_process_hpd_high(dp);
@@ -469,7 +468,9 @@ static int dp_display_handle_irq_hpd(struct dp_display_private *dp)
469468
static int dp_display_usbpd_attention_cb(struct device *dev)
470469
{
471470
int rc = 0;
471+
u32 sink_request;
472472
struct dp_display_private *dp;
473+
struct dp_usbpd *hpd;
473474

474475
if (!dev) {
475476
DRM_ERROR("invalid dev\n");
@@ -483,10 +484,26 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
483484
return -ENODEV;
484485
}
485486

487+
hpd = dp->usbpd;
488+
486489
/* check for any test request issued by sink */
487490
rc = dp_link_process_request(dp->link);
488-
if (!rc)
489-
dp_display_handle_irq_hpd(dp);
491+
if (!rc) {
492+
sink_request = dp->link->sink_request;
493+
if (sink_request & DS_PORT_STATUS_CHANGED) {
494+
/* same as unplugged */
495+
hpd->hpd_high = 0;
496+
dp->hpd_state = ST_DISCONNECT_PENDING;
497+
dp_add_event(dp, EV_USER_NOTIFICATION, false, 0);
498+
}
499+
500+
rc = dp_display_handle_irq_hpd(dp);
501+
502+
if (!rc && (sink_request & DS_PORT_STATUS_CHANGED)) {
503+
hpd->hpd_high = 1;
504+
dp->hpd_state = ST_CONNECT_PENDING;
505+
}
506+
}
490507

491508
return rc;
492509
}

0 commit comments

Comments
 (0)