From b15fed911e022b383295cb5443872d427e756677 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Tue, 14 Jul 2015 14:19:48 +0200 Subject: mxc_hdmi: fix detect disconnect case The keepalive module variable allows to not go into a disconnected state. Fix the case when keepalive is set to go to disconnect. Add a precompiler directive which allows to only evaluate the HPD signal for HDMI monitor detection. Default is to react on the status bits for HPD and the TMDS signal line detection to detect an attached monitor. While at it cleanup parameter documentation and whitespace. --- drivers/video/mxc/mxc_hdmi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c index 75825092b731..53ffdcfc8fd0 100644 --- a/drivers/video/mxc/mxc_hdmi.c +++ b/drivers/video/mxc/mxc_hdmi.c @@ -84,6 +84,14 @@ static int only_cea; module_param(only_cea, bool, 0644); MODULE_PARM_DESC(only_cea, "Allow only CEA modes"); +#if 0 +/* rely solely on the HPD pin for hot plug detection */ +#undef HDMI_DVI_STAT +#define HDMI_DVI_STAT 2 + +#undef HDMI_DVI_IH_STAT +#define HDMI_DVI_IH_STAT 1 +#endif /* * We follow a flowchart which is in the "Synopsys DesignWare Courses * HDMI Transmitter Controller User Guide, 1.30a", section 3.1 @@ -948,7 +956,7 @@ static u8 hdmi_edid_i2c_read(struct mxc_hdmi *hdmi, static int keepalive=1; module_param(keepalive, int, 0644); -MODULE_PARM_DESC(keepalive, "Allow only CEA modes"); +MODULE_PARM_DESC(keepalive, "Keep HDMI alive (don't detect disconnect)"); /* "Power-down enable (active low)" * That mean that power up == 1! */ @@ -2017,7 +2025,7 @@ static void hotplug_worker(struct work_struct *work) mxc_hdmi_cec_handle(0x80); #endif if (keepalive) - hdmi_writeb(HDMI_DVI_STAT, HDMI_PHY_POL0); + hdmi_writeb(HDMI_DVI_STAT, HDMI_PHY_POL0); isalive=1; } else if (!keepalive) { /* Plugout event */ @@ -2038,7 +2046,7 @@ static void hotplug_worker(struct work_struct *work) * completed before next interrupt processed */ spin_lock_irqsave(&hdmi->irq_lock, flags); - if (!(keepalive || isalive)) { + if (!(keepalive && isalive)) { /* Re-enable HPD interrupts */ hdmi_phy_mask0 = hdmi_readb(HDMI_PHY_MASK0); hdmi_phy_mask0 &= ~HDMI_DVI_STAT; -- cgit v1.2.3