earlysuspend.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef _LINUX_EARLYSUSPEND_H
  16. #define _LINUX_EARLYSUSPEND_H
  17. #ifdef CONFIG_HAS_EARLYSUSPEND
  18. #include <linux/list.h>
  19. #endif
  20. /* The early_suspend structure defines suspend and resume hooks to be called
  21. * when the user visible sleep state of the system changes, and a level to
  22. * control the order. They can be used to turn off the screen and input
  23. * devices that are not used for wakeup.
  24. * Suspend handlers are called in low to high level order, resume handlers are
  25. * called in the opposite order. If, when calling register_early_suspend,
  26. * the suspend handlers have already been called without a matching call to the
  27. * resume handlers, the suspend handler will be called directly from
  28. * register_early_suspend. This direct call can violate the normal level order.
  29. */
  30. enum {
  31. EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,
  32. EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,
  33. EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,
  34. };
  35. struct early_suspend {
  36. #ifdef CONFIG_HAS_EARLYSUSPEND
  37. struct list_head link;
  38. int level;
  39. void (*suspend)(struct early_suspend *h);
  40. void (*resume)(struct early_suspend *h);
  41. #endif
  42. };
  43. #ifdef CONFIG_HAS_EARLYSUSPEND
  44. void register_early_suspend(struct early_suspend *handler);
  45. void unregister_early_suspend(struct early_suspend *handler);
  46. #else
  47. #define register_early_suspend(handler) do { } while (0)
  48. #define unregister_early_suspend(handler) do { } while (0)
  49. #endif
  50. #endif