video: tegra: host: Added nvhost resume.
authorVarun Wadekar <vwadekar@nvidia.com>
Tue, 23 Nov 2010 11:55:32 +0000 (17:25 +0530)
committerErik Gilling <konkers@android.com>
Mon, 6 Dec 2010 22:17:52 +0000 (14:17 -0800)
Added nvhost device resume function, and moved syncpoints restoration
here from run-time power_host() control. Respectively added syncpoints
saving to nvhost suspend procedure. This change is required, since
power_host() has no way to account for display advancing syncpoints
after they have been already saved.

Change-Id: I2b5452dd4512c7ea16532d28a2d2894ab88929ca
Author: Alex Frid <afrid@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
drivers/video/tegra/host/dev.c

index 42d268e7da5948fbfeede3036d383d2430b172b6..d98327978ed4477b8422b4fd7c13ec70b393d0b8 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
 #include <linux/file.h>
+#include <linux/clk.h>
 
 #include <asm/io.h>
 
@@ -574,7 +575,6 @@ static void power_host(struct nvhost_module *mod, enum nvhost_power_action actio
 
        if (action == NVHOST_POWER_ACTION_ON) {
                nvhost_intr_configure(&dev->intr, clk_get_rate(mod->clk[0]));
-               nvhost_syncpt_reset(&dev->syncpt);
        }
        else if (action == NVHOST_POWER_ACTION_OFF) {
                int i;
@@ -738,13 +738,28 @@ static int nvhost_suspend(struct platform_device *pdev, pm_message_t state)
        struct nvhost_master *host = platform_get_drvdata(pdev);
        dev_info(&pdev->dev, "suspending\n");
        nvhost_module_suspend(&host->mod);
+       clk_enable(host->mod.clk[0]);
+       nvhost_syncpt_save(&host->syncpt);
+       clk_disable(host->mod.clk[0]);
        dev_info(&pdev->dev, "suspended\n");
        return 0;
 }
 
+static int nvhost_resume(struct platform_device *pdev)
+{
+       struct nvhost_master *host = platform_get_drvdata(pdev);
+       dev_info(&pdev->dev, "resuming\n");
+       clk_enable(host->mod.clk[0]);
+       nvhost_syncpt_reset(&host->syncpt);
+       clk_disable(host->mod.clk[0]);
+       dev_info(&pdev->dev, "resumed\n");
+       return 0;
+}
+
 static struct platform_driver nvhost_driver = {
        .remove = __exit_p(nvhost_remove),
        .suspend = nvhost_suspend,
+       .resume = nvhost_resume,
        .driver = {
                .owner = THIS_MODULE,
                .name = DRIVER_NAME