File: /usr/src/linux/drivers/acpi/ospm/include/bt.h
1 /******************************************************************************
2 *
3 * Module Name: bt.h
4 * $Revision: 16 $
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000, 2001 Andrew Grover
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26
27 #ifndef __BT_H__
28 #define __BT_H__
29
30 #include <actypes.h>
31 #include <acexcep.h>
32 #include <bm.h>
33
34
35 /*****************************************************************************
36 * Types & Other Defines
37 *****************************************************************************/
38
39 /*! [Begin] no source code translation */
40
41 #define BT_UNKNOWN 0xFFFFFFFF
42 #define BT_POWER_UNITS_DEFAULT "?"
43 #define BT_POWER_UNITS_WATTS "mW"
44 #define BT_POWER_UNITS_AMPS "mA"
45
46 /*! [End] no source code translation !*/
47
48 /*
49 * Battery Notifications:
50 * ----------------------
51 */
52 #define BT_NOTIFY_STATUS_CHANGE ((BM_NOTIFY) 0x80)
53 #define BT_NOTIFY_INFORMATION_CHANGE ((BM_NOTIFY) 0x81)
54
55
56 /*
57 * Hardware IDs:
58 * -------------
59 */
60 #define BT_HID_CM_BATTERY "PNP0C0A"
61
62
63 /*
64 * BT_CM_BATTERY_INFO:
65 * -------------------
66 */
67 typedef struct
68 {
69 u32 power_unit;
70 u32 design_capacity;
71 u32 last_full_capacity;
72 u32 battery_technology;
73 u32 design_voltage;
74 u32 design_capacity_warning;
75 u32 design_capacity_low;
76 u32 battery_capacity_granularity_1;
77 u32 battery_capacity_granularity_2;
78 acpi_string model_number;
79 acpi_string serial_number;
80 acpi_string battery_type;
81 acpi_string oem_info;
82
83 } BT_BATTERY_INFO;
84
85
86 /*
87 * BT_CM_BATTERY_STATUS:
88 * ---------------------
89 */
90 typedef struct
91 {
92 u32 state;
93 u32 present_rate;
94 u32 remaining_capacity;
95 u32 present_voltage;
96
97 } BT_BATTERY_STATUS;
98
99
100 /*
101 * BT_CONTEXT:
102 * -----------
103 */
104 typedef struct
105 {
106 BM_HANDLE device_handle;
107 acpi_handle acpi_handle;
108 char uid[9];
109 acpi_string power_units;
110 u8 is_present;
111
112 } BT_CONTEXT;
113
114
115 /*****************************************************************************
116 * Function Prototypes
117 *****************************************************************************/
118
119 /* bt.c */
120
121 acpi_status
122 bt_initialize (void);
123
124 acpi_status
125 bt_terminate (void);
126
127 acpi_status
128 bt_notify (
129 u32 notify_type,
130 u32 device,
131 void **context);
132
133 acpi_status
134 bt_request(
135 BM_REQUEST *request_info,
136 void *context);
137
138 acpi_status
139 bt_get_status (
140 BT_CONTEXT *battery,
141 BT_BATTERY_STATUS **battery_status);
142
143 acpi_status
144 bt_get_info (
145 BT_CONTEXT *battery,
146 BT_BATTERY_INFO **battery_info);
147
148 /* Battery OSL */
149
150 acpi_status
151 bt_osl_add_device (
152 BT_CONTEXT *battery);
153
154 acpi_status
155 bt_osl_remove_device (
156 BT_CONTEXT *battery);
157
158 acpi_status
159 bt_osl_generate_event (
160 u32 event,
161 BT_CONTEXT *battery);
162
163
164 #endif /* __BT_H__ */
165