diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2007-03-23 16:33:56 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-03-25 23:37:54 -0400 |
commit | 1406cdd1760743106278c1f02a0f445159c8f400 (patch) | |
tree | 59754d7bd3e540aee1e8353ea72e9059c8c2b9ef /drivers/acpi | |
parent | e062e0343871a41e8ec408f1c1e8ac3b0310da9d (diff) |
ACPI: ibm-acpi: add header file
Add a (private) header file for ibm-acpi, and move type definitions and
ThinkPad driver constants to the new header file.
This patch has no functional changes.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/ibm_acpi.c | 139 | ||||
-rw-r--r-- | drivers/acpi/ibm_acpi.h | 437 |
2 files changed, 438 insertions, 138 deletions
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 41c46b00511b..e2da95498f32 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -78,44 +78,13 @@ | |||
78 | * 2004-08-09 0.1 initial release, support for X series | 78 | * 2004-08-09 0.1 initial release, support for X series |
79 | */ | 79 | */ |
80 | 80 | ||
81 | #include <linux/kernel.h> | 81 | #include "ibm_acpi.h" |
82 | #include <linux/module.h> | ||
83 | #include <linux/init.h> | ||
84 | #include <linux/types.h> | ||
85 | #include <linux/string.h> | ||
86 | |||
87 | #include <linux/proc_fs.h> | ||
88 | #include <linux/backlight.h> | ||
89 | #include <linux/fb.h> | ||
90 | #include <asm/uaccess.h> | ||
91 | |||
92 | #include <linux/dmi.h> | ||
93 | #include <linux/jiffies.h> | ||
94 | #include <linux/workqueue.h> | ||
95 | |||
96 | #include <acpi/acpi_drivers.h> | ||
97 | #include <acpi/acnamesp.h> | ||
98 | |||
99 | #define IBM_NAME "ibm" | ||
100 | #define IBM_DESC "IBM ThinkPad ACPI Extras" | ||
101 | #define IBM_FILE "ibm_acpi" | ||
102 | #define IBM_URL "http://ibm-acpi.sf.net/" | ||
103 | 82 | ||
104 | MODULE_AUTHOR("Borislav Deianov, Henrique de Moraes Holschuh"); | 83 | MODULE_AUTHOR("Borislav Deianov, Henrique de Moraes Holschuh"); |
105 | MODULE_DESCRIPTION(IBM_DESC); | 84 | MODULE_DESCRIPTION(IBM_DESC); |
106 | MODULE_VERSION(IBM_VERSION); | 85 | MODULE_VERSION(IBM_VERSION); |
107 | MODULE_LICENSE("GPL"); | 86 | MODULE_LICENSE("GPL"); |
108 | 87 | ||
109 | #define IBM_DIR IBM_NAME | ||
110 | |||
111 | #define IBM_LOG IBM_FILE ": " | ||
112 | #define IBM_ERR KERN_ERR IBM_LOG | ||
113 | #define IBM_NOTICE KERN_NOTICE IBM_LOG | ||
114 | #define IBM_INFO KERN_INFO IBM_LOG | ||
115 | #define IBM_DEBUG KERN_DEBUG IBM_LOG | ||
116 | |||
117 | #define IBM_MAX_ACPI_ARGS 3 | ||
118 | |||
119 | #define __unused __attribute__ ((unused)) | 88 | #define __unused __attribute__ ((unused)) |
120 | 89 | ||
121 | static int experimental; | 90 | static int experimental; |
@@ -207,22 +176,6 @@ IBM_HANDLE(sfan, ec, "SFAN", /* 570 */ | |||
207 | "JFNS", /* 770x-JL */ | 176 | "JFNS", /* 770x-JL */ |
208 | ); /* all others */ | 177 | ); /* all others */ |
209 | 178 | ||
210 | #define IBM_HKEY_HID "IBM0068" | ||
211 | #define IBM_PCI_HID "PNP0A03" | ||
212 | |||
213 | enum thermal_access_mode { | ||
214 | IBMACPI_THERMAL_NONE = 0, /* No thermal support */ | ||
215 | IBMACPI_THERMAL_ACPI_TMP07, /* Use ACPI TMP0-7 */ | ||
216 | IBMACPI_THERMAL_ACPI_UPDT, /* Use ACPI TMP0-7 with UPDT */ | ||
217 | IBMACPI_THERMAL_TPEC_8, /* Use ACPI EC regs, 8 sensors */ | ||
218 | IBMACPI_THERMAL_TPEC_16, /* Use ACPI EC regs, 16 sensors */ | ||
219 | }; | ||
220 | |||
221 | #define IBMACPI_MAX_THERMAL_SENSORS 16 /* Max thermal sensors supported */ | ||
222 | struct ibm_thermal_sensors_struct { | ||
223 | s32 temp[IBMACPI_MAX_THERMAL_SENSORS]; | ||
224 | }; | ||
225 | |||
226 | /* | 179 | /* |
227 | * FAN ACCESS MODES | 180 | * FAN ACCESS MODES |
228 | * | 181 | * |
@@ -323,72 +276,12 @@ struct ibm_thermal_sensors_struct { | |||
323 | * but the ACPI tables just mention level 7. | 276 | * but the ACPI tables just mention level 7. |
324 | */ | 277 | */ |
325 | 278 | ||
326 | enum fan_status_access_mode { | ||
327 | IBMACPI_FAN_NONE = 0, /* No fan status or control */ | ||
328 | IBMACPI_FAN_RD_ACPI_GFAN, /* Use ACPI GFAN */ | ||
329 | IBMACPI_FAN_RD_TPEC, /* Use ACPI EC regs 0x2f, 0x84-0x85 */ | ||
330 | }; | ||
331 | |||
332 | enum fan_control_access_mode { | ||
333 | IBMACPI_FAN_WR_NONE = 0, /* No fan control */ | ||
334 | IBMACPI_FAN_WR_ACPI_SFAN, /* Use ACPI SFAN */ | ||
335 | IBMACPI_FAN_WR_TPEC, /* Use ACPI EC reg 0x2f */ | ||
336 | IBMACPI_FAN_WR_ACPI_FANS, /* Use ACPI FANS and EC reg 0x2f */ | ||
337 | }; | ||
338 | |||
339 | enum fan_control_commands { | ||
340 | IBMACPI_FAN_CMD_SPEED = 0x0001, /* speed command */ | ||
341 | IBMACPI_FAN_CMD_LEVEL = 0x0002, /* level command */ | ||
342 | IBMACPI_FAN_CMD_ENABLE = 0x0004, /* enable/disable cmd, | ||
343 | * and also watchdog cmd */ | ||
344 | }; | ||
345 | |||
346 | enum { /* Fan control constants */ | ||
347 | fan_status_offset = 0x2f, /* EC register 0x2f */ | ||
348 | fan_rpm_offset = 0x84, /* EC register 0x84: LSB, 0x85 MSB (RPM) | ||
349 | * 0x84 must be read before 0x85 */ | ||
350 | |||
351 | IBMACPI_FAN_EC_DISENGAGED = 0x40, /* EC mode: tachometer | ||
352 | * disengaged */ | ||
353 | IBMACPI_FAN_EC_AUTO = 0x80, /* EC mode: auto fan | ||
354 | * control */ | ||
355 | }; | ||
356 | |||
357 | static char *ibm_thinkpad_ec_found = NULL; | 279 | static char *ibm_thinkpad_ec_found = NULL; |
358 | 280 | ||
359 | struct ibm_struct { | ||
360 | char *name; | ||
361 | char param[32]; | ||
362 | |||
363 | char *hid; | ||
364 | struct acpi_driver *driver; | ||
365 | |||
366 | int (*init) (void); | ||
367 | int (*read) (char *); | ||
368 | int (*write) (char *); | ||
369 | void (*exit) (void); | ||
370 | |||
371 | void (*notify) (struct ibm_struct *, u32); | ||
372 | acpi_handle *handle; | ||
373 | int type; | ||
374 | struct acpi_device *device; | ||
375 | |||
376 | int driver_registered; | ||
377 | int proc_created; | ||
378 | int init_called; | ||
379 | int notify_installed; | ||
380 | |||
381 | int experimental; | ||
382 | }; | ||
383 | |||
384 | static struct proc_dir_entry *proc_dir = NULL; | 281 | static struct proc_dir_entry *proc_dir = NULL; |
385 | 282 | ||
386 | static struct backlight_device *ibm_backlight_device = NULL; | 283 | static struct backlight_device *ibm_backlight_device = NULL; |
387 | 284 | ||
388 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") | ||
389 | #define enabled(status,bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") | ||
390 | #define strlencmp(a,b) (strncmp((a), (b), strlen(b))) | ||
391 | |||
392 | static int acpi_evalf(acpi_handle handle, | 285 | static int acpi_evalf(acpi_handle handle, |
393 | void *res, char *method, char *fmt, ...) | 286 | void *res, char *method, char *fmt, ...) |
394 | { | 287 | { |
@@ -775,13 +668,6 @@ static int wan_write(char *buf) | |||
775 | return 0; | 668 | return 0; |
776 | } | 669 | } |
777 | 670 | ||
778 | enum video_access_mode { | ||
779 | IBMACPI_VIDEO_NONE = 0, | ||
780 | IBMACPI_VIDEO_570, /* 570 */ | ||
781 | IBMACPI_VIDEO_770, /* 600e/x, 770e, 770x */ | ||
782 | IBMACPI_VIDEO_NEW, /* all others */ | ||
783 | }; | ||
784 | |||
785 | static enum video_access_mode video_supported; | 671 | static enum video_access_mode video_supported; |
786 | static int video_orig_autosw; | 672 | static int video_orig_autosw; |
787 | 673 | ||
@@ -1248,12 +1134,6 @@ static int cmos_write(char *buf) | |||
1248 | return 0; | 1134 | return 0; |
1249 | } | 1135 | } |
1250 | 1136 | ||
1251 | enum led_access_mode { | ||
1252 | IBMACPI_LED_NONE = 0, | ||
1253 | IBMACPI_LED_570, /* 570 */ | ||
1254 | IBMACPI_LED_OLD, /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ | ||
1255 | IBMACPI_LED_NEW, /* all others */ | ||
1256 | }; | ||
1257 | static enum led_access_mode led_supported; | 1137 | static enum led_access_mode led_supported; |
1258 | 1138 | ||
1259 | static int led_init(void) | 1139 | static int led_init(void) |
@@ -1310,10 +1190,6 @@ static const int led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ | |||
1310 | static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ | 1190 | static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ |
1311 | static const int led_led_arg1[] = { 0, 0x80, 0xc0 }; | 1191 | static const int led_led_arg1[] = { 0, 0x80, 0xc0 }; |
1312 | 1192 | ||
1313 | #define IBMACPI_LED_EC_HLCL 0x0c | ||
1314 | #define IBMACPI_LED_EC_HLBL 0x0d | ||
1315 | #define IBMACPI_LED_EC_HLMS 0x0e | ||
1316 | |||
1317 | static int led_write(char *buf) | 1193 | static int led_write(char *buf) |
1318 | { | 1194 | { |
1319 | char *cmd; | 1195 | char *cmd; |
@@ -1629,8 +1505,6 @@ static int ecdump_write(char *buf) | |||
1629 | return 0; | 1505 | return 0; |
1630 | } | 1506 | } |
1631 | 1507 | ||
1632 | static int brightness_offset = 0x31; | ||
1633 | |||
1634 | static int brightness_get(struct backlight_device *bd) | 1508 | static int brightness_get(struct backlight_device *bd) |
1635 | { | 1509 | { |
1636 | u8 level; | 1510 | u8 level; |
@@ -1659,9 +1533,6 @@ static int brightness_read(char *p) | |||
1659 | return len; | 1533 | return len; |
1660 | } | 1534 | } |
1661 | 1535 | ||
1662 | #define TP_CMOS_BRIGHTNESS_UP 4 | ||
1663 | #define TP_CMOS_BRIGHTNESS_DOWN 5 | ||
1664 | |||
1665 | static int brightness_set(int value) | 1536 | static int brightness_set(int value) |
1666 | { | 1537 | { |
1667 | int cmos_cmd, inc, i; | 1538 | int cmos_cmd, inc, i; |
@@ -1752,8 +1623,6 @@ static void brightness_exit(void) | |||
1752 | } | 1623 | } |
1753 | } | 1624 | } |
1754 | 1625 | ||
1755 | static int volume_offset = 0x30; | ||
1756 | |||
1757 | static int volume_read(char *p) | 1626 | static int volume_read(char *p) |
1758 | { | 1627 | { |
1759 | int len = 0; | 1628 | int len = 0; |
@@ -1772,10 +1641,6 @@ static int volume_read(char *p) | |||
1772 | return len; | 1641 | return len; |
1773 | } | 1642 | } |
1774 | 1643 | ||
1775 | #define TP_CMOS_VOLUME_DOWN 0 | ||
1776 | #define TP_CMOS_VOLUME_UP 1 | ||
1777 | #define TP_CMOS_VOLUME_MUTE 2 | ||
1778 | |||
1779 | static int volume_write(char *buf) | 1644 | static int volume_write(char *buf) |
1780 | { | 1645 | { |
1781 | int cmos_cmd, inc, i; | 1646 | int cmos_cmd, inc, i; |
@@ -2563,8 +2428,6 @@ static int __init register_ibmacpi_subdriver(struct ibm_struct *ibm) | |||
2563 | return ret; | 2428 | return ret; |
2564 | } | 2429 | } |
2565 | 2430 | ||
2566 | static void ibm_exit(struct ibm_struct *ibm); | ||
2567 | |||
2568 | static int __init ibm_init(struct ibm_struct *ibm) | 2431 | static int __init ibm_init(struct ibm_struct *ibm) |
2569 | { | 2432 | { |
2570 | int ret; | 2433 | int ret; |
diff --git a/drivers/acpi/ibm_acpi.h b/drivers/acpi/ibm_acpi.h new file mode 100644 index 000000000000..7ebaaa40e183 --- /dev/null +++ b/drivers/acpi/ibm_acpi.h | |||
@@ -0,0 +1,437 @@ | |||
1 | /* | ||
2 | * ibm_acpi.h - IBM ThinkPad ACPI Extras | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2004-2005 Borislav Deianov <borislav@users.sf.net> | ||
6 | * Copyright (C) 2006-2007 Henrique de Moraes Holschuh <hmh@hmh.eng.br> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
21 | * 02110-1301, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef __IBM_ACPI_H__ | ||
25 | #define __IBM_ACPI_H__ | ||
26 | |||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/string.h> | ||
32 | |||
33 | #include <linux/proc_fs.h> | ||
34 | #include <linux/backlight.h> | ||
35 | #include <linux/fb.h> | ||
36 | #include <asm/uaccess.h> | ||
37 | |||
38 | #include <linux/dmi.h> | ||
39 | #include <linux/jiffies.h> | ||
40 | #include <linux/workqueue.h> | ||
41 | |||
42 | #include <acpi/acpi_drivers.h> | ||
43 | #include <acpi/acnamesp.h> | ||
44 | |||
45 | |||
46 | /**************************************************************************** | ||
47 | * Main driver | ||
48 | */ | ||
49 | |||
50 | #define IBM_NAME "ibm" | ||
51 | #define IBM_DESC "IBM ThinkPad ACPI Extras" | ||
52 | #define IBM_FILE "ibm_acpi" | ||
53 | #define IBM_URL "http://ibm-acpi.sf.net/" | ||
54 | |||
55 | #define IBM_DIR IBM_NAME | ||
56 | |||
57 | #define IBM_LOG IBM_FILE ": " | ||
58 | #define IBM_ERR KERN_ERR IBM_LOG | ||
59 | #define IBM_NOTICE KERN_NOTICE IBM_LOG | ||
60 | #define IBM_INFO KERN_INFO IBM_LOG | ||
61 | #define IBM_DEBUG KERN_DEBUG IBM_LOG | ||
62 | |||
63 | #define IBM_MAX_ACPI_ARGS 3 | ||
64 | |||
65 | /* ThinkPad CMOS commands */ | ||
66 | #define TP_CMOS_VOLUME_DOWN 0 | ||
67 | #define TP_CMOS_VOLUME_UP 1 | ||
68 | #define TP_CMOS_VOLUME_MUTE 2 | ||
69 | #define TP_CMOS_BRIGHTNESS_UP 4 | ||
70 | #define TP_CMOS_BRIGHTNESS_DOWN 5 | ||
71 | |||
72 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") | ||
73 | #define enabled(status,bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") | ||
74 | #define strlencmp(a,b) (strncmp((a), (b), strlen(b))) | ||
75 | |||
76 | /* ACPI HIDs */ | ||
77 | #define IBM_HKEY_HID "IBM0068" | ||
78 | #define IBM_PCI_HID "PNP0A03" | ||
79 | |||
80 | /* ACPI helpers */ | ||
81 | static int acpi_evalf(acpi_handle handle, | ||
82 | void *res, char *method, char *fmt, ...); | ||
83 | static int acpi_ec_read(int i, u8 * p); | ||
84 | static int acpi_ec_write(int i, u8 v); | ||
85 | static int _sta(acpi_handle handle); | ||
86 | |||
87 | /* ACPI handles */ | ||
88 | static acpi_handle root_handle; /* root namespace */ | ||
89 | static acpi_handle ec_handle; /* EC */ | ||
90 | static acpi_handle ecrd_handle, ecwr_handle; /* 570 EC access */ | ||
91 | static acpi_handle cmos_handle, hkey_handle; /* basic thinkpad handles */ | ||
92 | |||
93 | static void ibm_handle_init(char *name, | ||
94 | acpi_handle * handle, acpi_handle parent, | ||
95 | char **paths, int num_paths, char **path); | ||
96 | #define IBM_HANDLE_INIT(object) \ | ||
97 | ibm_handle_init(#object, &object##_handle, *object##_parent, \ | ||
98 | object##_paths, ARRAY_SIZE(object##_paths), &object##_path) | ||
99 | |||
100 | /* procfs support */ | ||
101 | static struct proc_dir_entry *proc_dir; | ||
102 | static int ibm_acpi_driver_init(void); | ||
103 | static int ibm_acpi_driver_read(char *p); | ||
104 | |||
105 | /* procfs helpers */ | ||
106 | static int dispatch_read(char *page, char **start, off_t off, int count, | ||
107 | int *eof, void *data); | ||
108 | static int dispatch_write(struct file *file, const char __user * userbuf, | ||
109 | unsigned long count, void *data); | ||
110 | static char *next_cmd(char **cmds); | ||
111 | |||
112 | /* Module */ | ||
113 | static int experimental; | ||
114 | static char *ibm_thinkpad_ec_found; | ||
115 | |||
116 | static char* check_dmi_for_ec(void); | ||
117 | static int acpi_ibm_init(void); | ||
118 | static void acpi_ibm_exit(void); | ||
119 | |||
120 | |||
121 | /**************************************************************************** | ||
122 | * Subdrivers | ||
123 | */ | ||
124 | |||
125 | struct ibm_struct { | ||
126 | char *name; | ||
127 | char param[32]; | ||
128 | |||
129 | char *hid; | ||
130 | struct acpi_driver *driver; | ||
131 | |||
132 | int (*init) (void); | ||
133 | int (*read) (char *); | ||
134 | int (*write) (char *); | ||
135 | void (*exit) (void); | ||
136 | |||
137 | void (*notify) (struct ibm_struct *, u32); | ||
138 | acpi_handle *handle; | ||
139 | int type; | ||
140 | struct acpi_device *device; | ||
141 | |||
142 | int driver_registered; | ||
143 | int proc_created; | ||
144 | int init_called; | ||
145 | int notify_installed; | ||
146 | |||
147 | int experimental; | ||
148 | }; | ||
149 | |||
150 | static struct ibm_struct ibms[]; | ||
151 | static int set_ibm_param(const char *val, struct kernel_param *kp); | ||
152 | static int ibm_init(struct ibm_struct *ibm); | ||
153 | static void ibm_exit(struct ibm_struct *ibm); | ||
154 | |||
155 | /* ACPI devices */ | ||
156 | static void dispatch_notify(acpi_handle handle, u32 event, void *data); | ||
157 | static int setup_notify(struct ibm_struct *ibm); | ||
158 | static int ibm_device_add(struct acpi_device *device); | ||
159 | static int register_ibmacpi_subdriver(struct ibm_struct *ibm); | ||
160 | |||
161 | |||
162 | /* | ||
163 | * Bay subdriver | ||
164 | */ | ||
165 | |||
166 | #ifdef CONFIG_ACPI_IBM_BAY | ||
167 | static int bay_status_supported, bay_eject_supported; | ||
168 | static int bay_status2_supported, bay_eject2_supported; | ||
169 | |||
170 | static acpi_handle bay_handle, bay_ej_handle; | ||
171 | static acpi_handle bay2_handle, bay2_ej_handle; | ||
172 | |||
173 | static int bay_init(void); | ||
174 | static void bay_notify(struct ibm_struct *ibm, u32 event); | ||
175 | static int bay_read(char *p); | ||
176 | static int bay_write(char *buf); | ||
177 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
178 | |||
179 | |||
180 | /* | ||
181 | * Beep subdriver | ||
182 | */ | ||
183 | |||
184 | static acpi_handle beep_handle; | ||
185 | |||
186 | static int beep_read(char *p); | ||
187 | static int beep_write(char *buf); | ||
188 | |||
189 | |||
190 | /* | ||
191 | * Bluetooth subdriver | ||
192 | */ | ||
193 | |||
194 | static int bluetooth_supported; | ||
195 | |||
196 | static int bluetooth_init(void); | ||
197 | static int bluetooth_status(void); | ||
198 | static int bluetooth_read(char *p); | ||
199 | static int bluetooth_write(char *buf); | ||
200 | |||
201 | |||
202 | /* | ||
203 | * Brightness (backlight) subdriver | ||
204 | */ | ||
205 | |||
206 | static struct backlight_device *ibm_backlight_device; | ||
207 | static int brightness_offset = 0x31; | ||
208 | |||
209 | static int brightness_init(void); | ||
210 | static void brightness_exit(void); | ||
211 | static int brightness_get(struct backlight_device *bd); | ||
212 | static int brightness_set(int value); | ||
213 | static int brightness_update_status(struct backlight_device *bd); | ||
214 | static int brightness_read(char *p); | ||
215 | static int brightness_write(char *buf); | ||
216 | |||
217 | |||
218 | /* | ||
219 | * CMOS subdriver | ||
220 | */ | ||
221 | |||
222 | static int cmos_eval(int cmos_cmd); | ||
223 | static int cmos_read(char *p); | ||
224 | static int cmos_write(char *buf); | ||
225 | |||
226 | |||
227 | /* | ||
228 | * Dock subdriver | ||
229 | */ | ||
230 | |||
231 | static acpi_handle pci_handle; | ||
232 | #ifdef CONFIG_ACPI_IBM_DOCK | ||
233 | static acpi_handle dock_handle; | ||
234 | |||
235 | static void dock_notify(struct ibm_struct *ibm, u32 event); | ||
236 | static int dock_read(char *p); | ||
237 | static int dock_write(char *buf); | ||
238 | #endif /* CONFIG_ACPI_IBM_DOCK */ | ||
239 | |||
240 | |||
241 | /* | ||
242 | * EC dump subdriver | ||
243 | */ | ||
244 | |||
245 | static int ecdump_read(char *p) ; | ||
246 | static int ecdump_write(char *buf); | ||
247 | |||
248 | |||
249 | /* | ||
250 | * Fan subdriver | ||
251 | */ | ||
252 | |||
253 | enum { /* Fan control constants */ | ||
254 | fan_status_offset = 0x2f, /* EC register 0x2f */ | ||
255 | fan_rpm_offset = 0x84, /* EC register 0x84: LSB, 0x85 MSB (RPM) | ||
256 | * 0x84 must be read before 0x85 */ | ||
257 | |||
258 | IBMACPI_FAN_EC_DISENGAGED = 0x40, /* EC mode: tachometer | ||
259 | * disengaged */ | ||
260 | IBMACPI_FAN_EC_AUTO = 0x80, /* EC mode: auto fan | ||
261 | * control */ | ||
262 | }; | ||
263 | |||
264 | enum fan_status_access_mode { | ||
265 | IBMACPI_FAN_NONE = 0, /* No fan status or control */ | ||
266 | IBMACPI_FAN_RD_ACPI_GFAN, /* Use ACPI GFAN */ | ||
267 | IBMACPI_FAN_RD_TPEC, /* Use ACPI EC regs 0x2f, 0x84-0x85 */ | ||
268 | }; | ||
269 | |||
270 | enum fan_control_access_mode { | ||
271 | IBMACPI_FAN_WR_NONE = 0, /* No fan control */ | ||
272 | IBMACPI_FAN_WR_ACPI_SFAN, /* Use ACPI SFAN */ | ||
273 | IBMACPI_FAN_WR_TPEC, /* Use ACPI EC reg 0x2f */ | ||
274 | IBMACPI_FAN_WR_ACPI_FANS, /* Use ACPI FANS and EC reg 0x2f */ | ||
275 | }; | ||
276 | |||
277 | enum fan_control_commands { | ||
278 | IBMACPI_FAN_CMD_SPEED = 0x0001, /* speed command */ | ||
279 | IBMACPI_FAN_CMD_LEVEL = 0x0002, /* level command */ | ||
280 | IBMACPI_FAN_CMD_ENABLE = 0x0004, /* enable/disable cmd, | ||
281 | * and also watchdog cmd */ | ||
282 | }; | ||
283 | |||
284 | static enum fan_status_access_mode fan_status_access_mode; | ||
285 | static enum fan_control_access_mode fan_control_access_mode; | ||
286 | static enum fan_control_commands fan_control_commands; | ||
287 | static int fan_control_status_known; | ||
288 | static u8 fan_control_initial_status; | ||
289 | static int fan_watchdog_maxinterval; | ||
290 | |||
291 | static acpi_handle fans_handle, gfan_handle, sfan_handle; | ||
292 | |||
293 | static int fan_init(void); | ||
294 | static void fan_exit(void); | ||
295 | static int fan_get_status(u8 *status); | ||
296 | static int fan_get_speed(unsigned int *speed); | ||
297 | static void fan_watchdog_fire(struct work_struct *ignored); | ||
298 | static void fan_watchdog_reset(void); | ||
299 | static int fan_set_level(int level); | ||
300 | static int fan_set_enable(void); | ||
301 | static int fan_set_disable(void); | ||
302 | static int fan_set_speed(int speed); | ||
303 | static int fan_read(char *p); | ||
304 | static int fan_write(char *buf); | ||
305 | static int fan_write_cmd_level(const char *cmd, int *rc); | ||
306 | static int fan_write_cmd_enable(const char *cmd, int *rc); | ||
307 | static int fan_write_cmd_disable(const char *cmd, int *rc); | ||
308 | static int fan_write_cmd_speed(const char *cmd, int *rc); | ||
309 | static int fan_write_cmd_watchdog(const char *cmd, int *rc); | ||
310 | |||
311 | |||
312 | /* | ||
313 | * Hotkey subdriver | ||
314 | */ | ||
315 | |||
316 | static int hotkey_supported; | ||
317 | static int hotkey_mask_supported; | ||
318 | static int hotkey_orig_status; | ||
319 | static int hotkey_orig_mask; | ||
320 | |||
321 | static int hotkey_init(void); | ||
322 | static void hotkey_exit(void); | ||
323 | static int hotkey_get(int *status, int *mask); | ||
324 | static int hotkey_set(int status, int mask); | ||
325 | static void hotkey_notify(struct ibm_struct *ibm, u32 event); | ||
326 | static int hotkey_read(char *p); | ||
327 | static int hotkey_write(char *buf); | ||
328 | |||
329 | |||
330 | /* | ||
331 | * LED subdriver | ||
332 | */ | ||
333 | |||
334 | enum led_access_mode { | ||
335 | IBMACPI_LED_NONE = 0, | ||
336 | IBMACPI_LED_570, /* 570 */ | ||
337 | IBMACPI_LED_OLD, /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ | ||
338 | IBMACPI_LED_NEW, /* all others */ | ||
339 | }; | ||
340 | |||
341 | enum { /* For IBMACPI_LED_OLD */ | ||
342 | IBMACPI_LED_EC_HLCL = 0x0c, /* EC reg to get led to power on */ | ||
343 | IBMACPI_LED_EC_HLBL = 0x0d, /* EC reg to blink a lit led */ | ||
344 | IBMACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ | ||
345 | }; | ||
346 | |||
347 | static enum led_access_mode led_supported; | ||
348 | static acpi_handle led_handle; | ||
349 | |||
350 | static int led_init(void); | ||
351 | static int led_read(char *p); | ||
352 | static int led_write(char *buf); | ||
353 | |||
354 | /* | ||
355 | * Light (thinklight) subdriver | ||
356 | */ | ||
357 | |||
358 | static int light_supported; | ||
359 | static int light_status_supported; | ||
360 | static acpi_handle lght_handle, ledb_handle; | ||
361 | |||
362 | static int light_init(void); | ||
363 | static int light_read(char *p); | ||
364 | static int light_write(char *buf); | ||
365 | |||
366 | |||
367 | /* | ||
368 | * Thermal subdriver | ||
369 | */ | ||
370 | |||
371 | enum thermal_access_mode { | ||
372 | IBMACPI_THERMAL_NONE = 0, /* No thermal support */ | ||
373 | IBMACPI_THERMAL_ACPI_TMP07, /* Use ACPI TMP0-7 */ | ||
374 | IBMACPI_THERMAL_ACPI_UPDT, /* Use ACPI TMP0-7 with UPDT */ | ||
375 | IBMACPI_THERMAL_TPEC_8, /* Use ACPI EC regs, 8 sensors */ | ||
376 | IBMACPI_THERMAL_TPEC_16, /* Use ACPI EC regs, 16 sensors */ | ||
377 | }; | ||
378 | |||
379 | #define IBMACPI_MAX_THERMAL_SENSORS 16 /* Max thermal sensors supported */ | ||
380 | struct ibm_thermal_sensors_struct { | ||
381 | s32 temp[IBMACPI_MAX_THERMAL_SENSORS]; | ||
382 | }; | ||
383 | |||
384 | static int thermal_init(void); | ||
385 | static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s); | ||
386 | static int thermal_read(char *p); | ||
387 | |||
388 | |||
389 | /* | ||
390 | * Video subdriver | ||
391 | */ | ||
392 | |||
393 | enum video_access_mode { | ||
394 | IBMACPI_VIDEO_NONE = 0, | ||
395 | IBMACPI_VIDEO_570, /* 570 */ | ||
396 | IBMACPI_VIDEO_770, /* 600e/x, 770e, 770x */ | ||
397 | IBMACPI_VIDEO_NEW, /* all others */ | ||
398 | }; | ||
399 | |||
400 | static enum video_access_mode video_supported; | ||
401 | static int video_orig_autosw; | ||
402 | static acpi_handle vid_handle, vid2_handle; | ||
403 | |||
404 | static int video_init(void); | ||
405 | static void video_exit(void); | ||
406 | static int video_status(void); | ||
407 | static int video_autosw(void); | ||
408 | static int video_switch(void); | ||
409 | static int video_switch2(int status); | ||
410 | static int video_expand(void); | ||
411 | static int video_read(char *p); | ||
412 | static int video_write(char *buf); | ||
413 | |||
414 | |||
415 | /* | ||
416 | * Volume subdriver | ||
417 | */ | ||
418 | |||
419 | static int volume_offset = 0x30; | ||
420 | |||
421 | static int volume_read(char *p); | ||
422 | static int volume_write(char *buf); | ||
423 | |||
424 | |||
425 | /* | ||
426 | * Wan subdriver | ||
427 | */ | ||
428 | |||
429 | static int wan_supported; | ||
430 | |||
431 | static int wan_init(void); | ||
432 | static int wan_status(void); | ||
433 | static int wan_read(char *p); | ||
434 | static int wan_write(char *buf); | ||
435 | |||
436 | |||
437 | #endif /* __IBM_ACPI_H */ | ||