Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* -*- linux-c -*-
0003  *
0004  * (C) 2003 zecke@handhelds.org
0005  *
0006  * based on arch/arm/kernel/apm.c
0007  * factor out the information needed by architectures to provide
0008  * apm status
0009  */
0010 #ifndef __LINUX_APM_EMULATION_H
0011 #define __LINUX_APM_EMULATION_H
0012 
0013 #include <linux/apm_bios.h>
0014 
0015 /*
0016  * This structure gets filled in by the machine specific 'get_power_status'
0017  * implementation.  Any fields which are not set default to a safe value.
0018  */
0019 struct apm_power_info {
0020     unsigned char   ac_line_status;
0021 #define APM_AC_OFFLINE          0
0022 #define APM_AC_ONLINE           1
0023 #define APM_AC_BACKUP           2
0024 #define APM_AC_UNKNOWN          0xff
0025 
0026     unsigned char   battery_status;
0027 #define APM_BATTERY_STATUS_HIGH     0
0028 #define APM_BATTERY_STATUS_LOW      1
0029 #define APM_BATTERY_STATUS_CRITICAL 2
0030 #define APM_BATTERY_STATUS_CHARGING 3
0031 #define APM_BATTERY_STATUS_NOT_PRESENT  4
0032 #define APM_BATTERY_STATUS_UNKNOWN  0xff
0033 
0034     unsigned char   battery_flag;
0035 #define APM_BATTERY_FLAG_HIGH       (1 << 0)
0036 #define APM_BATTERY_FLAG_LOW        (1 << 1)
0037 #define APM_BATTERY_FLAG_CRITICAL   (1 << 2)
0038 #define APM_BATTERY_FLAG_CHARGING   (1 << 3)
0039 #define APM_BATTERY_FLAG_NOT_PRESENT    (1 << 7)
0040 #define APM_BATTERY_FLAG_UNKNOWN    0xff
0041 
0042     int     battery_life;
0043     int     time;
0044     int     units;
0045 #define APM_UNITS_MINS          0
0046 #define APM_UNITS_SECS          1
0047 #define APM_UNITS_UNKNOWN       -1
0048 
0049 };
0050 
0051 /*
0052  * This allows machines to provide their own "apm get power status" function.
0053  */
0054 extern void (*apm_get_power_status)(struct apm_power_info *);
0055 
0056 /*
0057  * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
0058  */
0059 void apm_queue_event(apm_event_t event);
0060 
0061 #endif /* __LINUX_APM_EMULATION_H */