lkml.org 
[lkml]   [2019]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/3] spi: dw: Add basic runtime PM support
Hi Gareth,

On Fri, Sep 13, 2019 at 2:13 PM Gareth Williams
<gareth.williams.jx@renesas.com> wrote:
> From: Phil Edworthy <phil.edworthy@renesas.com>
>
> Enable runtime PM so that the clock used to access the registers in the
> peripheral is turned on using a clock domain.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Signed-off-by: Gareth Williams <gareth.williams.jx@renesas.com>

Thanks for your patch!

> --- a/drivers/spi/spi-dw.c
> +++ b/drivers/spi/spi-dw.c
> @@ -10,6 +10,7 @@
> #include <linux/module.h>
> #include <linux/highmem.h>
> #include <linux/delay.h>
> +#include <linux/pm_runtime.h>
> #include <linux/slab.h>
> #include <linux/spi/spi.h>
>
> @@ -497,6 +498,9 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
> if (dws->set_cs)
> master->set_cs = dws->set_cs;
>
> + pm_runtime_enable(dev);
> + pm_runtime_get_sync(dev);

The second line keeps the device powered all the time.
What about setting spi_controller.auto_runtime_pm = true, so the SPI
code can manage its Runtime PM status?

> +
> /* Basic HW init */
> spi_hw_init(dev, dws);
>

What about the error path?
Don't you need to disable Runtime PM again in dw_spi_remove_host()?

I assume this will be called from drivers/spi/spi-dw-mmio.c, which already
enables the clock explicitly all the timer?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2019-09-16 16:36    [W:0.091 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site