[PATCH] spi: spi-sun6i: enable autosuspend feature

Maxime Ripard maxime at cerno.tech
Mon Oct 19 03:05:41 EDT 2020


Hi,

On Fri, Oct 16, 2020 at 11:38:26AM +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.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet at gmail.com>
> ---
>  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 38e5b8af7da6..4cc0280e934c 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
>  
> @@ -639,9 +641,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);

You should also mention why pm_runtime_idle isn't useful anymore in your
commit log.

Thanks!
Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20201019/f0ce4fc9/attachment.sig>


More information about the linux-arm-kernel mailing list