public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: pm list <linux-pm@lists.linux-foundation.org>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: [RFC][PATCH 1/10] PM: Add flag for devices capable of generating run-time wake-up events
Date: Mon, 16 Nov 2009 00:49:22 +0100	[thread overview]
Message-ID: <200911160049.22717.rjw@sisk.pl> (raw)
In-Reply-To: <200911160047.46299.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Apparently, there are devices that can wake up the system from sleep
states and yet are incapable of generating wake-up events at run
time.  Thus, introduce a flag indicating if given device is capable
of generating run-time wake-up events.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 Documentation/power/runtime_pm.txt |    7 +++++--
 include/linux/pm.h                 |    8 +++++---
 include/linux/pm_runtime.h         |   12 ++++++++++++
 3 files changed, 22 insertions(+), 5 deletions(-)

Index: linux-2.6/include/linux/pm.h
===================================================================
--- linux-2.6.orig/include/linux/pm.h
+++ linux-2.6/include/linux/pm.h
@@ -179,9 +179,10 @@ typedef struct pm_message {
  *	This need not mean that the device should be put into a low power state.
  *	For example, if the device is behind a link which is about to be turned
  *	off, the device may remain at full power.  If the device does go to low
- *	power and if device_may_wakeup(dev) is true, remote wake-up (i.e., a
- *	hardware mechanism allowing the device to request a change of its power
- *	state, such as PCI PME) should be enabled for it.
+ *	power and is capable of generating run-time wake-up events, remote
+ *	wake-up (i.e., a hardware mechanism allowing the device to request a
+ *	change of its power state via a wake-up event, such as PCI PME) should
+ *	be enabled for it.
  *
  * @runtime_resume: Put the device into the fully active state in response to a
  *	wake-up event generated by hardware or at the request of software.  If
@@ -434,6 +435,7 @@ struct dev_pm_info {
 	unsigned int		idle_notification:1;
 	unsigned int		request_pending:1;
 	unsigned int		deferred_resume:1;
+	unsigned int		run_wake:1;
 	enum rpm_request	request;
 	enum rpm_status		runtime_status;
 	int			runtime_error;
Index: linux-2.6/Documentation/power/runtime_pm.txt
===================================================================
--- linux-2.6.orig/Documentation/power/runtime_pm.txt
+++ linux-2.6/Documentation/power/runtime_pm.txt
@@ -71,9 +71,9 @@ what to do to handle the device).
     purpose).
 
 In particular, if the driver requires remote wakeup capability for proper
-functioning and device_may_wakeup() returns 'false' for the device, then
+functioning and device_run_wake() returns 'false' for the device, then
 ->runtime_suspend() should return -EBUSY.  On the other hand, if
-device_may_wakeup() returns 'true' for the device and the device is put
+device_run_wake() returns 'true' for the device and the device is put
 into a low power state during the execution of its bus type's
 ->runtime_suspend(), it is expected that remote wake-up (i.e. hardware mechanism
 allowing the device to request a change of its power state, such as PCI PME)
@@ -214,6 +214,9 @@ defined in include/linux/pm.h:
       being executed for that device and it is not practical to wait for the
       suspend to complete; means "start a resume as soon as you've suspended"
 
+  unsigned int run_wake;
+    - set if the device is capable of generating run-time wake-up events
+
   enum rpm_status runtime_status;
     - the run-time PM status of the device; this field's initial value is
       RPM_SUSPENDED, which means that each device is initially regarded by the
Index: linux-2.6/include/linux/pm_runtime.h
===================================================================
--- linux-2.6.orig/include/linux/pm_runtime.h
+++ linux-2.6/include/linux/pm_runtime.h
@@ -50,6 +50,16 @@ static inline void pm_runtime_put_noidle
 	atomic_add_unless(&dev->power.usage_count, -1, 0);
 }
 
+static inline bool device_run_wake(struct device *dev)
+{
+	return dev->power.run_wake;
+}
+
+static inline void device_set_run_wake(struct device *dev, bool enable)
+{
+	dev->power.run_wake = enable;
+}
+
 #else /* !CONFIG_PM_RUNTIME */
 
 static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; }
