[PATCH 1/5] introduce .wakeup_event ops

Shaohua Li
2009-08-19T07:24:10Z

Introduce .wakeup_event(). When a device gets a wakeup event,
the callback is called. The callback usually should check if the device
really invokes wakeup event and disable wakeup event if yes.

Usually driver should does nothing in the op as bus can handle it. But in some
cases, like pci bus, UHCI controller doesn't use standard PME registers for
wakeup, instead of using special approach. In this case, UHCI controller driver
should implement this op.

---
include/linux/pm.h | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux/include/linux/pm.h
===================================================================
--- linux.orig/include/linux/pm.h 2009-08-19 11:44:41.000000000 +0800
+++ linux/include/linux/pm.h 2009-08-19 13:44:03.000000000 +0800
@@ -191,6 +191,13 @@ typedef struct pm_message {
* power state if all of the necessary conditions are satisfied. Check
* these conditions and handle the device as appropriate, possibly queueing
* a suspend request for it.
+ *
+ * @wakeup_event: Checks if a wakeup event occurs. In bus level, the op might
+ * check all devices under the bus and call device_receive_wakeup_event()
+ * for devices which invoke wakeup event. In device level, the op just
+ * returns if a wakeup event occurs. Note, if device follows standard
+ * mechanism for wakeup which bus level can handle, device level op can be
+ * empty.
*/

struct dev_pm_ops {
@@ -211,6 +218,7 @@ struct dev_pm_ops {
int (*runtime_suspend)(struct device *dev);
int (*runtime_resume)(struct device *dev);
void (*runtime_idle)(struct device *dev);
+ bool (*wakeup_event)(struct device *dev);
};

/**