OMAPDSS: HDMI: Add HPD extcon
authorMarcus Cooksey <mcooksey@ti.com>
Fri, 5 Dec 2014 21:54:45 +0000 (15:54 -0600)
committerMisael Lopez Cruz <misael.lopez@ti.com>
Fri, 6 Feb 2015 21:17:42 +0000 (15:17 -0600)
Added support to notify userspace when a HDMI Hotplug (HPD) event
(attach/detached) has occurred through the extcon mechanism.

Change-Id: Ifa92528938ee95864187744f8bb3f2b1592d08e7
Signed-off-by: Marcus Cooksey <mcooksey@ti.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
drivers/video/fbdev/omap2/dss/Kconfig
drivers/video/fbdev/omap2/dss/hdmi.h
drivers/video/fbdev/omap2/dss/hdmi4.c
drivers/video/fbdev/omap2/dss/hdmi5.c

index 711098b9e81df5e3d759d119a8c385b0d27e0d76..d39a349830004aaa02138fa8b0335eaaeb4116be 100644 (file)
@@ -74,6 +74,7 @@ config OMAP_DSS_HDMI_AUDIO
 
 config OMAP4_DSS_HDMI
        bool "HDMI support for OMAP4"
+       depends on EXTCON
         default y
        select OMAP2_DSS_HDMI_COMMON
        help
@@ -94,6 +95,7 @@ config OMAP4_DSS_HDMI_AUDIO
 
 config OMAP5_DSS_HDMI
        bool "HDMI support for OMAP5"
+       depends on EXTCON
        default n
        select OMAP2_DSS_HDMI_COMMON
        help
index 66ee6b67f21a4240648690b6da392ba04bf54736..c82c823e0e1d8a18f7df95581f42e20f9725c694 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/hdmi.h>
 #include <video/omapdss.h>
 #include <video/omapdss_hdmi_audio_data.h>
+#include <linux/extcon.h>
 
 #include "dss.h"
 
@@ -330,6 +331,8 @@ struct omap_hdmi {
        struct omap_dss_device output;
 
        int wp_idlemode;
+
+       struct extcon_dev edev;
 };
 
 #endif
index ae5efc1b088c161923005224bcbd5b0c71d4cc30..85f36f9e4e9b03e57479d90d322b9a430ffe2a1f 100644 (file)
@@ -90,8 +90,10 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data)
                hdmi_wp_set_phy_pwr(wp, HDMI_PHYPWRCMD_LDOON);
        } else if (irqstatus & HDMI_IRQ_LINK_CONNECT) {
                hdmi_wp_set_phy_pwr(wp, HDMI_PHYPWRCMD_TXON);
+               extcon_set_state(&hdmi.edev, 1);
        } else if (irqstatus & HDMI_IRQ_LINK_DISCONNECT) {
                hdmi_wp_set_phy_pwr(wp, HDMI_PHYPWRCMD_LDOON);
+               extcon_set_state(&hdmi.edev, 0);
        }
 
        return IRQ_HANDLED;
@@ -696,6 +698,12 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
                return r;
        }
 
+       hdmi.edev.name = "hdmi";
+       hdmi.edev.print_state = NULL;
+       r = extcon_dev_register(&hdmi.edev);
+       if (r)
+               return r;
+
        pm_runtime_enable(&pdev->dev);
 
        hdmi_init_output(pdev);
@@ -705,6 +713,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
                DSSERR("Registering HDMI audio failed\n");
                hdmi_uninit_output(pdev);
                pm_runtime_disable(&pdev->dev);
+               extcon_dev_unregister(&hdmi.edev);
                return r;
        }
 
@@ -721,6 +730,8 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 
        pm_runtime_disable(&pdev->dev);
 
+       extcon_dev_unregister(&hdmi.edev);
+
        return 0;
 }
 
index 2a52b98d5d4c67e3b6c5c9dde0c6169b03fb536a..27edecd72dd99e12332d29eff66a27dd822d13ad 100644 (file)
@@ -109,8 +109,10 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data)
 
        } else if (irqstatus & HDMI_IRQ_LINK_CONNECT) {
                hdmi_wp_set_phy_pwr(wp, HDMI_PHYPWRCMD_TXON);
+               extcon_set_state(&hdmi.edev, 1);
        } else if (irqstatus & HDMI_IRQ_LINK_DISCONNECT) {
                hdmi_wp_set_phy_pwr(wp, HDMI_PHYPWRCMD_LDOON);
+               extcon_set_state(&hdmi.edev, 0);
        }
 
        return IRQ_HANDLED;
@@ -733,6 +735,16 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
                return r;
        }
 
+       hdmi.edev.name = "hdmi";
+       hdmi.edev.print_state = NULL;
+
+       r = extcon_dev_register(&hdmi.edev);
+       if (r)
+               return r;
+
+       /* Init extcon state to zero */
+       extcon_set_state(&hdmi.edev, 0);
+
        pm_runtime_enable(&pdev->dev);
 
        hdmi_init_output(pdev);
@@ -742,6 +754,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
                DSSERR("Registering HDMI audio failed\n");
                hdmi_uninit_output(pdev);
                pm_runtime_disable(&pdev->dev);
+               extcon_dev_unregister(&hdmi.edev);
                return r;
        }
 
@@ -758,6 +771,8 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 
        pm_runtime_disable(&pdev->dev);
 
+       extcon_dev_unregister(&hdmi.edev);
+
        return 0;
 }