apm-emulation.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* -*- linux-c -*-
  3. *
  4. * (C) 2003 zecke@handhelds.org
  5. *
  6. * based on arch/arm/kernel/apm.c
  7. * factor out the information needed by architectures to provide
  8. * apm status
  9. */
  10. #ifndef __LINUX_APM_EMULATION_H
  11. #define __LINUX_APM_EMULATION_H
  12. #include <linux/apm_bios.h>
  13. /*
  14. * This structure gets filled in by the machine specific 'get_power_status'
  15. * implementation. Any fields which are not set default to a safe value.
  16. */
  17. struct apm_power_info {
  18. unsigned char ac_line_status;
  19. #define APM_AC_OFFLINE 0
  20. #define APM_AC_ONLINE 1
  21. #define APM_AC_BACKUP 2
  22. #define APM_AC_UNKNOWN 0xff
  23. unsigned char battery_status;
  24. #define APM_BATTERY_STATUS_HIGH 0
  25. #define APM_BATTERY_STATUS_LOW 1
  26. #define APM_BATTERY_STATUS_CRITICAL 2
  27. #define APM_BATTERY_STATUS_CHARGING 3
  28. #define APM_BATTERY_STATUS_NOT_PRESENT 4
  29. #define APM_BATTERY_STATUS_UNKNOWN 0xff
  30. unsigned char battery_flag;
  31. #define APM_BATTERY_FLAG_HIGH (1 << 0)
  32. #define APM_BATTERY_FLAG_LOW (1 << 1)
  33. #define APM_BATTERY_FLAG_CRITICAL (1 << 2)
  34. #define APM_BATTERY_FLAG_CHARGING (1 << 3)
  35. #define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
  36. #define APM_BATTERY_FLAG_UNKNOWN 0xff
  37. int battery_life;
  38. int time;
  39. int units;
  40. #define APM_UNITS_MINS 0
  41. #define APM_UNITS_SECS 1
  42. #define APM_UNITS_UNKNOWN -1
  43. };
  44. /*
  45. * This allows machines to provide their own "apm get power status" function.
  46. */
  47. extern void (*apm_get_power_status)(struct apm_power_info *);
  48. /*
  49. * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
  50. */
  51. void apm_queue_event(apm_event_t event);
  52. #endif /* __LINUX_APM_EMULATION_H */