summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-sun6i.c
diff options
context:
space:
mode:
authorAlexander Kochetkov <al.kochet@gmail.com>2020-10-19 18:03:43 +0300
committerMark Brown <broonie@kernel.org>2020-10-26 23:29:05 +0000
commitae0f18bef30d0e76dd62be46c59b24c75f175092 (patch)
treed7a93055b9c711852c770da98b2df15390407672 /drivers/spi/spi-sun6i.c
parent940f3bbf3dacd6e31e482a10e64c96e69b00dded (diff)
spi: spi-sun6i: enable autosuspend feature
If SPI is used for periodic polling any sensor, significant delays sometimes appear. Switching on module clocks during resume lead to delays. Enabling autosuspend mode causes the controller to not suspend between SPI transfers and the delays disappear. The commit also remove unnecessary call to pm_runtime_idle() used to explicit put device to suspended state. Without pm_runtime_idle() PM core will put device in the suspended state just after probe() returns. Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20201019150343.2520-1-akochetkov@lintech.ru Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-sun6i.c')
-rw-r--r--drivers/spi/spi-sun6i.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index 5336c5e32694..cc8401980125 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -22,6 +22,8 @@
#include <linux/spi/spi.h>
+#define SUN6I_AUTOSUSPEND_TIMEOUT 2000
+
#define SUN6I_FIFO_DEPTH 128
#define SUN8I_FIFO_DEPTH 64
@@ -650,9 +652,10 @@ static int sun6i_spi_probe(struct platform_device *pdev)
goto err_free_dma_rx;
}
+ pm_runtime_set_autosuspend_delay(&pdev->dev, SUN6I_AUTOSUSPEND_TIMEOUT);
+ pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
- pm_runtime_idle(&pdev->dev);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret) {