Thomas Gleixner | b1fb60d | 2019-06-01 10:08:29 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Wistron laptop button driver |
| 4 | * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 5 | * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 6 | * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 7 | */ |
Matthew Wilcox | 53d5ed6 | 2006-10-11 01:22:01 -0700 | [diff] [blame] | 8 | #include <linux/io.h> |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 9 | #include <linux/dmi.h> |
| 10 | #include <linux/init.h> |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 11 | #include <linux/input.h> |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 12 | #include <linux/input/sparse-keymap.h> |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 13 | #include <linux/interrupt.h> |
Eric Piel | a4da16d | 2007-05-21 00:46:22 -0400 | [diff] [blame] | 14 | #include <linux/jiffies.h> |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 15 | #include <linux/kernel.h> |
| 16 | #include <linux/mc146818rtc.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/preempt.h> |
| 19 | #include <linux/string.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 20 | #include <linux/slab.h> |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 21 | #include <linux/types.h> |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 22 | #include <linux/platform_device.h> |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 23 | #include <linux/leds.h> |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 24 | |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 25 | /* How often we poll keys - msecs */ |
| 26 | #define POLL_INTERVAL_DEFAULT 500 /* when idle */ |
| 27 | #define POLL_INTERVAL_BURST 100 /* when a key was recently pressed */ |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 28 | |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 29 | /* BIOS subsystem IDs */ |
| 30 | #define WIFI 0x35 |
| 31 | #define BLUETOOTH 0x34 |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 32 | #define MAIL_LED 0x31 |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 33 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 34 | MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); |
| 35 | MODULE_DESCRIPTION("Wistron laptop button driver"); |
| 36 | MODULE_LICENSE("GPL v2"); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 37 | |
Rusty Russell | 90ab5ee | 2012-01-13 09:32:20 +1030 | [diff] [blame] | 38 | static bool force; /* = 0; */ |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 39 | module_param(force, bool, 0); |
| 40 | MODULE_PARM_DESC(force, "Load even if computer is not in database"); |
| 41 | |
| 42 | static char *keymap_name; /* = NULL; */ |
| 43 | module_param_named(keymap, keymap_name, charp, 0); |
Eric Piel | 7b0a4cd | 2007-04-12 01:32:41 -0400 | [diff] [blame] | 44 | MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected [generic, 1557/MS2141]"); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 45 | |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 46 | static struct platform_device *wistron_device; |
| 47 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 48 | /* BIOS interface implementation */ |
| 49 | |
| 50 | static void __iomem *bios_entry_point; /* BIOS routine entry point */ |
| 51 | static void __iomem *bios_code_map_base; |
| 52 | static void __iomem *bios_data_map_base; |
| 53 | |
| 54 | static u8 cmos_address; |
| 55 | |
| 56 | struct regs { |
| 57 | u32 eax, ebx, ecx; |
| 58 | }; |
| 59 | |
| 60 | static void call_bios(struct regs *regs) |
| 61 | { |
| 62 | unsigned long flags; |
| 63 | |
| 64 | preempt_disable(); |
| 65 | local_irq_save(flags); |
| 66 | asm volatile ("pushl %%ebp;" |
| 67 | "movl %7, %%ebp;" |
| 68 | "call *%6;" |
| 69 | "popl %%ebp" |
| 70 | : "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx) |
| 71 | : "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx), |
| 72 | "m" (bios_entry_point), "m" (bios_data_map_base) |
| 73 | : "edx", "edi", "esi", "memory"); |
| 74 | local_irq_restore(flags); |
| 75 | preempt_enable(); |
| 76 | } |
| 77 | |
Miloslav Trmac | c28c358 | 2006-01-10 01:59:07 -0500 | [diff] [blame] | 78 | static ssize_t __init locate_wistron_bios(void __iomem *base) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 79 | { |
Andrew Morton | c794898 | 2006-07-06 00:23:38 -0400 | [diff] [blame] | 80 | static unsigned char __initdata signature[] = |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 81 | { 0x42, 0x21, 0x55, 0x30 }; |
Miloslav Trmac | c28c358 | 2006-01-10 01:59:07 -0500 | [diff] [blame] | 82 | ssize_t offset; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 83 | |
| 84 | for (offset = 0; offset < 0x10000; offset += 0x10) { |
| 85 | if (check_signature(base + offset, signature, |
| 86 | sizeof(signature)) != 0) |
| 87 | return offset; |
| 88 | } |
| 89 | return -1; |
| 90 | } |
| 91 | |
| 92 | static int __init map_bios(void) |
| 93 | { |
| 94 | void __iomem *base; |
Miloslav Trmac | c28c358 | 2006-01-10 01:59:07 -0500 | [diff] [blame] | 95 | ssize_t offset; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 96 | u32 entry_point; |
| 97 | |
| 98 | base = ioremap(0xF0000, 0x10000); /* Can't fail */ |
| 99 | offset = locate_wistron_bios(base); |
| 100 | if (offset < 0) { |
| 101 | printk(KERN_ERR "wistron_btns: BIOS entry point not found\n"); |
| 102 | iounmap(base); |
| 103 | return -ENODEV; |
| 104 | } |
| 105 | |
| 106 | entry_point = readl(base + offset + 5); |
| 107 | printk(KERN_DEBUG |
| 108 | "wistron_btns: BIOS signature found at %p, entry point %08X\n", |
| 109 | base + offset, entry_point); |
| 110 | |
| 111 | if (entry_point >= 0xF0000) { |
| 112 | bios_code_map_base = base; |
| 113 | bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF); |
| 114 | } else { |
| 115 | iounmap(base); |
| 116 | bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000); |
| 117 | if (bios_code_map_base == NULL) { |
| 118 | printk(KERN_ERR |
| 119 | "wistron_btns: Can't map BIOS code at %08X\n", |
| 120 | entry_point & ~0x3FFF); |
| 121 | goto err; |
| 122 | } |
| 123 | bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF); |
| 124 | } |
| 125 | /* The Windows driver maps 0x10000 bytes, we keep only one page... */ |
| 126 | bios_data_map_base = ioremap(0x400, 0xc00); |
| 127 | if (bios_data_map_base == NULL) { |
| 128 | printk(KERN_ERR "wistron_btns: Can't map BIOS data\n"); |
| 129 | goto err_code; |
| 130 | } |
| 131 | return 0; |
| 132 | |
| 133 | err_code: |
| 134 | iounmap(bios_code_map_base); |
| 135 | err: |
| 136 | return -ENOMEM; |
| 137 | } |
| 138 | |
Dmitry Torokhov | 22a397e | 2005-11-20 00:50:46 -0500 | [diff] [blame] | 139 | static inline void unmap_bios(void) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 140 | { |
| 141 | iounmap(bios_code_map_base); |
| 142 | iounmap(bios_data_map_base); |
| 143 | } |
| 144 | |
| 145 | /* BIOS calls */ |
| 146 | |
| 147 | static u16 bios_pop_queue(void) |
| 148 | { |
| 149 | struct regs regs; |
| 150 | |
| 151 | memset(®s, 0, sizeof (regs)); |
| 152 | regs.eax = 0x9610; |
| 153 | regs.ebx = 0x061C; |
| 154 | regs.ecx = 0x0000; |
| 155 | call_bios(®s); |
| 156 | |
| 157 | return regs.eax; |
| 158 | } |
| 159 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 160 | static void bios_attach(void) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 161 | { |
| 162 | struct regs regs; |
| 163 | |
| 164 | memset(®s, 0, sizeof (regs)); |
| 165 | regs.eax = 0x9610; |
| 166 | regs.ebx = 0x012E; |
| 167 | call_bios(®s); |
| 168 | } |
| 169 | |
Dmitry Torokhov | 22a397e | 2005-11-20 00:50:46 -0500 | [diff] [blame] | 170 | static void bios_detach(void) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 171 | { |
| 172 | struct regs regs; |
| 173 | |
| 174 | memset(®s, 0, sizeof (regs)); |
| 175 | regs.eax = 0x9610; |
| 176 | regs.ebx = 0x002E; |
| 177 | call_bios(®s); |
| 178 | } |
| 179 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 180 | static u8 bios_get_cmos_address(void) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 181 | { |
| 182 | struct regs regs; |
| 183 | |
| 184 | memset(®s, 0, sizeof (regs)); |
| 185 | regs.eax = 0x9610; |
| 186 | regs.ebx = 0x051C; |
| 187 | call_bios(®s); |
| 188 | |
| 189 | return regs.ecx; |
| 190 | } |
| 191 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 192 | static u16 bios_get_default_setting(u8 subsys) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 193 | { |
| 194 | struct regs regs; |
| 195 | |
| 196 | memset(®s, 0, sizeof (regs)); |
| 197 | regs.eax = 0x9610; |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 198 | regs.ebx = 0x0200 | subsys; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 199 | call_bios(®s); |
| 200 | |
| 201 | return regs.eax; |
| 202 | } |
| 203 | |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 204 | static void bios_set_state(u8 subsys, int enable) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 205 | { |
| 206 | struct regs regs; |
| 207 | |
| 208 | memset(®s, 0, sizeof (regs)); |
| 209 | regs.eax = 0x9610; |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 210 | regs.ebx = (enable ? 0x0100 : 0x0000) | subsys; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 211 | call_bios(®s); |
| 212 | } |
| 213 | |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 214 | /* Hardware database */ |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 215 | |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 216 | #define KE_WIFI (KE_LAST + 1) |
| 217 | #define KE_BLUETOOTH (KE_LAST + 2) |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 218 | |
| 219 | #define FE_MAIL_LED 0x01 |
| 220 | #define FE_WIFI_LED 0x02 |
| 221 | #define FE_UNTESTED 0x80 |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 222 | |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 223 | static struct key_entry *keymap; /* = NULL; Current key map */ |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 224 | static bool have_wifi; |
| 225 | static bool have_bluetooth; |
| 226 | static int leds_present; /* bitmask of leds present */ |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 227 | |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 228 | static int __init dmi_matched(const struct dmi_system_id *dmi) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 229 | { |
| 230 | const struct key_entry *key; |
| 231 | |
| 232 | keymap = dmi->driver_data; |
| 233 | for (key = keymap; key->type != KE_END; key++) { |
Reiner Herrmann | cde45f1 | 2006-10-01 21:58:51 -0400 | [diff] [blame] | 234 | if (key->type == KE_WIFI) |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 235 | have_wifi = true; |
Reiner Herrmann | cde45f1 | 2006-10-01 21:58:51 -0400 | [diff] [blame] | 236 | else if (key->type == KE_BLUETOOTH) |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 237 | have_bluetooth = true; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 238 | } |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 239 | leds_present = key->code & (FE_MAIL_LED | FE_WIFI_LED); |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 240 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 241 | return 1; |
| 242 | } |
| 243 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 244 | static struct key_entry keymap_empty[] __initdata = { |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 245 | { KE_END, 0 } |
| 246 | }; |
| 247 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 248 | static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 249 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 250 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 251 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 252 | { KE_WIFI, 0x30 }, |
| 253 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 254 | { KE_KEY, 0x36, {KEY_WWW} }, |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 255 | { KE_END, 0 } |
| 256 | }; |
| 257 | |
Remi Herilier | 34a7c48 | 2008-08-08 12:13:13 -0400 | [diff] [blame] | 258 | static struct key_entry keymap_fs_amilo_pro_v3505[] __initdata = { |
| 259 | { KE_KEY, 0x01, {KEY_HELP} }, /* Fn+F1 */ |
| 260 | { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Fn+F4 */ |
| 261 | { KE_BLUETOOTH, 0x30 }, /* Fn+F10 */ |
| 262 | { KE_KEY, 0x31, {KEY_MAIL} }, /* mail button */ |
| 263 | { KE_KEY, 0x36, {KEY_WWW} }, /* www button */ |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 264 | { KE_WIFI, 0x78 }, /* satellite dish button */ |
Remi Herilier | 34a7c48 | 2008-08-08 12:13:13 -0400 | [diff] [blame] | 265 | { KE_END, 0 } |
| 266 | }; |
| 267 | |
Jakub Bogusz | 11601a8 | 2014-01-27 17:21:32 -0800 | [diff] [blame] | 268 | static struct key_entry keymap_fs_amilo_pro_v8210[] __initdata = { |
| 269 | { KE_KEY, 0x01, {KEY_HELP} }, /* Fn+F1 */ |
| 270 | { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Fn+F4 */ |
| 271 | { KE_BLUETOOTH, 0x30 }, /* Fn+F10 */ |
| 272 | { KE_KEY, 0x31, {KEY_MAIL} }, /* mail button */ |
| 273 | { KE_KEY, 0x36, {KEY_WWW} }, /* www button */ |
| 274 | { KE_WIFI, 0x78 }, /* satelite dish button */ |
| 275 | { KE_END, FE_WIFI_LED } |
| 276 | }; |
| 277 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 278 | static struct key_entry keymap_fujitsu_n3510[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 279 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 280 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 281 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 282 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 283 | { KE_KEY, 0x71, {KEY_STOPCD} }, |
| 284 | { KE_KEY, 0x72, {KEY_PLAYPAUSE} }, |
| 285 | { KE_KEY, 0x74, {KEY_REWIND} }, |
| 286 | { KE_KEY, 0x78, {KEY_FORWARD} }, |
John Reed Riley | e2aa507 | 2006-04-05 00:40:01 -0400 | [diff] [blame] | 287 | { KE_END, 0 } |
| 288 | }; |
| 289 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 290 | static struct key_entry keymap_wistron_ms2111[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 291 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 292 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 293 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 294 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 295 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 296 | { KE_END, FE_MAIL_LED } |
| 297 | }; |
| 298 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 299 | static struct key_entry keymap_wistron_md40100[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 300 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 301 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 302 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 303 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 304 | { KE_KEY, 0x37, {KEY_DISPLAYTOGGLE} }, /* Display on/off */ |
| 305 | { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED } |
Frank de Lange | 9000195 | 2006-06-27 01:48:24 -0400 | [diff] [blame] | 306 | }; |
| 307 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 308 | static struct key_entry keymap_wistron_ms2141[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 309 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 310 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 311 | { KE_WIFI, 0x30 }, |
| 312 | { KE_KEY, 0x22, {KEY_REWIND} }, |
| 313 | { KE_KEY, 0x23, {KEY_FORWARD} }, |
| 314 | { KE_KEY, 0x24, {KEY_PLAYPAUSE} }, |
| 315 | { KE_KEY, 0x25, {KEY_STOPCD} }, |
| 316 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 317 | { KE_KEY, 0x36, {KEY_WWW} }, |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 318 | { KE_END, 0 } |
| 319 | }; |
| 320 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 321 | static struct key_entry keymap_acer_aspire_1500[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 322 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 323 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 324 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 325 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 326 | { KE_WIFI, 0x30 }, |
| 327 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 328 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 329 | { KE_KEY, 0x49, {KEY_CONFIG} }, |
| 330 | { KE_BLUETOOTH, 0x44 }, |
| 331 | { KE_END, FE_UNTESTED } |
| 332 | }; |
| 333 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 334 | static struct key_entry keymap_acer_aspire_1600[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 335 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 336 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 337 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 338 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 339 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 340 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 341 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 342 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 343 | { KE_KEY, 0x49, {KEY_CONFIG} }, |
| 344 | { KE_WIFI, 0x30 }, |
| 345 | { KE_BLUETOOTH, 0x44 }, |
| 346 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 347 | }; |
| 348 | |
| 349 | /* 3020 has been tested */ |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 350 | static struct key_entry keymap_acer_aspire_5020[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 351 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 352 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 353 | { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */ |
| 354 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 355 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 356 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 357 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 358 | { KE_KEY, 0x6a, {KEY_CONFIG} }, |
| 359 | { KE_WIFI, 0x30 }, |
| 360 | { KE_BLUETOOTH, 0x44 }, |
| 361 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 362 | }; |
| 363 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 364 | static struct key_entry keymap_acer_travelmate_2410[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 365 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 366 | { KE_KEY, 0x6d, {KEY_POWER} }, |
| 367 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 368 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 369 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 370 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 371 | { KE_KEY, 0x6a, {KEY_CONFIG} }, |
| 372 | { KE_WIFI, 0x30 }, |
| 373 | { KE_BLUETOOTH, 0x44 }, |
| 374 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 375 | }; |
| 376 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 377 | static struct key_entry keymap_acer_travelmate_110[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 378 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 379 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 380 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 381 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 382 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 383 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 384 | { KE_KEY, 0x20, {KEY_VOLUMEUP} }, |
| 385 | { KE_KEY, 0x21, {KEY_VOLUMEDOWN} }, |
| 386 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 387 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 388 | { KE_SW, 0x4a, {.sw = {SW_LID, 1}} }, /* lid close */ |
| 389 | { KE_SW, 0x4b, {.sw = {SW_LID, 0}} }, /* lid open */ |
| 390 | { KE_WIFI, 0x30 }, |
| 391 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 392 | }; |
| 393 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 394 | static struct key_entry keymap_acer_travelmate_300[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 395 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 396 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 397 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 398 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 399 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 400 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 401 | { KE_KEY, 0x20, {KEY_VOLUMEUP} }, |
| 402 | { KE_KEY, 0x21, {KEY_VOLUMEDOWN} }, |
| 403 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 404 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 405 | { KE_WIFI, 0x30 }, |
| 406 | { KE_BLUETOOTH, 0x44 }, |
| 407 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 408 | }; |
| 409 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 410 | static struct key_entry keymap_acer_travelmate_380[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 411 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 412 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 413 | { KE_KEY, 0x03, {KEY_POWER} }, /* not 370 */ |
| 414 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 415 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 416 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 417 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 418 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 419 | { KE_WIFI, 0x30 }, |
| 420 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 421 | }; |
| 422 | |
| 423 | /* unusual map */ |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 424 | static struct key_entry keymap_acer_travelmate_220[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 425 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 426 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 427 | { KE_KEY, 0x11, {KEY_MAIL} }, |
| 428 | { KE_KEY, 0x12, {KEY_WWW} }, |
| 429 | { KE_KEY, 0x13, {KEY_PROG2} }, |
| 430 | { KE_KEY, 0x31, {KEY_PROG1} }, |
| 431 | { KE_END, FE_WIFI_LED | FE_UNTESTED } |
| 432 | }; |
| 433 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 434 | static struct key_entry keymap_acer_travelmate_230[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 435 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 436 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 437 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 438 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 439 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 440 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 441 | { KE_END, FE_WIFI_LED | FE_UNTESTED } |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 442 | }; |
| 443 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 444 | static struct key_entry keymap_acer_travelmate_240[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 445 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 446 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 447 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 448 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 449 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 450 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 451 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 452 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 453 | { KE_BLUETOOTH, 0x44 }, |
| 454 | { KE_WIFI, 0x30 }, |
| 455 | { KE_END, FE_UNTESTED } |
| 456 | }; |
| 457 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 458 | static struct key_entry keymap_acer_travelmate_350[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 459 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 460 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 461 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 462 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 463 | { KE_KEY, 0x13, {KEY_MAIL} }, |
| 464 | { KE_KEY, 0x14, {KEY_PROG3} }, |
| 465 | { KE_KEY, 0x15, {KEY_WWW} }, |
| 466 | { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED } |
| 467 | }; |
| 468 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 469 | static struct key_entry keymap_acer_travelmate_360[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 470 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 471 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 472 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 473 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 474 | { KE_KEY, 0x13, {KEY_MAIL} }, |
| 475 | { KE_KEY, 0x14, {KEY_PROG3} }, |
| 476 | { KE_KEY, 0x15, {KEY_WWW} }, |
| 477 | { KE_KEY, 0x40, {KEY_WLAN} }, |
| 478 | { KE_END, FE_WIFI_LED | FE_UNTESTED } /* no mail led */ |
Ashutosh Naik | 74a89c9 | 2005-12-11 12:41:32 -0500 | [diff] [blame] | 479 | }; |
| 480 | |
Eric Piel | bc413c9 | 2007-03-07 01:45:16 -0500 | [diff] [blame] | 481 | /* Wifi subsystem only activates the led. Therefore we need to pass |
| 482 | * wifi event as a normal key, then userspace can really change the wifi state. |
| 483 | * TODO we need to export led state to userspace (wifi and mail) */ |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 484 | static struct key_entry keymap_acer_travelmate_610[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 485 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 486 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 487 | { KE_KEY, 0x11, {KEY_PROG1} }, |
Eric Piel | fd013ce | 2007-04-29 23:41:53 -0400 | [diff] [blame] | 488 | { KE_KEY, 0x12, {KEY_PROG2} }, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 489 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 490 | { KE_KEY, 0x14, {KEY_MAIL} }, |
| 491 | { KE_KEY, 0x15, {KEY_WWW} }, |
| 492 | { KE_KEY, 0x40, {KEY_WLAN} }, |
| 493 | { KE_END, FE_MAIL_LED | FE_WIFI_LED } |
| 494 | }; |
| 495 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 496 | static struct key_entry keymap_acer_travelmate_630[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 497 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 498 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 499 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 500 | { KE_KEY, 0x08, {KEY_MUTE} }, /* not 620 */ |
| 501 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 502 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 503 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 504 | { KE_KEY, 0x20, {KEY_VOLUMEUP} }, |
| 505 | { KE_KEY, 0x21, {KEY_VOLUMEDOWN} }, |
| 506 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 507 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 508 | { KE_WIFI, 0x30 }, |
| 509 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
Eric Piel | bc413c9 | 2007-03-07 01:45:16 -0500 | [diff] [blame] | 510 | }; |
| 511 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 512 | static struct key_entry keymap_aopen_1559as[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 513 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 514 | { KE_KEY, 0x06, {KEY_PROG3} }, |
| 515 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 516 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 517 | { KE_WIFI, 0x30 }, |
| 518 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 519 | { KE_KEY, 0x36, {KEY_WWW} }, |
Frank de Lange | 9000195 | 2006-06-27 01:48:24 -0400 | [diff] [blame] | 520 | { KE_END, 0 }, |
masc@theaterzentrum.at | e107b8e | 2006-05-29 23:29:36 -0400 | [diff] [blame] | 521 | }; |
| 522 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 523 | static struct key_entry keymap_fs_amilo_d88x0[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 524 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 525 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 526 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 527 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 528 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 529 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 530 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 531 | { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED } |
| 532 | }; |
| 533 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 534 | static struct key_entry keymap_wistron_md2900[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 535 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 536 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 537 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 538 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 539 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 540 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 541 | { KE_WIFI, 0x30 }, |
| 542 | { KE_END, FE_MAIL_LED | FE_UNTESTED } |
| 543 | }; |
| 544 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 545 | static struct key_entry keymap_wistron_md96500[] __initdata = { |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 546 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 547 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 548 | { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */ |
| 549 | { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Display on/off */ |
| 550 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 551 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 552 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 553 | { KE_KEY, 0x20, {KEY_VOLUMEUP} }, |
| 554 | { KE_KEY, 0x21, {KEY_VOLUMEDOWN} }, |
| 555 | { KE_KEY, 0x22, {KEY_REWIND} }, |
| 556 | { KE_KEY, 0x23, {KEY_FORWARD} }, |
| 557 | { KE_KEY, 0x24, {KEY_PLAYPAUSE} }, |
| 558 | { KE_KEY, 0x25, {KEY_STOPCD} }, |
| 559 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 560 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 561 | { KE_WIFI, 0x30 }, |
| 562 | { KE_BLUETOOTH, 0x44 }, |
Stefan Lippers-Hollmann | 53e8875 | 2013-08-12 22:45:38 -0700 | [diff] [blame] | 563 | { KE_END, 0 } |
Michael Leun | 5809d537 | 2007-02-10 01:29:42 -0500 | [diff] [blame] | 564 | }; |
| 565 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 566 | static struct key_entry keymap_wistron_generic[] __initdata = { |
Eric Piel | 7b0a4cd | 2007-04-12 01:32:41 -0400 | [diff] [blame] | 567 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 568 | { KE_KEY, 0x02, {KEY_CONFIG} }, |
| 569 | { KE_KEY, 0x03, {KEY_POWER} }, |
| 570 | { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */ |
| 571 | { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Display on/off */ |
| 572 | { KE_KEY, 0x08, {KEY_MUTE} }, |
| 573 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 574 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 575 | { KE_KEY, 0x13, {KEY_PROG3} }, |
| 576 | { KE_KEY, 0x14, {KEY_MAIL} }, |
| 577 | { KE_KEY, 0x15, {KEY_WWW} }, |
| 578 | { KE_KEY, 0x20, {KEY_VOLUMEUP} }, |
| 579 | { KE_KEY, 0x21, {KEY_VOLUMEDOWN} }, |
| 580 | { KE_KEY, 0x22, {KEY_REWIND} }, |
| 581 | { KE_KEY, 0x23, {KEY_FORWARD} }, |
| 582 | { KE_KEY, 0x24, {KEY_PLAYPAUSE} }, |
| 583 | { KE_KEY, 0x25, {KEY_STOPCD} }, |
| 584 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 585 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 586 | { KE_KEY, 0x37, {KEY_DISPLAYTOGGLE} }, /* Display on/off */ |
| 587 | { KE_KEY, 0x40, {KEY_WLAN} }, |
| 588 | { KE_KEY, 0x49, {KEY_CONFIG} }, |
| 589 | { KE_SW, 0x4a, {.sw = {SW_LID, 1}} }, /* lid close */ |
| 590 | { KE_SW, 0x4b, {.sw = {SW_LID, 0}} }, /* lid open */ |
| 591 | { KE_KEY, 0x6a, {KEY_CONFIG} }, |
| 592 | { KE_KEY, 0x6d, {KEY_POWER} }, |
| 593 | { KE_KEY, 0x71, {KEY_STOPCD} }, |
| 594 | { KE_KEY, 0x72, {KEY_PLAYPAUSE} }, |
| 595 | { KE_KEY, 0x74, {KEY_REWIND} }, |
| 596 | { KE_KEY, 0x78, {KEY_FORWARD} }, |
| 597 | { KE_WIFI, 0x30 }, |
| 598 | { KE_BLUETOOTH, 0x44 }, |
| 599 | { KE_END, 0 } |
| 600 | }; |
| 601 | |
Dmitry Torokhov | 85927b0 | 2009-09-09 19:17:24 -0700 | [diff] [blame] | 602 | static struct key_entry keymap_aopen_1557[] __initdata = { |
| 603 | { KE_KEY, 0x01, {KEY_HELP} }, |
| 604 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 605 | { KE_KEY, 0x12, {KEY_PROG2} }, |
| 606 | { KE_WIFI, 0x30 }, |
| 607 | { KE_KEY, 0x22, {KEY_REWIND} }, |
| 608 | { KE_KEY, 0x23, {KEY_FORWARD} }, |
| 609 | { KE_KEY, 0x24, {KEY_PLAYPAUSE} }, |
| 610 | { KE_KEY, 0x25, {KEY_STOPCD} }, |
| 611 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 612 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 613 | { KE_END, 0 } |
| 614 | }; |
| 615 | |
TJ | 19493478 | 2009-08-03 13:39:09 -0700 | [diff] [blame] | 616 | static struct key_entry keymap_prestigio[] __initdata = { |
| 617 | { KE_KEY, 0x11, {KEY_PROG1} }, |
| 618 | { KE_KEY, 0x12, {KEY_PROG2} }, |
Dmitry Torokhov | 85927b0 | 2009-09-09 19:17:24 -0700 | [diff] [blame] | 619 | { KE_WIFI, 0x30 }, |
TJ | 19493478 | 2009-08-03 13:39:09 -0700 | [diff] [blame] | 620 | { KE_KEY, 0x22, {KEY_REWIND} }, |
| 621 | { KE_KEY, 0x23, {KEY_FORWARD} }, |
| 622 | { KE_KEY, 0x24, {KEY_PLAYPAUSE} }, |
| 623 | { KE_KEY, 0x25, {KEY_STOPCD} }, |
| 624 | { KE_KEY, 0x31, {KEY_MAIL} }, |
| 625 | { KE_KEY, 0x36, {KEY_WWW} }, |
| 626 | { KE_END, 0 } |
| 627 | }; |
| 628 | |
| 629 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 630 | /* |
| 631 | * If your machine is not here (which is currently rather likely), please send |
| 632 | * a list of buttons and their key codes (reported when loading this module |
| 633 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. |
| 634 | */ |
Sachin Kamat | 98f6e5d | 2013-08-12 11:05:18 -0700 | [diff] [blame] | 635 | static const struct dmi_system_id dmi_ids[] __initconst = { |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 636 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 637 | /* Fujitsu-Siemens Amilo Pro V2000 */ |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 638 | .callback = dmi_matched, |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 639 | .matches = { |
| 640 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 641 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"), |
| 642 | }, |
| 643 | .driver_data = keymap_fs_amilo_pro_v2000 |
| 644 | }, |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 645 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 646 | /* Fujitsu-Siemens Amilo Pro Edition V3505 */ |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 647 | .callback = dmi_matched, |
Remi Herilier | 34a7c48 | 2008-08-08 12:13:13 -0400 | [diff] [blame] | 648 | .matches = { |
| 649 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 650 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro Edition V3505"), |
| 651 | }, |
| 652 | .driver_data = keymap_fs_amilo_pro_v3505 |
| 653 | }, |
| 654 | { |
Jakub Bogusz | 11601a8 | 2014-01-27 17:21:32 -0800 | [diff] [blame] | 655 | /* Fujitsu-Siemens Amilo Pro Edition V8210 */ |
| 656 | .callback = dmi_matched, |
| 657 | .matches = { |
| 658 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 659 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro Series V8210"), |
| 660 | }, |
| 661 | .driver_data = keymap_fs_amilo_pro_v8210 |
| 662 | }, |
| 663 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 664 | /* Fujitsu-Siemens Amilo M7400 */ |
Remi Herilier | 34a7c48 | 2008-08-08 12:13:13 -0400 | [diff] [blame] | 665 | .callback = dmi_matched, |
Stefan Rompf | 8a1b170 | 2006-04-05 00:39:20 -0400 | [diff] [blame] | 666 | .matches = { |
| 667 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 668 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO M "), |
| 669 | }, |
| 670 | .driver_data = keymap_fs_amilo_pro_v2000 |
| 671 | }, |
| 672 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 673 | /* Maxdata Pro 7000 DX */ |
Stefan Rompf | 8a1b170 | 2006-04-05 00:39:20 -0400 | [diff] [blame] | 674 | .callback = dmi_matched, |
Giuseppe Mazzotta | e705cee4 | 2009-07-12 21:02:27 -0700 | [diff] [blame] | 675 | .matches = { |
| 676 | DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"), |
| 677 | DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"), |
| 678 | }, |
| 679 | .driver_data = keymap_fs_amilo_pro_v2000 |
| 680 | }, |
| 681 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 682 | /* Fujitsu N3510 */ |
Giuseppe Mazzotta | e705cee4 | 2009-07-12 21:02:27 -0700 | [diff] [blame] | 683 | .callback = dmi_matched, |
John Reed Riley | e2aa507 | 2006-04-05 00:40:01 -0400 | [diff] [blame] | 684 | .matches = { |
| 685 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 686 | DMI_MATCH(DMI_PRODUCT_NAME, "N3510"), |
| 687 | }, |
| 688 | .driver_data = keymap_fujitsu_n3510 |
| 689 | }, |
| 690 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 691 | /* Acer Aspire 1500 */ |
John Reed Riley | e2aa507 | 2006-04-05 00:40:01 -0400 | [diff] [blame] | 692 | .callback = dmi_matched, |
Bernhard Rosenkraenzer | 84b256a | 2005-11-20 00:50:37 -0500 | [diff] [blame] | 693 | .matches = { |
| 694 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 695 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"), |
| 696 | }, |
| 697 | .driver_data = keymap_acer_aspire_1500 |
| 698 | }, |
Ashutosh Naik | 74a89c9 | 2005-12-11 12:41:32 -0500 | [diff] [blame] | 699 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 700 | /* Acer Aspire 1600 */ |
Ashutosh Naik | 74a89c9 | 2005-12-11 12:41:32 -0500 | [diff] [blame] | 701 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 702 | .matches = { |
| 703 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 704 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1600"), |
| 705 | }, |
| 706 | .driver_data = keymap_acer_aspire_1600 |
| 707 | }, |
| 708 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 709 | /* Acer Aspire 3020 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 710 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 711 | .matches = { |
| 712 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 713 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3020"), |
| 714 | }, |
| 715 | .driver_data = keymap_acer_aspire_5020 |
| 716 | }, |
| 717 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 718 | /* Acer Aspire 5020 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 719 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 720 | .matches = { |
| 721 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 722 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5020"), |
| 723 | }, |
| 724 | .driver_data = keymap_acer_aspire_5020 |
| 725 | }, |
| 726 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 727 | /* Acer TravelMate 2100 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 728 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 729 | .matches = { |
| 730 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 731 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2100"), |
| 732 | }, |
| 733 | .driver_data = keymap_acer_aspire_5020 |
| 734 | }, |
| 735 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 736 | /* Acer TravelMate 2410 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 737 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 738 | .matches = { |
| 739 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 740 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2410"), |
| 741 | }, |
| 742 | .driver_data = keymap_acer_travelmate_2410 |
| 743 | }, |
| 744 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 745 | /* Acer TravelMate C300 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 746 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 747 | .matches = { |
| 748 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 749 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C300"), |
| 750 | }, |
| 751 | .driver_data = keymap_acer_travelmate_300 |
| 752 | }, |
| 753 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 754 | /* Acer TravelMate C100 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 755 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 756 | .matches = { |
| 757 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 758 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C100"), |
| 759 | }, |
| 760 | .driver_data = keymap_acer_travelmate_300 |
| 761 | }, |
| 762 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 763 | /* Acer TravelMate C110 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 764 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 765 | .matches = { |
| 766 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 767 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C110"), |
| 768 | }, |
| 769 | .driver_data = keymap_acer_travelmate_110 |
| 770 | }, |
| 771 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 772 | /* Acer TravelMate 380 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 773 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 774 | .matches = { |
| 775 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 776 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 380"), |
| 777 | }, |
| 778 | .driver_data = keymap_acer_travelmate_380 |
| 779 | }, |
| 780 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 781 | /* Acer TravelMate 370 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 782 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 783 | .matches = { |
| 784 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 785 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 370"), |
| 786 | }, |
| 787 | .driver_data = keymap_acer_travelmate_380 /* keyboard minus 1 key */ |
| 788 | }, |
| 789 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 790 | /* Acer TravelMate 220 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 791 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 792 | .matches = { |
| 793 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 794 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 220"), |
| 795 | }, |
| 796 | .driver_data = keymap_acer_travelmate_220 |
| 797 | }, |
| 798 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 799 | /* Acer TravelMate 260 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 800 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 801 | .matches = { |
| 802 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 803 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 260"), |
| 804 | }, |
| 805 | .driver_data = keymap_acer_travelmate_220 |
| 806 | }, |
| 807 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 808 | /* Acer TravelMate 230 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 809 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 810 | .matches = { |
| 811 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 812 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 230"), |
| 813 | /* acerhk looks for "TravelMate F4..." ?! */ |
| 814 | }, |
| 815 | .driver_data = keymap_acer_travelmate_230 |
| 816 | }, |
| 817 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 818 | /* Acer TravelMate 280 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 819 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 820 | .matches = { |
| 821 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 822 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 280"), |
| 823 | }, |
| 824 | .driver_data = keymap_acer_travelmate_230 |
| 825 | }, |
| 826 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 827 | /* Acer TravelMate 240 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 828 | .callback = dmi_matched, |
Ashutosh Naik | 74a89c9 | 2005-12-11 12:41:32 -0500 | [diff] [blame] | 829 | .matches = { |
| 830 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 831 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 240"), |
| 832 | }, |
| 833 | .driver_data = keymap_acer_travelmate_240 |
| 834 | }, |
Ashutosh Naik | bb08859 | 2006-10-01 22:07:14 -0400 | [diff] [blame] | 835 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 836 | /* Acer TravelMate 250 */ |
Ashutosh Naik | bb08859 | 2006-10-01 22:07:14 -0400 | [diff] [blame] | 837 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 838 | .matches = { |
| 839 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 840 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 250"), |
| 841 | }, |
| 842 | .driver_data = keymap_acer_travelmate_240 |
| 843 | }, |
| 844 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 845 | /* Acer TravelMate 2424NWXCi */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 846 | .callback = dmi_matched, |
Ashutosh Naik | bb08859 | 2006-10-01 22:07:14 -0400 | [diff] [blame] | 847 | .matches = { |
| 848 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 849 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2420"), |
| 850 | }, |
| 851 | .driver_data = keymap_acer_travelmate_240 |
| 852 | }, |
| 853 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 854 | /* Acer TravelMate 350 */ |
masc@theaterzentrum.at | e107b8e | 2006-05-29 23:29:36 -0400 | [diff] [blame] | 855 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 856 | .matches = { |
| 857 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 858 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 350"), |
| 859 | }, |
| 860 | .driver_data = keymap_acer_travelmate_350 |
| 861 | }, |
| 862 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 863 | /* Acer TravelMate 360 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 864 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 865 | .matches = { |
| 866 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 867 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), |
| 868 | }, |
| 869 | .driver_data = keymap_acer_travelmate_360 |
| 870 | }, |
| 871 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 872 | /* Acer TravelMate 610 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 873 | .callback = dmi_matched, |
Eric Piel | bc413c9 | 2007-03-07 01:45:16 -0500 | [diff] [blame] | 874 | .matches = { |
| 875 | DMI_MATCH(DMI_SYS_VENDOR, "ACER"), |
| 876 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 610"), |
| 877 | }, |
| 878 | .driver_data = keymap_acer_travelmate_610 |
| 879 | }, |
| 880 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 881 | /* Acer TravelMate 620 */ |
Eric Piel | bc413c9 | 2007-03-07 01:45:16 -0500 | [diff] [blame] | 882 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 883 | .matches = { |
| 884 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 885 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 620"), |
| 886 | }, |
| 887 | .driver_data = keymap_acer_travelmate_630 |
| 888 | }, |
| 889 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 890 | /* Acer TravelMate 630 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 891 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 892 | .matches = { |
| 893 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 894 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 630"), |
| 895 | }, |
| 896 | .driver_data = keymap_acer_travelmate_630 |
| 897 | }, |
| 898 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 899 | /* AOpen 1559AS */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 900 | .callback = dmi_matched, |
masc@theaterzentrum.at | e107b8e | 2006-05-29 23:29:36 -0400 | [diff] [blame] | 901 | .matches = { |
| 902 | DMI_MATCH(DMI_PRODUCT_NAME, "E2U"), |
| 903 | DMI_MATCH(DMI_BOARD_NAME, "E2U"), |
| 904 | }, |
| 905 | .driver_data = keymap_aopen_1559as |
| 906 | }, |
Frank de Lange | 9000195 | 2006-06-27 01:48:24 -0400 | [diff] [blame] | 907 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 908 | /* Medion MD 9783 */ |
Frank de Lange | 9000195 | 2006-06-27 01:48:24 -0400 | [diff] [blame] | 909 | .callback = dmi_matched, |
Frank de Lange | 9000195 | 2006-06-27 01:48:24 -0400 | [diff] [blame] | 910 | .matches = { |
| 911 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), |
| 912 | DMI_MATCH(DMI_PRODUCT_NAME, "MD 9783"), |
| 913 | }, |
| 914 | .driver_data = keymap_wistron_ms2111 |
| 915 | }, |
Michael Leun | 5809d537 | 2007-02-10 01:29:42 -0500 | [diff] [blame] | 916 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 917 | /* Medion MD 40100 */ |
Michael Leun | 5809d537 | 2007-02-10 01:29:42 -0500 | [diff] [blame] | 918 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 919 | .matches = { |
| 920 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), |
| 921 | DMI_MATCH(DMI_PRODUCT_NAME, "WID2000"), |
| 922 | }, |
| 923 | .driver_data = keymap_wistron_md40100 |
| 924 | }, |
| 925 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 926 | /* Medion MD 2900 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 927 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 928 | .matches = { |
| 929 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), |
| 930 | DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2000"), |
| 931 | }, |
| 932 | .driver_data = keymap_wistron_md2900 |
| 933 | }, |
| 934 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 935 | /* Medion MD 42200 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 936 | .callback = dmi_matched, |
Sebastian Frei | 3bfb0a7 | 2009-10-05 21:43:39 -0700 | [diff] [blame] | 937 | .matches = { |
| 938 | DMI_MATCH(DMI_SYS_VENDOR, "Medion"), |
| 939 | DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2030"), |
| 940 | }, |
| 941 | .driver_data = keymap_fs_amilo_pro_v2000 |
| 942 | }, |
| 943 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 944 | /* Medion MD 96500 */ |
Sebastian Frei | 3bfb0a7 | 2009-10-05 21:43:39 -0700 | [diff] [blame] | 945 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 946 | .matches = { |
| 947 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"), |
| 948 | DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2040"), |
| 949 | }, |
| 950 | .driver_data = keymap_wistron_md96500 |
| 951 | }, |
| 952 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 953 | /* Medion MD 95400 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 954 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 955 | .matches = { |
| 956 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"), |
| 957 | DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2050"), |
| 958 | }, |
| 959 | .driver_data = keymap_wistron_md96500 |
| 960 | }, |
| 961 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 962 | /* Fujitsu Siemens Amilo D7820 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 963 | .callback = dmi_matched, |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 964 | .matches = { |
| 965 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), /* not sure */ |
| 966 | DMI_MATCH(DMI_PRODUCT_NAME, "Amilo D"), |
| 967 | }, |
| 968 | .driver_data = keymap_fs_amilo_d88x0 |
| 969 | }, |
| 970 | { |
Dmitry Torokhov | a9b0d0e | 2009-12-04 10:24:19 -0800 | [diff] [blame] | 971 | /* Fujitsu Siemens Amilo D88x0 */ |
Eric Piel | 6480e2a | 2007-04-12 01:32:34 -0400 | [diff] [blame] | 972 | .callback = dmi_matched, |
Michael Leun | 5809d537 | 2007-02-10 01:29:42 -0500 | [diff] [blame] | 973 | .matches = { |
| 974 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 975 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO D"), |
| 976 | }, |
| 977 | .driver_data = keymap_fs_amilo_d88x0 |
| 978 | }, |
Al Viro | 81f0a91 | 2005-12-15 09:19:05 +0000 | [diff] [blame] | 979 | { NULL, } |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 980 | }; |
Stefan Lippers-Hollmann | ac67be9 | 2013-08-12 22:45:58 -0700 | [diff] [blame] | 981 | MODULE_DEVICE_TABLE(dmi, dmi_ids); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 982 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 983 | /* Copy the good keymap, as the original ones are free'd */ |
| 984 | static int __init copy_keymap(void) |
| 985 | { |
| 986 | const struct key_entry *key; |
| 987 | struct key_entry *new_keymap; |
| 988 | unsigned int length = 1; |
| 989 | |
| 990 | for (key = keymap; key->type != KE_END; key++) |
| 991 | length++; |
| 992 | |
Julia Lawall | f8300ab | 2010-05-19 10:11:14 -0700 | [diff] [blame] | 993 | new_keymap = kmemdup(keymap, length * sizeof(struct key_entry), |
| 994 | GFP_KERNEL); |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 995 | if (!new_keymap) |
| 996 | return -ENOMEM; |
| 997 | |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 998 | keymap = new_keymap; |
| 999 | |
| 1000 | return 0; |
| 1001 | } |
| 1002 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1003 | static int __init select_keymap(void) |
| 1004 | { |
Eric Piel | 7b0a4cd | 2007-04-12 01:32:41 -0400 | [diff] [blame] | 1005 | dmi_check_system(dmi_ids); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1006 | if (keymap_name != NULL) { |
| 1007 | if (strcmp (keymap_name, "1557/MS2141") == 0) |
| 1008 | keymap = keymap_wistron_ms2141; |
Dmitry Torokhov | 85927b0 | 2009-09-09 19:17:24 -0700 | [diff] [blame] | 1009 | else if (strcmp (keymap_name, "aopen1557") == 0) |
| 1010 | keymap = keymap_aopen_1557; |
TJ | 19493478 | 2009-08-03 13:39:09 -0700 | [diff] [blame] | 1011 | else if (strcmp (keymap_name, "prestigio") == 0) |
| 1012 | keymap = keymap_prestigio; |
Eric Piel | 7b0a4cd | 2007-04-12 01:32:41 -0400 | [diff] [blame] | 1013 | else if (strcmp (keymap_name, "generic") == 0) |
| 1014 | keymap = keymap_wistron_generic; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1015 | else { |
| 1016 | printk(KERN_ERR "wistron_btns: Keymap unknown\n"); |
| 1017 | return -EINVAL; |
| 1018 | } |
| 1019 | } |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1020 | if (keymap == NULL) { |
| 1021 | if (!force) { |
| 1022 | printk(KERN_ERR "wistron_btns: System unknown\n"); |
| 1023 | return -ENODEV; |
| 1024 | } |
| 1025 | keymap = keymap_empty; |
| 1026 | } |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 1027 | |
| 1028 | return copy_keymap(); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1029 | } |
| 1030 | |
| 1031 | /* Input layer interface */ |
| 1032 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1033 | static struct input_dev *wistron_idev; |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1034 | static unsigned long jiffies_last_press; |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1035 | static bool wifi_enabled; |
| 1036 | static bool bluetooth_enabled; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1037 | |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1038 | /* led management */ |
| 1039 | static void wistron_mail_led_set(struct led_classdev *led_cdev, |
| 1040 | enum led_brightness value) |
| 1041 | { |
| 1042 | bios_set_state(MAIL_LED, (value != LED_OFF) ? 1 : 0); |
| 1043 | } |
| 1044 | |
| 1045 | /* same as setting up wifi card, but for laptops on which the led is managed */ |
| 1046 | static void wistron_wifi_led_set(struct led_classdev *led_cdev, |
| 1047 | enum led_brightness value) |
| 1048 | { |
| 1049 | bios_set_state(WIFI, (value != LED_OFF) ? 1 : 0); |
| 1050 | } |
| 1051 | |
| 1052 | static struct led_classdev wistron_mail_led = { |
Richard Purdie | 6c152be | 2007-10-31 15:00:07 +0100 | [diff] [blame] | 1053 | .name = "wistron:green:mail", |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1054 | .brightness_set = wistron_mail_led_set, |
| 1055 | }; |
| 1056 | |
| 1057 | static struct led_classdev wistron_wifi_led = { |
Richard Purdie | 6c152be | 2007-10-31 15:00:07 +0100 | [diff] [blame] | 1058 | .name = "wistron:red:wifi", |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1059 | .brightness_set = wistron_wifi_led_set, |
| 1060 | }; |
| 1061 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 1062 | static void wistron_led_init(struct device *parent) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1063 | { |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1064 | if (leds_present & FE_WIFI_LED) { |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1065 | u16 wifi = bios_get_default_setting(WIFI); |
| 1066 | if (wifi & 1) { |
| 1067 | wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : LED_OFF; |
| 1068 | if (led_classdev_register(parent, &wistron_wifi_led)) |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1069 | leds_present &= ~FE_WIFI_LED; |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1070 | else |
| 1071 | bios_set_state(WIFI, wistron_wifi_led.brightness); |
| 1072 | |
| 1073 | } else |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1074 | leds_present &= ~FE_WIFI_LED; |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1075 | } |
| 1076 | |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1077 | if (leds_present & FE_MAIL_LED) { |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1078 | /* bios_get_default_setting(MAIL) always retuns 0, so just turn the led off */ |
| 1079 | wistron_mail_led.brightness = LED_OFF; |
| 1080 | if (led_classdev_register(parent, &wistron_mail_led)) |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1081 | leds_present &= ~FE_MAIL_LED; |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1082 | else |
| 1083 | bios_set_state(MAIL_LED, wistron_mail_led.brightness); |
| 1084 | } |
| 1085 | } |
| 1086 | |
Bill Pemberton | e2619cf | 2012-11-23 21:50:47 -0800 | [diff] [blame] | 1087 | static void wistron_led_remove(void) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1088 | { |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1089 | if (leds_present & FE_MAIL_LED) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1090 | led_classdev_unregister(&wistron_mail_led); |
| 1091 | |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1092 | if (leds_present & FE_WIFI_LED) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1093 | led_classdev_unregister(&wistron_wifi_led); |
| 1094 | } |
| 1095 | |
| 1096 | static inline void wistron_led_suspend(void) |
| 1097 | { |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1098 | if (leds_present & FE_MAIL_LED) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1099 | led_classdev_suspend(&wistron_mail_led); |
| 1100 | |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1101 | if (leds_present & FE_WIFI_LED) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1102 | led_classdev_suspend(&wistron_wifi_led); |
| 1103 | } |
| 1104 | |
| 1105 | static inline void wistron_led_resume(void) |
| 1106 | { |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1107 | if (leds_present & FE_MAIL_LED) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1108 | led_classdev_resume(&wistron_mail_led); |
| 1109 | |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1110 | if (leds_present & FE_WIFI_LED) |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1111 | led_classdev_resume(&wistron_wifi_led); |
| 1112 | } |
| 1113 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1114 | static void handle_key(u8 code) |
| 1115 | { |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1116 | const struct key_entry *key = |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1117 | sparse_keymap_entry_from_scancode(wistron_idev, code); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1118 | |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1119 | if (key) { |
| 1120 | switch (key->type) { |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1121 | case KE_WIFI: |
| 1122 | if (have_wifi) { |
| 1123 | wifi_enabled = !wifi_enabled; |
| 1124 | bios_set_state(WIFI, wifi_enabled); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1125 | } |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1126 | break; |
| 1127 | |
| 1128 | case KE_BLUETOOTH: |
| 1129 | if (have_bluetooth) { |
| 1130 | bluetooth_enabled = !bluetooth_enabled; |
| 1131 | bios_set_state(BLUETOOTH, bluetooth_enabled); |
| 1132 | } |
| 1133 | break; |
| 1134 | |
| 1135 | default: |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1136 | sparse_keymap_report_entry(wistron_idev, key, 1, true); |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1137 | break; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1138 | } |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1139 | jiffies_last_press = jiffies; |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1140 | } else { |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1141 | printk(KERN_NOTICE |
| 1142 | "wistron_btns: Unknown key code %02X\n", code); |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1143 | } |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1144 | } |
| 1145 | |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1146 | static void poll_bios(bool discard) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1147 | { |
| 1148 | u8 qlen; |
| 1149 | u16 val; |
| 1150 | |
| 1151 | for (;;) { |
| 1152 | qlen = CMOS_READ(cmos_address); |
| 1153 | if (qlen == 0) |
| 1154 | break; |
| 1155 | val = bios_pop_queue(); |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1156 | if (val != 0 && !discard) |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1157 | handle_key((u8)val); |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1158 | } |
| 1159 | } |
| 1160 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1161 | static int wistron_flush(struct input_dev *dev) |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1162 | { |
| 1163 | /* Flush stale event queue */ |
| 1164 | poll_bios(true); |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1165 | |
| 1166 | return 0; |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1167 | } |
| 1168 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1169 | static void wistron_poll(struct input_dev *dev) |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1170 | { |
| 1171 | poll_bios(false); |
| 1172 | |
| 1173 | /* Increase poll frequency if user is currently pressing keys (< 2s ago) */ |
| 1174 | if (time_before(jiffies, jiffies_last_press + 2 * HZ)) |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1175 | input_set_poll_interval(dev, POLL_INTERVAL_BURST); |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1176 | else |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1177 | input_set_poll_interval(dev, POLL_INTERVAL_DEFAULT); |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1178 | } |
| 1179 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 1180 | static int wistron_setup_keymap(struct input_dev *dev, |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1181 | struct key_entry *entry) |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1182 | { |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1183 | switch (entry->type) { |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1184 | |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1185 | /* if wifi or bluetooth are not available, create normal keys */ |
| 1186 | case KE_WIFI: |
| 1187 | if (!have_wifi) { |
| 1188 | entry->type = KE_KEY; |
| 1189 | entry->keycode = KEY_WLAN; |
| 1190 | } |
| 1191 | break; |
| 1192 | |
| 1193 | case KE_BLUETOOTH: |
| 1194 | if (!have_bluetooth) { |
| 1195 | entry->type = KE_KEY; |
| 1196 | entry->keycode = KEY_BLUETOOTH; |
| 1197 | } |
| 1198 | break; |
| 1199 | |
| 1200 | case KE_END: |
| 1201 | if (entry->code & FE_UNTESTED) |
| 1202 | printk(KERN_WARNING "Untested laptop multimedia keys, " |
| 1203 | "please report success or failure to " |
| 1204 | "eric.piel@tremplin-utc.net\n"); |
| 1205 | break; |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1206 | } |
| 1207 | |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1208 | return 0; |
Dmitry Torokhov | d63219a | 2007-06-14 23:31:45 -0400 | [diff] [blame] | 1209 | } |
| 1210 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 1211 | static int setup_input_dev(void) |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1212 | { |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1213 | int error; |
| 1214 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1215 | wistron_idev = input_allocate_device(); |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1216 | if (!wistron_idev) |
| 1217 | return -ENOMEM; |
| 1218 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1219 | wistron_idev->name = "Wistron laptop buttons"; |
| 1220 | wistron_idev->phys = "wistron/input0"; |
| 1221 | wistron_idev->id.bustype = BUS_HOST; |
| 1222 | wistron_idev->dev.parent = &wistron_device->dev; |
| 1223 | |
Samu Onkalo | b0aba1e | 2009-10-18 00:38:57 -0700 | [diff] [blame] | 1224 | wistron_idev->open = wistron_flush; |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1225 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1226 | error = sparse_keymap_setup(wistron_idev, keymap, wistron_setup_keymap); |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1227 | if (error) |
| 1228 | goto err_free_dev; |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1229 | |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1230 | error = input_setup_polling(wistron_idev, wistron_poll); |
| 1231 | if (error) |
| 1232 | goto err_free_dev; |
| 1233 | |
| 1234 | input_set_poll_interval(wistron_idev, POLL_INTERVAL_DEFAULT); |
| 1235 | |
| 1236 | error = input_register_device(wistron_idev); |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1237 | if (error) |
Dmitry Torokhov | fc2a6e5 | 2017-03-08 09:27:27 -0800 | [diff] [blame] | 1238 | goto err_free_dev; |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1239 | |
| 1240 | return 0; |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1241 | |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1242 | err_free_dev: |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1243 | input_free_device(wistron_idev); |
Dmitry Torokhov | e97af4cb | 2009-12-04 10:22:24 -0800 | [diff] [blame] | 1244 | return error; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1245 | } |
| 1246 | |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1247 | /* Driver core */ |
| 1248 | |
Bill Pemberton | 5298cc4 | 2012-11-23 21:38:25 -0800 | [diff] [blame] | 1249 | static int wistron_probe(struct platform_device *dev) |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1250 | { |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1251 | int err; |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1252 | |
| 1253 | bios_attach(); |
| 1254 | cmos_address = bios_get_cmos_address(); |
| 1255 | |
| 1256 | if (have_wifi) { |
| 1257 | u16 wifi = bios_get_default_setting(WIFI); |
| 1258 | if (wifi & 1) |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1259 | wifi_enabled = wifi & 2; |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1260 | else |
| 1261 | have_wifi = 0; |
| 1262 | |
| 1263 | if (have_wifi) |
| 1264 | bios_set_state(WIFI, wifi_enabled); |
| 1265 | } |
| 1266 | |
| 1267 | if (have_bluetooth) { |
| 1268 | u16 bt = bios_get_default_setting(BLUETOOTH); |
| 1269 | if (bt & 1) |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1270 | bluetooth_enabled = bt & 2; |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1271 | else |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1272 | have_bluetooth = false; |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1273 | |
| 1274 | if (have_bluetooth) |
| 1275 | bios_set_state(BLUETOOTH, bluetooth_enabled); |
| 1276 | } |
| 1277 | |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1278 | wistron_led_init(&dev->dev); |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1279 | |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1280 | err = setup_input_dev(); |
| 1281 | if (err) { |
| 1282 | bios_detach(); |
| 1283 | return err; |
| 1284 | } |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1285 | |
| 1286 | return 0; |
| 1287 | } |
| 1288 | |
Bill Pemberton | e2619cf | 2012-11-23 21:50:47 -0800 | [diff] [blame] | 1289 | static int wistron_remove(struct platform_device *dev) |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1290 | { |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1291 | wistron_led_remove(); |
Dmitry Torokhov | 4a767ec | 2019-10-29 17:03:45 -0700 | [diff] [blame] | 1292 | input_unregister_device(wistron_idev); |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1293 | bios_detach(); |
| 1294 | |
| 1295 | return 0; |
| 1296 | } |
| 1297 | |
| 1298 | #ifdef CONFIG_PM |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1299 | static int wistron_suspend(struct device *dev) |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1300 | { |
Miloslav Trmac | e753b65 | 2005-11-20 00:51:05 -0500 | [diff] [blame] | 1301 | if (have_wifi) |
| 1302 | bios_set_state(WIFI, 0); |
| 1303 | |
| 1304 | if (have_bluetooth) |
| 1305 | bios_set_state(BLUETOOTH, 0); |
| 1306 | |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1307 | wistron_led_suspend(); |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1308 | |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1309 | return 0; |
| 1310 | } |
| 1311 | |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1312 | static int wistron_resume(struct device *dev) |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1313 | { |
| 1314 | if (have_wifi) |
| 1315 | bios_set_state(WIFI, wifi_enabled); |
| 1316 | |
| 1317 | if (have_bluetooth) |
| 1318 | bios_set_state(BLUETOOTH, bluetooth_enabled); |
| 1319 | |
Eric Piel | 389679d | 2007-05-21 00:46:31 -0400 | [diff] [blame] | 1320 | wistron_led_resume(); |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1321 | |
Dmitry Torokhov | c2554c9 | 2007-05-22 23:48:39 -0400 | [diff] [blame] | 1322 | poll_bios(true); |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1323 | |
| 1324 | return 0; |
| 1325 | } |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1326 | |
| 1327 | static const struct dev_pm_ops wistron_pm_ops = { |
| 1328 | .suspend = wistron_suspend, |
| 1329 | .resume = wistron_resume, |
| 1330 | .poweroff = wistron_suspend, |
| 1331 | .restore = wistron_resume, |
| 1332 | }; |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1333 | #endif |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1334 | |
| 1335 | static struct platform_driver wistron_driver = { |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1336 | .driver = { |
| 1337 | .name = "wistron-bios", |
Rakib Mullick | e97006a | 2009-12-29 23:19:31 -0800 | [diff] [blame] | 1338 | #ifdef CONFIG_PM |
Dmitry Torokhov | 67dbe83 | 2009-08-07 23:17:39 -0700 | [diff] [blame] | 1339 | .pm = &wistron_pm_ops, |
| 1340 | #endif |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1341 | }, |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1342 | .probe = wistron_probe, |
Bill Pemberton | 1cb0aa8 | 2012-11-23 21:27:39 -0800 | [diff] [blame] | 1343 | .remove = wistron_remove, |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1344 | }; |
| 1345 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1346 | static int __init wb_module_init(void) |
| 1347 | { |
| 1348 | int err; |
| 1349 | |
| 1350 | err = select_keymap(); |
| 1351 | if (err) |
| 1352 | return err; |
Dmitry Torokhov | 22a397e | 2005-11-20 00:50:46 -0500 | [diff] [blame] | 1353 | |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1354 | err = map_bios(); |
| 1355 | if (err) |
Axel Lin | 1fcb8bb | 2010-06-28 01:10:01 -0700 | [diff] [blame] | 1356 | goto err_free_keymap; |
Dmitry Torokhov | 22a397e | 2005-11-20 00:50:46 -0500 | [diff] [blame] | 1357 | |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1358 | err = platform_driver_register(&wistron_driver); |
| 1359 | if (err) |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1360 | goto err_unmap_bios; |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1361 | |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1362 | wistron_device = platform_device_alloc("wistron-bios", -1); |
| 1363 | if (!wistron_device) { |
| 1364 | err = -ENOMEM; |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1365 | goto err_unregister_driver; |
| 1366 | } |
| 1367 | |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1368 | err = platform_device_add(wistron_device); |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1369 | if (err) |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1370 | goto err_free_device; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1371 | |
| 1372 | return 0; |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1373 | |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1374 | err_free_device: |
| 1375 | platform_device_put(wistron_device); |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1376 | err_unregister_driver: |
| 1377 | platform_driver_unregister(&wistron_driver); |
Dmitry Torokhov | e7c3aad | 2005-12-28 01:26:24 -0500 | [diff] [blame] | 1378 | err_unmap_bios: |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1379 | unmap_bios(); |
Axel Lin | 1fcb8bb | 2010-06-28 01:10:01 -0700 | [diff] [blame] | 1380 | err_free_keymap: |
| 1381 | kfree(keymap); |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1382 | |
| 1383 | return err; |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1384 | } |
| 1385 | |
| 1386 | static void __exit wb_module_exit(void) |
| 1387 | { |
Dmitry Torokhov | a5b0cc80 | 2005-11-20 00:50:58 -0500 | [diff] [blame] | 1388 | platform_device_unregister(wistron_device); |
| 1389 | platform_driver_unregister(&wistron_driver); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1390 | unmap_bios(); |
Eric Piel | 55d29c9 | 2007-04-12 01:32:49 -0400 | [diff] [blame] | 1391 | kfree(keymap); |
Dmitry Torokhov | 5fc14680 | 2005-11-20 00:50:06 -0500 | [diff] [blame] | 1392 | } |
| 1393 | |
| 1394 | module_init(wb_module_init); |
| 1395 | module_exit(wb_module_exit); |