summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorEric Miao <emiao@nvidia.com>2013-03-06 19:30:26 +0800
committerRiham Haidar <rhaidar@nvidia.com>2013-03-18 17:24:02 -0700
commit762c897f0ccd4bf3282cd8f97c869b07f3feba45 (patch)
treedf05b2716c0bb11d81a033879a45b659cd2364d3 /drivers/crypto
parent98cbfb520ceaca002e28d836f4d1c6b0f99430a9 (diff)
crypto: tegra-se: put device into runtime suspend state when suspending
To prevent the device being accidentally put into runtime suspend state during the whole system suspend process, pm_runtime_get_noresume() is called upon _every_ device to increase the usage count (please refer to drivers/base/power/main.c). Since we don't explicitly disable the clock, pm_runtime_put_sync() in each operation in tegra_se_suspend() will not actually call the runtime suspend function, thus leaving the clock still enabled. To fix this issue in a simple way, we call pm_runtime_put_sync() in the end of tegra_se_suspend() to decrease the usage count to "0" and thus call tegra_se_runtime_suspend() in turn to disable the clock. To pair the usage count, we do a pm_runtime_get_noresume() in tegra_se_resume() as we don't actually need to runtime resume the device there. Bug 1246029 Change-Id: I64520b022b896f2867934255a55b852fafac4b63 Signed-off-by: Eric Miao <emiao@nvidia.com> Reviewed-on: http://git-master/r/206658 GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/tegra-se.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/crypto/tegra-se.c b/drivers/crypto/tegra-se.c
index 88084ee44cf8..6e48db942722 100644
--- a/drivers/crypto/tegra-se.c
+++ b/drivers/crypto/tegra-se.c
@@ -4,7 +4,7 @@
*
* Support for Tegra Security Engine hardware crypto algorithms.
*
- * Copyright (c) 2011-2012, NVIDIA Corporation. All Rights Reserved.
+ * Copyright (c) 2011-2013, NVIDIA Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -2677,11 +2677,6 @@ static int __devexit tegra_se_remove(struct platform_device *pdev)
}
#if defined(CONFIG_PM)
-static int tegra_se_resume(struct device *dev)
-{
- return 0;
-}
-
static int tegra_se_generate_rng_key(struct tegra_se_dev *se_dev)
{
int ret = 0;
@@ -3168,8 +3163,17 @@ static int tegra_se_suspend(struct device *dev)
}
out:
+ /* put the device into runtime suspend state - disable clock */
+ pm_runtime_put_sync(dev);
return err;
}
+
+static int tegra_se_resume(struct device *dev)
+{
+ /* pair with tegra_se_suspend, no need to actually enable clock */
+ pm_runtime_get_noresume(dev);
+ return 0;
+}
#endif
#if defined(CONFIG_PM_RUNTIME)