diff options
Diffstat (limited to 'drivers/misc/thinkpad_acpi.h')
-rw-r--r-- | drivers/misc/thinkpad_acpi.h | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 72d62f2dabb9..b7a4a888cc8b 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/list.h> | 32 | #include <linux/list.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | 34 | ||
35 | #include <linux/nvram.h> | ||
35 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
36 | #include <linux/sysfs.h> | 37 | #include <linux/sysfs.h> |
37 | #include <linux/backlight.h> | 38 | #include <linux/backlight.h> |
@@ -39,6 +40,7 @@ | |||
39 | #include <linux/platform_device.h> | 40 | #include <linux/platform_device.h> |
40 | #include <linux/hwmon.h> | 41 | #include <linux/hwmon.h> |
41 | #include <linux/hwmon-sysfs.h> | 42 | #include <linux/hwmon-sysfs.h> |
43 | #include <linux/input.h> | ||
42 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
43 | 45 | ||
44 | #include <linux/dmi.h> | 46 | #include <linux/dmi.h> |
@@ -48,6 +50,7 @@ | |||
48 | #include <acpi/acpi_drivers.h> | 50 | #include <acpi/acpi_drivers.h> |
49 | #include <acpi/acnamesp.h> | 51 | #include <acpi/acnamesp.h> |
50 | 52 | ||
53 | #include <linux/pci_ids.h> | ||
51 | 54 | ||
52 | /**************************************************************************** | 55 | /**************************************************************************** |
53 | * Main driver | 56 | * Main driver |
@@ -78,6 +81,11 @@ | |||
78 | #define TP_CMOS_BRIGHTNESS_UP 4 | 81 | #define TP_CMOS_BRIGHTNESS_UP 4 |
79 | #define TP_CMOS_BRIGHTNESS_DOWN 5 | 82 | #define TP_CMOS_BRIGHTNESS_DOWN 5 |
80 | 83 | ||
84 | /* ThinkPad CMOS NVRAM constants */ | ||
85 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e | ||
86 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07 | ||
87 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 | ||
88 | |||
81 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") | 89 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") |
82 | #define enabled(status,bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") | 90 | #define enabled(status,bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") |
83 | #define strlencmp(a,b) (strncmp((a), (b), strlen(b))) | 91 | #define strlencmp(a,b) (strncmp((a), (b), strlen(b))) |
@@ -98,9 +106,13 @@ static const char *str_supported(int is_supported); | |||
98 | #define vdbg_printk(a_dbg_level, format, arg...) | 106 | #define vdbg_printk(a_dbg_level, format, arg...) |
99 | #endif | 107 | #endif |
100 | 108 | ||
109 | /* Input IDs */ | ||
110 | #define TPACPI_HKEY_INPUT_VENDOR PCI_VENDOR_ID_IBM | ||
111 | #define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */ | ||
112 | #define TPACPI_HKEY_INPUT_VERSION 0x4101 | ||
113 | |||
101 | /* ACPI HIDs */ | 114 | /* ACPI HIDs */ |
102 | #define IBM_HKEY_HID "IBM0068" | 115 | #define IBM_HKEY_HID "IBM0068" |
103 | #define IBM_PCI_HID "PNP0A03" | ||
104 | 116 | ||
105 | /* ACPI helpers */ | 117 | /* ACPI helpers */ |
106 | static int __must_check acpi_evalf(acpi_handle handle, | 118 | static int __must_check acpi_evalf(acpi_handle handle, |
@@ -161,6 +173,7 @@ static int parse_strtoul(const char *buf, unsigned long max, | |||
161 | static struct platform_device *tpacpi_pdev; | 173 | static struct platform_device *tpacpi_pdev; |
162 | static struct class_device *tpacpi_hwmon; | 174 | static struct class_device *tpacpi_hwmon; |
163 | static struct platform_driver tpacpi_pdriver; | 175 | static struct platform_driver tpacpi_pdriver; |
176 | static struct input_dev *tpacpi_inputdev; | ||
164 | static int tpacpi_create_driver_attributes(struct device_driver *drv); | 177 | static int tpacpi_create_driver_attributes(struct device_driver *drv); |
165 | static void tpacpi_remove_driver_attributes(struct device_driver *drv); | 178 | static void tpacpi_remove_driver_attributes(struct device_driver *drv); |
166 | 179 | ||
@@ -168,9 +181,7 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv); | |||
168 | static int experimental; | 181 | static int experimental; |
169 | static u32 dbg_level; | 182 | static u32 dbg_level; |
170 | static int force_load; | 183 | static int force_load; |
171 | static char *ibm_thinkpad_ec_found; | ||
172 | 184 | ||
173 | static char* check_dmi_for_ec(void); | ||
174 | static int thinkpad_acpi_module_init(void); | 185 | static int thinkpad_acpi_module_init(void); |
175 | static void thinkpad_acpi_module_exit(void); | 186 | static void thinkpad_acpi_module_exit(void); |
176 | 187 | ||
@@ -197,6 +208,7 @@ struct ibm_struct { | |||
197 | int (*read) (char *); | 208 | int (*read) (char *); |
198 | int (*write) (char *); | 209 | int (*write) (char *); |
199 | void (*exit) (void); | 210 | void (*exit) (void); |
211 | void (*resume) (void); | ||
200 | 212 | ||
201 | struct list_head all_drivers; | 213 | struct list_head all_drivers; |
202 | 214 | ||
@@ -228,12 +240,29 @@ static struct { | |||
228 | u16 bluetooth:1; | 240 | u16 bluetooth:1; |
229 | u16 hotkey:1; | 241 | u16 hotkey:1; |
230 | u16 hotkey_mask:1; | 242 | u16 hotkey_mask:1; |
243 | u16 hotkey_wlsw:1; | ||
231 | u16 light:1; | 244 | u16 light:1; |
232 | u16 light_status:1; | 245 | u16 light_status:1; |
233 | u16 wan:1; | 246 | u16 wan:1; |
234 | u16 fan_ctrl_status_undef:1; | 247 | u16 fan_ctrl_status_undef:1; |
248 | u16 input_device_registered:1; | ||
235 | } tp_features; | 249 | } tp_features; |
236 | 250 | ||
251 | struct thinkpad_id_data { | ||
252 | unsigned int vendor; /* ThinkPad vendor: | ||
253 | * PCI_VENDOR_ID_IBM/PCI_VENDOR_ID_LENOVO */ | ||
254 | |||
255 | char *bios_version_str; /* Something like 1ZET51WW (1.03z) */ | ||
256 | char *ec_version_str; /* Something like 1ZHT51WW-1.04a */ | ||
257 | |||
258 | u16 bios_model; /* Big Endian, TP-1Y = 0x5931, 0 = unknown */ | ||
259 | u16 ec_model; | ||
260 | |||
261 | char *model_str; | ||
262 | }; | ||
263 | |||
264 | static struct thinkpad_id_data thinkpad_id; | ||
265 | |||
237 | static struct list_head tpacpi_all_drivers; | 266 | static struct list_head tpacpi_all_drivers; |
238 | 267 | ||
239 | static struct ibm_init_struct ibms_init[]; | 268 | static struct ibm_init_struct ibms_init[]; |
@@ -300,6 +329,7 @@ static int bluetooth_write(char *buf); | |||
300 | 329 | ||
301 | static struct backlight_device *ibm_backlight_device; | 330 | static struct backlight_device *ibm_backlight_device; |
302 | static int brightness_offset = 0x31; | 331 | static int brightness_offset = 0x31; |
332 | static int brightness_mode; | ||
303 | 333 | ||
304 | static int brightness_init(struct ibm_init_struct *iibm); | 334 | static int brightness_init(struct ibm_init_struct *iibm); |
305 | static void brightness_exit(void); | 335 | static void brightness_exit(void); |
@@ -415,14 +445,14 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc); | |||
415 | */ | 445 | */ |
416 | 446 | ||
417 | static int hotkey_orig_status; | 447 | static int hotkey_orig_status; |
418 | static int hotkey_orig_mask; | 448 | static u32 hotkey_orig_mask; |
419 | 449 | ||
420 | static struct mutex hotkey_mutex; | 450 | static struct mutex hotkey_mutex; |
421 | 451 | ||
422 | static int hotkey_init(struct ibm_init_struct *iibm); | 452 | static int hotkey_init(struct ibm_init_struct *iibm); |
423 | static void hotkey_exit(void); | 453 | static void hotkey_exit(void); |
424 | static int hotkey_get(int *status, int *mask); | 454 | static int hotkey_get(int *status, u32 *mask); |
425 | static int hotkey_set(int status, int mask); | 455 | static int hotkey_set(int status, u32 mask); |
426 | static void hotkey_notify(struct ibm_struct *ibm, u32 event); | 456 | static void hotkey_notify(struct ibm_struct *ibm, u32 event); |
427 | static int hotkey_read(char *p); | 457 | static int hotkey_read(char *p); |
428 | static int hotkey_write(char *buf); | 458 | static int hotkey_write(char *buf); |