aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:52:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:52:08 -0400
commit36ac1d2f323f8bf8bc10c25b88f617657720e241 (patch)
treed51f87bdf16eaa19ce0c5a682c10dccfaef4b48d /drivers/input/misc
parentd7a6119f457f48a94985fdbdc400cbb03e136a76 (diff)
parent4c0e799a9a6dc64426ddb6c03aea1a154357658f (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (32 commits) Input: wm97xx - update email address for Liam Girdwood Input: i8042 - add Thinkpad R31 to nomux list Input: move map_to_7segment.h to include/linux Input: ads7846 - fix cache line sharing issue Input: cm109 - add missing newlines to messages Input: document i8042.debug in kernel-parameters.txt Input: keyboard - fix potential out of bound access to key_map Input: psmouse - add OLPC touchpad driver Input: psmouse - tweak PSMOUSE_DEFINE_ATTR to support raw set callbacks Input: psmouse - add psmouse_queue_work() for ps/2 extension to make use of Input: psmouse - export psmouse_set_state for ps/2 extensions to use Input: ads7846 - introduce .gpio_pendown to get pendown state Input: ALPS - add signature for DualPoint found in Dell Latitude E6500 Input: serio_raw - allow attaching to translated (SERIO_I8042XL) ports Input: cm109 - don't use obsolete logging macros Input: atkbd - expand Latitude's force release quirk to other Dells Input: bf54x-keys - add power management support Input: atmel_tsadcc - improve accuracy Input: convert drivers to use strict_strtoul() Input: appletouch - handle geyser 3/4 status bits ...
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/Kconfig13
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/ati_remote2.c263
-rw-r--r--drivers/input/misc/cm109.c882
-rw-r--r--drivers/input/misc/map_to_7segment.h189
-rw-r--r--drivers/input/misc/wistron_btns.c19
-rw-r--r--drivers/input/misc/yealink.c2
7 files changed, 1144 insertions, 225 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index e99b7882f382..199055db5082 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -180,6 +180,19 @@ config INPUT_YEALINK
180 To compile this driver as a module, choose M here: the module will be 180 To compile this driver as a module, choose M here: the module will be
181 called yealink. 181 called yealink.
182 182
183config INPUT_CM109
184 tristate "C-Media CM109 USB I/O Controller"
185 depends on EXPERIMENTAL
186 depends on USB_ARCH_HAS_HCD
187 select USB
188 help
189 Say Y here if you want to enable keyboard and buzzer functions of the
190 C-Media CM109 usb phones. The audio part is enabled by the generic
191 usb sound driver, so you might want to enable that as well.
192
193 To compile this driver as a module, choose M here: the module will be
194 called cm109.
195
183config INPUT_UINPUT 196config INPUT_UINPUT
184 tristate "User level driver support" 197 tristate "User level driver support"
185 help 198 help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index f48009b52226..d7db2aeb8a98 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o
16obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o 16obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o
17obj-$(CONFIG_INPUT_POWERMATE) += powermate.o 17obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
18obj-$(CONFIG_INPUT_YEALINK) += yealink.o 18obj-$(CONFIG_INPUT_YEALINK) += yealink.o
19obj-$(CONFIG_INPUT_CM109) += cm109.o
19obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 20obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
20obj-$(CONFIG_INPUT_UINPUT) += uinput.o 21obj-$(CONFIG_INPUT_UINPUT) += uinput.o
21obj-$(CONFIG_INPUT_APANEL) += apanel.o 22obj-$(CONFIG_INPUT_APANEL) += apanel.o
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index a7fabafbd94c..3c9988dc0e9f 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * ati_remote2 - ATI/Philips USB RF remote driver 2 * ati_remote2 - ATI/Philips USB RF remote driver
3 * 3 *
4 * Copyright (C) 2005 Ville Syrjala <syrjala@sci.fi> 4 * Copyright (C) 2005-2008 Ville Syrjala <syrjala@sci.fi>
5 * Copyright (C) 2007 Peter Stokes <linux@dadeos.freeserve.co.uk> 5 * Copyright (C) 2007-2008 Peter Stokes <linux@dadeos.co.uk>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 8 * it under the terms of the GNU General Public License version 2
@@ -12,7 +12,7 @@
12#include <linux/usb/input.h> 12#include <linux/usb/input.h>
13 13
14#define DRIVER_DESC "ATI/Philips USB RF remote driver" 14#define DRIVER_DESC "ATI/Philips USB RF remote driver"
15#define DRIVER_VERSION "0.2" 15#define DRIVER_VERSION "0.3"
16 16
17MODULE_DESCRIPTION(DRIVER_DESC); 17MODULE_DESCRIPTION(DRIVER_DESC);
18MODULE_VERSION(DRIVER_VERSION); 18MODULE_VERSION(DRIVER_VERSION);
@@ -27,7 +27,7 @@ MODULE_LICENSE("GPL");
27 * A remote's "channel" may be altered by pressing and holding the "PC" button for 27 * A remote's "channel" may be altered by pressing and holding the "PC" button for
28 * approximately 3 seconds, after which the button will slowly flash the count of the 28 * approximately 3 seconds, after which the button will slowly flash the count of the
29 * currently configured "channel", using the numeric keypad enter a number between 1 and 29 * currently configured "channel", using the numeric keypad enter a number between 1 and
30 * 16 and then the "PC" button again, the button will slowly flash the count of the 30 * 16 and then press the "PC" button again, the button will slowly flash the count of the
31 * newly configured "channel". 31 * newly configured "channel".
32 */ 32 */
33 33
@@ -45,9 +45,25 @@ static struct usb_device_id ati_remote2_id_table[] = {
45}; 45};
46MODULE_DEVICE_TABLE(usb, ati_remote2_id_table); 46MODULE_DEVICE_TABLE(usb, ati_remote2_id_table);
47 47
48static struct { 48static DEFINE_MUTEX(ati_remote2_mutex);
49 int hw_code; 49
50 int key_code; 50enum {
51 ATI_REMOTE2_OPENED = 0x1,
52 ATI_REMOTE2_SUSPENDED = 0x2,
53};
54
55enum {
56 ATI_REMOTE2_AUX1,
57 ATI_REMOTE2_AUX2,
58 ATI_REMOTE2_AUX3,
59 ATI_REMOTE2_AUX4,
60 ATI_REMOTE2_PC,
61 ATI_REMOTE2_MODES,
62};
63
64static const struct {
65 u8 hw_code;
66 u16 keycode;
51} ati_remote2_key_table[] = { 67} ati_remote2_key_table[] = {
52 { 0x00, KEY_0 }, 68 { 0x00, KEY_0 },
53 { 0x01, KEY_1 }, 69 { 0x01, KEY_1 },
@@ -73,6 +89,7 @@ static struct {
73 { 0x37, KEY_RECORD }, 89 { 0x37, KEY_RECORD },
74 { 0x38, KEY_DVD }, 90 { 0x38, KEY_DVD },
75 { 0x39, KEY_TV }, 91 { 0x39, KEY_TV },
92 { 0x3f, KEY_PROG1 }, /* AUX1-AUX4 and PC */
76 { 0x54, KEY_MENU }, 93 { 0x54, KEY_MENU },
77 { 0x58, KEY_UP }, 94 { 0x58, KEY_UP },
78 { 0x59, KEY_DOWN }, 95 { 0x59, KEY_DOWN },
@@ -91,15 +108,9 @@ static struct {
91 { 0xa9, BTN_LEFT }, 108 { 0xa9, BTN_LEFT },
92 { 0xaa, BTN_RIGHT }, 109 { 0xaa, BTN_RIGHT },
93 { 0xbe, KEY_QUESTION }, 110 { 0xbe, KEY_QUESTION },
94 { 0xd5, KEY_FRONT },
95 { 0xd0, KEY_EDIT }, 111 { 0xd0, KEY_EDIT },
112 { 0xd5, KEY_FRONT },
96 { 0xf9, KEY_INFO }, 113 { 0xf9, KEY_INFO },
97 { (0x00 << 8) | 0x3f, KEY_PROG1 },
98 { (0x01 << 8) | 0x3f, KEY_PROG2 },
99 { (0x02 << 8) | 0x3f, KEY_PROG3 },
100 { (0x03 << 8) | 0x3f, KEY_PROG4 },
101 { (0x04 << 8) | 0x3f, KEY_PC },
102 { 0, KEY_RESERVED }
103}; 114};
104 115
105struct ati_remote2 { 116struct ati_remote2 {
@@ -117,46 +128,106 @@ struct ati_remote2 {
117 128
118 char name[64]; 129 char name[64];
119 char phys[64]; 130 char phys[64];
131
132 /* Each mode (AUX1-AUX4 and PC) can have an independent keymap. */
133 u16 keycode[ATI_REMOTE2_MODES][ARRAY_SIZE(ati_remote2_key_table)];
134
135 unsigned int flags;
120}; 136};
121 137
122static int ati_remote2_probe(struct usb_interface *interface, const struct usb_device_id *id); 138static int ati_remote2_probe(struct usb_interface *interface, const struct usb_device_id *id);
123static void ati_remote2_disconnect(struct usb_interface *interface); 139static void ati_remote2_disconnect(struct usb_interface *interface);
140static int ati_remote2_suspend(struct usb_interface *interface, pm_message_t message);
141static int ati_remote2_resume(struct usb_interface *interface);
124 142
125static struct usb_driver ati_remote2_driver = { 143static struct usb_driver ati_remote2_driver = {
126 .name = "ati_remote2", 144 .name = "ati_remote2",
127 .probe = ati_remote2_probe, 145 .probe = ati_remote2_probe,
128 .disconnect = ati_remote2_disconnect, 146 .disconnect = ati_remote2_disconnect,
129 .id_table = ati_remote2_id_table, 147 .id_table = ati_remote2_id_table,
148 .suspend = ati_remote2_suspend,
149 .resume = ati_remote2_resume,
150 .supports_autosuspend = 1,
130}; 151};
131 152
132static int ati_remote2_open(struct input_dev *idev) 153static int ati_remote2_submit_urbs(struct ati_remote2 *ar2)
133{ 154{
134 struct ati_remote2 *ar2 = input_get_drvdata(idev);
135 int r; 155 int r;
136 156
137 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL); 157 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL);
138 if (r) { 158 if (r) {
139 dev_err(&ar2->intf[0]->dev, 159 dev_err(&ar2->intf[0]->dev,
140 "%s: usb_submit_urb() = %d\n", __func__, r); 160 "%s(): usb_submit_urb() = %d\n", __func__, r);
141 return r; 161 return r;
142 } 162 }
143 r = usb_submit_urb(ar2->urb[1], GFP_KERNEL); 163 r = usb_submit_urb(ar2->urb[1], GFP_KERNEL);
144 if (r) { 164 if (r) {
145 usb_kill_urb(ar2->urb[0]); 165 usb_kill_urb(ar2->urb[0]);
146 dev_err(&ar2->intf[1]->dev, 166 dev_err(&ar2->intf[1]->dev,
147 "%s: usb_submit_urb() = %d\n", __func__, r); 167 "%s(): usb_submit_urb() = %d\n", __func__, r);
148 return r; 168 return r;
149 } 169 }
150 170
151 return 0; 171 return 0;
152} 172}
153 173
174static void ati_remote2_kill_urbs(struct ati_remote2 *ar2)
175{
176 usb_kill_urb(ar2->urb[1]);
177 usb_kill_urb(ar2->urb[0]);
178}
179
180static int ati_remote2_open(struct input_dev *idev)
181{
182 struct ati_remote2 *ar2 = input_get_drvdata(idev);
183 int r;
184
185 dev_dbg(&ar2->intf[0]->dev, "%s()\n", __func__);
186
187 r = usb_autopm_get_interface(ar2->intf[0]);
188 if (r) {
189 dev_err(&ar2->intf[0]->dev,
190 "%s(): usb_autopm_get_interface() = %d\n", __func__, r);
191 goto fail1;
192 }
193
194 mutex_lock(&ati_remote2_mutex);
195
196 if (!(ar2->flags & ATI_REMOTE2_SUSPENDED)) {
197 r = ati_remote2_submit_urbs(ar2);
198 if (r)
199 goto fail2;
200 }
201
202 ar2->flags |= ATI_REMOTE2_OPENED;
203
204 mutex_unlock(&ati_remote2_mutex);
205
206 usb_autopm_put_interface(ar2->intf[0]);
207
208 return 0;
209
210 fail2:
211 mutex_unlock(&ati_remote2_mutex);
212 usb_autopm_put_interface(ar2->intf[0]);
213 fail1:
214 return r;
215}
216
154static void ati_remote2_close(struct input_dev *idev) 217static void ati_remote2_close(struct input_dev *idev)
155{ 218{
156 struct ati_remote2 *ar2 = input_get_drvdata(idev); 219 struct ati_remote2 *ar2 = input_get_drvdata(idev);
157 220
158 usb_kill_urb(ar2->urb[0]); 221 dev_dbg(&ar2->intf[0]->dev, "%s()\n", __func__);
159 usb_kill_urb(ar2->urb[1]); 222
223 mutex_lock(&ati_remote2_mutex);
224
225 if (!(ar2->flags & ATI_REMOTE2_SUSPENDED))
226 ati_remote2_kill_urbs(ar2);
227
228 ar2->flags &= ~ATI_REMOTE2_OPENED;
229
230 mutex_unlock(&ati_remote2_mutex);
160} 231}
161 232
162static void ati_remote2_input_mouse(struct ati_remote2 *ar2) 233static void ati_remote2_input_mouse(struct ati_remote2 *ar2)
@@ -172,7 +243,7 @@ static void ati_remote2_input_mouse(struct ati_remote2 *ar2)
172 243
173 mode = data[0] & 0x0F; 244 mode = data[0] & 0x0F;
174 245
175 if (mode > 4) { 246 if (mode > ATI_REMOTE2_PC) {
176 dev_err(&ar2->intf[0]->dev, 247 dev_err(&ar2->intf[0]->dev,
177 "Unknown mode byte (%02x %02x %02x %02x)\n", 248 "Unknown mode byte (%02x %02x %02x %02x)\n",
178 data[3], data[2], data[1], data[0]); 249 data[3], data[2], data[1], data[0]);
@@ -191,7 +262,7 @@ static int ati_remote2_lookup(unsigned int hw_code)
191{ 262{
192 int i; 263 int i;
193 264
194 for (i = 0; ati_remote2_key_table[i].key_code != KEY_RESERVED; i++) 265 for (i = 0; i < ARRAY_SIZE(ati_remote2_key_table); i++)
195 if (ati_remote2_key_table[i].hw_code == hw_code) 266 if (ati_remote2_key_table[i].hw_code == hw_code)
196 return i; 267 return i;
197 268
@@ -211,7 +282,7 @@ static void ati_remote2_input_key(struct ati_remote2 *ar2)
211 282
212 mode = data[0] & 0x0F; 283 mode = data[0] & 0x0F;
213 284
214 if (mode > 4) { 285 if (mode > ATI_REMOTE2_PC) {
215 dev_err(&ar2->intf[1]->dev, 286 dev_err(&ar2->intf[1]->dev,
216 "Unknown mode byte (%02x %02x %02x %02x)\n", 287 "Unknown mode byte (%02x %02x %02x %02x)\n",
217 data[3], data[2], data[1], data[0]); 288 data[3], data[2], data[1], data[0]);
@@ -219,10 +290,6 @@ static void ati_remote2_input_key(struct ati_remote2 *ar2)
219 } 290 }
220 291
221 hw_code = data[2]; 292 hw_code = data[2];
222 /*
223 * Mode keys (AUX1-AUX4, PC) all generate the same code byte.
224 * Use the mode byte to figure out which one was pressed.
225 */
226 if (hw_code == 0x3f) { 293 if (hw_code == 0x3f) {
227 /* 294 /*
228 * For some incomprehensible reason the mouse pad generates 295 * For some incomprehensible reason the mouse pad generates
@@ -236,8 +303,6 @@ static void ati_remote2_input_key(struct ati_remote2 *ar2)
236 303
237 if (data[1] == 0) 304 if (data[1] == 0)
238 ar2->mode = mode; 305 ar2->mode = mode;
239
240 hw_code |= mode << 8;
241 } 306 }
242 307
243 if (!((1 << mode) & mode_mask)) 308 if (!((1 << mode) & mode_mask))
@@ -260,8 +325,8 @@ static void ati_remote2_input_key(struct ati_remote2 *ar2)
260 case 2: /* repeat */ 325 case 2: /* repeat */
261 326
262 /* No repeat for mouse buttons. */ 327 /* No repeat for mouse buttons. */
263 if (ati_remote2_key_table[index].key_code == BTN_LEFT || 328 if (ar2->keycode[mode][index] == BTN_LEFT ||
264 ati_remote2_key_table[index].key_code == BTN_RIGHT) 329 ar2->keycode[mode][index] == BTN_RIGHT)
265 return; 330 return;
266 331
267 if (!time_after_eq(jiffies, ar2->jiffies)) 332 if (!time_after_eq(jiffies, ar2->jiffies))
@@ -276,7 +341,7 @@ static void ati_remote2_input_key(struct ati_remote2 *ar2)
276 return; 341 return;
277 } 342 }
278 343
279 input_event(idev, EV_KEY, ati_remote2_key_table[index].key_code, data[1]); 344 input_event(idev, EV_KEY, ar2->keycode[mode][index], data[1]);
280 input_sync(idev); 345 input_sync(idev);
281} 346}
282 347
@@ -287,6 +352,7 @@ static void ati_remote2_complete_mouse(struct urb *urb)
287 352
288 switch (urb->status) { 353 switch (urb->status) {
289 case 0: 354 case 0:
355 usb_mark_last_busy(ar2->udev);
290 ati_remote2_input_mouse(ar2); 356 ati_remote2_input_mouse(ar2);
291 break; 357 break;
292 case -ENOENT: 358 case -ENOENT:
@@ -297,6 +363,7 @@ static void ati_remote2_complete_mouse(struct urb *urb)
297 "%s(): urb status = %d\n", __func__, urb->status); 363 "%s(): urb status = %d\n", __func__, urb->status);
298 return; 364 return;
299 default: 365 default:
366 usb_mark_last_busy(ar2->udev);
300 dev_err(&ar2->intf[0]->dev, 367 dev_err(&ar2->intf[0]->dev,
301 "%s(): urb status = %d\n", __func__, urb->status); 368 "%s(): urb status = %d\n", __func__, urb->status);
302 } 369 }
@@ -314,6 +381,7 @@ static void ati_remote2_complete_key(struct urb *urb)
314 381
315 switch (urb->status) { 382 switch (urb->status) {
316 case 0: 383 case 0:
384 usb_mark_last_busy(ar2->udev);
317 ati_remote2_input_key(ar2); 385 ati_remote2_input_key(ar2);
318 break; 386 break;
319 case -ENOENT: 387 case -ENOENT:
@@ -324,6 +392,7 @@ static void ati_remote2_complete_key(struct urb *urb)
324 "%s(): urb status = %d\n", __func__, urb->status); 392 "%s(): urb status = %d\n", __func__, urb->status);
325 return; 393 return;
326 default: 394 default:
395 usb_mark_last_busy(ar2->udev);
327 dev_err(&ar2->intf[1]->dev, 396 dev_err(&ar2->intf[1]->dev,
328 "%s(): urb status = %d\n", __func__, urb->status); 397 "%s(): urb status = %d\n", __func__, urb->status);
329 } 398 }
@@ -334,10 +403,60 @@ static void ati_remote2_complete_key(struct urb *urb)
334 "%s(): usb_submit_urb() = %d\n", __func__, r); 403 "%s(): usb_submit_urb() = %d\n", __func__, r);
335} 404}
336 405
406static int ati_remote2_getkeycode(struct input_dev *idev,
407 int scancode, int *keycode)
408{
409 struct ati_remote2 *ar2 = input_get_drvdata(idev);
410 int index, mode;
411
412 mode = scancode >> 8;
413 if (mode > ATI_REMOTE2_PC || !((1 << mode) & mode_mask))
414 return -EINVAL;
415
416 index = ati_remote2_lookup(scancode & 0xFF);
417 if (index < 0)
418 return -EINVAL;
419
420 *keycode = ar2->keycode[mode][index];
421 return 0;
422}
423
424static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode)
425{
426 struct ati_remote2 *ar2 = input_get_drvdata(idev);
427 int index, mode, old_keycode;
428
429 mode = scancode >> 8;
430 if (mode > ATI_REMOTE2_PC || !((1 << mode) & mode_mask))
431 return -EINVAL;
432
433 index = ati_remote2_lookup(scancode & 0xFF);
434 if (index < 0)
435 return -EINVAL;
436
437 if (keycode < KEY_RESERVED || keycode > KEY_MAX)
438 return -EINVAL;
439
440 old_keycode = ar2->keycode[mode][index];
441 ar2->keycode[mode][index] = keycode;
442 set_bit(keycode, idev->keybit);
443
444 for (mode = 0; mode < ATI_REMOTE2_MODES; mode++) {
445 for (index = 0; index < ARRAY_SIZE(ati_remote2_key_table); index++) {
446 if (ar2->keycode[mode][index] == old_keycode)
447 return 0;
448 }
449 }
450
451 clear_bit(old_keycode, idev->keybit);
452
453 return 0;
454}
455
337static int ati_remote2_input_init(struct ati_remote2 *ar2) 456static int ati_remote2_input_init(struct ati_remote2 *ar2)
338{ 457{
339 struct input_dev *idev; 458 struct input_dev *idev;
340 int i, retval; 459 int index, mode, retval;
341 460
342 idev = input_allocate_device(); 461 idev = input_allocate_device();
343 if (!idev) 462 if (!idev)
@@ -350,8 +469,26 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
350 idev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | 469 idev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
351 BIT_MASK(BTN_RIGHT); 470 BIT_MASK(BTN_RIGHT);
352 idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 471 idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
353 for (i = 0; ati_remote2_key_table[i].key_code != KEY_RESERVED; i++) 472
354 set_bit(ati_remote2_key_table[i].key_code, idev->keybit); 473 for (mode = 0; mode < ATI_REMOTE2_MODES; mode++) {
474 for (index = 0; index < ARRAY_SIZE(ati_remote2_key_table); index++) {
475 ar2->keycode[mode][index] = ati_remote2_key_table[index].keycode;
476 set_bit(ar2->keycode[mode][index], idev->keybit);
477 }
478 }
479
480 /* AUX1-AUX4 and PC generate the same scancode. */
481 index = ati_remote2_lookup(0x3f);
482 ar2->keycode[ATI_REMOTE2_AUX1][index] = KEY_PROG1;
483 ar2->keycode[ATI_REMOTE2_AUX2][index] = KEY_PROG2;
484 ar2->keycode[ATI_REMOTE2_AUX3][index] = KEY_PROG3;
485 ar2->keycode[ATI_REMOTE2_AUX4][index] = KEY_PROG4;
486 ar2->keycode[ATI_REMOTE2_PC][index] = KEY_PC;
487 set_bit(KEY_PROG1, idev->keybit);
488 set_bit(KEY_PROG2, idev->keybit);
489 set_bit(KEY_PROG3, idev->keybit);
490 set_bit(KEY_PROG4, idev->keybit);
491 set_bit(KEY_PC, idev->keybit);
355 492
356 idev->rep[REP_DELAY] = 250; 493 idev->rep[REP_DELAY] = 250;
357 idev->rep[REP_PERIOD] = 33; 494 idev->rep[REP_PERIOD] = 33;
@@ -359,6 +496,9 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
359 idev->open = ati_remote2_open; 496 idev->open = ati_remote2_open;
360 idev->close = ati_remote2_close; 497 idev->close = ati_remote2_close;
361 498
499 idev->getkeycode = ati_remote2_getkeycode;
500 idev->setkeycode = ati_remote2_setkeycode;
501
362 idev->name = ar2->name; 502 idev->name = ar2->name;
363 idev->phys = ar2->phys; 503 idev->phys = ar2->phys;
364 504
@@ -490,6 +630,8 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
490 630
491 usb_set_intfdata(interface, ar2); 631 usb_set_intfdata(interface, ar2);
492 632
633 interface->needs_remote_wakeup = 1;
634
493 return 0; 635 return 0;
494 636
495 fail2: 637 fail2:
@@ -522,6 +664,57 @@ static void ati_remote2_disconnect(struct usb_interface *interface)
522 kfree(ar2); 664 kfree(ar2);
523} 665}
524 666
667static int ati_remote2_suspend(struct usb_interface *interface,
668 pm_message_t message)
669{
670 struct ati_remote2 *ar2;
671 struct usb_host_interface *alt = interface->cur_altsetting;
672
673 if (alt->desc.bInterfaceNumber)
674 return 0;
675
676 ar2 = usb_get_intfdata(interface);
677
678 dev_dbg(&ar2->intf[0]->dev, "%s()\n", __func__);
679
680 mutex_lock(&ati_remote2_mutex);
681
682 if (ar2->flags & ATI_REMOTE2_OPENED)
683 ati_remote2_kill_urbs(ar2);
684
685 ar2->flags |= ATI_REMOTE2_SUSPENDED;
686
687 mutex_unlock(&ati_remote2_mutex);
688
689 return 0;
690}
691
692static int ati_remote2_resume(struct usb_interface *interface)
693{
694 struct ati_remote2 *ar2;
695 struct usb_host_interface *alt = interface->cur_altsetting;
696 int r = 0;
697
698 if (alt->desc.bInterfaceNumber)
699 return 0;
700
701 ar2 = usb_get_intfdata(interface);
702
703 dev_dbg(&ar2->intf[0]->dev, "%s()\n", __func__);
704
705 mutex_lock(&ati_remote2_mutex);
706
707 if (ar2->flags & ATI_REMOTE2_OPENED)
708 r = ati_remote2_submit_urbs(ar2);
709
710 if (!r)
711 ar2->flags &= ~ATI_REMOTE2_SUSPENDED;
712
713 mutex_unlock(&ati_remote2_mutex);
714
715 return r;
716}
717
525static int __init ati_remote2_init(void) 718static int __init ati_remote2_init(void)
526{ 719{
527 int r; 720 int r;
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
new file mode 100644
index 000000000000..bce160f4349b
--- /dev/null
+++ b/drivers/input/misc/cm109.c
@@ -0,0 +1,882 @@
1/*
2 * Driver for the VoIP USB phones with CM109 chipsets.
3 *
4 * Copyright (C) 2007 - 2008 Alfred E. Heggestad <aeh@db.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
9 */
10
11/*
12 * Tested devices:
13 * - Komunikate KIP1000
14 * - Genius G-talk
15 * - Allied-Telesis Corega USBPH01
16 * - ...
17 *
18 * This driver is based on the yealink.c driver
19 *
20 * Thanks to:
21 * - Authors of yealink.c
22 * - Thomas Reitmayr
23 * - Oliver Neukum for good review comments and code
24 * - Shaun Jackman <sjackman@gmail.com> for Genius G-talk keymap
25 * - Dmitry Torokhov for valuable input and review
26 *
27 * Todo:
28 * - Read/write EEPROM
29 */
30
31#include <linux/kernel.h>
32#include <linux/init.h>
33#include <linux/slab.h>
34#include <linux/module.h>
35#include <linux/moduleparam.h>
36#include <linux/rwsem.h>
37#include <linux/usb/input.h>
38
39#define DRIVER_VERSION "20080805"
40#define DRIVER_AUTHOR "Alfred E. Heggestad"
41#define DRIVER_DESC "CM109 phone driver"
42
43static char *phone = "kip1000";
44module_param(phone, charp, S_IRUSR);
45MODULE_PARM_DESC(phone, "Phone name {kip1000, gtalk, usbph01}");
46
47enum {
48 /* HID Registers */
49 HID_IR0 = 0x00, /* Record/Playback-mute button, Volume up/down */
50 HID_IR1 = 0x01, /* GPI, generic registers or EEPROM_DATA0 */
51 HID_IR2 = 0x02, /* Generic registers or EEPROM_DATA1 */
52 HID_IR3 = 0x03, /* Generic registers or EEPROM_CTRL */
53 HID_OR0 = 0x00, /* Mapping control, buzzer, SPDIF (offset 0x04) */
54 HID_OR1 = 0x01, /* GPO - General Purpose Output */
55 HID_OR2 = 0x02, /* Set GPIO to input/output mode */
56 HID_OR3 = 0x03, /* SPDIF status channel or EEPROM_CTRL */
57
58 /* HID_IR0 */
59 RECORD_MUTE = 1 << 3,
60 PLAYBACK_MUTE = 1 << 2,
61 VOLUME_DOWN = 1 << 1,
62 VOLUME_UP = 1 << 0,
63
64 /* HID_OR0 */
65 /* bits 7-6
66 0: HID_OR1-2 are used for GPO; HID_OR0, 3 are used for buzzer
67 and SPDIF
68 1: HID_OR0-3 are used as generic HID registers
69 2: Values written to HID_OR0-3 are also mapped to MCU_CTRL,
70 EEPROM_DATA0-1, EEPROM_CTRL (see Note)
71 3: Reserved
72 */
73 HID_OR_GPO_BUZ_SPDIF = 0 << 6,
74 HID_OR_GENERIC_HID_REG = 1 << 6,
75 HID_OR_MAP_MCU_EEPROM = 2 << 6,
76
77 BUZZER_ON = 1 << 5,
78
79 /* up to 256 normal keys, up to 16 special keys */
80 KEYMAP_SIZE = 256 + 16,
81};
82
83/* CM109 protocol packet */
84struct cm109_ctl_packet {
85 u8 byte[4];
86} __attribute__ ((packed));
87
88enum { USB_PKT_LEN = sizeof(struct cm109_ctl_packet) };
89
90/* CM109 device structure */
91struct cm109_dev {
92 struct input_dev *idev; /* input device */
93 struct usb_device *udev; /* usb device */
94 struct usb_interface *intf;
95
96 /* irq input channel */
97 struct cm109_ctl_packet *irq_data;
98 dma_addr_t irq_dma;
99 struct urb *urb_irq;
100
101 /* control output channel */
102 struct cm109_ctl_packet *ctl_data;
103 dma_addr_t ctl_dma;
104 struct usb_ctrlrequest *ctl_req;
105 dma_addr_t ctl_req_dma;
106 struct urb *urb_ctl;
107 /*
108 * The 3 bitfields below are protected by ctl_submit_lock.
109 * They have to be separate since they are accessed from IRQ
110 * context.
111 */
112 unsigned irq_urb_pending:1; /* irq_urb is in flight */
113 unsigned ctl_urb_pending:1; /* ctl_urb is in flight */
114 unsigned buzzer_pending:1; /* need to issue buzz command */
115 spinlock_t ctl_submit_lock;
116
117 unsigned char buzzer_state; /* on/off */
118
119 /* flags */
120 unsigned open:1;
121 unsigned resetting:1;
122 unsigned shutdown:1;
123
124 /* This mutex protects writes to the above flags */
125 struct mutex pm_mutex;
126
127 unsigned short keymap[KEYMAP_SIZE];
128
129 char phys[64]; /* physical device path */
130 int key_code; /* last reported key */
131 int keybit; /* 0=new scan 1,2,4,8=scan columns */
132 u8 gpi; /* Cached value of GPI (high nibble) */
133};
134
135/******************************************************************************
136 * CM109 key interface
137 *****************************************************************************/
138
139static unsigned short special_keymap(int code)
140{
141 if (code > 0xff) {
142 switch (code - 0xff) {
143 case RECORD_MUTE: return KEY_MUTE;
144 case PLAYBACK_MUTE: return KEY_MUTE;
145 case VOLUME_DOWN: return KEY_VOLUMEDOWN;
146 case VOLUME_UP: return KEY_VOLUMEUP;
147 }
148 }
149 return KEY_RESERVED;
150}
151
152/* Map device buttons to internal key events.
153 *
154 * The "up" and "down" keys, are symbolised by arrows on the button.
155 * The "pickup" and "hangup" keys are symbolised by a green and red phone
156 * on the button.
157
158 Komunikate KIP1000 Keyboard Matrix
159
160 -> -- 1 -- 2 -- 3 --> GPI pin 4 (0x10)
161 | | | |
162 <- -- 4 -- 5 -- 6 --> GPI pin 5 (0x20)
163 | | | |
164 END - 7 -- 8 -- 9 --> GPI pin 6 (0x40)
165 | | | |
166 OK -- * -- 0 -- # --> GPI pin 7 (0x80)
167 | | | |
168
169 /|\ /|\ /|\ /|\
170 | | | |
171GPO
172pin: 3 2 1 0
173 0x8 0x4 0x2 0x1
174
175 */
176static unsigned short keymap_kip1000(int scancode)
177{
178 switch (scancode) { /* phone key: */
179 case 0x82: return KEY_NUMERIC_0; /* 0 */
180 case 0x14: return KEY_NUMERIC_1; /* 1 */
181 case 0x12: return KEY_NUMERIC_2; /* 2 */
182 case 0x11: return KEY_NUMERIC_3; /* 3 */
183 case 0x24: return KEY_NUMERIC_4; /* 4 */
184 case 0x22: return KEY_NUMERIC_5; /* 5 */
185 case 0x21: return KEY_NUMERIC_6; /* 6 */
186 case 0x44: return KEY_NUMERIC_7; /* 7 */
187 case 0x42: return KEY_NUMERIC_8; /* 8 */
188 case 0x41: return KEY_NUMERIC_9; /* 9 */
189 case 0x81: return KEY_NUMERIC_POUND; /* # */
190 case 0x84: return KEY_NUMERIC_STAR; /* * */
191 case 0x88: return KEY_ENTER; /* pickup */
192 case 0x48: return KEY_ESC; /* hangup */
193 case 0x28: return KEY_LEFT; /* IN */
194 case 0x18: return KEY_RIGHT; /* OUT */
195 default: return special_keymap(scancode);
196 }
197}
198
199/*
200 Contributed by Shaun Jackman <sjackman@gmail.com>
201
202 Genius G-Talk keyboard matrix
203 0 1 2 3
204 4: 0 4 8 Talk
205 5: 1 5 9 End
206 6: 2 6 # Up
207 7: 3 7 * Down
208*/
209static unsigned short keymap_gtalk(int scancode)
210{
211 switch (scancode) {
212 case 0x11: return KEY_NUMERIC_0;
213 case 0x21: return KEY_NUMERIC_1;
214 case 0x41: return KEY_NUMERIC_2;
215 case 0x81: return KEY_NUMERIC_3;
216 case 0x12: return KEY_NUMERIC_4;
217 case 0x22: return KEY_NUMERIC_5;
218 case 0x42: return KEY_NUMERIC_6;
219 case 0x82: return KEY_NUMERIC_7;
220 case 0x14: return KEY_NUMERIC_8;
221 case 0x24: return KEY_NUMERIC_9;
222 case 0x44: return KEY_NUMERIC_POUND; /* # */
223 case 0x84: return KEY_NUMERIC_STAR; /* * */
224 case 0x18: return KEY_ENTER; /* Talk (green handset) */
225 case 0x28: return KEY_ESC; /* End (red handset) */
226 case 0x48: return KEY_UP; /* Menu up (rocker switch) */
227 case 0x88: return KEY_DOWN; /* Menu down (rocker switch) */
228 default: return special_keymap(scancode);
229 }
230}
231
232/*
233 * Keymap for Allied-Telesis Corega USBPH01
234 * http://www.alliedtelesis-corega.com/2/1344/1437/1360/chprd.html
235 *
236 * Contributed by july@nat.bg
237 */
238static unsigned short keymap_usbph01(int scancode)
239{
240 switch (scancode) {
241 case 0x11: return KEY_NUMERIC_0; /* 0 */
242 case 0x21: return KEY_NUMERIC_1; /* 1 */
243 case 0x41: return KEY_NUMERIC_2; /* 2 */
244 case 0x81: return KEY_NUMERIC_3; /* 3 */
245 case 0x12: return KEY_NUMERIC_4; /* 4 */
246 case 0x22: return KEY_NUMERIC_5; /* 5 */
247 case 0x42: return KEY_NUMERIC_6; /* 6 */
248 case 0x82: return KEY_NUMERIC_7; /* 7 */
249 case 0x14: return KEY_NUMERIC_8; /* 8 */
250 case 0x24: return KEY_NUMERIC_9; /* 9 */
251 case 0x44: return KEY_NUMERIC_POUND; /* # */
252 case 0x84: return KEY_NUMERIC_STAR; /* * */
253 case 0x18: return KEY_ENTER; /* pickup */
254 case 0x28: return KEY_ESC; /* hangup */
255 case 0x48: return KEY_LEFT; /* IN */
256 case 0x88: return KEY_RIGHT; /* OUT */
257 default: return special_keymap(scancode);
258 }
259}
260
261static unsigned short (*keymap)(int) = keymap_kip1000;
262
263/*
264 * Completes a request by converting the data into events for the
265 * input subsystem.
266 */
267static void report_key(struct cm109_dev *dev, int key)
268{
269 struct input_dev *idev = dev->idev;
270
271 if (dev->key_code >= 0) {
272 /* old key up */
273 input_report_key(idev, dev->key_code, 0);
274 }
275
276 dev->key_code = key;
277 if (key >= 0) {
278 /* new valid key */
279 input_report_key(idev, key, 1);
280 }
281
282 input_sync(idev);
283}
284
285/******************************************************************************
286 * CM109 usb communication interface
287 *****************************************************************************/
288
289static void cm109_submit_buzz_toggle(struct cm109_dev *dev)
290{
291 int error;
292
293 if (dev->buzzer_state)
294 dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
295 else
296 dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
297
298 error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
299 if (error)
300 err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error);
301}
302
303/*
304 * IRQ handler
305 */
306static void cm109_urb_irq_callback(struct urb *urb)
307{
308 struct cm109_dev *dev = urb->context;
309 const int status = urb->status;
310 int error;
311
312 dev_dbg(&urb->dev->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n",
313 dev->irq_data->byte[0],
314 dev->irq_data->byte[1],
315 dev->irq_data->byte[2],
316 dev->irq_data->byte[3],
317 dev->keybit);
318
319 if (status) {
320 if (status == -ESHUTDOWN)
321 return;
322 err("%s: urb status %d", __func__, status);
323 }
324
325 /* Special keys */
326 if (dev->irq_data->byte[HID_IR0] & 0x0f) {
327 const int code = (dev->irq_data->byte[HID_IR0] & 0x0f);
328 report_key(dev, dev->keymap[0xff + code]);
329 }
330
331 /* Scan key column */
332 if (dev->keybit == 0xf) {
333
334 /* Any changes ? */
335 if ((dev->gpi & 0xf0) == (dev->irq_data->byte[HID_IR1] & 0xf0))
336 goto out;
337
338 dev->gpi = dev->irq_data->byte[HID_IR1] & 0xf0;
339 dev->keybit = 0x1;
340 } else {
341 report_key(dev, dev->keymap[dev->irq_data->byte[HID_IR1]]);
342
343 dev->keybit <<= 1;
344 if (dev->keybit > 0x8)
345 dev->keybit = 0xf;
346 }
347
348 out:
349
350 spin_lock(&dev->ctl_submit_lock);
351
352 dev->irq_urb_pending = 0;
353
354 if (likely(!dev->shutdown)) {
355
356 if (dev->buzzer_state)
357 dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
358 else
359 dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
360
361 dev->ctl_data->byte[HID_OR1] = dev->keybit;
362 dev->ctl_data->byte[HID_OR2] = dev->keybit;
363
364 dev->buzzer_pending = 0;
365 dev->ctl_urb_pending = 1;
366
367 error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
368 if (error)
369 err("%s: usb_submit_urb (urb_ctl) failed %d",
370 __func__, error);
371 }
372
373 spin_unlock(&dev->ctl_submit_lock);
374}
375
376static void cm109_urb_ctl_callback(struct urb *urb)
377{
378 struct cm109_dev *dev = urb->context;
379 const int status = urb->status;
380 int error;
381
382 dev_dbg(&urb->dev->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
383 dev->ctl_data->byte[0],
384 dev->ctl_data->byte[1],
385 dev->ctl_data->byte[2],
386 dev->ctl_data->byte[3]);
387
388 if (status)
389 err("%s: urb status %d", __func__, status);
390
391 spin_lock(&dev->ctl_submit_lock);
392
393 dev->ctl_urb_pending = 0;
394
395 if (likely(!dev->shutdown)) {
396
397 if (dev->buzzer_pending) {
398 dev->buzzer_pending = 0;
399 dev->ctl_urb_pending = 1;
400 cm109_submit_buzz_toggle(dev);
401 } else if (likely(!dev->irq_urb_pending)) {
402 /* ask for key data */
403 dev->irq_urb_pending = 1;
404 error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC);
405 if (error)
406 err("%s: usb_submit_urb (urb_irq) failed %d",
407 __func__, error);
408 }
409 }
410
411 spin_unlock(&dev->ctl_submit_lock);
412}
413
414static void cm109_toggle_buzzer_async(struct cm109_dev *dev)
415{
416 unsigned long flags;
417
418 spin_lock_irqsave(&dev->ctl_submit_lock, flags);
419
420 if (dev->ctl_urb_pending) {
421 /* URB completion will resubmit */
422 dev->buzzer_pending = 1;
423 } else {
424 dev->ctl_urb_pending = 1;
425 cm109_submit_buzz_toggle(dev);
426 }
427
428 spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
429}
430
431static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on)
432{
433 int error;
434
435 if (on)
436 dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
437 else
438 dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
439
440 error = usb_control_msg(dev->udev,
441 usb_sndctrlpipe(dev->udev, 0),
442 dev->ctl_req->bRequest,
443 dev->ctl_req->bRequestType,
444 le16_to_cpu(dev->ctl_req->wValue),
445 le16_to_cpu(dev->ctl_req->wIndex),
446 dev->ctl_data,
447 USB_PKT_LEN, USB_CTRL_SET_TIMEOUT);
448 if (error && error != EINTR)
449 err("%s: usb_control_msg() failed %d", __func__, error);
450}
451
452static void cm109_stop_traffic(struct cm109_dev *dev)
453{
454 dev->shutdown = 1;
455 /*
456 * Make sure other CPUs see this
457 */
458 smp_wmb();
459
460 usb_kill_urb(dev->urb_ctl);
461 usb_kill_urb(dev->urb_irq);
462
463 cm109_toggle_buzzer_sync(dev, 0);
464
465 dev->shutdown = 0;
466 smp_wmb();
467}
468
469static void cm109_restore_state(struct cm109_dev *dev)
470{
471 if (dev->open) {
472 /*
473 * Restore buzzer state.
474 * This will also kick regular URB submission
475 */
476 cm109_toggle_buzzer_async(dev);
477 }
478}
479
480/******************************************************************************
481 * input event interface
482 *****************************************************************************/
483
484static int cm109_input_open(struct input_dev *idev)
485{
486 struct cm109_dev *dev = input_get_drvdata(idev);
487 int error;
488
489 error = usb_autopm_get_interface(dev->intf);
490 if (error < 0) {
491 err("%s - cannot autoresume, result %d",
492 __func__, error);
493 return error;
494 }
495
496 mutex_lock(&dev->pm_mutex);
497
498 dev->buzzer_state = 0;
499 dev->key_code = -1; /* no keys pressed */
500 dev->keybit = 0xf;
501
502 /* issue INIT */
503 dev->ctl_data->byte[HID_OR0] = HID_OR_GPO_BUZ_SPDIF;
504 dev->ctl_data->byte[HID_OR1] = dev->keybit;
505 dev->ctl_data->byte[HID_OR2] = dev->keybit;
506 dev->ctl_data->byte[HID_OR3] = 0x00;
507
508 error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
509 if (error)
510 err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error);
511 else
512 dev->open = 1;
513
514 mutex_unlock(&dev->pm_mutex);
515
516 if (error)
517 usb_autopm_put_interface(dev->intf);
518
519 return error;
520}
521
522static void cm109_input_close(struct input_dev *idev)
523{
524 struct cm109_dev *dev = input_get_drvdata(idev);
525
526 mutex_lock(&dev->pm_mutex);
527
528 /*
529 * Once we are here event delivery is stopped so we
530 * don't need to worry about someone starting buzzer
531 * again
532 */
533 cm109_stop_traffic(dev);
534 dev->open = 0;
535
536 mutex_unlock(&dev->pm_mutex);
537
538 usb_autopm_put_interface(dev->intf);
539}
540
541static int cm109_input_ev(struct input_dev *idev, unsigned int type,
542 unsigned int code, int value)
543{
544 struct cm109_dev *dev = input_get_drvdata(idev);
545
546 dev_dbg(&dev->udev->dev,
547 "input_ev: type=%u code=%u value=%d\n", type, code, value);
548
549 if (type != EV_SND)
550 return -EINVAL;
551
552 switch (code) {
553 case SND_TONE:
554 case SND_BELL:
555 dev->buzzer_state = !!value;
556 if (!dev->resetting)
557 cm109_toggle_buzzer_async(dev);
558 return 0;
559
560 default:
561 return -EINVAL;
562 }
563}
564
565
566/******************************************************************************
567 * Linux interface and usb initialisation
568 *****************************************************************************/
569
570struct driver_info {
571 char *name;
572};
573
574static const struct driver_info info_cm109 = {
575 .name = "CM109 USB driver",
576};
577
578enum {
579 VENDOR_ID = 0x0d8c, /* C-Media Electronics */
580 PRODUCT_ID_CM109 = 0x000e, /* CM109 defines range 0x0008 - 0x000f */
581};
582
583/* table of devices that work with this driver */
584static const struct usb_device_id cm109_usb_table[] = {
585 {
586 .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
587 USB_DEVICE_ID_MATCH_INT_INFO,
588 .idVendor = VENDOR_ID,
589 .idProduct = PRODUCT_ID_CM109,
590 .bInterfaceClass = USB_CLASS_HID,
591 .bInterfaceSubClass = 0,
592 .bInterfaceProtocol = 0,
593 .driver_info = (kernel_ulong_t) &info_cm109
594 },
595 /* you can add more devices here with product ID 0x0008 - 0x000f */
596 { }
597};
598
599static void cm109_usb_cleanup(struct cm109_dev *dev)
600{
601 if (dev->ctl_req)
602 usb_buffer_free(dev->udev, sizeof(*(dev->ctl_req)),
603 dev->ctl_req, dev->ctl_req_dma);
604 if (dev->ctl_data)
605 usb_buffer_free(dev->udev, USB_PKT_LEN,
606 dev->ctl_data, dev->ctl_dma);
607 if (dev->irq_data)
608 usb_buffer_free(dev->udev, USB_PKT_LEN,
609 dev->irq_data, dev->irq_dma);
610
611 usb_free_urb(dev->urb_irq); /* parameter validation in core/urb */
612 usb_free_urb(dev->urb_ctl); /* parameter validation in core/urb */
613 kfree(dev);
614}
615
616static void cm109_usb_disconnect(struct usb_interface *interface)
617{
618 struct cm109_dev *dev = usb_get_intfdata(interface);
619
620 usb_set_intfdata(interface, NULL);
621 input_unregister_device(dev->idev);
622 cm109_usb_cleanup(dev);
623}
624
625static int cm109_usb_probe(struct usb_interface *intf,
626 const struct usb_device_id *id)
627{
628 struct usb_device *udev = interface_to_usbdev(intf);
629 struct driver_info *nfo = (struct driver_info *)id->driver_info;
630 struct usb_host_interface *interface;
631 struct usb_endpoint_descriptor *endpoint;
632 struct cm109_dev *dev;
633 struct input_dev *input_dev = NULL;
634 int ret, pipe, i;
635 int error = -ENOMEM;
636
637 interface = intf->cur_altsetting;
638 endpoint = &interface->endpoint[0].desc;
639
640 if (!usb_endpoint_is_int_in(endpoint))
641 return -ENODEV;
642
643 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
644 if (!dev)
645 return -ENOMEM;
646
647 spin_lock_init(&dev->ctl_submit_lock);
648 mutex_init(&dev->pm_mutex);
649
650 dev->udev = udev;
651 dev->intf = intf;
652
653 dev->idev = input_dev = input_allocate_device();
654 if (!input_dev)
655 goto err_out;
656
657 /* allocate usb buffers */
658 dev->irq_data = usb_buffer_alloc(udev, USB_PKT_LEN,
659 GFP_KERNEL, &dev->irq_dma);
660 if (!dev->irq_data)
661 goto err_out;
662
663 dev->ctl_data = usb_buffer_alloc(udev, USB_PKT_LEN,
664 GFP_KERNEL, &dev->ctl_dma);
665 if (!dev->ctl_data)
666 goto err_out;
667
668 dev->ctl_req = usb_buffer_alloc(udev, sizeof(*(dev->ctl_req)),
669 GFP_KERNEL, &dev->ctl_req_dma);
670 if (!dev->ctl_req)
671 goto err_out;
672
673 /* allocate urb structures */
674 dev->urb_irq = usb_alloc_urb(0, GFP_KERNEL);
675 if (!dev->urb_irq)
676 goto err_out;
677
678 dev->urb_ctl = usb_alloc_urb(0, GFP_KERNEL);
679 if (!dev->urb_ctl)
680 goto err_out;
681
682 /* get a handle to the interrupt data pipe */
683 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
684 ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
685 if (ret != USB_PKT_LEN)
686 err("invalid payload size %d, expected %d", ret, USB_PKT_LEN);
687
688 /* initialise irq urb */
689 usb_fill_int_urb(dev->urb_irq, udev, pipe, dev->irq_data,
690 USB_PKT_LEN,
691 cm109_urb_irq_callback, dev, endpoint->bInterval);
692 dev->urb_irq->transfer_dma = dev->irq_dma;
693 dev->urb_irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
694 dev->urb_irq->dev = udev;
695
696 /* initialise ctl urb */
697 dev->ctl_req->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE |
698 USB_DIR_OUT;
699 dev->ctl_req->bRequest = USB_REQ_SET_CONFIGURATION;
700 dev->ctl_req->wValue = cpu_to_le16(0x200);
701 dev->ctl_req->wIndex = cpu_to_le16(interface->desc.bInterfaceNumber);
702 dev->ctl_req->wLength = cpu_to_le16(USB_PKT_LEN);
703
704 usb_fill_control_urb(dev->urb_ctl, udev, usb_sndctrlpipe(udev, 0),
705 (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN,
706 cm109_urb_ctl_callback, dev);
707 dev->urb_ctl->setup_dma = dev->ctl_req_dma;
708 dev->urb_ctl->transfer_dma = dev->ctl_dma;
709 dev->urb_ctl->transfer_flags |= URB_NO_SETUP_DMA_MAP |
710 URB_NO_TRANSFER_DMA_MAP;
711 dev->urb_ctl->dev = udev;
712
713 /* find out the physical bus location */
714 usb_make_path(udev, dev->phys, sizeof(dev->phys));
715 strlcat(dev->phys, "/input0", sizeof(dev->phys));
716
717 /* register settings for the input device */
718 input_dev->name = nfo->name;
719 input_dev->phys = dev->phys;
720 usb_to_input_id(udev, &input_dev->id);
721 input_dev->dev.parent = &intf->dev;
722
723 input_set_drvdata(input_dev, dev);
724 input_dev->open = cm109_input_open;
725 input_dev->close = cm109_input_close;
726 input_dev->event = cm109_input_ev;
727
728 input_dev->keycode = dev->keymap;
729 input_dev->keycodesize = sizeof(unsigned char);
730 input_dev->keycodemax = ARRAY_SIZE(dev->keymap);
731
732 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_SND);
733 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
734
735 /* register available key events */
736 for (i = 0; i < KEYMAP_SIZE; i++) {
737 unsigned short k = keymap(i);
738 dev->keymap[i] = k;
739 __set_bit(k, input_dev->keybit);
740 }
741 __clear_bit(KEY_RESERVED, input_dev->keybit);
742
743 error = input_register_device(dev->idev);
744 if (error)
745 goto err_out;
746
747 usb_set_intfdata(intf, dev);
748
749 return 0;
750
751 err_out:
752 input_free_device(input_dev);
753 cm109_usb_cleanup(dev);
754 return error;
755}
756
757static int cm109_usb_suspend(struct usb_interface *intf, pm_message_t message)
758{
759 struct cm109_dev *dev = usb_get_intfdata(intf);
760
761 dev_info(&intf->dev, "cm109: usb_suspend (event=%d)\n", message.event);
762
763 mutex_lock(&dev->pm_mutex);
764 cm109_stop_traffic(dev);
765 mutex_unlock(&dev->pm_mutex);
766
767 return 0;
768}
769
770static int cm109_usb_resume(struct usb_interface *intf)
771{
772 struct cm109_dev *dev = usb_get_intfdata(intf);
773
774 dev_info(&intf->dev, "cm109: usb_resume\n");
775
776 mutex_lock(&dev->pm_mutex);
777 cm109_restore_state(dev);
778 mutex_unlock(&dev->pm_mutex);
779
780 return 0;
781}
782
783static int cm109_usb_pre_reset(struct usb_interface *intf)
784{
785 struct cm109_dev *dev = usb_get_intfdata(intf);
786
787 mutex_lock(&dev->pm_mutex);
788
789 /*
790 * Make sure input events don't try to toggle buzzer
791 * while we are resetting
792 */
793 dev->resetting = 1;
794 smp_wmb();
795
796 cm109_stop_traffic(dev);
797
798 return 0;
799}
800
801static int cm109_usb_post_reset(struct usb_interface *intf)
802{
803 struct cm109_dev *dev = usb_get_intfdata(intf);
804
805 dev->resetting = 0;
806 smp_wmb();
807
808 cm109_restore_state(dev);
809
810 mutex_unlock(&dev->pm_mutex);
811
812 return 0;
813}
814
815static struct usb_driver cm109_driver = {
816 .name = "cm109",
817 .probe = cm109_usb_probe,
818 .disconnect = cm109_usb_disconnect,
819 .suspend = cm109_usb_suspend,
820 .resume = cm109_usb_resume,
821 .reset_resume = cm109_usb_resume,
822 .pre_reset = cm109_usb_pre_reset,
823 .post_reset = cm109_usb_post_reset,
824 .id_table = cm109_usb_table,
825 .supports_autosuspend = 1,
826};
827
828static int __init cm109_select_keymap(void)
829{
830 /* Load the phone keymap */
831 if (!strcasecmp(phone, "kip1000")) {
832 keymap = keymap_kip1000;
833 printk(KERN_INFO KBUILD_MODNAME ": "
834 "Keymap for Komunikate KIP1000 phone loaded\n");
835 } else if (!strcasecmp(phone, "gtalk")) {
836 keymap = keymap_gtalk;
837 printk(KERN_INFO KBUILD_MODNAME ": "
838 "Keymap for Genius G-talk phone loaded\n");
839 } else if (!strcasecmp(phone, "usbph01")) {
840 keymap = keymap_usbph01;
841 printk(KERN_INFO KBUILD_MODNAME ": "
842 "Keymap for Allied-Telesis Corega USBPH01 phone loaded\n");
843 } else {
844 printk(KERN_ERR KBUILD_MODNAME ": "
845 "Unsupported phone: %s\n", phone);
846 return -EINVAL;
847 }
848
849 return 0;
850}
851
852static int __init cm109_init(void)
853{
854 int err;
855
856 err = cm109_select_keymap();
857 if (err)
858 return err;
859
860 err = usb_register(&cm109_driver);
861 if (err)
862 return err;
863
864 printk(KERN_INFO KBUILD_MODNAME ": "
865 DRIVER_DESC ": " DRIVER_VERSION " (C) " DRIVER_AUTHOR "\n");
866
867 return 0;
868}
869
870static void __exit cm109_exit(void)
871{
872 usb_deregister(&cm109_driver);
873}
874
875module_init(cm109_init);
876module_exit(cm109_exit);
877
878MODULE_DEVICE_TABLE(usb, cm109_usb_table);
879
880MODULE_AUTHOR(DRIVER_AUTHOR);
881MODULE_DESCRIPTION(DRIVER_DESC);
882MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/map_to_7segment.h b/drivers/input/misc/map_to_7segment.h
deleted file mode 100644
index a424094d9fe2..000000000000
--- a/drivers/input/misc/map_to_7segment.h
+++ /dev/null
@@ -1,189 +0,0 @@
1/*
2 * drivers/usb/input/map_to_7segment.h
3 *
4 * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef MAP_TO_7SEGMENT_H
22#define MAP_TO_7SEGMENT_H
23
24/* This file provides translation primitives and tables for the conversion
25 * of (ASCII) characters to a 7-segments notation.
26 *
27 * The 7 segment's wikipedia notation below is used as standard.
28 * See: http://en.wikipedia.org/wiki/Seven_segment_display
29 *
30 * Notation: +-a-+
31 * f b
32 * +-g-+
33 * e c
34 * +-d-+
35 *
36 * Usage:
37 *
38 * Register a map variable, and fill it with a character set:
39 * static SEG7_DEFAULT_MAP(map_seg7);
40 *
41 *
42 * Then use for conversion:
43 * seg7 = map_to_seg7(&map_seg7, some_char);
44 * ...
45 *
46 * In device drivers it is recommended, if required, to make the char map
47 * accessible via the sysfs interface using the following scheme:
48 *
49 * static ssize_t show_map(struct device *dev, char *buf) {
50 * memcpy(buf, &map_seg7, sizeof(map_seg7));
51 * return sizeof(map_seg7);
52 * }
53 * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) {
54 * if(cnt != sizeof(map_seg7))
55 * return -EINVAL;
56 * memcpy(&map_seg7, buf, cnt);
57 * return cnt;
58 * }
59 * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map);
60 *
61 * History:
62 * 2005-05-31 RFC linux-kernel@vger.kernel.org
63 */
64#include <linux/errno.h>
65
66
67#define BIT_SEG7_A 0
68#define BIT_SEG7_B 1
69#define BIT_SEG7_C 2
70#define BIT_SEG7_D 3
71#define BIT_SEG7_E 4
72#define BIT_SEG7_F 5
73#define BIT_SEG7_G 6
74#define BIT_SEG7_RESERVED 7
75
76struct seg7_conversion_map {
77 unsigned char table[128];
78};
79
80static inline int map_to_seg7(struct seg7_conversion_map *map, int c)
81{
82 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
83}
84
85#define SEG7_CONVERSION_MAP(_name, _map) \
86 struct seg7_conversion_map _name = { .table = { _map } }
87
88/*
89 * It is recommended to use a facility that allows user space to redefine
90 * custom character sets for LCD devices. Please use a sysfs interface
91 * as described above.
92 */
93#define MAP_TO_SEG7_SYSFS_FILE "map_seg7"
94
95/*******************************************************************************
96 * ASCII conversion table
97 ******************************************************************************/
98
99#define _SEG7(l,a,b,c,d,e,f,g) \
100 ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \
101 e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G )
102
103#define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
104 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
105
106#define _MAP_33_47_ASCII_SEG7_SYMBOL \
107 _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\
108 _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\
109 _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\
110 _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\
111 _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1),
112
113#define _MAP_48_57_ASCII_SEG7_NUMERIC \
114 _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\
115 _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\
116 _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\
117 _SEG7('9',1,1,1,1,0,1,1),
118
119#define _MAP_58_64_ASCII_SEG7_SYMBOL \
120 _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\
121 _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\
122 _SEG7('@',1,1,0,1,1,1,1),
123
124#define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
125 _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\
126 _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
127 _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\
128 _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
129 _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\
130 _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\
131 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\
132 _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
133 _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
134
135#define _MAP_91_96_ASCII_SEG7_SYMBOL \
136 _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\
137 _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0),
138
139#define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
140 _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\
141 _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
142 _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\
143 _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
144 _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\
145 _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\
146 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\
147 _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
148 _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
149
150#define _MAP_123_126_ASCII_SEG7_SYMBOL \
151 _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\
152 _SEG7('~',1,0,0,0,0,0,0),
153
154/* Maps */
155
156/* This set tries to map as close as possible to the visible characteristics
157 * of the ASCII symbol, lowercase and uppercase letters may differ in
158 * presentation on the display.
159 */
160#define MAP_ASCII7SEG_ALPHANUM \
161 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
162 _MAP_33_47_ASCII_SEG7_SYMBOL \
163 _MAP_48_57_ASCII_SEG7_NUMERIC \
164 _MAP_58_64_ASCII_SEG7_SYMBOL \
165 _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
166 _MAP_91_96_ASCII_SEG7_SYMBOL \
167 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
168 _MAP_123_126_ASCII_SEG7_SYMBOL
169
170/* This set tries to map as close as possible to the symbolic characteristics
171 * of the ASCII character for maximum discrimination.
172 * For now this means all alpha chars are in lower case representations.
173 * (This for example facilitates the use of hex numbers with uppercase input.)
174 */
175#define MAP_ASCII7SEG_ALPHANUM_LC \
176 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
177 _MAP_33_47_ASCII_SEG7_SYMBOL \
178 _MAP_48_57_ASCII_SEG7_NUMERIC \
179 _MAP_58_64_ASCII_SEG7_SYMBOL \
180 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
181 _MAP_91_96_ASCII_SEG7_SYMBOL \
182 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
183 _MAP_123_126_ASCII_SEG7_SYMBOL
184
185#define SEG7_DEFAULT_MAP(_name) \
186 SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM)
187
188#endif /* MAP_TO_7SEGMENT_H */
189
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index fe268be3293b..7c8957dd22c0 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -277,6 +277,16 @@ static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = {
277 { KE_END, 0 } 277 { KE_END, 0 }
278}; 278};
279 279
280static struct key_entry keymap_fs_amilo_pro_v3505[] __initdata = {
281 { KE_KEY, 0x01, {KEY_HELP} }, /* Fn+F1 */
282 { KE_KEY, 0x06, {KEY_DISPLAYTOGGLE} }, /* Fn+F4 */
283 { KE_BLUETOOTH, 0x30 }, /* Fn+F10 */
284 { KE_KEY, 0x31, {KEY_MAIL} }, /* mail button */
285 { KE_KEY, 0x36, {KEY_WWW} }, /* www button */
286 { KE_WIFI, 0x78 }, /* satelite dish button */
287 { KE_END, 0 }
288};
289
280static struct key_entry keymap_fujitsu_n3510[] __initdata = { 290static struct key_entry keymap_fujitsu_n3510[] __initdata = {
281 { KE_KEY, 0x11, {KEY_PROG1} }, 291 { KE_KEY, 0x11, {KEY_PROG1} },
282 { KE_KEY, 0x12, {KEY_PROG2} }, 292 { KE_KEY, 0x12, {KEY_PROG2} },
@@ -618,6 +628,15 @@ static struct dmi_system_id dmi_ids[] __initdata = {
618 }, 628 },
619 { 629 {
620 .callback = dmi_matched, 630 .callback = dmi_matched,
631 .ident = "Fujitsu-Siemens Amilo Pro Edition V3505",
632 .matches = {
633 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
634 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro Edition V3505"),
635 },
636 .driver_data = keymap_fs_amilo_pro_v3505
637 },
638 {
639 .callback = dmi_matched,
621 .ident = "Fujitsu-Siemens Amilo M7400", 640 .ident = "Fujitsu-Siemens Amilo M7400",
622 .matches = { 641 .matches = {
623 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 642 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index facefd3dba29..11b5c7e84ed1 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -52,8 +52,8 @@
52#include <linux/module.h> 52#include <linux/module.h>
53#include <linux/rwsem.h> 53#include <linux/rwsem.h>
54#include <linux/usb/input.h> 54#include <linux/usb/input.h>
55#include <linux/map_to_7segment.h>
55 56
56#include "map_to_7segment.h"
57#include "yealink.h" 57#include "yealink.h"
58 58
59#define DRIVER_VERSION "yld-20051230" 59#define DRIVER_VERSION "yld-20051230"