summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/dev.c
diff options
context:
space:
mode:
authorMayuresh Kulkarni <mkulkarni@nvidia.com>2012-02-03 15:06:07 +0530
committerSimone Willett <swillett@nvidia.com>2012-02-13 09:27:15 -0800
commit410041d0247db2434a3013f16930d2fcd16256c8 (patch)
treebf70ce748d00dad01f80f199a1d82b5f31a0ba26 /drivers/video/tegra/host/dev.c
parente8dc4bd80bf2a31b46bf2bad034dcd514c1e11f5 (diff)
video: tegra: host: use runtime pm for clock management
- use runtime pm for clock management of host1x and its clients thus replacing ACM - start a delayed worker after disabling the clock if module supports power gating - in its timeout handler power gate the module after saving its context for next submit - use auto-suspend mode of runtime pm for clock management - pm core seems to keep a ref count on runtime pm thus we cannot use runtime pm's usage_count as an idicator of module idle during suspend - do not use runtime pm call-backs during system suspend. instead manage the clocks directly for context save of modules that support it - enable runtime pm only during boot-up as pm core disables it before suspending the device and enables it after resume for bug 887332 Change-Id: I3b30643e8e75c13684cf4edaaae4429c3a18d6eb Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-on: http://git-master/r/79186 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/dev.c')
-rw-r--r--drivers/video/tegra/host/dev.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c
index 4cd1e4eaf843..c75448021484 100644
--- a/drivers/video/tegra/host/dev.c
+++ b/drivers/video/tegra/host/dev.c
@@ -35,7 +35,7 @@
#include <linux/hrtimer.h>
#define CREATE_TRACE_POINTS
#include <trace/events/nvhost.h>
-
+#include <linux/pm_runtime.h>
#include <linux/io.h>
#include <linux/nvhost.h>
@@ -984,20 +984,24 @@ static int __devinit nvhost_probe(struct platform_device *pdev)
if (err)
goto fail;
+ pm_runtime_enable(&hostdev.dev);
err = nvhost_module_init(&hostdev);
if (err)
goto fail;
for (i = 0; i < host->nb_channels; i++) {
struct nvhost_channel *ch = &host->channels[i];
+ pm_runtime_enable(&ch->dev->dev);
nvhost_module_init(ch->dev);
}
platform_set_drvdata(pdev, host);
- clk_enable(host->dev->clk[0]);
+ for (i = 0; i < host->dev->num_clks; i++)
+ clk_enable(host->dev->clk[i]);
nvhost_syncpt_reset(&host->syncpt);
- clk_disable(host->dev->clk[0]);
+ for (i = 0; i < host->dev->num_clks; i++)
+ clk_disable(host->dev->clk[i]);
nvhost_debug_init(host);
@@ -1038,7 +1042,25 @@ static int nvhost_suspend(struct platform_device *pdev, pm_message_t state)
static int nvhost_resume(struct platform_device *pdev)
{
+ int i;
+ struct nvhost_master *host = platform_get_drvdata(pdev);
+
dev_info(&pdev->dev, "resuming\n");
+
+ for (i = 0; i < host->dev->num_clks; i++)
+ clk_enable(host->dev->clk[i]);
+ if (host->dev->finalize_poweron)
+ host->dev->finalize_poweron(host->dev);
+ for (i = 0; i < host->dev->num_clks; i++)
+ clk_disable(host->dev->clk[i]);
+
+ /* enable runtime pm for host1x */
+ nvhost_module_resume(host->dev);
+
+ /* enable runtime pm for clients */
+ for (i = 0; i < host->nb_channels; i++)
+ nvhost_module_resume(host->channels[i].dev);
+
return 0;
}