]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MLK-10138: Revert "MLK-10047: hdmi: Add hotplug detect for DVI monitors"
authorSandor Yu <R01008@freescale.com>
Mon, 2 Feb 2015 02:00:16 +0000 (10:00 +0800)
committerSandor Yu <R01008@freescale.com>
Mon, 2 Feb 2015 06:37:56 +0000 (14:37 +0800)
This reverts commit e88c775a272b4f7af1a2fec8736fea9a55e58472.
Some HDMI TV not support rxsense as hotplug interrupter source.

Signed-off-by: Sandor Yu <R01008@freescale.com>
drivers/video/mxc/mxc_hdmi.c
include/video/mxc_hdmi.h

index ab7165eb0ef8ceb6aebf03ef3b1f6d76755a88f8..10b54fb5fe3322406d89ba9d96147b0b788e7f78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2011-2015 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -170,6 +170,7 @@ struct mxc_hdmi {
        bool dft_mode_set;
        char *dft_mode_str;
        int default_bpp;
+       u8 latest_intr_stat;
        bool irq_enabled;
        spinlock_t irq_lock;
        bool phy_enabled;
@@ -1994,45 +1995,58 @@ static void hotplug_worker(struct work_struct *work)
        struct delayed_work *delay_work = to_delayed_work(work);
        struct mxc_hdmi *hdmi =
                container_of(delay_work, struct mxc_hdmi, hotplug_work);
-       u32 hdmi_phy_stat0, hdmi_phy_pol0, hdmi_phy_mask0;
+       u32 phy_int_stat, phy_int_pol, phy_int_mask;
+       u8 val;
        unsigned long flags;
        char event_string[32];
        char *envp[] = { event_string, NULL };
 
-       hdmi_phy_stat0 = hdmi_readb(HDMI_PHY_STAT0);
-       hdmi_phy_pol0 = hdmi_readb(HDMI_PHY_POL0);
-
-       dev_dbg(&hdmi->pdev->dev, "hdmi_phy_stat0=0x%x, hdmi_phy_pol0=0x%x\n",
-                       hdmi_phy_stat0, hdmi_phy_pol0);
+       phy_int_stat = hdmi->latest_intr_stat;
+       phy_int_pol = hdmi_readb(HDMI_PHY_POL0);
 
-       /* Make HPD intr active low to capture unplug event or
-        * active high to capture plugin event */
-       hdmi_writeb((HDMI_PHY_RXSENSE_HPD & ~hdmi_phy_stat0), HDMI_PHY_POL0);
+       dev_dbg(&hdmi->pdev->dev, "phy_int_stat=0x%x, phy_int_pol=0x%x\n",
+                       phy_int_stat, phy_int_pol);
 
        /* check cable status */
-       if (hdmi_phy_stat0 & HDMI_PHY_RXSENSE_HPD) {
-               /* Plugin event */
-               dev_dbg(&hdmi->pdev->dev, "EVENT=plugin\n");
-               mxc_hdmi_cable_connected(hdmi);
-
-               sprintf(event_string, "EVENT=plugin");
-               kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
+       if (phy_int_stat & HDMI_IH_PHY_STAT0_HPD) {
+               /* cable connection changes */
+               if (phy_int_pol & HDMI_PHY_HPD) {
+                       /* Plugin event */
+                       dev_dbg(&hdmi->pdev->dev, "EVENT=plugin\n");
+                       mxc_hdmi_cable_connected(hdmi);
+
+                       /* Make HPD intr active low to capture unplug event */
+                       val = hdmi_readb(HDMI_PHY_POL0);
+                       val &= ~HDMI_PHY_HPD;
+                       hdmi_writeb(val, HDMI_PHY_POL0);
+
+                       hdmi_set_cable_state(1);
+
+                       sprintf(event_string, "EVENT=plugin");
+                       kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
 #ifdef CONFIG_MXC_HDMI_CEC
-               mxc_hdmi_cec_handle(0x80);
+                       mxc_hdmi_cec_handle(0x80);
 #endif
-               hdmi_set_cable_state(1);
-       } else {
-               /* Plugout event */
-               dev_dbg(&hdmi->pdev->dev, "EVENT=plugout\n");
-               hdmi_set_cable_state(0);
-               mxc_hdmi_abort_stream();
-               mxc_hdmi_cable_disconnected(hdmi);
+               } else if (!(phy_int_pol & HDMI_PHY_HPD)) {
+                       /* Plugout event */
+                       dev_dbg(&hdmi->pdev->dev, "EVENT=plugout\n");
+                       hdmi_set_cable_state(0);
+                       mxc_hdmi_abort_stream();
+                       mxc_hdmi_cable_disconnected(hdmi);
 
-               sprintf(event_string, "EVENT=plugout");
-               kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
+                       /* Make HPD intr active high to capture plugin event */
+                       val = hdmi_readb(HDMI_PHY_POL0);
+                       val |= HDMI_PHY_HPD;
+                       hdmi_writeb(val, HDMI_PHY_POL0);
+
+                       sprintf(event_string, "EVENT=plugout");
+                       kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp);
 #ifdef CONFIG_MXC_HDMI_CEC
-               mxc_hdmi_cec_handle(0x100);
+                       mxc_hdmi_cec_handle(0x100);
 #endif
+
+               } else
+                       dev_dbg(&hdmi->pdev->dev, "EVENT=none?\n");
        }
 
        /* Lock here to ensure full powerdown sequence
@@ -2040,12 +2054,12 @@ static void hotplug_worker(struct work_struct *work)
        spin_lock_irqsave(&hdmi->irq_lock, flags);
 
        /* Re-enable HPD interrupts */
-       hdmi_phy_mask0 = hdmi_readb(HDMI_PHY_MASK0);
-       hdmi_phy_mask0 &= ~HDMI_PHY_RXSENSE_HPD;
-       hdmi_writeb(hdmi_phy_mask0, HDMI_PHY_MASK0);
+       phy_int_mask = hdmi_readb(HDMI_PHY_MASK0);
+       phy_int_mask &= ~HDMI_PHY_HPD;
+       hdmi_writeb(phy_int_mask, HDMI_PHY_MASK0);
+
        /* Unmute interrupts */
-       hdmi_writeb(~HDMI_IH_MUTE_PHY_STAT0_RXSENSE_HPD,
-                               HDMI_IH_MUTE_PHY_STAT0);
+       hdmi_writeb(~HDMI_IH_MUTE_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
 
        if (hdmi_readb(HDMI_IH_FC_STAT2) & HDMI_IH_FC_STAT2_OVERFLOW_MASK)
                mxc_hdmi_clear_overflow(hdmi);
@@ -2071,7 +2085,7 @@ static void hdcp_hdp_worker(struct work_struct *work)
 static irqreturn_t mxc_hdmi_hotplug(int irq, void *data)
 {
        struct mxc_hdmi *hdmi = data;
-       u8 val;
+       u8 val, intr_stat;
        unsigned long flags;
 
        spin_lock_irqsave(&hdmi->irq_lock, flags);
@@ -2093,22 +2107,25 @@ static irqreturn_t mxc_hdmi_hotplug(int irq, void *data)
         * HDMI registers.
         */
        /* Capture status - used in hotplug_worker ISR */
-       if (hdmi_readb(HDMI_IH_PHY_STAT0) & HDMI_IH_PHY_STAT0_RXSENSE_HPD) {
+       intr_stat = hdmi_readb(HDMI_IH_PHY_STAT0);
+
+       if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
 
                dev_dbg(&hdmi->pdev->dev, "Hotplug interrupt received\n");
+               hdmi->latest_intr_stat = intr_stat;
 
                /* Mute interrupts until handled */
 
                val = hdmi_readb(HDMI_IH_MUTE_PHY_STAT0);
-               val |= HDMI_IH_MUTE_PHY_STAT0_RXSENSE_HPD;
+               val |= HDMI_IH_MUTE_PHY_STAT0_HPD;
                hdmi_writeb(val, HDMI_IH_MUTE_PHY_STAT0);
 
                val = hdmi_readb(HDMI_PHY_MASK0);
-               val |= HDMI_PHY_RXSENSE_HPD;
+               val |= HDMI_PHY_HPD;
                hdmi_writeb(val, HDMI_PHY_MASK0);
 
                /* Clear Hotplug interrupts */
-               hdmi_writeb(HDMI_IH_PHY_STAT0_RXSENSE_HPD, HDMI_IH_PHY_STAT0);
+               hdmi_writeb(HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
 
                schedule_delayed_work(&(hdmi->hotplug_work), msecs_to_jiffies(20));
        }
@@ -2260,14 +2277,13 @@ static void mxc_hdmi_fb_registered(struct mxc_hdmi *hdmi)
                    HDMI_PHY_I2CM_CTLINT_ADDR);
 
        /* enable cable hot plug irq */
-       hdmi_writeb((u8)~HDMI_PHY_RXSENSE_HPD, HDMI_PHY_MASK0);
+       hdmi_writeb((u8)~HDMI_PHY_HPD, HDMI_PHY_MASK0);
 
        /* Clear Hotplug interrupts */
-       hdmi_writeb(HDMI_IH_PHY_STAT0_RXSENSE_HPD, HDMI_IH_PHY_STAT0);
+       hdmi_writeb(HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
 
        /* Unmute interrupts */
-       hdmi_writeb(~HDMI_IH_MUTE_PHY_STAT0_RXSENSE_HPD,
-                               HDMI_IH_MUTE_PHY_STAT0);
+       hdmi_writeb(~HDMI_IH_MUTE_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
 
        hdmi->fb_reg = true;
 
@@ -2599,10 +2615,10 @@ static int mxc_hdmi_disp_init(struct mxc_dispdrv_handle *disp,
 
        /* Configure registers related to HDMI interrupt
         * generation before registering IRQ. */
-       hdmi_writeb(HDMI_PHY_RXSENSE_HPD, HDMI_PHY_POL0);
+       hdmi_writeb(HDMI_PHY_HPD, HDMI_PHY_POL0);
 
        /* Clear Hotplug interrupts */
-       hdmi_writeb(HDMI_IH_PHY_STAT0_RXSENSE_HPD, HDMI_IH_PHY_STAT0);
+       hdmi_writeb(HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
 
        hdmi->nb.notifier_call = mxc_hdmi_fb_event;
        ret = fb_register_client(&hdmi->nb);
index b8a42ddcbf5277118f44baeb217b603214f72350..6ed17492e8e9f3d27359fdc0b80852b7844ced84 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2011-2015 Freescale Semiconductor, Inc.
  */
 
 /*
@@ -557,8 +557,6 @@ enum {
        HDMI_IH_PHY_STAT0_RX_SENSE0 = 0x4,
        HDMI_IH_PHY_STAT0_TX_PHY_LOCK = 0x2,
        HDMI_IH_PHY_STAT0_HPD = 0x1,
-/* IH convenience macro RX_SENSEx | HPD*/
-       HDMI_IH_PHY_STAT0_RXSENSE_HPD = 0x3D,
 
 /* IH_CEC_STAT0 field values */
        HDMI_IH_CEC_STAT0_WAKEUP = 0x40,
@@ -569,6 +567,7 @@ enum {
        HDMI_IH_CEC_STAT0_EOM = 0x2,
        HDMI_IH_CEC_STAT0_DONE = 0x1,
 
+
 /* IH_MUTE_I2CMPHY_STAT0 field values */
        HDMI_IH_MUTE_I2CMPHY_STAT0_I2CMPHYDONE = 0x2,
        HDMI_IH_MUTE_I2CMPHY_STAT0_I2CMPHYERROR = 0x1,
@@ -580,8 +579,6 @@ enum {
        HDMI_IH_MUTE_PHY_STAT0_RX_SENSE0 = 0x4,
        HDMI_IH_MUTE_PHY_STAT0_TX_PHY_LOCK = 0x2,
        HDMI_IH_MUTE_PHY_STAT0_HPD = 0x1,
-/* IH_MUTE convenience macro RX_SENSEx | HPD*/
-       HDMI_IH_MUTE_PHY_STAT0_RXSENSE_HPD = 0x3D,
 
 /* IH_AHBDMAAUD_STAT0 field values */
        HDMI_IH_AHBDMAAUD_STAT0_ERROR = 0x20,
@@ -877,8 +874,6 @@ enum {
        HDMI_PHY_RX_SENSE0 = 0x10,
        HDMI_PHY_HPD = 0x02,
        HDMI_PHY_TX_PHY_LOCK = 0x01,
-/* HDMI STAT convenience RX_SENSEx | HPD */
-       HDMI_PHY_RXSENSE_HPD = 0xF2,
 
 /* PHY_I2CM_SLAVE_ADDR field values */
        HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2 = 0x69,