linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] PM: runtime: enable wake irq after runtime_suspend hook called
@ 2021-04-08  9:35 Chunfeng Yun
  2021-04-08  9:35 ` [PATCH 2/6] usb: xhci-mtk: check return value in suspend/resume hooks Chunfeng Yun
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-04-08  9:35 UTC (permalink / raw)
  To: Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger,
	Rafael J. Wysocki, Len Brown, Pavel Machek, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel,
	linux-pm, Tony Lindgren, Tianping Fang, Eddie Hung, Ikjoon Jang,
	Nicolas Boichat

When the dedicated wake irq is level trigger, enable it before
calling runtime_suspend, will trigger an interrupt.

e.g.
for a low level trigger type, it's low level at running time (0),
and becomes high level when enters suspend (runtime_suspend (1) is
called), a wakeup signal at (2) make it become low level, wake irq
will be triggered.

                ------------------
               |           ^     ^|
----------------           |     | --------------
 |<---(0)--->|<--(1)--|   (3)   (2)    (4)

if we enable the wake irq before calling runtime_suspend during (0),
an interrupt will arise, it causes resume immediately;
enable wake irq after calling runtime_suspend, e.g. at (3) or (4),
will works.

This patch seems no side effect on edge trigger wake irq.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/base/power/runtime.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index a46a7e30881b..796739a015a5 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -619,12 +619,12 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 	__update_runtime_status(dev, RPM_SUSPENDING);
 
 	callback = RPM_GET_CALLBACK(dev, runtime_suspend);
-
-	dev_pm_enable_wake_irq_check(dev, true);
 	retval = rpm_callback(callback, dev);
 	if (retval)
 		goto fail;
 
+	dev_pm_enable_wake_irq_check(dev, true);
+
  no_callback:
 	__update_runtime_status(dev, RPM_SUSPENDED);
 	pm_runtime_deactivate_timer(dev);
@@ -659,7 +659,6 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 	return retval;
 
  fail:
-	dev_pm_disable_wake_irq_check(dev);
 	__update_runtime_status(dev, RPM_ACTIVE);
 	dev->power.deferred_resume = false;
 	wake_up_all(&dev->power.wait_queue);
-- 
2.18.0


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

end of thread, other threads:[~2021-04-13  3:36 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  9:35 [PATCH 1/6] PM: runtime: enable wake irq after runtime_suspend hook called Chunfeng Yun
2021-04-08  9:35 ` [PATCH 2/6] usb: xhci-mtk: check return value in suspend/resume hooks Chunfeng Yun
2021-04-08  9:35 ` [PATCH 3/6] dt-bindings: usb: mtk-xhci: add wakeup interrupt Chunfeng Yun
2021-04-09 18:41   ` Rob Herring
2021-04-08  9:35 ` [PATCH 4/6] usb: xhci-mtk: add support runtime PM Chunfeng Yun
2021-04-08  9:51   ` Chunfeng Yun
2021-04-09  5:45   ` Ikjoon Jang
2021-04-09  8:54     ` Chunfeng Yun
2021-04-12  5:14       ` Ikjoon Jang
2021-04-13  3:35         ` Chunfeng Yun
2021-04-08  9:35 ` [PATCH 5/6] usb: xhci-mtk: use clock bulk to get clocks Chunfeng Yun
2021-04-08  9:35 ` [PATCH 6/6] usb: xhci-mtk: remove unused members Chunfeng Yun
2021-04-08 17:41 ` [PATCH 1/6] PM: runtime: enable wake irq after runtime_suspend hook called Rafael J. Wysocki
2021-04-09  1:53   ` Chunfeng Yun
2021-04-09  5:39     ` Tony Lindgren
2021-04-09  8:36       ` Chunfeng Yun
2021-04-09 11:14         ` Rafael J. Wysocki
2021-04-10  1:44           ` Chunfeng Yun
2021-04-09  5:32 ` Ikjoon Jang
2021-04-09  5:40   ` Tony Lindgren
2021-04-09  8:43   ` Chunfeng Yun

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