18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* -*- linux-c -*- 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * (C) 2003 zecke@handhelds.org 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * based on arch/arm/kernel/apm.c 78c2ecf20Sopenharmony_ci * factor out the information needed by architectures to provide 88c2ecf20Sopenharmony_ci * apm status 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci#ifndef __LINUX_APM_EMULATION_H 118c2ecf20Sopenharmony_ci#define __LINUX_APM_EMULATION_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/apm_bios.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* 168c2ecf20Sopenharmony_ci * This structure gets filled in by the machine specific 'get_power_status' 178c2ecf20Sopenharmony_ci * implementation. Any fields which are not set default to a safe value. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_cistruct apm_power_info { 208c2ecf20Sopenharmony_ci unsigned char ac_line_status; 218c2ecf20Sopenharmony_ci#define APM_AC_OFFLINE 0 228c2ecf20Sopenharmony_ci#define APM_AC_ONLINE 1 238c2ecf20Sopenharmony_ci#define APM_AC_BACKUP 2 248c2ecf20Sopenharmony_ci#define APM_AC_UNKNOWN 0xff 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci unsigned char battery_status; 278c2ecf20Sopenharmony_ci#define APM_BATTERY_STATUS_HIGH 0 288c2ecf20Sopenharmony_ci#define APM_BATTERY_STATUS_LOW 1 298c2ecf20Sopenharmony_ci#define APM_BATTERY_STATUS_CRITICAL 2 308c2ecf20Sopenharmony_ci#define APM_BATTERY_STATUS_CHARGING 3 318c2ecf20Sopenharmony_ci#define APM_BATTERY_STATUS_NOT_PRESENT 4 328c2ecf20Sopenharmony_ci#define APM_BATTERY_STATUS_UNKNOWN 0xff 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci unsigned char battery_flag; 358c2ecf20Sopenharmony_ci#define APM_BATTERY_FLAG_HIGH (1 << 0) 368c2ecf20Sopenharmony_ci#define APM_BATTERY_FLAG_LOW (1 << 1) 378c2ecf20Sopenharmony_ci#define APM_BATTERY_FLAG_CRITICAL (1 << 2) 388c2ecf20Sopenharmony_ci#define APM_BATTERY_FLAG_CHARGING (1 << 3) 398c2ecf20Sopenharmony_ci#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7) 408c2ecf20Sopenharmony_ci#define APM_BATTERY_FLAG_UNKNOWN 0xff 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci int battery_life; 438c2ecf20Sopenharmony_ci int time; 448c2ecf20Sopenharmony_ci int units; 458c2ecf20Sopenharmony_ci#define APM_UNITS_MINS 0 468c2ecf20Sopenharmony_ci#define APM_UNITS_SECS 1 478c2ecf20Sopenharmony_ci#define APM_UNITS_UNKNOWN -1 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* 528c2ecf20Sopenharmony_ci * This allows machines to provide their own "apm get power status" function. 538c2ecf20Sopenharmony_ci */ 548c2ecf20Sopenharmony_ciextern void (*apm_get_power_status)(struct apm_power_info *); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* 578c2ecf20Sopenharmony_ci * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND) 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_civoid apm_queue_event(apm_event_t event); 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#endif /* __LINUX_APM_EMULATION_H */ 62