dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit
@ 2018-01-17  9:38 Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-01-17  9:38 UTC (permalink / raw)
  To: Vinod Koul, Dan Williams, Ulf Hansson, Rafael J . Wysocki
  Cc: dmaengine, linux-pm, linux-renesas-soc, Geert Uytterhoeven

The current (empty) system sleep callbacks rely on the PM core to force
a runtime resume to reinitialize the DMAC registers during system
resume.  Without a reinitialization, e.g. SCIF DMA will hang silently
after a system resume on R-Car Gen3.

Make this explicit by using pm_runtime_force_{suspend,resume}() as the
system sleep callbacks instead.  Use SET_LATE_SYSTEM_SLEEP_PM_OPS() as
DMA engines must be initialized before all DMA slave devices.

Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is a dependency for "[PATCH 1/2] PM / genpd: Stop/start devices
without pm_runtime_force_suspend/resume()"
(https://www.spinics.net/lists/kernel/msg2696802.html), so perhaps it
makes most sense if Rafael takes it through the PM tree?

Thanks!
---
 drivers/dma/sh/rcar-dmac.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index fb06b193ad252086..06e4e604eebb79f6 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1657,22 +1657,6 @@ static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec,
  * Power management
  */
 
-#ifdef CONFIG_PM_SLEEP
-static int rcar_dmac_sleep_suspend(struct device *dev)
-{
-	/*
-	 * TODO: Wait for the current transfer to complete and stop the device.
-	 */
-	return 0;
-}
-
-static int rcar_dmac_sleep_resume(struct device *dev)
-{
-	/* TODO: Resume transfers, if any. */
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_PM
 static int rcar_dmac_runtime_suspend(struct device *dev)
 {
@@ -1688,7 +1672,13 @@ static int rcar_dmac_runtime_resume(struct device *dev)
 #endif
 
 static const struct dev_pm_ops rcar_dmac_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(rcar_dmac_sleep_suspend, rcar_dmac_sleep_resume)
+	/*
+	 * TODO for system sleep/resume:
+	 *   - Wait for the current transfer to complete and stop the device,
+	 *   - Resume transfers, if any.
+	 */
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+				     pm_runtime_force_resume)
 	SET_RUNTIME_PM_OPS(rcar_dmac_runtime_suspend, rcar_dmac_runtime_resume,
 			   NULL)
 };

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

* dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit
@ 2018-01-17 10:00 Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2018-01-17 10:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Vinod Koul, Dan Williams, Rafael J . Wysocki, dmaengine, Linux PM,
	Linux-Renesas

On 17 January 2018 at 10:38, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> The current (empty) system sleep callbacks rely on the PM core to force
> a runtime resume to reinitialize the DMAC registers during system
> resume.  Without a reinitialization, e.g. SCIF DMA will hang silently
> after a system resume on R-Car Gen3.
>
> Make this explicit by using pm_runtime_force_{suspend,resume}() as the
> system sleep callbacks instead.  Use SET_LATE_SYSTEM_SLEEP_PM_OPS() as
> DMA engines must be initialized before all DMA slave devices.
>
> Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
> This is a dependency for "[PATCH 1/2] PM / genpd: Stop/start devices
> without pm_runtime_force_suspend/resume()"
> (https://www.spinics.net/lists/kernel/msg2696802.html), so perhaps it
> makes most sense if Rafael takes it through the PM tree?
>
> Thanks!
> ---
>  drivers/dma/sh/rcar-dmac.c | 24 +++++++-----------------
>  1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
> index fb06b193ad252086..06e4e604eebb79f6 100644
> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -1657,22 +1657,6 @@ static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec,
>   * Power management
>   */
>
> -#ifdef CONFIG_PM_SLEEP
> -static int rcar_dmac_sleep_suspend(struct device *dev)
> -{
> -       /*
> -        * TODO: Wait for the current transfer to complete and stop the device.
> -        */
> -       return 0;
> -}
> -
> -static int rcar_dmac_sleep_resume(struct device *dev)
> -{
> -       /* TODO: Resume transfers, if any. */
> -       return 0;
> -}
> -#endif
> -
>  #ifdef CONFIG_PM
>  static int rcar_dmac_runtime_suspend(struct device *dev)
>  {
> @@ -1688,7 +1672,13 @@ static int rcar_dmac_runtime_resume(struct device *dev)
>  #endif
>
>  static const struct dev_pm_ops rcar_dmac_pm = {
> -       SET_SYSTEM_SLEEP_PM_OPS(rcar_dmac_sleep_suspend, rcar_dmac_sleep_resume)
> +       /*
> +        * TODO for system sleep/resume:
> +        *   - Wait for the current transfer to complete and stop the device,
> +        *   - Resume transfers, if any.
> +        */
> +       SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> +                                    pm_runtime_force_resume)
>         SET_RUNTIME_PM_OPS(rcar_dmac_runtime_suspend, rcar_dmac_runtime_resume,
>                            NULL)
>  };
> --
> 2.7.4
>
---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit
@ 2018-01-17 10:19 Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2018-01-17 10:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Dan Williams, Ulf Hansson, Rafael J . Wysocki, dmaengine,
	linux-pm, linux-renesas-soc

On Wed, Jan 17, 2018 at 10:38:28AM +0100, Geert Uytterhoeven wrote:
> The current (empty) system sleep callbacks rely on the PM core to force
> a runtime resume to reinitialize the DMAC registers during system
> resume.  Without a reinitialization, e.g. SCIF DMA will hang silently
> after a system resume on R-Car Gen3.
> 
> Make this explicit by using pm_runtime_force_{suspend,resume}() as the
> system sleep callbacks instead.  Use SET_LATE_SYSTEM_SLEEP_PM_OPS() as
> DMA engines must be initialized before all DMA slave devices.
> 
> Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This is a dependency for "[PATCH 1/2] PM / genpd: Stop/start devices
> without pm_runtime_force_suspend/resume()"
> (https://www.spinics.net/lists/kernel/msg2696802.html), so perhaps it
> makes most sense if Rafael takes it through the PM tree?

Sounds okay to me.

Acked-By: Vinod Koul <vinod.koul@intel.com>

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

* dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit
@ 2018-01-17 11:15 Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2018-01-17 11:15 UTC (permalink / raw)
  To: Vinod Koul, Geert Uytterhoeven
  Cc: Dan Williams, Ulf Hansson, dmaengine, linux-pm, linux-renesas-soc

On Wednesday, January 17, 2018 11:19:17 AM CET Vinod Koul wrote:
> On Wed, Jan 17, 2018 at 10:38:28AM +0100, Geert Uytterhoeven wrote:
> > The current (empty) system sleep callbacks rely on the PM core to force
> > a runtime resume to reinitialize the DMAC registers during system
> > resume.  Without a reinitialization, e.g. SCIF DMA will hang silently
> > after a system resume on R-Car Gen3.
> > 
> > Make this explicit by using pm_runtime_force_{suspend,resume}() as the
> > system sleep callbacks instead.  Use SET_LATE_SYSTEM_SLEEP_PM_OPS() as
> > DMA engines must be initialized before all DMA slave devices.
> > 
> > Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > This is a dependency for "[PATCH 1/2] PM / genpd: Stop/start devices
> > without pm_runtime_force_suspend/resume()"
> > (https://www.spinics.net/lists/kernel/msg2696802.html), so perhaps it
> > makes most sense if Rafael takes it through the PM tree?
> 
> Sounds okay to me.
> 
> Acked-By: Vinod Koul <vinod.koul@intel.com>

OK, so I'll take it.

Thanks!
---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-01-17 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-17  9:38 dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2018-01-17 10:00 Ulf Hansson
2018-01-17 10:19 Vinod Koul
2018-01-17 11:15 Rafael J. Wysocki

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