define platform wakeup hook, use in pci_enable_wake()

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

[akpm@linux-foundation.org: Make it compile with CONFIG_PM=n]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
David Brownell
2007-04-26 00:12:06 -07:00
committed by Greg Kroah-Hartman
parent 057f6c019f
commit 075c177152
3 changed files with 63 additions and 17 deletions

View File

@ -273,6 +273,20 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
__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.
* Returns zero on success, else negative errno
*/
extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
if (platform_enable_wakeup)
return (*platform_enable_wakeup)(dev, is_on);
return 0;
}
#else /* !CONFIG_PM */
static inline int device_suspend(pm_message_t state)
@ -294,6 +308,11 @@ static inline void dpm_runtime_resume(struct device * dev)
#define suspend_report_result(fn, ret) do { } while (0)
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
return -EIO;
}
#endif
/* changes to device_may_wakeup take effect on the next pm state change.