linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] spi: spi-sun6i: enable autosuspend feature
@ 2020-10-19 15:03 Alexander Kochetkov
  2020-10-21 15:02 ` Maxime Ripard
  2020-10-26 23:47 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Kochetkov @ 2020-10-19 15:03 UTC (permalink / raw)
  To: Mark Brown, Maxime Ripard, Chen-Yu Tsai
  Cc: linux-spi, linux-arm-kernel, linux-kernel, Alexander Kochetkov

From: Alexander Kochetkov <al.kochet@gmail.com>

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>
---

Changes in v2:
- Extend commit description with explanation about removal
  of pm_runtime_idle()


 drivers/spi/spi-sun6i.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index 29ea1e87ce7e..86f29c3e335a 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
 
@@ -652,9 +654,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) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] spi: spi-sun6i: enable autosuspend feature
  2020-10-19 15:03 [PATCH v2] spi: spi-sun6i: enable autosuspend feature Alexander Kochetkov
@ 2020-10-21 15:02 ` Maxime Ripard
  2020-10-26 23:47 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2020-10-21 15:02 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Mark Brown, Chen-Yu Tsai, linux-spi, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

On Mon, Oct 19, 2020 at 06:03:43PM +0300, Alexander Kochetkov wrote:
> From: Alexander Kochetkov <al.kochet@gmail.com>
> 
> 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>

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] spi: spi-sun6i: enable autosuspend feature
  2020-10-19 15:03 [PATCH v2] spi: spi-sun6i: enable autosuspend feature Alexander Kochetkov
  2020-10-21 15:02 ` Maxime Ripard
@ 2020-10-26 23:47 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-10-26 23:47 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Alexander Kochetkov
  Cc: linux-kernel, linux-spi, linux-arm-kernel

On Mon, 19 Oct 2020 18:03:43 +0300, Alexander Kochetkov wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: spi-sun6i: enable autosuspend feature
      commit: ae0f18bef30d0e76dd62be46c59b24c75f175092

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-26 23:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 15:03 [PATCH v2] spi: spi-sun6i: enable autosuspend feature Alexander Kochetkov
2020-10-21 15:02 ` Maxime Ripard
2020-10-26 23:47 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).