1 /* include/linux/earlysuspend.h 2 * 3 * Copyright (C) 2007-2008 Google, Inc. 4 * 5 * This software is licensed under the terms of the GNU General Public 6 * License version 2, as published by the Free Software Foundation, and 7 * may be copied, distributed, and modified under those terms. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 */ 15 16 #ifndef _LINUX_EARLYSUSPEND_H 17 #define _LINUX_EARLYSUSPEND_H 18 19 #ifdef CONFIG_HAS_EARLYSUSPEND 20 #include <linux/list.h> 21 #endif 22 23 /* The early_suspend structure defines suspend and resume hooks to be called 24 * when the user visible sleep state of the system changes, and a level to 25 * control the order. They can be used to turn off the screen and input 26 * devices that are not used for wakeup. 27 * Suspend handlers are called in low to high level order, resume handlers are 28 * called in the opposite order. If, when calling register_early_suspend, 29 * the suspend handlers have already been called without a matching call to the 30 * resume handlers, the suspend handler will be called directly from 31 * register_early_suspend. This direct call can violate the normal level order. 32 */ 33 enum { 34 EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50, 35 EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100, 36 EARLY_SUSPEND_LEVEL_DISABLE_FB = 150, 37 }; 38 struct early_suspend { 39 #ifdef CONFIG_HAS_EARLYSUSPEND 40 struct list_head link; 41 int level; 42 void (*suspend)(struct early_suspend *h); 43 void (*resume)(struct early_suspend *h); 44 #endif 45 }; 46 47 #ifdef CONFIG_HAS_EARLYSUSPEND 48 void register_early_suspend(struct early_suspend *handler); 49 void unregister_early_suspend(struct early_suspend *handler); 50 #else 51 #define register_early_suspend(handler) do { } while (0) 52 #define unregister_early_suspend(handler) do { } while (0) 53 #endif 54 55 #endif 56 57