summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jiang <chaoj@nvidia.com>2012-03-01 13:07:26 +0900
committerSimone Willett <swillett@nvidia.com>2012-03-02 18:07:52 -0800
commitabf888f5810713adb049b5aa79bf6ac58398435f (patch)
treeec5923f34024751238b1b234886d5d444c912895
parent5dbd2046e1cfb883be3f3655bd6a68de5fd604a3 (diff)
dtv: Added power management support
Added suspend/resume function in kernel model to support power management. fixed bug 914638 Change-Id: I2746710b6eba6d2528f27b4226383985e314943f Signed-off-by: Adam Jiang <chaoj@nvidia.com> Reviewed-on: http://git-master/r/86757 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--drivers/media/video/tegra/tegra_dtv.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/media/video/tegra/tegra_dtv.c b/drivers/media/video/tegra/tegra_dtv.c
index e1e2596007f6..97a1f231ec58 100644
--- a/drivers/media/video/tegra/tegra_dtv.c
+++ b/drivers/media/video/tegra/tegra_dtv.c
@@ -1011,6 +1011,8 @@ static int __devexit tegra_dtv_remove(struct platform_device *pdev)
tear_down_dma(dtv_ctx);
release_stream_buffer(&dtv_ctx->stream, dtv_ctx->stream.num_bufs);
+ clk_put(dtv_ctx->clk);
+
misc_deregister(&dtv_ctx->miscdev);
return 0;
@@ -1019,11 +1021,38 @@ static int __devexit tegra_dtv_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int tegra_dtv_suspend(struct platform_device *pdev, pm_message_t state)
{
+ struct tegra_dtv_context *dtv_ctx;
+
+ pr_info("%s: suspend dtv.\n", __func__);
+
+ dtv_ctx = platform_get_drvdata(pdev);
+
+ /* stop xferring */
+ mutex_lock(&dtv_ctx->stream.mtx);
+ if (dtv_ctx->stream.xferring) {
+ stop_xfer_unsafe(&dtv_ctx->stream);
+ /* clean up stop condition */
+ complete(&dtv_ctx->stream.stop_completion);
+ __force_xfer_stop(&dtv_ctx->stream);
+ }
+ /* wakeup any pending process */
+ wakeup_suspend(&dtv_ctx->stream);
+ mutex_unlock(&dtv_ctx->stream.mtx);
+
+ clk_disable(dtv_ctx->clk);
+
return 0;
}
static int tegra_dtv_resume(struct platform_device *pdev)
{
+ struct tegra_dtv_context *dtv_ctx;
+
+ pr_info("%s: resume dtv.\n", __func__);
+
+ dtv_ctx = platform_get_drvdata(pdev);
+ clk_enable(dtv_ctx->clk);
+
return 0;
}
#endif /* CONFIG_PM */