arm: video: tegra: dc callbacks for hotplug init
Jon Mayo [Wed, 13 Apr 2011 01:14:22 +0000 (18:14 -0700)]
add new dc out callback hotplug_init and postsuspend to handle board
specific configuration of power and gpios for detecting hotplug.

bug 812083 bug 811523

Original-Change-Id: Ia7937cc9461465502cabbd2a5efaee0093bccfe0
Reviewed-on: http://git-master/r/27570
Reviewed-by: Jonathan Mayo <jmayo@nvidia.com>
Tested-by: Jonathan Mayo <jmayo@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Original-Change-Id: Iab0fbe0e493ad3818416454ba7a2dda679f68dfb

Rebase-Id: R8869de766d7939a7be48a4860c45d18ac7a2ffed

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

index 08efecb..d602c89 100644 (file)
@@ -284,6 +284,9 @@ struct tegra_dc_out {
        int     (*enable)(void);
        int     (*postpoweron)(void);
        int     (*disable)(void);
+
+       int     (*hotplug_init)(void);
+       int     (*postsuspend)(void);
 };
 
 /* bits for tegra_dc_out.flags */
index 9d65036..e0922ec 100644 (file)
@@ -1708,6 +1708,9 @@ static int tegra_dc_probe(struct nvhost_device *ndev)
                        dc->overlay = NULL;
        }
 
+       if (dc->out && dc->out->hotplug_init)
+               dc->out->hotplug_init();
+
        if (dc->out_ops && dc->out_ops->detect)
                dc->out_ops->detect(dc);
 
@@ -1780,6 +1783,12 @@ static int tegra_dc_suspend(struct nvhost_device *ndev, pm_message_t state)
 
                dc->suspended = true;
        }
+
+       if (dc->out && dc->out->postsuspend) {
+               dc->out->postsuspend();
+               msleep(100); /* avoid resume event due to voltage falling */
+       }
+
        mutex_unlock(&dc->lock);
 
        return 0;
@@ -1797,6 +1806,9 @@ static int tegra_dc_resume(struct nvhost_device *ndev)
        if (dc->enabled)
                _tegra_dc_enable(dc);
 
+       if (dc->out && dc->out->hotplug_init)
+               dc->out->hotplug_init();
+
        if (dc->out_ops && dc->out_ops->resume)
                dc->out_ops->resume(dc);
        mutex_unlock(&dc->lock);