Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dhruva Gole <d-gole@ti.com>
To: Peng Fan <peng.fan@nxp.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Peter Chen <peter.chen@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Xu Yang <xu.yang_2@nxp.com>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<imx@lists.linux.dev>, <arm-scmi@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 1/4] pmdomain: core: Introduce device_set/get_out_band_wakeup()
Date: Thu, 18 Sep 2025 11:09:34 +0530	[thread overview]
Message-ID: <20250918053934.dweerdmcqdkr342w@lcpd911> (raw)
In-Reply-To: <20250902-pm-v3-1-ffadbb454cdc@nxp.com>

On Sep 02, 2025 at 11:33:00 +0800, Peng Fan wrote:
> For some cases, a device could still wakeup the system even if its power
> domain is in off state, because the device's wakeup hardware logic is
> in an always-on domain.

Don't we already have something like wake IRQs [1] for such purposes?

8<----------------------------------------------------------------------
That may involve turning on a special signal handling logic within the
platform (such as an SoC) so that signals from a given line are routed
in a different way during system sleep so as to trigger a system wakeup
when needed
----------------------------------------------------------------------->8

[1] https://docs.kernel.org/power/suspend-and-interrupts.html#system-wakeup-interrupts-enable-irq-wake-and-disable-irq-wake

> 
> To support this case, introduce device_set/get_out_band_wakeup() to
> allow device drivers to control the behaviour in genpd for a device
> that is attached to it.

Do you have any explanation as to why wake IRQ is not solving this
problem and you need to introduce these new APIs?

> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/pmdomain/core.c   |  6 ++++--
>  include/linux/pm.h        |  1 +
>  include/linux/pm_wakeup.h | 17 +++++++++++++++++
>  3 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index 0006ab3d078972cc72a6dd22a2144fb31443e3da..8e37758cea88a9ee051ad9fb13bdd3feb4f8745e 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -1549,7 +1549,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_get_out_band_wakeup(dev))
>  		return 0;
>  
>  	if (genpd->dev_ops.stop && genpd->dev_ops.start &&
> @@ -1604,7 +1605,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_get_out_band_wakeup(dev))
>  		return resume_noirq(dev);
>  
>  	genpd_lock(genpd);
> 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..c461c7edef6f7927d696b7d18b59a6a1147f53a3 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, bool capable)
> +{
> +	dev->power.out_band_wakeup = capable;
> +}
> +
> +static inline bool device_get_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, bool capable) {}
> +
> +static inline bool device_get_out_band_wakeup(struct device *dev)
> +{
> +	return false;
> +}
> +
>  static inline void __pm_stay_awake(struct wakeup_source *ws) {}

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated


  parent reply	other threads:[~2025-09-18  5:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  3:32 [PATCH v3 0/4] pmdomain: core: Introduce device_set/get_out_band_wakeup and use it in usb Peng Fan
2025-09-02  3:33 ` [PATCH v3 1/4] pmdomain: core: Introduce device_set/get_out_band_wakeup() Peng Fan
2025-09-02  8:53   ` Xu Yang
2025-09-18  5:39   ` Dhruva Gole [this message]
2025-09-18  9:59   ` Dhruva Gole
2025-09-18 13:12     ` Peng Fan
2025-09-18 13:40       ` Dhruva Gole
2025-09-18 14:18         ` Ulf Hansson
2025-09-18 14:57   ` Ulf Hansson
2025-09-02  3:33 ` [PATCH v3 2/4] usb: chipidea: core: detach power domain for ci_hdrc platform device Peng Fan
2025-09-02  8:54   ` Xu Yang
2025-09-18 15:11   ` Ulf Hansson
2025-09-02  3:33 ` [PATCH v3 3/4] usb: chipidea: ci_hdrc_imx: Set out of band wakeup for i.MX95 Peng Fan
2025-09-02  8:55   ` Xu Yang
2025-09-18 15:14   ` Ulf Hansson
2025-09-02  3:33 ` [PATCH v3 4/4] usb: dwc3: imx8mp: " Peng Fan
2025-09-02  8:56   ` Xu Yang
2025-09-18 15:15   ` Ulf Hansson
2025-09-11 14:45 ` [PATCH v3 0/4] pmdomain: core: Introduce device_set/get_out_band_wakeup and use it in usb Ulf Hansson
2025-09-12  4:53   ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250918053934.dweerdmcqdkr342w@lcpd911 \
    --to=d-gole@ti.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=lenb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peter.chen@kernel.org \
    --cc=rafael@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=xu.yang_2@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox