2000-10-28 06:59:48 +00:00
|
|
|
/*-
|
2003-08-19 01:54:34 +00:00
|
|
|
* Copyright (c) 1999 Takanori Watanabe <takawata@jp.freebsd.org>
|
2000-10-28 06:59:48 +00:00
|
|
|
* Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
2005-03-02 09:22:34 +00:00
|
|
|
* $FreeBSD$
|
2000-10-28 06:59:48 +00:00
|
|
|
*/
|
|
|
|
|
2005-02-28 05:39:34 +00:00
|
|
|
#ifndef _ACPIIO_H_
|
|
|
|
#define _ACPIIO_H_
|
|
|
|
|
2000-12-08 09:16:20 +00:00
|
|
|
/*
|
|
|
|
* Core ACPI subsystem ioctls
|
|
|
|
*/
|
2000-10-28 06:59:48 +00:00
|
|
|
#define ACPIIO_SETSLPSTATE _IOW('P', 3, int)
|
|
|
|
|
2001-06-23 10:38:25 +00:00
|
|
|
struct acpi_battinfo {
|
2003-08-28 16:06:30 +00:00
|
|
|
int cap; /* percent */
|
2005-03-17 22:42:49 +00:00
|
|
|
int min; /* remaining time (in minutes) */
|
2003-08-28 16:06:30 +00:00
|
|
|
int state; /* battery state */
|
2005-07-23 19:36:00 +00:00
|
|
|
int rate; /* emptying rate */
|
2001-06-23 10:38:25 +00:00
|
|
|
};
|
|
|
|
|
2000-12-22 14:41:55 +00:00
|
|
|
#define ACPI_CMBAT_MAXSTRLEN 32
|
|
|
|
struct acpi_bif {
|
2005-10-23 00:16:41 +00:00
|
|
|
uint32_t units; /* Units (mW or mA). */
|
|
|
|
#define ACPI_BIF_UNITS_MW 0 /* Capacity in mWh, rate in mW. */
|
|
|
|
#define ACPI_BIF_UNITS_MA 1 /* Capacity in mAh, rate in mA. */
|
2005-07-23 19:36:00 +00:00
|
|
|
uint32_t dcap; /* Design Capacity */
|
|
|
|
uint32_t lfcap; /* Last Full capacity */
|
|
|
|
uint32_t btech; /* Battery Technology */
|
|
|
|
uint32_t dvol; /* Design voltage (mV) */
|
|
|
|
uint32_t wcap; /* WARN capacity */
|
|
|
|
uint32_t lcap; /* Low capacity */
|
|
|
|
uint32_t gra1; /* Granularity 1 (Warn to Low) */
|
|
|
|
uint32_t gra2; /* Granularity 2 (Full to Warn) */
|
2003-08-28 16:06:30 +00:00
|
|
|
char model[ACPI_CMBAT_MAXSTRLEN]; /* model identifier */
|
|
|
|
char serial[ACPI_CMBAT_MAXSTRLEN]; /* Serial number */
|
|
|
|
char type[ACPI_CMBAT_MAXSTRLEN]; /* Type */
|
|
|
|
char oeminfo[ACPI_CMBAT_MAXSTRLEN]; /* OEM infomation */
|
2000-12-22 14:41:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_bst {
|
2005-07-23 19:36:00 +00:00
|
|
|
uint32_t state; /* Battery State */
|
|
|
|
uint32_t rate; /* Present Rate */
|
|
|
|
uint32_t cap; /* Remaining Capacity */
|
|
|
|
uint32_t volt; /* Present Voltage */
|
2000-12-22 14:41:55 +00:00
|
|
|
};
|
|
|
|
|
2001-06-23 10:38:25 +00:00
|
|
|
#define ACPI_BATT_STAT_DISCHARG 0x0001
|
|
|
|
#define ACPI_BATT_STAT_CHARGING 0x0002
|
|
|
|
#define ACPI_BATT_STAT_CRITICAL 0x0004
|
|
|
|
#define ACPI_BATT_STAT_NOT_PRESENT 0x0007
|
|
|
|
#define ACPI_BATT_STAT_MAX 0x0007
|
|
|
|
|
|
|
|
union acpi_battery_ioctl_arg {
|
2005-07-23 19:36:00 +00:00
|
|
|
int unit; /* Device unit or ACPI_BATTERY_ALL_UNITS. */
|
2001-06-23 10:38:25 +00:00
|
|
|
|
2005-07-23 19:36:00 +00:00
|
|
|
struct acpi_battinfo battinfo;
|
2001-06-23 10:38:25 +00:00
|
|
|
|
2005-03-17 22:42:49 +00:00
|
|
|
struct acpi_bif bif;
|
|
|
|
struct acpi_bst bst;
|
2000-12-24 19:12:10 +00:00
|
|
|
};
|
|
|
|
|
2005-07-23 19:36:00 +00:00
|
|
|
#define ACPI_BATTERY_ALL_UNITS (-1)
|
2005-10-23 00:16:41 +00:00
|
|
|
#define ACPI_BATT_UNKNOWN 0xffffffff /* _BST or _BIF value unknown. */
|
2005-07-23 19:36:00 +00:00
|
|
|
|
2005-03-17 22:42:49 +00:00
|
|
|
/* Common battery ioctls */
|
2003-08-28 16:06:30 +00:00
|
|
|
#define ACPIIO_BATT_GET_UNITS _IOR('B', 0x01, int)
|
2001-06-23 10:38:25 +00:00
|
|
|
#define ACPIIO_BATT_GET_BATTINFO _IOWR('B', 0x03, union acpi_battery_ioctl_arg)
|
2005-03-17 22:42:49 +00:00
|
|
|
#define ACPIIO_BATT_GET_BIF _IOWR('B', 0x10, union acpi_battery_ioctl_arg)
|
|
|
|
#define ACPIIO_BATT_GET_BST _IOWR('B', 0x11, union acpi_battery_ioctl_arg)
|
2001-06-23 10:38:25 +00:00
|
|
|
|
2005-03-17 22:42:49 +00:00
|
|
|
/* Control Method battery ioctls (deprecated) */
|
|
|
|
#define ACPIIO_CMBAT_GET_BIF ACPIIO_BATT_GET_BIF
|
|
|
|
#define ACPIIO_CMBAT_GET_BST ACPIIO_BATT_GET_BST
|
2000-12-24 19:12:10 +00:00
|
|
|
|
2005-02-28 05:39:34 +00:00
|
|
|
/* Get AC adapter status. */
|
2003-08-28 16:06:30 +00:00
|
|
|
#define ACPIIO_ACAD_GET_STATUS _IOR('A', 1, int)
|
2000-12-24 19:12:10 +00:00
|
|
|
|
2000-12-08 09:16:20 +00:00
|
|
|
#ifdef _KERNEL
|
2003-08-28 16:06:30 +00:00
|
|
|
typedef int (*acpi_ioctl_fn)(u_long cmd, caddr_t addr, void *arg);
|
|
|
|
extern int acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg);
|
|
|
|
extern void acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn);
|
2000-12-08 09:16:20 +00:00
|
|
|
#endif
|
2005-02-28 05:39:34 +00:00
|
|
|
|
|
|
|
#endif /* !_ACPIIO_H_ */
|