summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2017-05-24 10:35:25 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-10 07:04:14 +0300
commit418f2a8cf2ebb817a2b98cb4829c13d374e06932 (patch)
tree8c7b7b202273f2fba98375a01178df20859ada11
parenta636fdce55c6ad12b07436424ceffad1045714db (diff)
downloadlinux-418f2a8cf2ebb817a2b98cb4829c13d374e06932.tar.xz
crypto: omap-des - use runtime_pm autosuspend for clock handling
Convert the driver to use autosuspend for runtime_pm. This boosts the performance, and optimizes the power consumption for the driver. By default, the timeout value for autosuspend is set to one second. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/omap-des.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index 0d68f77ea53a..3783dcf6bc37 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -78,6 +78,8 @@
#define FLAGS_INIT BIT(4)
#define FLAGS_BUSY BIT(6)
+#define DEFAULT_AUTOSUSPEND_DELAY 1000
+
struct omap_des_ctx {
struct omap_des_dev *dd;
@@ -506,8 +508,10 @@ static void omap_des_finish_req(struct omap_des_dev *dd, int err)
pr_debug("err: %d\n", err);
- pm_runtime_put(dd->dev);
crypto_finalize_cipher_request(dd->engine, req, err);
+
+ pm_runtime_mark_last_busy(dd->dev);
+ pm_runtime_put_autosuspend(dd->dev);
}
static int omap_des_crypt_dma_stop(struct omap_des_dev *dd)
@@ -1044,8 +1048,10 @@ static int omap_des_probe(struct platform_device *pdev)
}
dd->phys_base = res->start;
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY);
+
pm_runtime_enable(dev);
- pm_runtime_irq_safe(dev);
err = pm_runtime_get_sync(dev);
if (err < 0) {
pm_runtime_put_noidle(dev);