From ae989813d68723914c844fea1905f4e6a45f7422 Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Thu, 1 Mar 2018 13:27:48 +0800 Subject: [PATCH] drm/bridge: synopsys: dw-hdmi: update rxsense status in repo_hpd_event Under following processes, rxsense will be not match the real signal status. 1. HDMI plug in, irq is triggered. 2. HDMI irq is mute in dw_hdmi_hardirq, bring up dw_hdmi_irq. 3. For HDMI connection is not stable, phy_stat read in dw_hdmi_irq may be zero, then hdmi->rxsense will be false. 4. Connection fallback to stable, but dw_hdmi_irq had not unmute the irq, irq is not triggered again, and hdmi->rxsense keep false. 5. repo_hpd_event inform HDMI is pluggned in, dw_hdmi_bridge_enable is called to enable HDMI. For rxsense is flase, bridge is not powered up. When repo_hpd_event is called, we think HDMI connection is stable, updating rxsense is reliable. Change-Id: Ie1f52f65b15e9a603dad9200529202053528a390 Signed-off-by: Zheng Yang --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index b66756c48e0f..8394920d0e6e 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -378,6 +378,14 @@ static void repo_hpd_event(struct work_struct *p_work) struct dw_hdmi *hdmi = container_of(p_work, struct dw_hdmi, work.work); enum drm_connector_status status = hdmi->hpd_state ? connector_status_connected : connector_status_disconnected; + u8 phy_stat = hdmi_readb(hdmi, HDMI_PHY_STAT0); + + mutex_lock(&hdmi->mutex); + if (!(phy_stat & HDMI_PHY_RX_SENSE)) + hdmi->rxsense = false; + if (phy_stat & HDMI_PHY_HPD) + hdmi->rxsense = true; + mutex_unlock(&hdmi->mutex); if (hdmi->bridge.dev) { drm_helper_hpd_irq_event(hdmi->bridge.dev);