linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb
@ 2025-09-22  2:21 Peng Fan
  2025-09-22  2:21 ` [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices Peng Fan
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Peng Fan @ 2025-09-22  2:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen
  Cc: linux-pm, linux-kernel, linux-usb, imx, linux-arm-kernel,
	Peng Fan, Xu Yang

To i.MX95, USB2 and USB3 are in HSIOMIX domain, but there is always on logic
to make USB2 and USB3 has wakeup capability when HSIOMIX power domain
is in off state. So when in system-suspend state, USB2/USB3 could wakeup
the system even the USB2/USB3 HSIOMIX power domain is turned off. This
means USB2/USB3 has out-of-band wakeup capability to wakeup system from
suspended state.

Without this patchset, if USB2/USB3 are configured with wakeup enabled,
the HSIOMIX power domain will not be turned off. This leads to more
power consumed in system suspend state.

This patchset introduces device_set_out_band_wakeup and
device_out_band_wakeup two APIs to set out-of-band and query the flag.
In genpd_finish_suspend, there is a check, if out-of-band is set,
it will continue to turn off the power domain. In genpd resume flow,
there is a similar check to turn on the power domain.

Patch 1,2 introduces device_set_out_band_wakeup and
device_out_band_wakeup
Patch 3 and 4 are drivers changes to use device_out_band_wakeup

More old discussions:
https://lore.kernel.org/linux-pm/20250311083239.3336439-1-peng.fan@oss.nxp.com/

This is pick up of [1]
This V2 patchset
- includes usb driver changes to give people a full picture on how it is used.
- Rebased next-20250729 to resolve conflicts

[1]https://lore.kernel.org/linux-pm/20250311083239.3336439-1-peng.fan@oss.nxp.com/

Changes in v4:
- Split device_set_out_band_wakeup API and pmdomain changes into patch 1
  and 2 and clear the flag in device_prepare (from Ulf)
- Add R-b in patch 2
- Move the call of device_set_out_band_wakeup to system suspend
  callback in patch 3 and 4. (from Ulf)
- For patch 3,4, I still keep the Tags, since compared with V3, it is quite
  small changes.
- Link to v3: https://lore.kernel.org/r/20250902-pm-v3-0-ffadbb454cdc@nxp.com

Changes in v3:
- Add a new patch from Xu Yang to detach power domain for ci hdrc
- Add A-b for patch 4
- Link to v2: https://lore.kernel.org/r/20250801-pm-v2-0-97c8fb2a433c@nxp.com

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (4):
      PM: wakeup: Add out-of-band system wakeup support for devices
      PM: domains: Allow power-off for out-of-band wakeup-capable devices
      usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
      usb: dwc3: imx8mp: Set out of band wakeup for i.MX95

Xu Yang (1):
      usb: chipidea: core: detach power domain for ci_hdrc platform device

 drivers/base/power/main.c          |  1 +
 drivers/pmdomain/core.c            |  6 ++++--
 drivers/usb/chipidea/ci_hdrc_imx.c | 11 ++++++++++-
 drivers/usb/chipidea/core.c        |  3 +++
 drivers/usb/dwc3/dwc3-imx8mp.c     |  9 +++++++--
 include/linux/pm.h                 |  1 +
 include/linux/pm_wakeup.h          | 17 +++++++++++++++++
 include/linux/usb/chipidea.h       |  1 +
 8 files changed, 44 insertions(+), 5 deletions(-)
---
base-commit: 8f7f8b1b3f4c613dd886f53f768f82816b41eaa3
change-id: 20250919-pm-v4-1879568de500

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>



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

* [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
@ 2025-09-22  2:21 ` Peng Fan
  2025-09-23  9:40   ` Dhruva Gole
  2025-09-22  2:21 ` [PATCH v4 2/5] PM: domains: Allow power-off for out-of-band wakeup-capable devices Peng Fan
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Peng Fan @ 2025-09-22  2:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen
  Cc: linux-pm, linux-kernel, linux-usb, imx, linux-arm-kernel,
	Peng Fan

Some devices can wake up the system from suspend even when their power
domains are turned off. This is possible because their system-wakeup logic
resides in an always-on power domain - indicating that they support
out-of-band system wakeup.

Currently, PM domain core doesn't power off such devices if they are marked
as system wakeup sources. To better represent devices with out-of-band
wakeup capability, this patch introduces a new flag out_band_wakeup in
'struct dev_pm_info'.

Two helper APIs are added:
 - device_set_out_band_wakeup() - to mark a device as having out-of-band
   wakeup capability.
 - device_out_band_wakeup() - to query the flag.

Allow the PM core and drivers to distinguish between regular and
out-of-band wakeup sources, enable more accurate power management decision.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/base/power/main.c |  1 +
 include/linux/pm.h        |  1 +
 include/linux/pm_wakeup.h | 17 +++++++++++++++++
 3 files changed, 19 insertions(+)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index b9a34c3425ecfab038097e2c03645157af2e598c..6b1ca729dc3e34292952c9c309aab3f34a0a664a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -2124,6 +2124,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
 	device_lock(dev);
 
 	dev->power.wakeup_path = false;
