diff mbox series

[v2] drm/msm/dp: service only one irq_hpd if there are multiple irq_hpd pending

Message ID 1619037964-26222-1-git-send-email-khsieh@codeaurora.org
State New
Headers show
Series [v2] drm/msm/dp: service only one irq_hpd if there are multiple irq_hpd pending | expand

Commit Message

Kuogee Hsieh April 21, 2021, 8:46 p.m. UTC
irq_hpd is an asynchronous event generated by panel to bring up attention
of host. It could only be generated at run time of normal operation and
it is not possible to be generated while main link is down. Therefore no
need to handle irq_hpd if main link is down, such as cable unplug or system
suspended. To handle irq_hpd, host has to read DPCD out of panel to figure
out what action requested and perform that action accordingly. Also only
handle the latest irq_hpd if there are multiple irq_hpd pending at the time
of service since panel contains only the latest irq_hpd request status.

Changes in v2:
-- re wording of commit test

Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
---
 drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 5a39da6..1107c4e 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -707,6 +707,12 @@  static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
 		return 0;
 	}
 
+	/*
+	 * handle only one irq_hpd in case of multiple irq_hpd pending
+	 * since panel contains the lateset request at this time
+	 */
+	dp_del_event(dp, EV_IRQ_HPD_INT);
+
 	ret = dp_display_usbpd_attention_cb(&dp->pdev->dev);
 	if (ret == -ECONNRESET) { /* cable unplugged */
 		dp->core_initialized = false;
@@ -1300,6 +1306,9 @@  static int dp_pm_suspend(struct device *dev)
 	/* host_init will be called at pm_resume */
 	dp->core_initialized = false;
 
+	/* suspending, no need to handle pending irq_hdps */
+	dp_del_event(dp, EV_IRQ_HPD_INT);
+
 	mutex_unlock(&dp->event_mutex);
 
 	return 0;
@@ -1496,6 +1505,9 @@  int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder)
 	/* stop sentinel checking */
 	dp_del_event(dp_display, EV_DISCONNECT_PENDING_TIMEOUT);
 
+	/* link is teared down, no need to handle pending irq_hdps */
+	dp_del_event(dp_display, EV_IRQ_HPD_INT);
+
 	dp_display_disable(dp_display, 0);
 
 	rc = dp_display_unprepare(dp);