linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM: sleep: Add helpers to allow a device to remain powered-on
@ 2023-08-10 16:21 Ulf Hansson
  2023-08-17  9:40 ` Peng Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2023-08-10 16:21 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm
  Cc: Rafael J . Wysocki, Tony Lindgren, Geert Uytterhoeven,
	Patrice Chotard, Peng Fan, Ajay Agarwal, Michael Shavit,
	Manivannan Sadhasivam, linux-kernel, Ulf Hansson

On some platforms a device and its corresponding PM domain, may need to
remain powered-on during system wide suspend, to support various use cases.
For example, when the console_suspend_enabled flag is unset for a serial
controller, the corresponding device may need to remain powered on. Other
use cases exists too.

In fact, we already have the mechanism in the PM core to deal with these
kind of use cases. However, the current naming of the corresponding
functions/flags clearly suggests these should be use for system wakeup.
See device_wakeup_path(), device_set_wakeup_path and
dev->power.wakeup_path.

As a way to extend the use of the existing mechanism, let's introduce two
new helpers functions, device_awake_path() and device_set_awake_path(). At
this point, let them act as wrappers of the existing functions. Ideally,
when all users have been converted to use the new helpers, we may decide to
drop the old ones and rename the flag.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/pm_wakeup.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 77f4849e3418..6eb9adaef52b 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -194,6 +194,16 @@ static inline void pm_wakeup_dev_event(struct device *dev, unsigned int msec,
 
 #endif /* !CONFIG_PM_SLEEP */
 
+static inline bool device_awake_path(struct device *dev)
+{
+	return device_wakeup_path(dev);
+}
+
+static inline void device_set_awake_path(struct device *dev)
+{
+	device_set_wakeup_path(dev);
+}
+
 static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec)
 {
 	return pm_wakeup_ws_event(ws, msec, false);
-- 
2.34.1


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

* RE: [PATCH] PM: sleep: Add helpers to allow a device to remain powered-on
  2023-08-10 16:21 [PATCH] PM: sleep: Add helpers to allow a device to remain powered-on Ulf Hansson
@ 2023-08-17  9:40 ` Peng Fan
  2023-08-22 20:05   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2023-08-17  9:40 UTC (permalink / raw)
  To: Ulf Hansson, Rafael J . Wysocki, linux-pm@vger.kernel.org
  Cc: Rafael J . Wysocki, Tony Lindgren, Geert Uytterhoeven,
	Patrice Chotard, Ajay Agarwal, Michael Shavit,
	Manivannan Sadhasivam, linux-kernel@vger.kernel.org

> Subject: [PATCH] PM: sleep: Add helpers to allow a device to remain
> powered-on
> 
> On some platforms a device and its corresponding PM domain, may need to
> remain powered-on during system wide suspend, to support various use
> cases.
> For example, when the console_suspend_enabled flag is unset for a serial
> controller, the corresponding device may need to remain powered on.
> Other use cases exists too.
> 
> In fact, we already have the mechanism in the PM core to deal with these
> kind of use cases. However, the current naming of the corresponding
> functions/flags clearly suggests these should be use for system wakeup.
> See device_wakeup_path(), device_set_wakeup_path and
> dev->power.wakeup_path.
> 
> As a way to extend the use of the existing mechanism, let's introduce two
> new helpers functions, device_awake_path() and device_set_awake_path().
> At this point, let them act as wrappers of the existing functions. Ideally,
> when all users have been converted to use the new helpers, we may decide
> to drop the old ones and rename the flag.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

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

* Re: [PATCH] PM: sleep: Add helpers to allow a device to remain powered-on
  2023-08-17  9:40 ` Peng Fan
@ 2023-08-22 20:05   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2023-08-22 20:05 UTC (permalink / raw)
  To: Peng Fan, Ulf Hansson
  Cc: linux-pm@vger.kernel.org, Tony Lindgren, Geert Uytterhoeven,
	Patrice Chotard, Ajay Agarwal, Michael Shavit,
	Manivannan Sadhasivam, linux-kernel@vger.kernel.org

On Thu, Aug 17, 2023 at 11:40 AM Peng Fan <peng.fan@nxp.com> wrote:
>
> > Subject: [PATCH] PM: sleep: Add helpers to allow a device to remain
> > powered-on
> >
> > On some platforms a device and its corresponding PM domain, may need to
> > remain powered-on during system wide suspend, to support various use
> > cases.
> > For example, when the console_suspend_enabled flag is unset for a serial
> > controller, the corresponding device may need to remain powered on.
> > Other use cases exists too.
> >
> > In fact, we already have the mechanism in the PM core to deal with these
> > kind of use cases. However, the current naming of the corresponding
> > functions/flags clearly suggests these should be use for system wakeup.
> > See device_wakeup_path(), device_set_wakeup_path and
> > dev->power.wakeup_path.
> >
> > As a way to extend the use of the existing mechanism, let's introduce two
> > new helpers functions, device_awake_path() and device_set_awake_path().
> > At this point, let them act as wrappers of the existing functions. Ideally,
> > when all users have been converted to use the new helpers, we may decide
> > to drop the old ones and rename the flag.
> >
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Applied as 6.6 material, thanks!

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

end of thread, other threads:[~2023-08-22 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 16:21 [PATCH] PM: sleep: Add helpers to allow a device to remain powered-on Ulf Hansson
2023-08-17  9:40 ` Peng Fan
2023-08-22 20:05   ` Rafael J. Wysocki

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