All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: designware: Make sure the device is suspended before disabling runtime PM
@ 2015-06-17  9:08 Mika Westerberg
       [not found] ` <1434532118-119906-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mika Westerberg @ 2015-06-17  9:08 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Christian Ruppert, jarkko.nikula-VuQAYsv1563Yd54FQh9/CA,
	Mika Westerberg, linux-i2c-u79uwXL29TY76Z2rM5mHXA

The driver calls pm_runtime_put() right before pm_runtime_disable() in its
->remove() hook to make sure clock is gated etc. However, it turns out that
pm_runtime_put() only calls ->idle() hook without actually suspending
anything. The following pm_runtime_disable() will prevent the driver from
suspending thus leaving it "active".

It is better to suspend the device synchronously to make sure it is
actually suspended before disabling runtime PM from it.

While there, undo call to pm_runtime_use_autosuspend().

Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 4794911a6165..3dd2de31a2f8 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -281,7 +281,8 @@ static int dw_i2c_remove(struct platform_device *pdev)
 
 	i2c_dw_disable(dev);
 
-	pm_runtime_put(&pdev->dev);
+	pm_runtime_dont_use_autosuspend(&pdev->dev);
+	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	if (has_acpi_companion(&pdev->dev))
-- 
2.1.4

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

* Re: [PATCH] i2c: designware: Make sure the device is suspended before disabling runtime PM
       [not found] ` <1434532118-119906-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2015-06-17 10:16   ` Wolfram Sang
  2015-06-17 10:24     ` Mika Westerberg
  2015-06-21 19:31   ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2015-06-17 10:16 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Christian Ruppert, jarkko.nikula-VuQAYsv1563Yd54FQh9/CA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

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

On Wed, Jun 17, 2015 at 12:08:38PM +0300, Mika Westerberg wrote:
> The driver calls pm_runtime_put() right before pm_runtime_disable() in its
> ->remove() hook to make sure clock is gated etc. However, it turns out that
> pm_runtime_put() only calls ->idle() hook without actually suspending
> anything. The following pm_runtime_disable() will prevent the driver from
> suspending thus leaving it "active".
> 
> It is better to suspend the device synchronously to make sure it is
> actually suspended before disabling runtime PM from it.
> 
> While there, undo call to pm_runtime_use_autosuspend().
> 
> Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

For current? For next? stable?


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] i2c: designware: Make sure the device is suspended before disabling runtime PM
  2015-06-17 10:16   ` Wolfram Sang
@ 2015-06-17 10:24     ` Mika Westerberg
  0 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2015-06-17 10:24 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Christian Ruppert, jarkko.nikula-VuQAYsv1563Yd54FQh9/CA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Wed, Jun 17, 2015 at 12:16:45PM +0200, Wolfram Sang wrote:
> On Wed, Jun 17, 2015 at 12:08:38PM +0300, Mika Westerberg wrote:
> > The driver calls pm_runtime_put() right before pm_runtime_disable() in its
> > ->remove() hook to make sure clock is gated etc. However, it turns out that
> > pm_runtime_put() only calls ->idle() hook without actually suspending
> > anything. The following pm_runtime_disable() will prevent the driver from
> > suspending thus leaving it "active".
> > 
> > It is better to suspend the device synchronously to make sure it is
> > actually suspended before disabling runtime PM from it.
> > 
> > While there, undo call to pm_runtime_use_autosuspend().
> > 
> > Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> For current? For next? stable?
> 

Right, sorry about that.

I think it is fine to get this for next.

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

* Re: [PATCH] i2c: designware: Make sure the device is suspended before disabling runtime PM
       [not found] ` <1434532118-119906-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  2015-06-17 10:16   ` Wolfram Sang
@ 2015-06-21 19:31   ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2015-06-21 19:31 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Christian Ruppert, jarkko.nikula-VuQAYsv1563Yd54FQh9/CA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

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

On Wed, Jun 17, 2015 at 12:08:38PM +0300, Mika Westerberg wrote:
> The driver calls pm_runtime_put() right before pm_runtime_disable() in its
> ->remove() hook to make sure clock is gated etc. However, it turns out that
> pm_runtime_put() only calls ->idle() hook without actually suspending
> anything. The following pm_runtime_disable() will prevent the driver from
> suspending thus leaving it "active".
> 
> It is better to suspend the device synchronously to make sure it is
> actually suspended before disabling runtime PM from it.
> 
> While there, undo call to pm_runtime_use_autosuspend().
> 
> Signed-off-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Applied to for-next, thanks!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-06-21 19:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17  9:08 [PATCH] i2c: designware: Make sure the device is suspended before disabling runtime PM Mika Westerberg
     [not found] ` <1434532118-119906-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-06-17 10:16   ` Wolfram Sang
2015-06-17 10:24     ` Mika Westerberg
2015-06-21 19:31   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.