1042aefc4SAlexander von Gluck IV/*
2042aefc4SAlexander von Gluck IV * Copyright 2004-2011, Haiku, Inc. All rights reserved.
3042aefc4SAlexander von Gluck IV * Distributed under the terms of the MIT License.
4042aefc4SAlexander von Gluck IV */
540890e97SAxel Dörfler#ifndef POWER_MANAGMENT_H
640890e97SAxel Dörfler#define POWER_MANAGMENT_H
740890e97SAxel Dörfler
8042aefc4SAlexander von Gluck IV
940890e97SAxel Dörfler#include <Drivers.h>
1040890e97SAxel Dörfler
11042aefc4SAlexander von Gluck IV
1240890e97SAxel Dörfler// io controls
13042aefc4SAlexander von Gluck IVenum {
1440890e97SAxel Dörfler	// ioctl response with kMagicFreqID
1540890e97SAxel Dörfler	IDENTIFY_DEVICE = B_DEVICE_OP_CODES_END + 20001,
16042aefc4SAlexander von Gluck IV
17a6356144SClemens Zeidler	GET_BATTERY_INFO,
18a6356144SClemens Zeidler	GET_EXTENDED_BATTERY_INFO,
19a6356144SClemens Zeidler	WATCH_BATTERY,
20a6356144SClemens Zeidler	STOP_WATCHING_BATTERY
21042aefc4SAlexander von Gluck IV};
22042aefc4SAlexander von Gluck IV
2340890e97SAxel Dörfler
24a6356144SClemens Zeidler// ACPI Battery:
25a6356144SClemens Zeidler// magic id returned by IDENTIFY_DEVICE
26a6356144SClemens Zeidlerconst uint32 kMagicACPIBatteryID = 17822;
27a6356144SClemens Zeidler
28042aefc4SAlexander von Gluck IV
29042aefc4SAlexander von Gluck IV// Our known battery states
30a6356144SClemens Zeidler#define BATTERY_DISCHARGING		0x01
31a6356144SClemens Zeidler#define BATTERY_CHARGING		0x02
32a6356144SClemens Zeidler#define BATTERY_CRITICAL_STATE	0x04
33a6356144SClemens Zeidler
34a6356144SClemens Zeidler
35a6356144SClemens Zeidlertypedef struct {
36a6356144SClemens Zeidler	int		state;
37a6356144SClemens Zeidler	int		current_rate;
38a6356144SClemens Zeidler	int 	capacity;
39a6356144SClemens Zeidler	int		voltage;
40a6356144SClemens Zeidler} acpi_battery_info;
41a6356144SClemens Zeidler
42a6356144SClemens Zeidler
43a6356144SClemens Zeidlertypedef struct {
44a6356144SClemens Zeidler	int		power_unit;
45a6356144SClemens Zeidler	int		design_capacity;
46a6356144SClemens Zeidler	int		last_full_charge;
47a6356144SClemens Zeidler	int		technology;
48a6356144SClemens Zeidler	int 	design_voltage;
49a6356144SClemens Zeidler	int		design_capacity_warning;
50a6356144SClemens Zeidler	int		design_capacity_low;
51a6356144SClemens Zeidler	int		capacity_granularity_1;
52a6356144SClemens Zeidler	int		capacity_granularity_2;
53a6356144SClemens Zeidler	char	model_number[32];
54a6356144SClemens Zeidler	char	serial_number[32];
55a6356144SClemens Zeidler	char	type[32];
56042aefc4SAlexander von Gluck IV	char	oem_info[32];
57a6356144SClemens Zeidler} acpi_extended_battery_info;
58a6356144SClemens Zeidler
59a6356144SClemens Zeidler
6040890e97SAxel Dörfler#endif
61