162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/* -*- linux-c -*-
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * (C) 2003 zecke@handhelds.org
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * based on arch/arm/kernel/apm.c
762306a36Sopenharmony_ci * factor out the information needed by architectures to provide
862306a36Sopenharmony_ci * apm status
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#ifndef __LINUX_APM_EMULATION_H
1162306a36Sopenharmony_ci#define __LINUX_APM_EMULATION_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/apm_bios.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/*
1662306a36Sopenharmony_ci * This structure gets filled in by the machine specific 'get_power_status'
1762306a36Sopenharmony_ci * implementation.  Any fields which are not set default to a safe value.
1862306a36Sopenharmony_ci */
1962306a36Sopenharmony_cistruct apm_power_info {
2062306a36Sopenharmony_ci	unsigned char	ac_line_status;
2162306a36Sopenharmony_ci#define APM_AC_OFFLINE			0
2262306a36Sopenharmony_ci#define APM_AC_ONLINE			1
2362306a36Sopenharmony_ci#define APM_AC_BACKUP			2
2462306a36Sopenharmony_ci#define APM_AC_UNKNOWN			0xff
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci	unsigned char	battery_status;
2762306a36Sopenharmony_ci#define APM_BATTERY_STATUS_HIGH		0
2862306a36Sopenharmony_ci#define APM_BATTERY_STATUS_LOW		1
2962306a36Sopenharmony_ci#define APM_BATTERY_STATUS_CRITICAL	2
3062306a36Sopenharmony_ci#define APM_BATTERY_STATUS_CHARGING	3
3162306a36Sopenharmony_ci#define APM_BATTERY_STATUS_NOT_PRESENT	4
3262306a36Sopenharmony_ci#define APM_BATTERY_STATUS_UNKNOWN	0xff
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	unsigned char	battery_flag;
3562306a36Sopenharmony_ci#define APM_BATTERY_FLAG_HIGH		(1 << 0)
3662306a36Sopenharmony_ci#define APM_BATTERY_FLAG_LOW		(1 << 1)
3762306a36Sopenharmony_ci#define APM_BATTERY_FLAG_CRITICAL	(1 << 2)
3862306a36Sopenharmony_ci#define APM_BATTERY_FLAG_CHARGING	(1 << 3)
3962306a36Sopenharmony_ci#define APM_BATTERY_FLAG_NOT_PRESENT	(1 << 7)
4062306a36Sopenharmony_ci#define APM_BATTERY_FLAG_UNKNOWN	0xff
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	int		battery_life;
4362306a36Sopenharmony_ci	int		time;
4462306a36Sopenharmony_ci	int		units;
4562306a36Sopenharmony_ci#define APM_UNITS_MINS			0
4662306a36Sopenharmony_ci#define APM_UNITS_SECS			1
4762306a36Sopenharmony_ci#define APM_UNITS_UNKNOWN		-1
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/*
5262306a36Sopenharmony_ci * This allows machines to provide their own "apm get power status" function.
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_ciextern void (*apm_get_power_status)(struct apm_power_info *);
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/*
5762306a36Sopenharmony_ci * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
5862306a36Sopenharmony_ci */
5962306a36Sopenharmony_civoid apm_queue_event(apm_event_t event);
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#endif /* __LINUX_APM_EMULATION_H */
62