video: tegra: Wire up output connectedness
Robert Morell [Thu, 3 Mar 2011 23:04:19 +0000 (15:04 -0800)]
This makes the core dc driver keep track of whether a particular input
in enabled.  It is up to the output ops to maintain the connected status
if a detect op is plugged in, otherwise it is assumed that the output is
always connected.

bug 818525

Original-Change-Id: I794d7e2db347f63bbb1a7d80bca1a53d9d10c210
Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-on: http://git-master/r/40522
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Rfeeae486b6a39b95d9f1d95b697132b476735f50

arch/arm/mach-tegra/include/mach/dc.h
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/dc_priv.h
drivers/video/tegra/dc/ext/control.c
drivers/video/tegra/dc/hdmi.c

index c6f71af..bddab09 100644 (file)
@@ -441,6 +441,7 @@ struct tegra_dc_platform_data {
 
 struct tegra_dc *tegra_dc_get_dc(unsigned idx);
 struct tegra_dc_win *tegra_dc_get_window(struct tegra_dc *dc, unsigned win);
+bool tegra_dc_get_connected(struct tegra_dc *);
 
 void tegra_dc_enable(struct tegra_dc *dc);
 void tegra_dc_disable(struct tegra_dc *dc);
index 976770c..7f671ec 100644 (file)
@@ -527,6 +527,12 @@ static int get_topmost_window(u32 *depths, unsigned long *wins)
        return best;
 }
 
+bool tegra_dc_get_connected(struct tegra_dc *dc)
+{
+       return dc->connected;
+}
+EXPORT_SYMBOL(tegra_dc_get_connected);
+
 static u32 blend_topwin(u32 flags)
 {
        if (flags & TEGRA_WIN_FLAG_BLEND_COVERAGE)
@@ -2434,6 +2440,8 @@ static int tegra_dc_probe(struct nvhost_device *ndev)
 
        if (dc->out_ops && dc->out_ops->detect)
                dc->out_ops->detect(dc);
+       else
+               dc->connected = true;
 
        tegra_dc_create_sysfs(&dc->ndev->dev);
 
index e7e86cc..fd156a7 100644 (file)
@@ -83,6 +83,7 @@ struct tegra_dc {
        int                             emc_clk_rate;
        int                             new_emc_clk_rate;
 
+       bool                            connected;
        bool                            enabled;
        bool                            suspended;
 
index 65d302f..aab7db4 100644 (file)
@@ -36,6 +36,8 @@ int tegra_dc_ext_process_hotplug(int output)
 static int
 get_output_properties(struct tegra_dc_ext_control_output_properties *properties)
 {
+       struct tegra_dc *dc;
+
        /* TODO: this should be more dynamic */
        if (properties->handle > 2)
                return -EINVAL;
@@ -43,17 +45,19 @@ get_output_properties(struct tegra_dc_ext_control_output_properties *properties)
        switch (properties->handle) {
        case 0:
                properties->type = TEGRA_DC_EXT_LVDS;
-               properties->connected = 1;
                break;
        case 1:
                properties->type = TEGRA_DC_EXT_HDMI;
-               properties->connected = 1;
                break;
        default:
                return -EINVAL;
        }
+
        properties->associated_head = properties->handle;
 
+       dc = tegra_dc_get_dc(properties->associated_head);
+       properties->connected = tegra_dc_get_connected(dc);
+
        return 0;
 }
 
index bb912d9..20d9ec8 100644 (file)
@@ -745,6 +745,7 @@ static bool tegra_dc_hdmi_detect(struct tegra_dc *dc)
        tegra_fb_update_monspecs(dc->fb, &specs, tegra_dc_hdmi_mode_filter);
        dev_info(&dc->ndev->dev, "display detected\n");
 
+       dc->connected = true;
        tegra_dc_ext_process_hotplug(dc->ndev->id);
 
        return true;
@@ -768,6 +769,7 @@ static void tegra_dc_hdmi_detect_worker(struct work_struct *work)
                tegra_dc_disable(dc);
                tegra_fb_update_monspecs(dc->fb, NULL, NULL);
 
+               dc->connected = false;
                tegra_dc_ext_process_hotplug(dc->ndev->id);
        }
 }