+	dev->power.out_band_wakeup = false;
 
 	if (dev->power.no_pm_callbacks)
 		goto unlock;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index cc7b2dc28574c24ece2f651352d4d23ecaf15f31..5b28a4f2e87e2aa34acc709e146ce729acace344 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -684,6 +684,7 @@ struct dev_pm_info {
 	bool			smart_suspend:1;	/* Owned by the PM core */
 	bool			must_resume:1;		/* Owned by the PM core */
 	bool			may_skip_resume:1;	/* Set by subsystems */
+	bool			out_band_wakeup:1;
 	bool			strict_midlayer:1;
 #else
 	bool			should_wakeup:1;
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index c838b4a30f876ef5a66972d16f461cfba9ff2814..41e8f344a20563898e827da62dd240b8cbe657d2 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -94,6 +94,16 @@ static inline void device_set_wakeup_path(struct device *dev)
 	dev->power.wakeup_path = true;
 }
 
+static inline void device_set_out_band_wakeup(struct device *dev)
+{
+	dev->power.out_band_wakeup = true;
+}
+
+static inline bool device_out_band_wakeup(struct device *dev)
+{
+	return dev->power.out_band_wakeup;
+}
+
 /* drivers/base/power/wakeup.c */
 extern struct wakeup_source *wakeup_source_register(struct device *dev,
 						    const char *name);
@@ -162,6 +172,13 @@ static inline bool device_wakeup_path(struct device *dev)
 
 static inline void device_set_wakeup_path(struct device *dev) {}
 
+static inline void device_set_out_band_wakeup(struct device *dev) {}
+
+static inline bool device_out_band_wakeup(struct device *dev)
+{
+	return false;
+}
+
 static inline void __pm_stay_awake(struct wakeup_source *ws) {}
 
 static inline void pm_stay_awake(struct device *dev) {}

-- 
2.37.1



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

* [PATCH v4 2/5] PM: domains: Allow power-off for out-of-band wakeup-capable devices
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
  2025-09-22  2:21 ` [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices Peng Fan
@ 2025-09-22  2:21 ` Peng Fan
  2025-09-23  9:44   ` Dhruva Gole
  2025-09-22  2:21 ` [PATCH v4 3/5] usb: chipidea: core: detach power domain for ci_hdrc platform device Peng Fan
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Peng Fan @ 2025-09-22  2:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen
  Cc: linux-pm, linux-kernel, linux-usb, imx, linux-arm-kernel,
	Peng Fan

Currently, if a device is configured as a system wakeup source, the PM
domain core avoids powering off its power domain during system-wide
suspend. However, this can lead to unnecessary power consumption,
especially for devices whose wakeup logic resides in an always-on domain,
i.e., devices with out-of-band wakeup capability.

To address this, add a check for device_out_band_wakeup() in
genpd_finish_suspend(). If the device supports out-of-band wakeup, its
power domain can be safely powered off, just like regular devices without
wakeup enabled. And same check in genpd_finish_resume().

This change improves power efficiency without compromising wakeup
functionality.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/pmdomain/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 61c2277c9ce39fcd2f7e77df549626e49a4d5310..4925bc1c441078a8d38600192ee696bf550e80f0 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -1545,7 +1545,8 @@ static int genpd_finish_suspend(struct device *dev,
 	if (ret)
 		return ret;
 
-	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd))
+	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd) &&
+	    !device_out_band_wakeup(dev))
 		return 0;
 
 	if (genpd->dev_ops.stop && genpd->dev_ops.start &&
@@ -1600,7 +1601,8 @@ static int genpd_finish_resume(struct device *dev,
 	if (IS_ERR(genpd))
 		return -EINVAL;
 
-	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd))
+	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd) &&
+	    !device_out_band_wakeup(dev))
 		return resume_noirq(dev);
 
 	genpd_lock(genpd);

-- 
2.37.1



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

* [PATCH v4 3/5] usb: chipidea: core: detach power domain for ci_hdrc platform device
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
  2025-09-22  2:21 ` [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices Peng Fan
  2025-09-22  2:21 ` [PATCH v4 2/5] PM: domains: Allow power-off for out-of-band wakeup-capable devices Peng Fan
