Tegra: DC: Add hotplug detect callback
Graziano Misuraca [Mon, 1 Apr 2013 23:24:57 +0000 (16:24 -0700)]
Add optional hotplug callback.

Bug 1237421

Change-Id: I865c94aede543918eeea34561e5d48fd28c739f9
Signed-off-by: Graziano Misuraca <gmisuraca@nvidia.com>
Reviewed-on: http://git-master/r/215267
(cherry picked from commit 6b0677e6dd8b4d37be34022fc1801dcddd1daf36)
Reviewed-on: http://git-master/r/224295
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/include/mach/dc.h
drivers/video/tegra/dc/dc.c

index ba5e786..7846349 100644 (file)
@@ -520,6 +520,7 @@ struct tegra_dc_out {
 
        int     (*hotplug_init)(struct device *);
        int     (*postsuspend)(void);
+       void    (*hotplug_report)(bool);
 };
 
 /* bits for tegra_dc_out.flags */
index 4d36df1..f05386d 100644 (file)
@@ -982,6 +982,7 @@ bool tegra_dc_hpd(struct tegra_dc *dc)
 {
        int sense;
        int level;
+       int hpd;
 
        if (WARN_ON(!dc || !dc->out))
                return false;
@@ -996,8 +997,13 @@ bool tegra_dc_hpd(struct tegra_dc *dc)
 
        sense = dc->out->flags & TEGRA_DC_OUT_HOTPLUG_MASK;
 
-       return (sense == TEGRA_DC_OUT_HOTPLUG_HIGH && level) ||
+       hpd = (sense == TEGRA_DC_OUT_HOTPLUG_HIGH && level) ||
                (sense == TEGRA_DC_OUT_HOTPLUG_LOW && !level);
+
+       if (dc->out->hotplug_report)
+               dc->out->hotplug_report(hpd);
+
+       return hpd;
 }
 EXPORT_SYMBOL(tegra_dc_hpd);