@@ -73,6 +83,8 @@ static inline bool pm_children_suspended
 static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
 static inline void pm_runtime_get_noresume(struct device *dev) {}
 static inline void pm_runtime_put_noidle(struct device *dev) {}
+static inline bool device_run_wake(struct device *dev) { return false; }
+static inline void device_set_run_wake(struct device *dev, bool enable) {}
 
 #endif /* !CONFIG_PM_RUNTIME */
 

  reply	other threads:[~2009-11-15 23:49 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-15 23:47 [RFC][PATCH 0/10] PCI run-time PM support Rafael J. Wysocki
2009-11-15 23:49 ` Rafael J. Wysocki [this message]
2009-11-16 19:39   ` [RFC][PATCH 1/10] PM: Add flag for devices capable of generating run-time wake-up events Alan Stern
2009-11-15 23:50 ` [RFC][PATCH 2/10] PCI PM: Add function for checking PME status of devices Rafael J. Wysocki
2009-11-15 23:51 ` [RFC][PATCH 3/10] PCI / PM: Propagate wake-up enable for PCIe devices too Rafael J. Wysocki
2009-11-15 23:52 ` [RFC][PATCH 4/10] PCI PM: PCIe PME root port service driver (rev. 4) Rafael J. Wysocki
2009-11-15 23:53 ` [RFC][PATCH 5/10] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2009-11-15 23:55 ` [RFC][PATCH 6/10] ACPI: Add support for new refcounted GPE API to drivers Rafael J. Wysocki
2009-11-15 23:55 ` [RFC][PATCH 7/10] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2009-11-15 23:55 ` [RFC][PATCH 8/10] ACPI / PM: Add more run-time wake-up fields Rafael J. Wysocki
2009-11-15 23:57 ` [RFC][PATCH 9/10] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 3) Rafael J. Wysocki
2009-11-15 23:58 ` [RFC][PATCH 10/10] PCI PM: Run-time callbacks for PCI bus type Rafael J. Wysocki
     [not found] ` <200911160057.42421.rjw@sisk.pl>
2009-11-16  4:36   ` [RFC][PATCH 9/10] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 3) Jin Dongming
     [not found]   ` <4B00D6E2.9010404@np.css.fujitsu.com>
2009-11-16 19:04     ` Rafael J. Wysocki
2009-11-29 15:32 ` [RFC][PATCH 0/12] PCI run-time PM support (updated) Rafael J. Wysocki
     [not found] ` <200911291632.44763.rjw@sisk.pl>
2009-11-29 15:34   ` [RFC][PATCH 1/12] PM: Add flag for devices capable of generating run-time wake-up events Rafael J. Wysocki
2009-11-29 15:34   ` [RFC][PATCH 2/12] PCI PM: Add function for checking PME status of devices Rafael J. Wysocki
2009-11-29 15:35   ` [RFC][PATCH 3/12] PCI / PM: Propagate wake-up enable for PCIe devices too Rafael J. Wysocki
2009-12-16 19:19     ` Jesse Barnes
     [not found]     ` <20091216111939.1a756377@jbarnes-piketon>
