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/ibm_acpi.c | |
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/ibm_acpi.c')
-rw-r--r-- | drivers/acpi/ibm_acpi.c | 139 |
1 files changed, 1 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; |