Skip to contentSkip to conversation

new platform_enable_wake() hook; use it in PCI

PATCH In review David Brownell 2 participants 5 messages Apr 5, 2007 – Apr 23, 2007

Subsystems (6)
ACPI PCI Driver core Suspend to RAM +2 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 new platform_enable_wake() hook; use it in PCI

This defines a platform hook to enable/disable a device as a wakeup event source. It's initially for use with ACPI, but more generally it could be used whenever enable_irq_wake()/disable_irq_wake() don't suffice.

The hook is called -- if available -- inside pci_enable_wake(); and the semantics of that call are enhanced so that support for PCI PME# is no longer needed. It can now work for devices with "legacy PCI PM", when platform support allows it. (That support would use some board-specific signal for for the same purpose as PME#.)

---
 drivers/base/power/main.c |    3 ++
 drivers/pci/pci.c         |   61 ++++++++++++++++++++++++++++++++--------------
 include/linux/pm.h        |    5 +++
 3 files changed, 51 insertions(+), 18 deletions(-)
include/linux/pm.h +5 -0
@@ -273,6 +273,11 @@ extern void __suspend_report_result(cons
 		__suspend_report_result(__FUNCTION__, fn, ret);		\
 	} while (0)
 
+/* platform hook to activate device wakeup capability, if
+ * that's not already handled by enable_irq_wake() etc
+ */
+extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
+
 #else /* !CONFIG_PM */
 
 static inline int device_suspend(pm_message_t state)
drivers/base/power/main.c +3 -0
@@ -29,6 +29,9 @@ LIST_HEAD(dpm_off_irq);
 DECLARE_MUTEX(dpm_sem);
 DECLARE_MUTEX(dpm_list_sem);
 
+int (*platform_enable_wakeup)(struct device *dev, int is_on) = NULL;
+
+
 /**
  *	device_pm_set_parent - Specify power dependency.
  *	@dev:		Device who needs power.
drivers/pci/pci.c +43 -18

89 lines not on this page · raw message

#1 lore raw

Hi!

drivers/base/power/main.c LIST_HEAD(dpm_off_irq); · line 32

Quoted 8 lines

static inline int device_suspend(pm_message_t state)

drivers/base/power/main.c +1 -0
@@ -29,6 +29,9 @@ LIST_HEAD(dpm_off_irq);
 DECLARE_MUTEX(dpm_sem);
 DECLARE_MUTEX(dpm_list_sem);
 
+int (*platform_enable_wakeup)(struct device *dev, int is_on) = NULL;

Static variables do not need zero initializers.

Otherwise it looks ok.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
In reply to David Brownell

Hi!

drivers/base/power/main.c LIST_HEAD(dpm_off_irq); · line 32

Quoted 8 lines

static inline int device_suspend(pm_message_t state)

drivers/base/power/main.c +1 -0
@@ -29,6 +29,9 @@ LIST_HEAD(dpm_off_irq);
 DECLARE_MUTEX(dpm_sem);
 DECLARE_MUTEX(dpm_list_sem);
 
+int (*platform_enable_wakeup)(struct device *dev, int is_on) = NULL;

Static variables do not need zero initializers.

Otherwise it looks ok.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 9 lines · Pavel Machek

Hi!

Quoted 7 lines

static inline int device_suspend(pm_message_t state)

drivers/base/power/main.c +0 -0
@@ -29,6 +29,9 @@ LIST_HEAD(dpm_off_irq);
 DECLARE_MUTEX(dpm_sem);
 DECLARE_MUTEX(dpm_list_sem);
 
Quoted 3 lines

drivers/base/power/main.c LIST_HEAD(dpm_off_irq); · line 32

Quoted 1 line
drivers/base/power/main.c +1 -0
+int (*platform_enable_wakeup)(struct device *dev, int is_on) = NULL;

Static variables do not need zero initializers.

That was resolved by a cleanup patch; also a glitch when building without CONFIG_PM.

- dave

#4 lore raw
In reply to Pavel Machek
Quoted 9 lines · Pavel Machek

Hi!

Quoted 7 lines

static inline int device_suspend(pm_message_t state)

drivers/base/power/main.c +0 -0
@@ -29,6 +29,9 @@ LIST_HEAD(dpm_off_irq);
 DECLARE_MUTEX(dpm_sem);
 DECLARE_MUTEX(dpm_list_sem);
 
Quoted 3 lines

drivers/base/power/main.c LIST_HEAD(dpm_off_irq); · line 32

Quoted 1 line
drivers/base/power/main.c +1 -0
+int (*platform_enable_wakeup)(struct device *dev, int is_on) = NULL;

Static variables do not need zero initializers.

That was resolved by a cleanup patch; also a glitch when building without CONFIG_PM.

- dave