2009-12-16 19:28       ` Rafael J. Wysocki
2009-11-29 15:36   ` [RFC][PATCH 4/12] PCI PM: PCIe PME root port service driver (rev. 5) Rafael J. Wysocki
2009-11-29 15:37   ` [RFC][PATCH 5/12] PCI PM: Make it possible to force using INTx for PCIe PME signaling Rafael J. Wysocki
2009-11-29 15:39   ` [RFC][PATCH 6/12] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2009-11-29 15:39   ` [RFC][PATCH 7/12] ACPI: Add support for new refcounted GPE API to drivers Rafael J. Wysocki
2009-11-29 15:40   ` [RFC][PATCH 8/12] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2009-11-29 15:41   ` [RFC][PATCH 9/12] ACPI / PM: Add more run-time wake-up fields Rafael J. Wysocki
2009-11-29 15:42   ` [RFC][PATCH 10/12] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 4) Rafael J. Wysocki
2009-11-29 15:43   ` [RFC][PATCH 11/12] PCI PM: Run-time callbacks for PCI bus type (rev. 2) Rafael J. Wysocki
2009-11-29 15:44   ` [RFC][PATCH 12/12] PM / r8169: Add simplified run-time PM support Rafael J. Wysocki
     [not found]   ` <200911291643.15603.rjw@sisk.pl>
2009-12-01 22:00     ` [RFC][PATCH 11/12] PCI PM: Run-time callbacks for PCI bus type (rev. 2) Matthew Garrett
     [not found]     ` <20091201220043.GA17093@srcf.ucam.org>
2009-12-01 22:50       ` Rafael J. Wysocki
     [not found]   ` <200911291642.20172.rjw@sisk.pl>
2009-12-04 16:21     ` [RFC][PATCH 10/12] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 4) Matthew Garrett
     [not found]     ` <20091204162107.GA13371@srcf.ucam.org>
2009-12-04 21:15       ` Rafael J. Wysocki
     [not found]       ` <200912042215.03776.rjw@sisk.pl>
2009-12-05  0:35         ` [RFC][PATCH 10/12] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 5) Rafael J. Wysocki
     [not found]   ` <200911291637.41461.rjw@sisk.pl>
2009-12-04 21:17     ` [RFC][PATCH 5/12] PCI PM: Make it possible to force using INTx for PCIe PME signaling (updated) Rafael J. Wysocki
2009-12-04 23:21   ` [RFC][PATCH 0/12] PCI run-time PM support (updated) Jesse Barnes
     [not found]   ` <200911291636.39842.rjw@sisk.pl>
2009-12-05  0:38     ` [RFC][PATCH 4/12] PCI PM: PCIe PME root port service driver (rev. 5) (updated) Rafael J. Wysocki
     [not found]   ` <200911291644.27288.rjw@sisk.pl>
2009-12-15 11:49     ` [RFC][PATCH 12/12] PM / r8169: Add simplified run-time PM support Pavel Machek
     [not found]     ` <20091215114956.GA1415@ucw.cz>
2009-12-27 19:48       ` Rafael J. Wysocki
     [not found]       ` <200912272048.37332.rjw@sisk.pl>
2009-12-27 20:01         ` Pavel Machek
     [not found]         ` <20091227200147.GJ11737@elf.ucw.cz>
2010-01-02 20:49           ` Rafael J. Wysocki
     [not found]           ` <201001022149.05553.rjw@sisk.pl>
2010-01-03 19:55             ` Pavel Machek
     [not found]             ` <20100103195544.GC11928@elf.ucw.cz>
2010-01-03 21:01               ` Rafael J. Wysocki
     [not found]               ` <201001032201.14087.rjw@sisk.pl>
2010-01-04  8:31                 ` Pavel Machek
     [not found]                 ` <20100104083108.GD1372@ucw.cz>
2010-01-04  9:53                   ` Oliver Neukum
2010-01-04 19:51                   ` Rafael J. Wysocki
     [not found]                   ` <201001042051.08692.rjw@sisk.pl>
2010-01-04 21:00                     ` Pavel Machek
     [not found] <Pine.LNX.4.44L0.0911161436560.2971-100000@iolanthe.rowland.org>
2009-11-16 20:52 ` [RFC][PATCH 1/10] PM: Add flag for devices capable of generating run-time wake-up events Rafael J. Wysocki
     [not found] <200911162152.38333.rjw@sisk.pl>
2009-11-16 21:00 ` Alan Stern
     [not found] ` <Pine.LNX.4.44L0.0911161557130.2971-100000@iolanthe.rowland.org>
2009-11-16 21:05   ` Matthew Garrett
2009-11-16 21:23   ` Oliver Neukum
     [not found] <20091116210545.GA29696@srcf.ucam.org>
2009-11-16 21:31 ` Alan Stern

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=200911160049.22717.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    /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