blob: 59188a80445f304f2fad3cc900c57f7c0f2ab657 [file] [log] [blame]
Colin Crossa2582c22012-05-03 17:30:16 -07001/*
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>
Ruchi Kandoid3027d82015-05-13 14:57:08 -070021#include <stdbool.h>
Colin Crossa2582c22012-05-03 17:30:16 -070022
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 */
35int 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 */
45int autosuspend_disable(void);
46
Dianne Hackborn9552cdf2014-03-07 11:00:39 -080047/*
48 * set_wakeup_callback
49 *
Ruchi Kandoid3027d82015-05-13 14:57:08 -070050 * 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.
Dianne Hackborn9552cdf2014-03-07 11:00:39 -080053 */
Ruchi Kandoid3027d82015-05-13 14:57:08 -070054void set_wakeup_callback(void (*func)(bool success));
Dianne Hackborn9552cdf2014-03-07 11:00:39 -080055
Colin Crossa2582c22012-05-03 17:30:16 -070056__END_DECLS
57
58#endif