]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/suspend.h
Suspend: Introduce begin() and end() callbacks
[linux-2.6-omap-h63xx.git] / include / linux / suspend.h
index 51283e0745b36bcf1fa9878a3597777b67a2c154..a0b1dbb5919fb72de7f8bf4a2c973bf0d218b7fd 100644 (file)
@@ -38,18 +38,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 +55,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 +67,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