Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbZKOX6x (ORCPT ); Sun, 15 Nov 2009 18:58:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752275AbZKOX6v (ORCPT ); Sun, 15 Nov 2009 18:58:51 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:54443 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbZKOX6f (ORCPT ); Sun, 15 Nov 2009 18:58:35 -0500 From: "Rafael J. Wysocki" To: pm list 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 User-Agent: KMail/1.12.3 (Linux/2.6.32-rc7-rjw; KDE/4.3.3; x86_64; ; ) Cc: LKML , Linux PCI , ACPI Devel Maling List , Alan Stern , Jesse Barnes , Matthew Garrett , Oliver Neukum , Shaohua Li , Bjorn Helgaas References: <200911160047.46299.rjw@sisk.pl> In-Reply-To: <200911160047.46299.rjw@sisk.pl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200911160049.22717.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4647 Lines: 102 From: Rafael J. Wysocki 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 --- 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 */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/