| 1 | From 4f76252afe98fd017894e61c296bc61836e67a4a Mon Sep 17 00:00:00 2001 |
| 2 | From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com> |
| 3 | Date: Fri, 26 Sep 2008 22:10:56 -0700 |
| 4 | Subject: [PATCH 065/134] PM: Add early suspend api. |
| 5 | |
| 6 | --- |
| 7 | include/linux/earlysuspend.h | 56 ++++++++++++++++++++++++++++++++++++++++++ |
| 8 | 1 files changed, 56 insertions(+), 0 deletions(-) |
| 9 | create mode 100755 include/linux/earlysuspend.h |
| 10 | |
| 11 | --- /dev/null |
| 12 | +++ b/include/linux/earlysuspend.h |
| 13 | @@ -0,0 +1,56 @@ |
| 14 | +/* include/linux/earlysuspend.h |
| 15 | + * |
| 16 | + * Copyright (C) 2007-2008 Google, Inc. |
| 17 | + * |
| 18 | + * This software is licensed under the terms of the GNU General Public |
| 19 | + * License version 2, as published by the Free Software Foundation, and |
| 20 | + * may be copied, distributed, and modified under those terms. |
| 21 | + * |
| 22 | + * This program is distributed in the hope that it will be useful, |
| 23 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | + * GNU General Public License for more details. |
| 26 | + * |
| 27 | + */ |
| 28 | + |
| 29 | +#ifndef _LINUX_EARLYSUSPEND_H |
| 30 | +#define _LINUX_EARLYSUSPEND_H |
| 31 | + |
| 32 | +#ifdef CONFIG_HAS_EARLYSUSPEND |
| 33 | +#include <linux/list.h> |
| 34 | +#endif |
| 35 | + |
| 36 | +/* The early_suspend structure defines suspend and resume hooks to be called |
| 37 | + * when the user visible sleep state of the system changes, and a level to |
| 38 | + * control the order. They can be used to turn off the screen and input |
| 39 | + * devices that are not used for wakeup. |
| 40 | + * Suspend handlers are called in low to high level order, resume handlers are |
| 41 | + * called in the opposite order. If, when calling register_early_suspend, |
| 42 | + * the suspend handlers have already been called without a matching call to the |
| 43 | + * resume handlers, the suspend handler will be called directly from |
| 44 | + * register_early_suspend. This direct call can violate the normal level order. |
| 45 | + */ |
| 46 | +enum { |
| 47 | + EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50, |
| 48 | + EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100, |
| 49 | + EARLY_SUSPEND_LEVEL_DISABLE_FB = 150, |
| 50 | +}; |
| 51 | +struct early_suspend { |
| 52 | +#ifdef CONFIG_HAS_EARLYSUSPEND |
| 53 | + struct list_head link; |
| 54 | + int level; |
| 55 | + void (*suspend)(struct early_suspend *h); |
| 56 | + void (*resume)(struct early_suspend *h); |
| 57 | +#endif |
| 58 | +}; |
| 59 | + |
| 60 | +#ifdef CONFIG_HAS_EARLYSUSPEND |
| 61 | +void register_early_suspend(struct early_suspend *handler); |
| 62 | +void unregister_early_suspend(struct early_suspend *handler); |
| 63 | +#else |
| 64 | +#define register_early_suspend(handler) do { } while (0) |
| 65 | +#define unregister_early_suspend(handler) do { } while (0) |
| 66 | +#endif |
| 67 | + |
| 68 | +#endif |
| 69 | + |
| 70 | |