aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/thinkpad_acpi.h')
-rw-r--r--drivers/misc/thinkpad_acpi.h42
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 */
106static int __must_check acpi_evalf(acpi_handle handle, 118static int __must_check acpi_evalf(acpi_handle handle,
@@ -161,6 +173,7 @@ static int parse_strtoul(const char *buf, unsigned long max,
161static struct platform_device *tpacpi_pdev; 173static struct platform_device *tpacpi_pdev;
162static struct class_device *tpacpi_hwmon; 174static struct class_device *tpacpi_hwmon;
163static struct platform_driver tpacpi_pdriver; 175static struct platform_driver tpacpi_pdriver;
176static struct input_dev *tpacpi_inputdev;
164static int tpacpi_create_driver_attributes(struct device_driver *drv); 177static int tpacpi_create_driver_attributes(struct device_driver *drv);
165static void tpacpi_remove_driver_attributes(struct device_driver *drv); 178static 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);
168static int experimental; 181static int experimental;
169static u32 dbg_level; 182static u32 dbg_level;
170static int force_load; 183static int force_load;
171static char *ibm_thinkpad_ec_found;
172 184
173static char* check_dmi_for_ec(void);
174static int thinkpad_acpi_module_init(void); 185static int thinkpad_acpi_module_init(void);
175static void thinkpad_acpi_module_exit(void); 186static 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
251struct 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
264static struct thinkpad_id_data thinkpad_id;
265
237static struct list_head tpacpi_all_drivers; 266static struct list_head tpacpi_all_drivers;
238 267
239static struct ibm_init_struct ibms_init[]; 268static struct ibm_init_struct ibms_init[];
@@ -300,6 +329,7 @@ static int bluetooth_write(char *buf);
300 329
301static struct backlight_device *ibm_backlight_device; 330static struct backlight_device *ibm_backlight_device;
302static int brightness_offset = 0x31; 331static int brightness_offset = 0x31;
332static int brightness_mode;
303 333
304static int brightness_init(struct ibm_init_struct *iibm); 334static int brightness_init(struct ibm_init_struct *iibm);
305static void brightness_exit(void); 335static void brightness_exit(void);
@@ -415,14 +445,14 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc);
415 */ 445 */
416 446
417static int hotkey_orig_status; 447static int hotkey_orig_status;
418static int hotkey_orig_mask; 448static u32 hotkey_orig_mask;
419 449
420static struct mutex hotkey_mutex; 450static struct mutex hotkey_mutex;
421 451
422static int hotkey_init(struct ibm_init_struct *iibm); 452static int hotkey_init(struct ibm_init_struct *iibm);
423static void hotkey_exit(void); 453static void hotkey_exit(void);
424static int hotkey_get(int *status, int *mask); 454static int hotkey_get(int *status, u32 *mask);
425static int hotkey_set(int status, int mask); 455static int hotkey_set(int status, u32 mask);
426static void hotkey_notify(struct ibm_struct *ibm, u32 event); 456static void hotkey_notify(struct ibm_struct *ibm, u32 event);
427static int hotkey_read(char *p); 457static int hotkey_read(char *p);
428static int hotkey_write(char *buf); 458static int hotkey_write(char *buf);