• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _LIBSUSPEND_AUTOSUSPEND_H_
18 #define _LIBSUSPEND_AUTOSUSPEND_H_
19 
20 #include <sys/cdefs.h>
21 #include <stdbool.h>
22 
23 __BEGIN_DECLS
24 
25 /*
26  * autosuspend_enable
27  *
28  * Turn on autosuspend in the kernel, allowing it to enter suspend if no
29  * wakelocks/wakeup_sources are held.
30  *
31  *
32  *
33  * Returns 0 on success, -1 if autosuspend was not enabled.
34  */
35 int autosuspend_enable(void);
36 
37 /*
38  * autosuspend_disable
39  *
40  * Turn off autosuspend in the kernel, preventing suspend and synchronizing
41  * with any in-progress resume.
42  *
43  * Returns 0 on success, -1 if autosuspend was not disabled.
44  */
45 int autosuspend_disable(void);
46 
47 /*
48  * set_wakeup_callback
49  *
50  * Set a function to be called each time the device returns from suspend.
51  * success is true if the suspend was sucessful and false if the suspend
52  * aborted due to some reason.
53  */
54 void set_wakeup_callback(void (*func)(bool success));
55 
56 __END_DECLS
57 
58 #endif
59