From d2e5de51163e77e6b631a930af3c009cc7e18d08 Mon Sep 17 00:00:00 2001 From: Nickey Yang Date: Sat, 24 Aug 2019 17:45:53 +0800 Subject: [PATCH] drm/bridge: synopsys: dw-hdmi: check hdmi status in resume HDMI status maybe incorrect in the following condition: HDMI plug in -> system sleep -> HDMI plug out -> system wake up. At this time, cat /sys/class/drm/card 0-HDMI-A-1/status is connected. There is no hpd interrupt, because HDMI is powerdown during suspend. So we need check the current HDMI status in this case. Test on rk3288 & rk3399. Change-Id: I2fbafd1d80b59628bca65e9e45760a24d1668241 Signed-off-by: Nickey Yang --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 2b2576861d6e..6e9273330394 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -4545,6 +4545,21 @@ void dw_hdmi_resume(struct dw_hdmi *hdmi) dw_hdmi_i2c_init(hdmi); if (hdmi->irq) enable_irq(hdmi->irq); + /* + * HDMI status maybe incorrect in the following condition: + * HDMI plug in -> system sleep -> HDMI plug out -> system wake up. + * At this time, cat /sys/class/drm/card 0-HDMI-A-1/status is connected. + * There is no hpd interrupt, because HDMI is powerdown during suspend. + * So we need check the current HDMI status in this case. + */ + if (hdmi->connector.status == connector_status_connected) { + if (hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data) == + connector_status_disconnected) { + hdmi->hpd_state = false; + mod_delayed_work(hdmi->workqueue, &hdmi->work, + msecs_to_jiffies(20)); + } + } mutex_unlock(&hdmi->mutex); } EXPORT_SYMBOL_GPL(dw_hdmi_resume);