video: tegra: dc: move set default videomode out of _tegra_dc_enable.
Marvin Zhang [Fri, 3 Aug 2012 00:03:21 +0000 (17:03 -0700)]
Set default videomode happens during probe and resume. _tegra_dc_enable
is also called during hotplug, setting default videomode there causes
hdcp test failure.

Bug 991805

Reviewed-on: http://git-master/r/121052
(cherry picked from commit 7d4e0461a88b8cf638963e69829274824fecc38b)
Change-Id: Ic71ca4df54a2c7f4a6cb2b56143cd86f718bd39e
Signed-off-by: Marvin Zhang <mzhang@nvidia.com>
Reviewed-on: http://git-master/r/121981
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

Rebase-Id: R3f455bfff477412a7c74d04f73d4f4530b8850a6

drivers/video/tegra/dc/dc.c

index aa2b8c1..9577e2d 100644 (file)
@@ -1716,19 +1716,14 @@ static bool _tegra_dc_controller_reset_enable(struct tegra_dc *dc)
 
 static int _tegra_dc_set_default_videomode(struct tegra_dc *dc)
 {
-       return tegra_dc_set_fb_mode(dc, &tegra_dc_hdmi_fallback_mode, 0);
-}
-
-static bool _tegra_dc_enable(struct tegra_dc *dc)
-{
        if (dc->mode.pclk == 0) {
                switch (dc->out->type) {
                case TEGRA_DC_OUT_HDMI:
                /* DC enable called but no videomode is loaded.
                     Check if HDMI is connected, then set fallback mdoe */
                if (tegra_dc_hpd(dc)) {
-                       if (_tegra_dc_set_default_videomode(dc))
-                               return false;
+                       return tegra_dc_set_fb_mode(dc,
+                                       &tegra_dc_hdmi_fallback_mode, 0);
                } else
                        return false;
 
@@ -1744,6 +1739,14 @@ static bool _tegra_dc_enable(struct tegra_dc *dc)
                }
        }
 
+       return false;
+}
+
+static bool _tegra_dc_enable(struct tegra_dc *dc)
+{
+       if (dc->mode.pclk == 0)
+               return false;
+
        if (!dc->out)
                return false;
 
@@ -2129,8 +2132,10 @@ static int tegra_dc_probe(struct nvhost_device *ndev,
        }
 
        mutex_lock(&dc->lock);
-       if (dc->pdata->flags & TEGRA_DC_FLAG_ENABLED)
+       if (dc->pdata->flags & TEGRA_DC_FLAG_ENABLED) {
                dc->enabled = _tegra_dc_enable(dc);
+               _tegra_dc_set_default_videomode(dc);
+       }
        mutex_unlock(&dc->lock);
 
        /* interrupt handler must be registered before tegra_fb_register() */
@@ -2278,8 +2283,10 @@ static int tegra_dc_resume(struct nvhost_device *ndev)
        mutex_lock(&dc->lock);
        dc->suspended = false;
 
-       if (dc->enabled)
+       if (dc->enabled) {
                _tegra_dc_enable(dc);
+               _tegra_dc_set_default_videomode(dc);
+       }
 
        if (dc->out && dc->out->hotplug_init)
                dc->out->hotplug_init();