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 22 __BEGIN_DECLS 23 24 /* 25 * autosuspend_enable 26 * 27 * Turn on autosuspend in the kernel, allowing it to enter suspend if no 28 * wakelocks/wakeup_sources are held. 29 * 30 * 31 * 32 * Returns 0 on success, -1 if autosuspend was not enabled. 33 */ 34 int autosuspend_enable(void); 35 36 /* 37 * autosuspend_disable 38 * 39 * Turn off autosuspend in the kernel, preventing suspend and synchronizing 40 * with any in-progress resume. 41 * 42 * Returns 0 on success, -1 if autosuspend was not disabled. 43 */ 44 int autosuspend_disable(void); 45 46 /* 47 * set_wakeup_callback 48 * 49 * Set a function to be called each time the device wakes up from suspend. 50 */ 51 void set_wakeup_callback(void (*func)(void)); 52 53 __END_DECLS 54 55 #endif 56