@ 2025-09-22  2:21 ` Peng Fan
  2025-09-24  0:35   ` Peter Chen (CIX)
  2025-09-22  2:21 ` [PATCH v4 4/5] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95 Peng Fan
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Peng Fan @ 2025-09-22  2:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen
  Cc: linux-pm, linux-kernel, linux-usb, imx, linux-arm-kernel,
	Peng Fan, Xu Yang

From: Xu Yang <xu.yang_2@nxp.com>

When add a platform device by calling ci_hdrc_add_device(), this device
will reuse OF node of its parent device. If power-domains property is
provided in the OF node, both two platform devices will be attached to
the same power domain. This should be unnecessary and may bring other
inconsistent behavior. For example, to support wakeup capability, these
two platform device need different power domain state. The parent device
need NOT power domain on for out-band interrupt, but the ci_hdrc device
need power domain on for in-band interrupt. The i.MX95 Soc support
out-band wakeup interrupt, the user need to enable wakeup for the parent
device, but if the user also enable wakeup for ci_hdrc device, the power
domain will keep at on state finally. To exclude such inconsistent
behavior and simplify the power management, detach power domain for ci_hdrc
platform device.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/usb/chipidea/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 694b4a8e4e1d8583dcbf4a42f8c2dfd785d5745c..70597f40b9997a9766934c67bbbed38e96c210f8 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
+#include <linux/pm_domain.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
@@ -915,6 +916,8 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
 	if (ret)
 		goto err;
 
+	dev_pm_domain_detach(&pdev->dev, false);
+
 	return pdev;
 
 err:

-- 
2.37.1



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

* [PATCH v4 4/5] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
                   ` (2 preceding siblings ...)
  2025-09-22  2:21 ` [PATCH v4 3/5] usb: chipidea: core: detach power domain for ci_hdrc platform device Peng Fan
@ 2025-09-22  2:21 ` Peng Fan
  2025-09-24  0:52   ` Peter Chen (CIX)
  2025-09-22  2:21 ` [PATCH v4 5/5] usb: dwc3: imx8mp: " Peng Fan
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Peng Fan @ 2025-09-22  2:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen
  Cc: linux-pm, linux-kernel, linux-usb, imx, linux-arm-kernel,
	Peng Fan, Xu Yang

i.MX95 USB2 inside HSIOMIX could still wakeup Linux, even if HSIOMIX
power domain(Digital logic) is off. There is still always on logic
have the wakeup capability which is out band wakeup capbility.

So use device_set_out_band_wakeup for i.MX95 to make sure usb2 could
wakeup system even if HSIOMIX power domain is in off state.

Tested-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 11 ++++++++++-
 include/linux/usb/chipidea.h       |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index d7c2a1a3c2715967203b98c819fa864e06a00a32..d4ee9e16332fe8b506711e4739c9008f73a377bf 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -79,6 +79,10 @@ static const struct ci_hdrc_imx_platform_flag imx8ulp_usb_data = {
 		CI_HDRC_HAS_PORTSC_PEC_MISSED,
 };
 
+static const struct ci_hdrc_imx_platform_flag imx95_usb_data = {
+	.flags = CI_HDRC_SUPPORTS_RUNTIME_PM | CI_HDRC_OUT_BAND_WAKEUP,
+};
+
 static const struct ci_hdrc_imx_platform_flag s32g_usb_data = {
 	.flags = CI_HDRC_DISABLE_HOST_STREAMING,
 };
@@ -94,6 +98,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
 	{ .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
 	{ .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data},
 	{ .compatible = "fsl,imx8ulp-usb", .data = &imx8ulp_usb_data},
+	{ .compatible = "fsl,imx95-usb", .data = &imx95_usb_data},
 	{ .compatible = "nxp,s32g2-usb", .data = &s32g_usb_data},
 	{ /* sentinel */ }
 };
@@ -704,9 +709,13 @@ static int ci_hdrc_imx_suspend(struct device *dev)
 
 	pinctrl_pm_select_sleep_state(dev);
 
