linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes
@ 2019-12-05 14:37 Ulf Hansson
  2019-12-05 14:37 ` [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume Ulf Hansson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ulf Hansson @ 2019-12-05 14:37 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Ulf Hansson, linux-samsung-soc, linux-arm-kernel,
	Krzysztof Kozlowski, Marek Szyprowski

I accidentally stumbled over a couple of things for the system suspend/resume
support in the pl330 driver, that I thought deserved to be improved. So here
there are, only compile tested, so far.

Kind regards
Ulf Hansson


Ulf Hansson (2):
  dmaengine: pl330: Drop boilerplate code for suspend/resume
  dmaengine: pl330: Convert to the *_late and *_early system sleep
    callbacks

 drivers/dma/pl330.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume
  2019-12-05 14:37 [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Ulf Hansson
@ 2019-12-05 14:37 ` Ulf Hansson
  2019-12-06 11:46   ` Marek Szyprowski
  2019-12-05 14:37 ` [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks Ulf Hansson
  2019-12-10  6:09 ` [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Vinod Koul
  2 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2019-12-05 14:37 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Ulf Hansson, linux-samsung-soc, linux-arm-kernel,
	Krzysztof Kozlowski, Marek Szyprowski

Let's drop the boilerplate code in the system suspend/resume callbacks and
convert to use pm_runtime_force_suspend|resume(). This change also has a
nice side effect, as pm_runtime_force_resume() may decide to leave the
device in low power state, when that is feasible, thus avoiding to waste
both time and energy during system resume.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/dma/pl330.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 6cce9ef61b29..8e01da157518 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2961,12 +2961,7 @@ static int __maybe_unused pl330_suspend(struct device *dev)
 {
 	struct amba_device *pcdev = to_amba_device(dev);
 
-	pm_runtime_disable(dev);
-
-	if (!pm_runtime_status_suspended(dev)) {
-		/* amba did not disable the clock */
-		amba_pclk_disable(pcdev);
-	}
+	pm_runtime_force_suspend(dev);
 	amba_pclk_unprepare(pcdev);
 
 	return 0;
@@ -2981,10 +2976,7 @@ static int __maybe_unused pl330_resume(struct device *dev)
 	if (ret)
 		return ret;
 
-	if (!pm_runtime_status_suspended(dev))
-		ret = amba_pclk_enable(pcdev);
-
-	pm_runtime_enable(dev);
+	pm_runtime_force_resume(dev);
 
 	return ret;
 }
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks
  2019-12-05 14:37 [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Ulf Hansson
  2019-12-05 14:37 ` [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume Ulf Hansson
@ 2019-12-05 14:37 ` Ulf Hansson
  2019-12-06 11:46   ` Marek Szyprowski
  2019-12-10  6:09 ` [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Vinod Koul
  2 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2019-12-05 14:37 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Ulf Hansson, linux-samsung-soc, linux-arm-kernel,
	Krzysztof Kozlowski, Marek Szyprowski

It has turned out that it's in general a good idea for dmaengines to allow
DMA requests during the entire dpm_suspend() phase. Therefore, convert the
pl330 driver into using SET_LATE_SYSTEM_SLEEP_PM_OPS.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/dma/pl330.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 8e01da157518..88b884cbb7c1 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2981,7 +2981,9 @@ static int __maybe_unused pl330_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume);
+static const struct dev_pm_ops pl330_pm = {
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(pl330_suspend, pl330_resume)
+};
 
 static int
 pl330_probe(struct amba_device *adev, const struct amba_id *id)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume
  2019-12-05 14:37 ` [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume Ulf Hansson
@ 2019-12-06 11:46   ` Marek Szyprowski
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2019-12-06 11:46 UTC (permalink / raw)
  To: Ulf Hansson, Vinod Koul, dmaengine
  Cc: linux-samsung-soc, linux-arm-kernel, Krzysztof Kozlowski

Hi Ulf,

On 05.12.2019 15:37, Ulf Hansson wrote:
> Let's drop the boilerplate code in the system suspend/resume callbacks and
> convert to use pm_runtime_force_suspend|resume(). This change also has a
> nice side effect, as pm_runtime_force_resume() may decide to leave the
> device in low power state, when that is feasible, thus avoiding to waste
> both time and energy during system resume.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Works fine on various Samsung Exynos boards I have for tests.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/dma/pl330.c | 12 ++----------
>   1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 6cce9ef61b29..8e01da157518 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2961,12 +2961,7 @@ static int __maybe_unused pl330_suspend(struct device *dev)
>   {
>   	struct amba_device *pcdev = to_amba_device(dev);
>   
> -	pm_runtime_disable(dev);
> -
> -	if (!pm_runtime_status_suspended(dev)) {
> -		/* amba did not disable the clock */
> -		amba_pclk_disable(pcdev);
> -	}
> +	pm_runtime_force_suspend(dev);
>   	amba_pclk_unprepare(pcdev);
>   
>   	return 0;
> @@ -2981,10 +2976,7 @@ static int __maybe_unused pl330_resume(struct device *dev)
>   	if (ret)
>   		return ret;
>   
> -	if (!pm_runtime_status_suspended(dev))
> -		ret = amba_pclk_enable(pcdev);
> -
> -	pm_runtime_enable(dev);
> +	pm_runtime_force_resume(dev);
>   
>   	return ret;
>   }

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks
  2019-12-05 14:37 ` [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks Ulf Hansson
@ 2019-12-06 11:46   ` Marek Szyprowski
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2019-12-06 11:46 UTC (permalink / raw)
  To: Ulf Hansson, Vinod Koul, dmaengine
  Cc: linux-samsung-soc, linux-arm-kernel, Krzysztof Kozlowski

Hi,

On 05.12.2019 15:37, Ulf Hansson wrote:
> It has turned out that it's in general a good idea for dmaengines to allow
> DMA requests during the entire dpm_suspend() phase. Therefore, convert the
> pl330 driver into using SET_LATE_SYSTEM_SLEEP_PM_OPS.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Works fine on various Samsung Exynos boards I have for tests.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/dma/pl330.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 8e01da157518..88b884cbb7c1 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2981,7 +2981,9 @@ static int __maybe_unused pl330_resume(struct device *dev)
>   	return ret;
>   }
>   
> -static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume);
> +static const struct dev_pm_ops pl330_pm = {
> +	SET_LATE_SYSTEM_SLEEP_PM_OPS(pl330_suspend, pl330_resume)
> +};
>   
>   static int
>   pl330_probe(struct amba_device *adev, const struct amba_id *id)

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes
  2019-12-05 14:37 [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Ulf Hansson
  2019-12-05 14:37 ` [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume Ulf Hansson
  2019-12-05 14:37 ` [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks Ulf Hansson
@ 2019-12-10  6:09 ` Vinod Koul
  2 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2019-12-10  6:09 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: dmaengine, linux-samsung-soc, linux-arm-kernel,
	Krzysztof Kozlowski, Marek Szyprowski

On 05-12-19, 15:37, Ulf Hansson wrote:
> I accidentally stumbled over a couple of things for the system suspend/resume
> support in the pl330 driver, that I thought deserved to be improved. So here
> there are, only compile tested, so far.

Applied both, thanks

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-12-10  6:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 14:37 [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Ulf Hansson
2019-12-05 14:37 ` [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume Ulf Hansson
2019-12-06 11:46   ` Marek Szyprowski
2019-12-05 14:37 ` [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks Ulf Hansson
2019-12-06 11:46   ` Marek Szyprowski
2019-12-10  6:09 ` [PATCH 0/2] dmaengine: pl330: A few system suspend/resume changes Vinod Koul

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