edd: add default mode CONFIG_EDD_OFF=n, override with edd={on,off}
[pandora-kernel.git] / include / linux / suspend.h
index 4360e08..a697742 100644 (file)
 #include <asm/errno.h>
 
 #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern void pm_set_vt_switch(int);
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
-static inline int pm_prepare_console(void) { return 0; }
-static inline void pm_restore_console(void) {}
+static inline void pm_set_vt_switch(int do_switch)
+{
+}
+
+static inline int pm_prepare_console(void)
+{
+       return 0;
+}
+
+static inline void pm_restore_console(void)
+{
+}
 #endif
 
 typedef int __bitwise suspend_state_t;
@@ -38,18 +49,16 @@ typedef int __bitwise suspend_state_t;
  *     There is the %suspend_valid_only_mem function available that can be
  *     assigned to this if the platform only supports mem sleep.
  *
- * @set_target: Tell the platform which system sleep state is going to be
- *     entered.
- *     @set_target() is executed right prior to suspending devices.  The
- *     information conveyed to the platform code by @set_target() should be
- *     disregarded by the platform as soon as @finish() is executed and if
- *     @prepare() fails.  If @set_target() fails (ie. returns nonzero),
+ * @begin: Initialise a transition to given system sleep state.
+ *     @begin() is executed right prior to suspending devices.  The information
+ *     conveyed to the platform code by @begin() should be disregarded by it as
+ *     soon as @end() is executed.  If @begin() fails (ie. returns nonzero),
  *     @prepare(), @enter() and @finish() will not be called by the PM core.
  *     This callback is optional.  However, if it is implemented, the argument
- *     passed to @enter() is meaningless and should be ignored.
+ *     passed to @enter() is redundant and should be ignored.
  *
  * @prepare: Prepare the platform for entering the system sleep state indicated
- *     by @set_target().
+ *     by @begin().
  *     @prepare() is called right after devices have been suspended (ie. the
  *     appropriate .suspend() method has been executed for each device) and
  *     before the nonboot CPUs are disabled (it is executed with IRQs enabled).
@@ -57,8 +66,8 @@ typedef int __bitwise suspend_state_t;
  *     error code otherwise, in which case the system cannot enter the desired
  *     sleep state (@enter() and @finish() will not be called in that case).
  *
- * @enter: Enter the system sleep state indicated by @set_target() or
- *     represented by the argument if @set_target() is not implemented.
+ * @enter: Enter the system sleep state indicated by @begin() or represented by
+ *     the argument if @begin() is not implemented.
  *     This callback is mandatory.  It returns 0 on success or a negative
  *     error code otherwise, in which case the system cannot enter the desired
  *     sleep state.
@@ -69,13 +78,22 @@ typedef int __bitwise suspend_state_t;
  *     This callback is optional, but should be implemented by the platforms
  *     that implement @prepare().  If implemented, it is always called after
  *     @enter() (even if @enter() fails).
+ *
+ * @end: Called by the PM core right after resuming devices, to indicate to
+ *     the platform that the system has returned to the working state or
+ *     the transition to the sleep state has been aborted.
+ *     This callback is optional, but should be implemented by the platforms
+ *     that implement @begin(), but platforms implementing @begin() should
+ *     also provide a @end() which cleans up transitions aborted before
+ *     @enter().
  */
 struct platform_suspend_ops {
        int (*valid)(suspend_state_t state);
-       int (*set_target)(suspend_state_t state);
+       int (*begin)(suspend_state_t state);
        int (*prepare)(void);
        int (*enter)(suspend_state_t state);
        void (*finish)(void);
+       void (*end)(void);
 };
 
 #ifdef CONFIG_SUSPEND
@@ -123,20 +141,22 @@ struct pbe {
 };
 
 /* mm/page_alloc.c */
-extern void drain_local_pages(void);
 extern void mark_free_pages(struct zone *zone);
 
 /**
  * struct platform_hibernation_ops - hibernation platform support
  *
- * The methods in this structure allow a platform to override the default
- * mechanism of shutting down the machine during a hibernation transition.
+ * The methods in this structure allow a platform to carry out special
+ * operations required by it during a hibernation transition.
  *
- * All three methods must be assigned.
+ * All the methods below must be implemented.
  *
- * @start: Tell the platform driver that we're starting hibernation.
+ * @begin: Tell the platform driver that we're starting hibernation.
  *     Called right after shrinking memory and before freezing devices.
  *
+ * @end: Called by the PM core right after resuming devices, to indicate to
+ *     the platform that the system has returned to the working state.
+ *
  * @pre_snapshot: Prepare the platform for creating the hibernation image.
  *     Called right after devices have been frozen and before the nonboot
  *     CPUs are disabled (runs with IRQs on).
@@ -171,7 +191,8 @@ extern void mark_free_pages(struct zone *zone);
  *     thawing devices (runs with IRQs on).
  */
 struct platform_hibernation_ops {
-       int (*start)(void);
+       int (*begin)(void);
+       void (*end)(void);
        int (*pre_snapshot)(void);
        void (*finish)(void);
        int (*prepare)(void);
@@ -211,22 +232,10 @@ static inline int hibernate(void) { return -ENOSYS; }
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
-struct saved_context;
-void __save_processor_state(struct saved_context *ctxt);
-void __restore_processor_state(struct saved_context *ctxt);
 
 /* kernel/power/main.c */
-extern struct blocking_notifier_head pm_chain_head;
-
-static inline int register_pm_notifier(struct notifier_block *nb)
-{
-       return blocking_notifier_chain_register(&pm_chain_head, nb);
-}
-
-static inline int unregister_pm_notifier(struct notifier_block *nb)
-{
-       return blocking_notifier_chain_unregister(&pm_chain_head, nb);
-}
+extern int register_pm_notifier(struct notifier_block *nb);
+extern int unregister_pm_notifier(struct notifier_block *nb);
 
 #define pm_notifier(fn, pri) {                         \
        static struct notifier_block fn##_nb =                  \