-	if (data->wakeup_irq > 0 && device_may_wakeup(dev))
+	if (data->wakeup_irq > 0 && device_may_wakeup(dev)) {
 		enable_irq_wake(data->wakeup_irq);
 
+		if (data->plat_data->flags & CI_HDRC_OUT_BAND_WAKEUP)
+			device_set_out_band_wakeup(dev);
+	}
+
 	return ret;
 }
 
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index e17ebeee24e3ecc4b1c2d153d9ea9b656b5a3d35..c6451191d2de68607a9380482701d11f949d0ff7 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -66,6 +66,7 @@ struct ci_hdrc_platform_data {
 #define CI_HDRC_HAS_PORTSC_PEC_MISSED	BIT(17)
 #define CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS	BIT(18)
 #define	CI_HDRC_HAS_SHORT_PKT_LIMIT	BIT(19)
+#define	CI_HDRC_OUT_BAND_WAKEUP		BIT(20)
 	enum usb_dr_mode	dr_mode;
 #define CI_HDRC_CONTROLLER_RESET_EVENT		0
 #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1

-- 
2.37.1



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

* [PATCH v4 5/5] usb: dwc3: imx8mp: Set out of band wakeup for i.MX95
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
                   ` (3 preceding siblings ...)
  2025-09-22  2:21 ` [PATCH v4 4/5] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95 Peng Fan
@ 2025-09-22  2:21 ` Peng Fan
  2025-09-23 10:07 ` [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Ulf Hansson
  2025-10-13 11:15 ` Ulf Hansson
  6 siblings, 0 replies; 15+ messages in thread
From: Peng Fan @ 2025-09-22  2:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen
  Cc: linux-pm, linux-kernel, linux-usb, imx, linux-arm-kernel,
	Peng Fan, Xu Yang

i.MX95 DWC3 inside HSIOMIX could still wakeup Linux, even if HSIOMIX
power domain(Digital logic) is off. There is still always on logic
have the wakeup capability which is out band wakeup capbility.

So use device_set_out_band_wakeup for i.MX95 to make sure DWC3 could
wakeup system even if HSIOMIX power domain is in off state.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Tested-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/usb/dwc3/dwc3-imx8mp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index bce6af82f54c24423c1e1fcc46913c8456b6f035..225d59e9c1901c36be1fc18311dace6cdd45de75 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -334,10 +334,15 @@ static int dwc3_imx8mp_pm_suspend(struct device *dev)
 
 	ret = dwc3_imx8mp_suspend(dwc3_imx, PMSG_SUSPEND);
 
-	if (device_may_wakeup(dwc3_imx->dev))
+	if (device_may_wakeup(dwc3_imx->dev)) {
 		enable_irq_wake(dwc3_imx->irq);
-	else
+
+		if (device_is_compatible(dev, "fsl,imx95-dwc3"))
+			device_set_out_band_wakeup(dev);
+
+	} else {
 		clk_disable_unprepare(dwc3_imx->suspend_clk);
+	}
 
 	clk_disable_unprepare(dwc3_imx->hsio_clk);
 	dev_dbg(dev, "dwc3 imx8mp pm suspend.\n");

-- 
2.37.1



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

* Re: [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices
  2025-09-22  2:21 ` [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices Peng Fan
@ 2025-09-23  9:40   ` Dhruva Gole
  0 siblings, 0 replies; 15+ messages in thread
From: Dhruva Gole @ 2025-09-23  9:40 UTC (permalink / raw)
  To: Peng Fan
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen, linux-pm, linux-kernel, linux-usb, imx,
	linux-arm-kernel

On Sep 22, 2025 at 10:21:06 +0800, Peng Fan wrote:
> Some devices can wake up the system from suspend even when their power
> domains are turned off. This is possible because their system-wakeup logic
> resides in an always-on power domain - indicating that they support
> out-of-band system wakeup.
> 
> Currently, PM domain core doesn't power off such devices if they are marked
> as system wakeup sources. To better represent devices with out-of-band

This commit message makes things much clearer now. Thanks!

> wakeup capability, this patch introduces a new flag out_band_wakeup in
> 'struct dev_pm_info'.
> 
> Two helper APIs are added:
>  - device_set_out_band_wakeup() - to mark a device as having out-of-band
>    wakeup capability.
>  - device_out_band_wakeup() - to query the flag.
> 
> Allow the PM core and drivers to distinguish between regular and
> out-of-band wakeup sources, enable more accurate power management decision.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---

Reviewed-by: Dhruva Gole <d-gole@ti.com>

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated


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

* Re: [PATCH v4 2/5] PM: domains: Allow power-off for out-of-band wakeup-capable devices
  2025-09-22  2:21 ` [PATCH v4 2/5] PM: domains: Allow power-off for out-of-band wakeup-capable devices Peng Fan
@ 2025-09-23  9:44   ` Dhruva Gole
  0 siblings, 0 replies; 15+ messages in thread
From: Dhruva Gole @ 2025-09-23  9:44 UTC (permalink / raw)
  To: Peng Fan
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen, linux-pm, linux-kernel, linux-usb, imx,
	linux-arm-kernel

On Sep 22, 2025 at 10:21:07 +0800, Peng Fan wrote:
> Currently, if a device is configured as a system wakeup source, the PM
> domain core avoids powering off its power domain during system-wide
> suspend. However, this can lead to unnecessary power consumption,
> especially for devices whose wakeup logic resides in an always-on domain,
> i.e., devices with out-of-band wakeup capability.
> 
> To address this, add a check for device_out_band_wakeup() in
> genpd_finish_suspend(). If the device supports out-of-band wakeup, its
> power domain can be safely powered off, just like regular devices without
> wakeup enabled. And same check in genpd_finish_resume().

Seems very well structured now! Thanks.

> 
> This change improves power efficiency without compromising wakeup
> functionality.

On a lighter note-
This seems like an AI generated sentence to me :P

I've often seen LLMs throw around terms like improve code / power
efficiency, etc...

> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/pmdomain/core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index 61c2277c9ce39fcd2f7e77df549626e49a4d5310..4925bc1c441078a8d38600192ee696bf550e80f0 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -1545,7 +1545,8 @@ static int genpd_finish_suspend(struct device *dev,
>  	if (ret)
>  		return ret;
>  
> -	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd))
> +	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd) &&
> +	    !device_out_band_wakeup(dev))
>  		return 0;
>  
>  	if (genpd->dev_ops.stop && genpd->dev_ops.start &&
> @@ -1600,7 +1601,8 @@ static int genpd_finish_resume(struct device *dev,
>  	if (IS_ERR(genpd))
>  		return -EINVAL;
>  
> -	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd))
> +	if (device_awake_path(dev) && genpd_is_active_wakeup(genpd) &&
> +	    !device_out_band_wakeup(dev))
>  		return resume_noirq(dev);

Reviewed-by: Dhruva Gole <d-gole@ti.com>

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated


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

* Re: [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
                   ` (4 preceding siblings ...)
  2025-09-22  2:21 ` [PATCH v4 5/5] usb: dwc3: imx8mp: " Peng Fan
@ 2025-09-23 10:07 ` Ulf Hansson
  2025-09-29  3:40   ` Peng Fan
  2025-10-13 11:15 ` Ulf Hansson
  6 siblings, 1 reply; 15+ messages in thread
From: Ulf Hansson @ 2025-09-23 10:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Peng Fan
  Cc: Pavel Machek, Len Brown, Greg Kroah-Hartman, Danilo Krummrich,
	Peter Chen, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Thinh Nguyen, linux-pm, linux-kernel, linux-usb,
	imx, linux-arm-kernel, Xu Yang

On Mon, 22 Sept 2025 at 04:21, Peng Fan <peng.fan@nxp.com> wrote:
>
> To i.MX95, USB2 and USB3 are in HSIOMIX domain, but there is always on logic
> to make USB2 and USB3 has wakeup capability when HSIOMIX power domain
> is in off state. So when in system-suspend state, USB2/USB3 could wakeup
> the system even the USB2/USB3 HSIOMIX power domain is turned off. This
> means USB2/USB3 has out-of-band wakeup capability to wakeup system from
> suspended state.
>
> Without this patchset, if USB2/USB3 are configured with wakeup enabled,
> the HSIOMIX power domain will not be turned off. This leads to more
> power consumed in system suspend state.
>
> This patchset introduces device_set_out_band_wakeup and
> device_out_band_wakeup two APIs to set out-of-band and query the flag.
> In genpd_finish_suspend, there is a check, if out-of-band is set,
> it will continue to turn off the power domain. In genpd resume flow,
> there is a similar check to turn on the power domain.
>
> Patch 1,2 introduces device_set_out_band_wakeup and
> device_out_band_wakeup
> Patch 3 and 4 are drivers changes to use device_out_band_wakeup
>
> More old discussions:
> https://lore.kernel.org/linux-pm/20250311083239.3336439-1-peng.fan@oss.nxp.com/
>
> This is pick up of [1]
> This V2 patchset
> - includes usb driver changes to give people a full picture on how it is used.
> - Rebased next-20250729 to resolve conflicts
>
> [1]https://lore.kernel.org/linux-pm/20250311083239.3336439-1-peng.fan@oss.nxp.com/
>
> Changes in v4:
> - Split device_set_out_band_wakeup API and pmdomain changes into patch 1
>   and 2 and clear the flag in device_prepare (from Ulf)
> - Add R-b in patch 2
> - Move the call of device_set_out_band_wakeup to system suspend
>   callback in patch 3 and 4. (from Ulf)
> - For patch 3,4, I still keep the Tags, since compared with V3, it is quite
>   small changes.
> - Link to v3: https://lore.kernel.org/r/20250902-pm-v3-0-ffadbb454cdc@nxp.com
>
> Changes in v3:
> - Add a new patch from Xu Yang to detach power domain for ci hdrc
> - Add A-b for patch 4
> - Link to v2: https://lore.kernel.org/r/20250801-pm-v2-0-97c8fb2a433c@nxp.com
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Peng Fan (4):
>       PM: wakeup: Add out-of-band system wakeup support for devices
>       PM: domains: Allow power-off for out-of-band wakeup-capable devices
>       usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
>       usb: dwc3: imx8mp: Set out of band wakeup for i.MX95
>
> Xu Yang (1):
>       usb: chipidea: core: detach power domain for ci_hdrc platform device
>
>  drivers/base/power/main.c          |  1 +
>  drivers/pmdomain/core.c            |  6 ++++--
>  drivers/usb/chipidea/ci_hdrc_imx.c | 11 ++++++++++-
>  drivers/usb/chipidea/core.c        |  3 +++
>  drivers/usb/dwc3/dwc3-imx8mp.c     |  9 +++++++--
>  include/linux/pm.h                 |  1 +
>  include/linux/pm_wakeup.h          | 17 +++++++++++++++++
>  include/linux/usb/chipidea.h       |  1 +
>  8 files changed, 44 insertions(+), 5 deletions(-)
> ---
> base-commit: 8f7f8b1b3f4c613dd886f53f768f82816b41eaa3
> change-id: 20250919-pm-v4-1879568de500
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>

Rafael, I intend to pick up this series via my pmdomain tree shortly,
unless you have some objections, of course.

Kind regards
Uffe


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

* Re: [PATCH v4 3/5] usb: chipidea: core: detach power domain for ci_hdrc platform device
  2025-09-22  2:21 ` [PATCH v4 3/5] usb: chipidea: core: detach power domain for ci_hdrc platform device Peng Fan
@ 2025-09-24  0:35   ` Peter Chen (CIX)
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Chen (CIX) @ 2025-09-24  0:35 UTC (permalink / raw)
  To: Peng Fan
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Thinh Nguyen, linux-pm,
	linux-kernel, linux-usb, imx, linux-arm-kernel, Xu Yang

On 25-09-22 10:21:08, Peng Fan wrote:
> From: Xu Yang <xu.yang_2@nxp.com>
> 
> When add a platform device by calling ci_hdrc_add_device(), this device
> will reuse OF node of its parent device. If power-domains property is
> provided in the OF node, both two platform devices will be attached to
> the same power domain. This should be unnecessary and may bring other
> inconsistent behavior. For example, to support wakeup capability, these
> two platform device need different power domain state. The parent device
> need NOT power domain on for out-band interrupt, but the ci_hdrc device
> need power domain on for in-band interrupt. The i.MX95 Soc support
> out-band wakeup interrupt, the user need to enable wakeup for the parent
> device, but if the user also enable wakeup for ci_hdrc device, the power
> domain will keep at on state finally. To exclude such inconsistent
> behavior and simplify the power management, detach power domain for ci_hdrc
> platform device.
> 
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Acked-by: Peter Chen <peter.chen@kernel.org>

Peter

> ---
>  drivers/usb/chipidea/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 694b4a8e4e1d8583dcbf4a42f8c2dfd785d5745c..70597f40b9997a9766934c67bbbed38e96c210f8 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -27,6 +27,7 @@
>  #include <linux/kernel.h>
>  #include <linux/slab.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/pm_domain.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> @@ -915,6 +916,8 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
>  	if (ret)
>  		goto err;
>  
> +	dev_pm_domain_detach(&pdev->dev, false);
> +
>  	return pdev;
>  
>  err:
> 
> -- 
> 2.37.1
> 

-- 

Best regards,
Peter


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

* Re: [PATCH v4 4/5] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
  2025-09-22  2:21 ` [PATCH v4 4/5] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95 Peng Fan
@ 2025-09-24  0:52   ` Peter Chen (CIX)
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Chen (CIX) @ 2025-09-24  0:52 UTC (permalink / raw)
  To: Peng Fan
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Ulf Hansson, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Thinh Nguyen, linux-pm,
	linux-kernel, linux-usb, imx, linux-arm-kernel, Xu Yang

On 25-09-22 10:21:09, Peng Fan wrote:
> i.MX95 USB2 inside HSIOMIX could still wakeup Linux, even if HSIOMIX
> power domain(Digital logic) is off. There is still always on logic
> have the wakeup capability which is out band wakeup capbility.
> 
> So use device_set_out_band_wakeup for i.MX95 to make sure usb2 could
> wakeup system even if HSIOMIX power domain is in off state.
> 
> Tested-by: Xu Yang <xu.yang_2@nxp.com>
> Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Acked-by: Peter Chen <peter.chen@kernel.org> 

Feel free add my ack if power part has accepted.

Peter
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 11 ++++++++++-
>  include/linux/usb/chipidea.h       |  1 +
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index d7c2a1a3c2715967203b98c819fa864e06a00a32..d4ee9e16332fe8b506711e4739c9008f73a377bf 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -79,6 +79,10 @@ static const struct ci_hdrc_imx_platform_flag imx8ulp_usb_data = {
>  		CI_HDRC_HAS_PORTSC_PEC_MISSED,
>  };
>  
> +static const struct ci_hdrc_imx_platform_flag imx95_usb_data = {
> +	.flags = CI_HDRC_SUPPORTS_RUNTIME_PM | CI_HDRC_OUT_BAND_WAKEUP,
> +};
> +
>  static const struct ci_hdrc_imx_platform_flag s32g_usb_data = {
>  	.flags = CI_HDRC_DISABLE_HOST_STREAMING,
>  };
> @@ -94,6 +98,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
>  	{ .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
>  	{ .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data},
>  	{ .compatible = "fsl,imx8ulp-usb", .data = &imx8ulp_usb_data},
> +	{ .compatible = "fsl,imx95-usb", .data = &imx95_usb_data},
>  	{ .compatible = "nxp,s32g2-usb", .data = &s32g_usb_data},
>  	{ /* sentinel */ }
>  };
> @@ -704,9 +709,13 @@ static int ci_hdrc_imx_suspend(struct device *dev)
>  
>  	pinctrl_pm_select_sleep_state(dev);
>  
> -	if (data->wakeup_irq > 0 && device_may_wakeup(dev))
> +	if (data->wakeup_irq > 0 && device_may_wakeup(dev)) {
>  		enable_irq_wake(data->wakeup_irq);
>  
> +		if (data->plat_data->flags & CI_HDRC_OUT_BAND_WAKEUP)
> +			device_set_out_band_wakeup(dev);
> +	}
> +
>  	return ret;
>  }
>  
> diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
> index e17ebeee24e3ecc4b1c2d153d9ea9b656b5a3d35..c6451191d2de68607a9380482701d11f949d0ff7 100644
> --- a/include/linux/usb/chipidea.h
> +++ b/include/linux/usb/chipidea.h
> @@ -66,6 +66,7 @@ struct ci_hdrc_platform_data {
>  #define CI_HDRC_HAS_PORTSC_PEC_MISSED	BIT(17)
>  #define CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS	BIT(18)
>  #define	CI_HDRC_HAS_SHORT_PKT_LIMIT	BIT(19)
> +#define	CI_HDRC_OUT_BAND_WAKEUP		BIT(20)
>  	enum usb_dr_mode	dr_mode;
>  #define CI_HDRC_CONTROLLER_RESET_EVENT		0
>  #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1
> 
> -- 
> 2.37.1
> 

-- 

Best regards,
Peter


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

* Re: [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb
  2025-09-23 10:07 ` [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Ulf Hansson
@ 2025-09-29  3:40   ` Peng Fan
  2025-09-29  9:30     ` Ulf Hansson
  0 siblings, 1 reply; 15+ messages in thread
From: Peng Fan @ 2025-09-29  3:40 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rafael J. Wysocki, Peng Fan, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Danilo Krummrich, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen, linux-pm, linux-kernel, linux-usb, imx,
	linux-arm-kernel, Xu Yang

Hi Ulf,

On Tue, Sep 23, 2025 at 12:07:02PM +0200, Ulf Hansson wrote:
>On Mon, 22 Sept 2025 at 04:21, Peng Fan <peng.fan@nxp.com> wrote:
>>
...
>> ---
>> Peng Fan (4):
>>       PM: wakeup: Add out-of-band system wakeup support for devices
>>       PM: domains: Allow power-off for out-of-band wakeup-capable devices
>>       usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
>>       usb: dwc3: imx8mp: Set out of band wakeup for i.MX95
>>
>> Xu Yang (1):
>>       usb: chipidea: core: detach power domain for ci_hdrc platform device
...
>
>Rafael, I intend to pick up this series via my pmdomain tree shortly,
>unless you have some objections, of course.

Sorry for an early ping. I see v6.17 is released. Just want to know whether
you would pick this up for 6.18.

Thanks,
Peng

>
>Kind regards
>Uffe


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

* Re: [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb
  2025-09-29  3:40   ` Peng Fan
@ 2025-09-29  9:30     ` Ulf Hansson
  2025-09-29 12:06       ` Peng Fan
  0 siblings, 1 reply; 15+ messages in thread
From: Ulf Hansson @ 2025-09-29  9:30 UTC (permalink / raw)
  To: Peng Fan
  Cc: Rafael J. Wysocki, Peng Fan, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Danilo Krummrich, Peter Chen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Thinh Nguyen, linux-pm, linux-kernel, linux-usb, imx,
	linux-arm-kernel, Xu Yang

On Mon, 29 Sept 2025 at 04:28, Peng Fan <peng.fan@oss.nxp.com> wrote:
>
> Hi Ulf,
>
> On Tue, Sep 23, 2025 at 12:07:02PM +0200, Ulf Hansson wrote:
> >On Mon, 22 Sept 2025 at 04:21, Peng Fan <peng.fan@nxp.com> wrote:
> >>
> ...
> >> ---
> >> Peng Fan (4):
> >>       PM: wakeup: Add out-of-band system wakeup support for devices
> >>       PM: domains: Allow power-off for out-of-band wakeup-capable devices
> >>       usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
> >>       usb: dwc3: imx8mp: Set out of band wakeup for i.MX95
> >>
> >> Xu Yang (1):
> >>       usb: chipidea: core: detach power domain for ci_hdrc platform device
> ...
> >
> >Rafael, I intend to pick up this series via my pmdomain tree shortly,
> >unless you have some objections, of course.
>
> Sorry for an early ping. I see v6.17 is released. Just want to know whether
> you would pick this up for 6.18.

If we have had another week, then v6.18 should have worked. That said,
I plan to queue this for v6.19 as soon as we have v6.18-rc1.

Kind regards
Uffe


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

* RE: [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb
  2025-09-29  9:30     ` Ulf Hansson
@ 2025-09-29 12:06       ` Peng Fan
  0 siblings, 0 replies; 15+ messages in thread
From: Peng Fan @ 2025-09-29 12:06 UTC (permalink / raw)
  To: Ulf Hansson, Peng Fan (OSS)
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Peter Chen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Thinh Nguyen,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org, Xu Yang

> Subject: Re: [PATCH v4 0/5] pmdomain: core: Introduce
> device_set_out_band_wakeup and use it in usb
> >
> > Sorry for an early ping. I see v6.17 is released. Just want to know
> > whether you would pick this up for 6.18.
> 
> If we have had another week, then v6.18 should have worked. That
> said, I plan to queue this for v6.19 as soon as we have v6.18-rc1.

Thanks for letting me know. Appreciate your help.

Thanks,
Peng.

> 
> Kind regards
> Uffe

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

* Re: [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb
  2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
                   ` (5 preceding siblings ...)
  2025-09-23 10:07 ` [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Ulf Hansson
@ 2025-10-13 11:15 ` Ulf Hansson
  6 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2025-10-13 11:15 UTC (permalink / raw)
  To: Peng Fan
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Peter Chen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Thinh Nguyen, linux-pm,
	linux-kernel, linux-usb, imx, linux-arm-kernel, Xu Yang

On Mon, 22 Sept 2025 at 04:21, Peng Fan <peng.fan@nxp.com> wrote:
>
> To i.MX95, USB2 and USB3 are in HSIOMIX domain, but there is always on logic
> to make USB2 and USB3 has wakeup capability when HSIOMIX power domain
> is in off state. So when in system-suspend state, USB2/USB3 could wakeup
> the system even the USB2/USB3 HSIOMIX power domain is turned off. This
> means USB2/USB3 has out-of-band wakeup capability to wakeup system from
> suspended state.
>
> Without this patchset, if USB2/USB3 are configured with wakeup enabled,
> the HSIOMIX power domain will not be turned off. This leads to more
> power consumed in system suspend state.
>
> This patchset introduces device_set_out_band_wakeup and
> device_out_band_wakeup two APIs to set out-of-band and query the flag.
> In genpd_finish_suspend, there is a check, if out-of-band is set,
> it will continue to turn off the power domain. In genpd resume flow,
> there is a similar check to turn on the power domain.
>
> Patch 1,2 introduces device_set_out_band_wakeup and
> device_out_band_wakeup
> Patch 3 and 4 are drivers changes to use device_out_band_wakeup
>
> More old discussions:
> https://lore.kernel.org/linux-pm/20250311083239.3336439-1-peng.fan@oss.nxp.com/
>
> This is pick up of [1]
> This V2 patchset
> - includes usb driver changes to give people a full picture on how it is used.
> - Rebased next-20250729 to resolve conflicts
>
> [1]https://lore.kernel.org/linux-pm/20250311083239.3336439-1-peng.fan@oss.nxp.com/
>
> Changes in v4:
> - Split device_set_out_band_wakeup API and pmdomain changes into patch 1
>   and 2 and clear the flag in device_prepare (from Ulf)
> - Add R-b in patch 2
> - Move the call of device_set_out_band_wakeup to system suspend
>   callback in patch 3 and 4. (from Ulf)
> - For patch 3,4, I still keep the Tags, since compared with V3, it is quite
>   small changes.
> - Link to v3: https://lore.kernel.org/r/20250902-pm-v3-0-ffadbb454cdc@nxp.com
>
> Changes in v3:
> - Add a new patch from Xu Yang to detach power domain for ci hdrc
> - Add A-b for patch 4
> - Link to v2: https://lore.kernel.org/r/20250801-pm-v2-0-97c8fb2a433c@nxp.com
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Peng Fan (4):
>       PM: wakeup: Add out-of-band system wakeup support for devices
>       PM: domains: Allow power-off for out-of-band wakeup-capable devices
>       usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95
>       usb: dwc3: imx8mp: Set out of band wakeup for i.MX95
>
> Xu Yang (1):
>       usb: chipidea: core: detach power domain for ci_hdrc platform device
>
>  drivers/base/power/main.c          |  1 +
>  drivers/pmdomain/core.c            |  6 ++++--
>  drivers/usb/chipidea/ci_hdrc_imx.c | 11 ++++++++++-
>  drivers/usb/chipidea/core.c        |  3 +++
>  drivers/usb/dwc3/dwc3-imx8mp.c     |  9 +++++++--
>  include/linux/pm.h                 |  1 +
>  include/linux/pm_wakeup.h          | 17 +++++++++++++++++
>  include/linux/usb/chipidea.h       |  1 +
>  8 files changed, 44 insertions(+), 5 deletions(-)
> ---
> base-commit: 8f7f8b1b3f4c613dd886f53f768f82816b41eaa3
> change-id: 20250919-pm-v4-1879568de500
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>

I have now queued this series (including the acked usb patches) via my
pmdomain tree for next. Please let me know if it's preferred to route
the usb patches via another tree, so I can share an immutable branch
instead.

Kind regards
Uffe


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

end of thread, other threads:[~2025-10-13 11:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-22  2:21 [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Peng Fan
2025-09-22  2:21 ` [PATCH v4 1/5] PM: wakeup: Add out-of-band system wakeup support for devices Peng Fan
2025-09-23  9:40   ` Dhruva Gole
2025-09-22  2:21 ` [PATCH v4 2/5] PM: domains: Allow power-off for out-of-band wakeup-capable devices Peng Fan
2025-09-23  9:44   ` Dhruva Gole
2025-09-22  2:21 ` [PATCH v4 3/5] usb: chipidea: core: detach power domain for ci_hdrc platform device Peng Fan
2025-09-24  0:35   ` Peter Chen (CIX)
2025-09-22  2:21 ` [PATCH v4 4/5] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95 Peng Fan
2025-09-24  0:52   ` Peter Chen (CIX)
2025-09-22  2:21 ` [PATCH v4 5/5] usb: dwc3: imx8mp: " Peng Fan
2025-09-23 10:07 ` [PATCH v4 0/5] pmdomain: core: Introduce device_set_out_band_wakeup and use it in usb Ulf Hansson
2025-09-29  3:40   ` Peng Fan
2025-09-29  9:30     ` Ulf Hansson
2025-09-29 12:06       ` Peng Fan
2025-10-13 11:15 ` Ulf Hansson

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