aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 13:30:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 13:30:33 -0500
commit407cf84f956ee4b52da5508d5357b8ae212ff77c (patch)
treeb3efbcb770e1202b65aee2fe70ea5a407a60e6a5 /drivers
parentb3ce1debe2685383a9ad6ace9c49869c3968c013 (diff)
parent0aeafa77558fc1b44b0f39a4d9e5bd9316420788 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c27
-rw-r--r--drivers/input/keyboard/lkkbd.c101
-rw-r--r--drivers/input/keyboard/locomokbd.c63
-rw-r--r--drivers/input/mouse/logips2pp.c3
4 files changed, 109 insertions, 85 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1a1654caedd5..0879915b14d5 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -377,7 +377,7 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
377 377
378 list_for_each_entry(dev, &input_dev_list, node) { 378 list_for_each_entry(dev, &input_dev_list, node) {
379 379
380 path = dev->dynalloc ? kobject_get_path(&dev->cdev.kobj, GFP_KERNEL) : NULL; 380 path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL);
381 381
382 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", 382 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
383 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); 383 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
@@ -741,15 +741,21 @@ static void input_register_classdevice(struct input_dev *dev)
741 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); 741 sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
742} 742}
743 743
744void input_register_device(struct input_dev *dev) 744int input_register_device(struct input_dev *dev)
745{ 745{
746 struct input_handle *handle; 746 struct input_handle *handle;
747 struct input_handler *handler; 747 struct input_handler *handler;
748 struct input_device_id *id; 748 struct input_device_id *id;
749 749
750 set_bit(EV_SYN, dev->evbit); 750 if (!dev->dynalloc) {
751 printk(KERN_WARNING "input: device %s is statically allocated, will not register\n"
752 "Please convert to input_allocate_device() or contact dtor_core@ameritech.net\n",
753 dev->name ? dev->name : "<Unknown>");
754 return -EINVAL;
755 }
751 756
752 init_MUTEX(&dev->sem); 757 init_MUTEX(&dev->sem);
758 set_bit(EV_SYN, dev->evbit);
753 759
754 /* 760 /*
755 * If delay and period are pre-set by the driver, then autorepeating 761 * If delay and period are pre-set by the driver, then autorepeating
@@ -767,8 +773,7 @@ void input_register_device(struct input_dev *dev)
767 INIT_LIST_HEAD(&dev->h_list); 773 INIT_LIST_HEAD(&dev->h_list);
768 list_add_tail(&dev->node, &input_dev_list); 774 list_add_tail(&dev->node, &input_dev_list);
769 775
770 if (dev->dynalloc) 776 input_register_classdevice(dev);
771 input_register_classdevice(dev);
772 777
773 list_for_each_entry(handler, &input_handler_list, node) 778 list_for_each_entry(handler, &input_handler_list, node)
774 if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) 779 if (!handler->blacklist || !input_match_device(handler->blacklist, dev))
@@ -776,8 +781,9 @@ void input_register_device(struct input_dev *dev)
776 if ((handle = handler->connect(handler, dev, id))) 781 if ((handle = handler->connect(handler, dev, id)))
777 input_link_handle(handle); 782 input_link_handle(handle);
778 783
779
780 input_wakeup_procfs_readers(); 784 input_wakeup_procfs_readers();
785
786 return 0;
781} 787}
782 788
783void input_unregister_device(struct input_dev *dev) 789void input_unregister_device(struct input_dev *dev)
@@ -797,11 +803,10 @@ void input_unregister_device(struct input_dev *dev)
797 803
798 list_del_init(&dev->node); 804 list_del_init(&dev->node);
799 805
800 if (dev->dynalloc) { 806 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group);
801 sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); 807 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group);
802 sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); 808 sysfs_remove_group(&dev->cdev.kobj, &input_dev_group);
803 class_device_unregister(&dev->cdev); 809 class_device_unregister(&dev->cdev);
804 }
805 810
806 input_wakeup_procfs_readers(); 811 input_wakeup_procfs_readers();
807} 812}
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
index 9481132532d0..77c4d9669ad0 100644
--- a/drivers/input/keyboard/lkkbd.c
+++ b/drivers/input/keyboard/lkkbd.c
@@ -273,11 +273,11 @@ static lk_keycode_t lkkbd_keycode[LK_NUM_KEYCODES] = {
273 [0xfb] = KEY_APOSTROPHE, 273 [0xfb] = KEY_APOSTROPHE,
274}; 274};
275 275
276#define CHECK_LED(LED, BITS) do { \ 276#define CHECK_LED(LK, VAR_ON, VAR_OFF, LED, BITS) do { \
277 if (test_bit (LED, lk->dev->led)) \ 277 if (test_bit (LED, (LK)->dev->led)) \
278 leds_on |= BITS; \ 278 VAR_ON |= BITS; \
279 else \ 279 else \
280 leds_off |= BITS; \ 280 VAR_OFF |= BITS; \
281 } while (0) 281 } while (0)
282 282
283/* 283/*
@@ -298,6 +298,42 @@ struct lkkbd {
298 int ctrlclick_volume; 298 int ctrlclick_volume;
299}; 299};
300 300
301#ifdef LKKBD_DEBUG
302/*
303 * Responses from the keyboard and mapping back to their names.
304 */
305static struct {
306 unsigned char value;
307 unsigned char *name;
308} lk_response[] = {
309#define RESPONSE(x) { .value = (x), .name = #x, }
310 RESPONSE (LK_STUCK_KEY),
311 RESPONSE (LK_SELFTEST_FAILED),
312 RESPONSE (LK_ALL_KEYS_UP),
313 RESPONSE (LK_METRONOME),
314 RESPONSE (LK_OUTPUT_ERROR),
315 RESPONSE (LK_INPUT_ERROR),
316 RESPONSE (LK_KBD_LOCKED),
317 RESPONSE (LK_KBD_TEST_MODE_ACK),
318 RESPONSE (LK_PREFIX_KEY_DOWN),
319 RESPONSE (LK_MODE_CHANGE_ACK),
320 RESPONSE (LK_RESPONSE_RESERVED),
321#undef RESPONSE
322};
323
324static unsigned char *
325response_name (unsigned char value)
326{
327 int i;
328
329 for (i = 0; i < ARRAY_SIZE (lk_response); i++)
330 if (lk_response[i].value == value)
331 return lk_response[i].name;
332
333 return "<unknown>";
334}
335#endif /* LKKBD_DEBUG */
336
301/* 337/*
302 * Calculate volume parameter byte for a given volume. 338 * Calculate volume parameter byte for a given volume.
303 */ 339 */
@@ -440,43 +476,24 @@ lkkbd_interrupt (struct serio *serio, unsigned char data, unsigned int flags,
440 input_report_key (lk->dev, lk->keycode[i], 0); 476 input_report_key (lk->dev, lk->keycode[i], 0);
441 input_sync (lk->dev); 477 input_sync (lk->dev);
442 break; 478 break;
443 case LK_METRONOME: 479
444 DBG (KERN_INFO "Got LK_METRONOME and don't " 480 case 0x01:
445 "know how to handle...\n"); 481 DBG (KERN_INFO "Got 0x01, scheduling re-initialization\n");
482 lk->ignore_bytes = LK_NUM_IGNORE_BYTES;
483 lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
484 schedule_work (&lk->tq);
446 break; 485 break;
486
487 case LK_METRONOME:
447 case LK_OUTPUT_ERROR: 488 case LK_OUTPUT_ERROR:
448 DBG (KERN_INFO "Got LK_OUTPUT_ERROR and don't "
449 "know how to handle...\n");
450 break;
451 case LK_INPUT_ERROR: 489 case LK_INPUT_ERROR:
452 DBG (KERN_INFO "Got LK_INPUT_ERROR and don't "
453 "know how to handle...\n");
454 break;
455 case LK_KBD_LOCKED: 490 case LK_KBD_LOCKED:
456 DBG (KERN_INFO "Got LK_KBD_LOCKED and don't "
457 "know how to handle...\n");
458 break;
459 case LK_KBD_TEST_MODE_ACK: 491 case LK_KBD_TEST_MODE_ACK:
460 DBG (KERN_INFO "Got LK_KBD_TEST_MODE_ACK and don't "
461 "know how to handle...\n");
462 break;
463 case LK_PREFIX_KEY_DOWN: 492 case LK_PREFIX_KEY_DOWN:
464 DBG (KERN_INFO "Got LK_PREFIX_KEY_DOWN and don't "
465 "know how to handle...\n");
466 break;
467 case LK_MODE_CHANGE_ACK: 493 case LK_MODE_CHANGE_ACK:
468 DBG (KERN_INFO "Got LK_MODE_CHANGE_ACK and ignored "
469 "it properly...\n");
470 break;
471 case LK_RESPONSE_RESERVED: 494 case LK_RESPONSE_RESERVED:
472 DBG (KERN_INFO "Got LK_RESPONSE_RESERVED and don't " 495 DBG (KERN_INFO "Got %s and don't know how to handle...\n",
473 "know how to handle...\n"); 496 response_name (data));
474 break;
475 case 0x01:
476 DBG (KERN_INFO "Got 0x01, scheduling re-initialization\n");
477 lk->ignore_bytes = LK_NUM_IGNORE_BYTES;
478 lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
479 schedule_work (&lk->tq);
480 break; 497 break;
481 498
482 default: 499 default:
@@ -509,10 +526,10 @@ lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
509 526
510 switch (type) { 527 switch (type) {
511 case EV_LED: 528 case EV_LED:
512 CHECK_LED (LED_CAPSL, LK_LED_SHIFTLOCK); 529 CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK);
513 CHECK_LED (LED_COMPOSE, LK_LED_COMPOSE); 530 CHECK_LED (lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE);
514 CHECK_LED (LED_SCROLLL, LK_LED_SCROLLLOCK); 531 CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK);
515 CHECK_LED (LED_SLEEP, LK_LED_WAIT); 532 CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT);
516 if (leds_on != 0) { 533 if (leds_on != 0) {
517 lk->serio->write (lk->serio, LK_CMD_LED_ON); 534 lk->serio->write (lk->serio, LK_CMD_LED_ON);
518 lk->serio->write (lk->serio, leds_on); 535 lk->serio->write (lk->serio, leds_on);
@@ -574,10 +591,10 @@ lkkbd_reinit (void *data)
574 lk->serio->write (lk->serio, LK_CMD_SET_DEFAULTS); 591 lk->serio->write (lk->serio, LK_CMD_SET_DEFAULTS);
575 592
576 /* Set LEDs */ 593 /* Set LEDs */
577 CHECK_LED (LED_CAPSL, LK_LED_SHIFTLOCK); 594 CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK);
578 CHECK_LED (LED_COMPOSE, LK_LED_COMPOSE); 595 CHECK_LED (lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE);
579 CHECK_LED (LED_SCROLLL, LK_LED_SCROLLLOCK); 596 CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK);
580 CHECK_LED (LED_SLEEP, LK_LED_WAIT); 597 CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT);
581 if (leds_on != 0) { 598 if (leds_on != 0) {
582 lk->serio->write (lk->serio, LK_CMD_LED_ON); 599 lk->serio->write (lk->serio, LK_CMD_LED_ON);
583 lk->serio->write (lk->serio, leds_on); 600 lk->serio->write (lk->serio, leds_on);
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 8935290256b3..2c510881874a 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -76,7 +76,7 @@ static unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS] = {
76 76
77struct locomokbd { 77struct locomokbd {
78 unsigned char keycode[LOCOMOKBD_NUMKEYS]; 78 unsigned char keycode[LOCOMOKBD_NUMKEYS];
79 struct input_dev input; 79 struct input_dev *input;
80 char phys[32]; 80 char phys[32];
81 81
82 struct locomo_dev *ldev; 82 struct locomo_dev *ldev;
@@ -136,8 +136,7 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd, struct pt_regs *
136 136
137 spin_lock_irqsave(&locomokbd->lock, flags); 137 spin_lock_irqsave(&locomokbd->lock, flags);
138 138
139 if (regs) 139 input_regs(locomokbd->input, regs);
140 input_regs(&locomokbd->input, regs);
141 140
142 locomokbd_charge_all(membase); 141 locomokbd_charge_all(membase);
143 142
@@ -152,16 +151,16 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd, struct pt_regs *
152 scancode = SCANCODE(col, row); 151 scancode = SCANCODE(col, row);
153 if (rowd & KB_ROWMASK(row)) { 152 if (rowd & KB_ROWMASK(row)) {
154 num_pressed += 1; 153 num_pressed += 1;
155 input_report_key(&locomokbd->input, locomokbd->keycode[scancode], 1); 154 input_report_key(locomokbd->input, locomokbd->keycode[scancode], 1);
156 } else { 155 } else {
157 input_report_key(&locomokbd->input, locomokbd->keycode[scancode], 0); 156 input_report_key(locomokbd->input, locomokbd->keycode[scancode], 0);
158 } 157 }
159 } 158 }
160 locomokbd_reset_col(membase, col); 159 locomokbd_reset_col(membase, col);
161 } 160 }
162 locomokbd_activate_all(membase); 161 locomokbd_activate_all(membase);
163 162
164 input_sync(&locomokbd->input); 163 input_sync(locomokbd->input);
165 164
166 /* if any keys are pressed, enable the timer */ 165 /* if any keys are pressed, enable the timer */
167 if (num_pressed) 166 if (num_pressed)
@@ -196,13 +195,15 @@ static void locomokbd_timer_callback(unsigned long data)
196static int locomokbd_probe(struct locomo_dev *dev) 195static int locomokbd_probe(struct locomo_dev *dev)
197{ 196{
198 struct locomokbd *locomokbd; 197 struct locomokbd *locomokbd;
198 struct input_dev *input_dev;
199 int i, ret; 199 int i, ret;
200 200
201 locomokbd = kmalloc(sizeof(struct locomokbd), GFP_KERNEL); 201 locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
202 if (!locomokbd) 202 input_dev = input_allocate_device();
203 return -ENOMEM; 203 if (!locomokbd || !input_dev) {
204 204 ret = -ENOMEM;
205 memset(locomokbd, 0, sizeof(struct locomokbd)); 205 goto free;
206 }
206 207
207 /* try and claim memory region */ 208 /* try and claim memory region */
208 if (!request_mem_region((unsigned long) dev->mapbase, 209 if (!request_mem_region((unsigned long) dev->mapbase,
@@ -224,27 +225,26 @@ static int locomokbd_probe(struct locomo_dev *dev)
224 locomokbd->timer.function = locomokbd_timer_callback; 225 locomokbd->timer.function = locomokbd_timer_callback;
225 locomokbd->timer.data = (unsigned long) locomokbd; 226 locomokbd->timer.data = (unsigned long) locomokbd;
226 227
227 locomokbd->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 228 locomokbd->input = input_dev;
229 strcpy(locomokbd->phys, "locomokbd/input0");
230
231 input_dev->name = "LoCoMo keyboard";
232 input_dev->phys = locomokbd->phys;
233 input_dev->id.bustype = BUS_HOST;
234 input_dev->id.vendor = 0x0001;
235 input_dev->id.product = 0x0001;
236 input_dev->id.version = 0x0100;
237 input_dev->private = locomokbd;
228 238
229 init_input_dev(&locomokbd->input); 239 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
230 locomokbd->input.keycode = locomokbd->keycode; 240 input_dev->keycode = locomokbd->keycode;
231 locomokbd->input.keycodesize = sizeof(unsigned char); 241 input_dev->keycodesize = sizeof(unsigned char);
232 locomokbd->input.keycodemax = ARRAY_SIZE(locomokbd_keycode); 242 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode);
233 locomokbd->input.private = locomokbd;
234 243
235 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode)); 244 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode));
236 for (i = 0; i < LOCOMOKBD_NUMKEYS; i++) 245 for (i = 0; i < LOCOMOKBD_NUMKEYS; i++)
237 set_bit(locomokbd->keycode[i], locomokbd->input.keybit); 246 set_bit(locomokbd->keycode[i], input_dev->keybit);
238 clear_bit(0, locomokbd->input.keybit); 247 clear_bit(0, input_dev->keybit);
239
240 strcpy(locomokbd->phys, "locomokbd/input0");
241
242 locomokbd->input.name = "LoCoMo keyboard";
243 locomokbd->input.phys = locomokbd->phys;
244 locomokbd->input.id.bustype = BUS_XTKBD;
245 locomokbd->input.id.vendor = 0x0001;
246 locomokbd->input.id.product = 0x0001;
247 locomokbd->input.id.version = 0x0100;
248 248
249 /* attempt to get the interrupt */ 249 /* attempt to get the interrupt */
250 ret = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd); 250 ret = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
@@ -253,9 +253,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
253 goto out; 253 goto out;
254 } 254 }
255 255
256 input_register_device(&locomokbd->input); 256 input_register_device(locomokbd->input);
257
258 printk(KERN_INFO "input: LoCoMo keyboard on locomokbd\n");
259 257
260 return 0; 258 return 0;
261 259
@@ -263,6 +261,7 @@ out:
263 release_mem_region((unsigned long) dev->mapbase, dev->length); 261 release_mem_region((unsigned long) dev->mapbase, dev->length);
264 locomo_set_drvdata(dev, NULL); 262 locomo_set_drvdata(dev, NULL);
265free: 263free:
264 input_free_device(input_dev);
266 kfree(locomokbd); 265 kfree(locomokbd);
267 266
268 return ret; 267 return ret;
@@ -276,7 +275,7 @@ static int locomokbd_remove(struct locomo_dev *dev)
276 275
277 del_timer_sync(&locomokbd->timer); 276 del_timer_sync(&locomokbd->timer);
278 277
279 input_unregister_device(&locomokbd->input); 278 input_unregister_device(locomokbd->input);
280 locomo_set_drvdata(dev, NULL); 279 locomo_set_drvdata(dev, NULL);
281 280
282 release_mem_region((unsigned long) dev->mapbase, dev->length); 281 release_mem_region((unsigned long) dev->mapbase, dev->length);
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 0f69ff46c1ae..31a59f7abfaf 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -217,6 +217,9 @@ static struct ps2pp_info *get_model_info(unsigned char model)
217 { 61, PS2PP_KIND_MX, /* MX700 */ 217 { 61, PS2PP_KIND_MX, /* MX700 */
218 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | 218 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
219 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, 219 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
220 { 66, PS2PP_KIND_MX, /* MX3100 reciver */
221 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
222 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL },
220 { 73, 0, PS2PP_SIDE_BTN }, 223 { 73, 0, PS2PP_SIDE_BTN },
221 { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 224 { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
222 { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 225 { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL },