tegra: dc: Disconnect display if there is no output driver
Raghavendra VK [Fri, 18 Oct 2013 10:58:49 +0000 (15:58 +0530)]
bug 1373849

Change-Id: I403b3f6cb8a8c2b31d5b5555721df57531ea7997
Signed-off-by: Raghavendra VK <rvk@nvidia.com>
Reviewed-on: http://git-master/r/301193
Reviewed-by: Bob Johnston <bjohnston@nvidia.com>
Tested-by: Bob Johnston <bjohnston@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/mode.c

index a58bfdf..9cf0041 100644 (file)
@@ -2901,14 +2901,19 @@ static int tegra_dc_probe(struct platform_device *ndev)
        if (dc->out && dc->out->hotplug_init)
                dc->out->hotplug_init(&ndev->dev);
 
-       if (dc->out_ops && dc->out_ops->detect)
-               dc->out_ops->detect(dc);
+       if (dc->out_ops) {
+               if (dc->out_ops->detect)
+                       dc->out_ops->detect(dc);
+               else
+                       dc->connected = true;
+       }
        else
-               dc->connected = true;
+               dc->connected = false;
 
        /* Powergate display module when it's unconnected. */
        /* detect() function, if presetns, responsible for the powergate */
-       if (!tegra_dc_get_connected(dc) && !dc->out_ops->detect)
+       if (!tegra_dc_get_connected(dc) &&
+                       !(dc->out_ops && dc->out_ops->detect))
                tegra_dc_powergate_locked(dc);
 
        tegra_dc_create_sysfs(&dc->ndev->dev);
index d26f241..20dfaf5 100644 (file)
@@ -385,8 +385,11 @@ int tegra_dc_to_fb_videomode(struct fb_videomode *fbmode,
 {
        long mode_pclk;
 
-       if (!fbmode || !mode || !mode->pclk)
+       if (!fbmode || !mode || !mode->pclk) {
+               if (fbmode)
+                       memset(fbmode, 0, sizeof(*fbmode));
                return -EINVAL;
+       }
        if (mode->rated_pclk >= 1000) /* handle DSI one-shot modes */
                mode_pclk = mode->rated_pclk;
        else if (mode->pclk >= 1000) /* normal continous modes */