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: (34 commits)
Input: i8042 - non-x86 build fix
Input: pxa27x_keypad - also enable on PXA3xx
Input: pxa27x_keypad - add debounce_interval to the keypad platform data
Input: pxa27x_keypad - use device resources for I/O memory mapping and IRQ
Input: pxa27x_keypad - enable rotary encoders and direct keys
Input: pxa27x_keypad - introduce pxa27x_keypad_config()
Input: pxa27x_keypad - introduce driver structure and use KEY() to define matrix keys
Input: pxa27x_keypad - remove pin configuration from the driver
Input: pxa27x_keypad - rename the driver (was pxa27x_keyboard)
Input: constify function pointer tables (seq_operations)
Input: i8042 - add Fujitsu-Siemens Amilo Pro 2010 to nomux list
Input: i8042 - enable DMI quirks on x86-64
Input: i8042 - add Dritek quirk for Acer Aspire 9110
Input: add input event to APM event bridge
Input: mousedev - use BIT_MASK instead of BIT
Input: remove duplicate includes
Input: remove cdev from input_dev structure
Input: remove duplicated headers in drivers/char/keyboard.c
Input: i8042 - add Dritek keyboard extension quirk
Input: add Tosa keyboard driver
...

+2073 -484
+1 -1
Documentation/input/input-programming.txt
··· 22 22 23 23 static void button_interrupt(int irq, void *dummy, struct pt_regs *fp) 24 24 { 25 - input_report_key(button_dev, BTN_1, inb(BUTTON_PORT) & 1); 25 + input_report_key(button_dev, BTN_0, inb(BUTTON_PORT) & 1); 26 26 input_sync(button_dev); 27 27 } 28 28
+43
arch/arm/mach-pxa/tosa.c
··· 21 21 #include <linux/mmc/host.h> 22 22 #include <linux/pm.h> 23 23 #include <linux/delay.h> 24 + #include <linux/gpio_keys.h> 25 + #include <linux/input.h> 24 26 25 27 #include <asm/setup.h> 26 28 #include <asm/memory.h> ··· 248 246 .id = -1, 249 247 }; 250 248 249 + static struct gpio_keys_button tosa_gpio_keys[] = { 250 + { 251 + .type = EV_PWR, 252 + .code = KEY_SUSPEND, 253 + .gpio = TOSA_GPIO_ON_KEY, 254 + .desc = "On key", 255 + .wakeup = 1, 256 + .active_low = 1, 257 + }, 258 + { 259 + .type = EV_KEY, 260 + .code = TOSA_KEY_RECORD, 261 + .gpio = TOSA_GPIO_RECORD_BTN, 262 + .desc = "Record Button", 263 + .wakeup = 1, 264 + .active_low = 1, 265 + }, 266 + { 267 + .type = EV_KEY, 268 + .code = TOSA_KEY_SYNC, 269 + .gpio = TOSA_GPIO_SYNC, 270 + .desc = "Sync Button", 271 + .wakeup = 1, 272 + .active_low = 1, 273 + }, 274 + }; 275 + 276 + static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = { 277 + .buttons = tosa_gpio_keys, 278 + .nbuttons = ARRAY_SIZE(tosa_gpio_keys), 279 + }; 280 + 281 + static struct platform_device tosa_gpio_keys_device = { 282 + .name = "gpio-keys", 283 + .id = -1, 284 + .dev = { 285 + .platform_data = &tosa_gpio_keys_platform_data, 286 + }, 287 + }; 288 + 251 289 /* 252 290 * Tosa LEDs 253 291 */ ··· 300 258 &tosascoop_device, 301 259 &tosascoop_jc_device, 302 260 &tosakbd_device, 261 + &tosa_gpio_keys_device, 303 262 &tosaled_device, 304 263 }; 305 264
+2 -3
drivers/char/keyboard.c
··· 38 38 #include <linux/kbd_kern.h> 39 39 #include <linux/kbd_diacr.h> 40 40 #include <linux/vt_kern.h> 41 - #include <linux/consolemap.h> 42 41 #include <linux/sysrq.h> 43 42 #include <linux/input.h> 44 43 #include <linux/reboot.h> ··· 193 194 int error = -ENODEV; 194 195 195 196 list_for_each_entry(handle, &kbd_handler.h_list, h_node) { 196 - error = handle->dev->getkeycode(handle->dev, scancode, &keycode); 197 + error = input_get_keycode(handle->dev, scancode, &keycode); 197 198 if (!error) 198 199 return keycode; 199 200 } ··· 207 208 int error = -ENODEV; 208 209 209 210 list_for_each_entry(handle, &kbd_handler.h_list, h_node) { 210 - error = handle->dev->setkeycode(handle->dev, scancode, keycode); 211 + error = input_set_keycode(handle->dev, scancode, keycode); 211 212 if (!error) 212 213 break; 213 214 }
+12
drivers/input/Kconfig
··· 137 137 To compile this driver as a module, choose M here: the 138 138 module will be called evbug. 139 139 140 + config INPUT_APMPOWER 141 + tristate "Input Power Event -> APM Bridge" if EMBEDDED 142 + depends on INPUT && APM_EMULATION 143 + ---help--- 144 + Say Y here if you want suspend key events to trigger a user 145 + requested suspend through APM. This is useful on embedded 146 + systems where such behviour is desired without userspace 147 + interaction. If unsure, say N. 148 + 149 + To compile this driver as a module, choose M here: the 150 + module will be called apm-power. 151 + 140 152 comment "Input Device Drivers" 141 153 142 154 source "drivers/input/keyboard/Kconfig"
+1
drivers/input/Makefile
··· 22 22 obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/ 23 23 obj-$(CONFIG_INPUT_MISC) += misc/ 24 24 25 + obj-$(CONFIG_INPUT_APMPOWER) += apm-power.o
+131
drivers/input/apm-power.c
··· 1 + /* 2 + * Input Power Event -> APM Bridge 3 + * 4 + * Copyright (c) 2007 Richard Purdie 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + */ 11 + 12 + #include <linux/module.h> 13 + #include <linux/input.h> 14 + #include <linux/slab.h> 15 + #include <linux/init.h> 16 + #include <linux/tty.h> 17 + #include <linux/delay.h> 18 + #include <linux/pm.h> 19 + #include <linux/apm-emulation.h> 20 + 21 + static void system_power_event(unsigned int keycode) 22 + { 23 + switch (keycode) { 24 + case KEY_SUSPEND: 25 + apm_queue_event(APM_USER_SUSPEND); 26 + 27 + printk(KERN_INFO "apm-power: Requesting system suspend...\n"); 28 + break; 29 + default: 30 + break; 31 + } 32 + } 33 + 34 + static void apmpower_event(struct input_handle *handle, unsigned int type, 35 + unsigned int code, int value) 36 + { 37 + /* only react on key down events */ 38 + if (value != 1) 39 + return; 40 + 41 + switch (type) { 42 + case EV_PWR: 43 + system_power_event(code); 44 + break; 45 + 46 + default: 47 + break; 48 + } 49 + } 50 + 51 + static int apmpower_connect(struct input_handler *handler, 52 + struct input_dev *dev, 53 + const struct input_device_id *id) 54 + { 55 + struct input_handle *handle; 56 + int error; 57 + 58 + handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); 59 + if (!handle) 60 + return -ENOMEM; 61 + 62 + handle->dev = dev; 63 + handle->handler = handler; 64 + handle->name = "apm-power"; 65 + 66 + handler->private = handle; 67 + 68 + error = input_register_handle(handle); 69 + if (error) { 70 + printk(KERN_ERR 71 + "apm-power: Failed to register input power handler, " 72 + "error %d\n", error); 73 + kfree(handle); 74 + return error; 75 + } 76 + 77 + error = input_open_device(handle); 78 + if (error) { 79 + printk(KERN_ERR 80 + "apm-power: Failed to open input power device, " 81 + "error %d\n", error); 82 + input_unregister_handle(handle); 83 + kfree(handle); 84 + return error; 85 + } 86 + 87 + return 0; 88 + } 89 + 90 + static void apmpower_disconnect(struct input_handle *handler) 91 + { 92 + struct input_handle *handle = handler->private; 93 + 94 + input_close_device(handle); 95 + kfree(handle); 96 + } 97 + 98 + static const struct input_device_id apmpower_ids[] = { 99 + { 100 + .flags = INPUT_DEVICE_ID_MATCH_EVBIT, 101 + .evbit = { BIT_MASK(EV_PWR) }, 102 + }, 103 + { }, 104 + }; 105 + 106 + MODULE_DEVICE_TABLE(input, apmpower_ids); 107 + 108 + static struct input_handler apmpower_handler = { 109 + .event = apmpower_event, 110 + .connect = apmpower_connect, 111 + .disconnect = apmpower_disconnect, 112 + .name = "apm-power", 113 + .id_table = apmpower_ids, 114 + }; 115 + 116 + static int __init apmpower_init(void) 117 + { 118 + return input_register_handler(&apmpower_handler); 119 + } 120 + 121 + static void __exit apmpower_exit(void) 122 + { 123 + input_unregister_handler(&apmpower_handler); 124 + } 125 + 126 + module_init(apmpower_init); 127 + module_exit(apmpower_exit); 128 + 129 + MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 130 + MODULE_DESCRIPTION("Input Power Event -> APM Bridge"); 131 + MODULE_LICENSE("GPL");
+3 -3
drivers/input/evdev.c
··· 617 617 if (get_user(t, ip)) 618 618 return -EFAULT; 619 619 620 - error = dev->getkeycode(dev, t, &v); 620 + error = input_get_keycode(dev, t, &v); 621 621 if (error) 622 622 return error; 623 623 ··· 630 630 if (get_user(t, ip) || get_user(v, ip + 1)) 631 631 return -EFAULT; 632 632 633 - return dev->setkeycode(dev, t, v); 633 + return input_set_keycode(dev, t, v); 634 634 635 635 case EVIOCSFF: 636 636 if (copy_from_user(&effect, p, sizeof(effect))) ··· 683 683 case EV_FF: bits = dev->ffbit; len = FF_MAX; break; 684 684 case EV_SW: bits = dev->swbit; len = SW_MAX; break; 685 685 default: return -EINVAL; 686 - } 686 + } 687 687 return bits_to_user(bits, len, _IOC_SIZE(cmd), p, compat_mode); 688 688 } 689 689
+10 -8
drivers/input/input-polldev.c
··· 60 60 { 61 61 struct input_polled_dev *dev = 62 62 container_of(work, struct input_polled_dev, work.work); 63 + unsigned long delay; 63 64 64 65 dev->poll(dev); 65 - queue_delayed_work(polldev_wq, &dev->work, 66 - msecs_to_jiffies(dev->poll_interval)); 66 + 67 + delay = msecs_to_jiffies(dev->poll_interval); 68 + if (delay >= HZ) 69 + delay = round_jiffies_relative(delay); 70 + 71 + queue_delayed_work(polldev_wq, &dev->work, delay); 67 72 } 68 73 69 74 static int input_open_polled_device(struct input_dev *input) 70 75 { 71 76 struct input_polled_dev *dev = input->private; 72 77 int error; 73 - unsigned long ticks; 74 78 75 79 error = input_polldev_start_workqueue(); 76 80 if (error) ··· 83 79 if (dev->flush) 84 80 dev->flush(dev); 85 81 86 - ticks = msecs_to_jiffies(dev->poll_interval); 87 - if (ticks >= HZ) 88 - ticks = round_jiffies(ticks); 89 - queue_delayed_work(polldev_wq, &dev->work, ticks); 82 + queue_delayed_work(polldev_wq, &dev->work, 83 + msecs_to_jiffies(dev->poll_interval)); 90 84 91 85 return 0; 92 86 } ··· 93 91 { 94 92 struct input_polled_dev *dev = input->private; 95 93 96 - cancel_rearming_delayed_workqueue(polldev_wq, &dev->work); 94 + cancel_delayed_work_sync(&dev->work); 97 95 input_polldev_stop_workqueue(); 98 96 } 99 97
+74 -11
drivers/input/input.c
··· 493 493 if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) { 494 494 for (code = 0; code <= KEY_MAX; code++) { 495 495 if (is_event_supported(code, dev->keybit, KEY_MAX) && 496 - test_bit(code, dev->key)) { 496 + __test_and_clear_bit(code, dev->key)) { 497 497 input_pass_event(dev, EV_KEY, code, 0); 498 498 } 499 499 } ··· 526 526 if (!dev->keycodesize) 527 527 return -EINVAL; 528 528 529 - if (scancode < 0 || scancode >= dev->keycodemax) 529 + if (scancode >= dev->keycodemax) 530 530 return -EINVAL; 531 531 532 532 *keycode = input_fetch_keycode(dev, scancode); ··· 540 540 int old_keycode; 541 541 int i; 542 542 543 - if (scancode < 0 || scancode >= dev->keycodemax) 544 - return -EINVAL; 545 - 546 - if (keycode < 0 || keycode > KEY_MAX) 543 + if (scancode >= dev->keycodemax) 547 544 return -EINVAL; 548 545 549 546 if (!dev->keycodesize) ··· 583 586 return 0; 584 587 } 585 588 589 + /** 590 + * input_get_keycode - retrieve keycode currently mapped to a given scancode 591 + * @dev: input device which keymap is being queried 592 + * @scancode: scancode (or its equivalent for device in question) for which 593 + * keycode is needed 594 + * @keycode: result 595 + * 596 + * This function should be called by anyone interested in retrieving current 597 + * keymap. Presently keyboard and evdev handlers use it. 598 + */ 599 + int input_get_keycode(struct input_dev *dev, int scancode, int *keycode) 600 + { 601 + if (scancode < 0) 602 + return -EINVAL; 603 + 604 + return dev->getkeycode(dev, scancode, keycode); 605 + } 606 + EXPORT_SYMBOL(input_get_keycode); 607 + 608 + /** 609 + * input_get_keycode - assign new keycode to a given scancode 610 + * @dev: input device which keymap is being updated 611 + * @scancode: scancode (or its equivalent for device in question) 612 + * @keycode: new keycode to be assigned to the scancode 613 + * 614 + * This function should be called by anyone needing to update current 615 + * keymap. Presently keyboard and evdev handlers use it. 616 + */ 617 + int input_set_keycode(struct input_dev *dev, int scancode, int keycode) 618 + { 619 + unsigned long flags; 620 + int old_keycode; 621 + int retval; 622 + 623 + if (scancode < 0) 624 + return -EINVAL; 625 + 626 + if (keycode < 0 || keycode > KEY_MAX) 627 + return -EINVAL; 628 + 629 + spin_lock_irqsave(&dev->event_lock, flags); 630 + 631 + retval = dev->getkeycode(dev, scancode, &old_keycode); 632 + if (retval) 633 + goto out; 634 + 635 + retval = dev->setkeycode(dev, scancode, keycode); 636 + if (retval) 637 + goto out; 638 + 639 + /* 640 + * Simulate keyup event if keycode is not present 641 + * in the keymap anymore 642 + */ 643 + if (test_bit(EV_KEY, dev->evbit) && 644 + !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && 645 + __test_and_clear_bit(old_keycode, dev->key)) { 646 + 647 + input_pass_event(dev, EV_KEY, old_keycode, 0); 648 + if (dev->sync) 649 + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); 650 + } 651 + 652 + out: 653 + spin_unlock_irqrestore(&dev->event_lock, flags); 654 + 655 + return retval; 656 + } 657 + EXPORT_SYMBOL(input_set_keycode); 586 658 587 659 #define MATCH_BIT(bit, max) \ 588 660 for (i = 0; i < BITS_TO_LONGS(max); i++) \ ··· 821 755 return 0; 822 756 } 823 757 824 - static struct seq_operations input_devices_seq_ops = { 758 + static const struct seq_operations input_devices_seq_ops = { 825 759 .start = input_devices_seq_start, 826 760 .next = input_devices_seq_next, 827 761 .stop = input_devices_seq_stop, ··· 874 808 875 809 return 0; 876 810 } 877 - static struct seq_operations input_handlers_seq_ops = { 811 + static const struct seq_operations input_handlers_seq_ops = { 878 812 .start = input_handlers_seq_start, 879 813 .next = input_handlers_seq_next, 880 814 .stop = input_handlers_seq_stop, ··· 1394 1328 1395 1329 snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), 1396 1330 "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); 1397 - 1398 - if (dev->cdev.dev) 1399 - dev->dev.parent = dev->cdev.dev; 1400 1331 1401 1332 error = device_add(&dev->dev); 1402 1333 if (error)
-1
drivers/input/joystick/amijoy.c
··· 32 32 #include <linux/errno.h> 33 33 #include <linux/kernel.h> 34 34 #include <linux/module.h> 35 - #include <linux/moduleparam.h> 36 35 #include <linux/init.h> 37 36 #include <linux/input.h> 38 37 #include <linux/interrupt.h>
-1
drivers/input/joystick/analog.c
··· 31 31 #include <linux/delay.h> 32 32 #include <linux/kernel.h> 33 33 #include <linux/module.h> 34 - #include <linux/moduleparam.h> 35 34 #include <linux/slab.h> 36 35 #include <linux/bitops.h> 37 36 #include <linux/init.h>
-1
drivers/input/joystick/db9.c
··· 33 33 34 34 #include <linux/kernel.h> 35 35 #include <linux/module.h> 36 - #include <linux/moduleparam.h> 37 36 #include <linux/delay.h> 38 37 #include <linux/init.h> 39 38 #include <linux/parport.h>
-1
drivers/input/joystick/gamecon.c
··· 33 33 #include <linux/kernel.h> 34 34 #include <linux/delay.h> 35 35 #include <linux/module.h> 36 - #include <linux/moduleparam.h> 37 36 #include <linux/init.h> 38 37 #include <linux/parport.h> 39 38 #include <linux/input.h>
+9 -8
drivers/input/joystick/iforce/iforce-main.c
··· 85 85 86 86 static int iforce_playback(struct input_dev *dev, int effect_id, int value) 87 87 { 88 - struct iforce* iforce = dev->private; 88 + struct iforce *iforce = input_get_drvdata(dev); 89 89 struct iforce_core_effect *core_effect = &iforce->core_effects[effect_id]; 90 90 91 91 if (value > 0) ··· 99 99 100 100 static void iforce_set_gain(struct input_dev *dev, u16 gain) 101 101 { 102 - struct iforce* iforce = dev->private; 102 + struct iforce *iforce = input_get_drvdata(dev); 103 103 unsigned char data[3]; 104 104 105 105 data[0] = gain >> 9; ··· 108 108 109 109 static void iforce_set_autocenter(struct input_dev *dev, u16 magnitude) 110 110 { 111 - struct iforce* iforce = dev->private; 111 + struct iforce *iforce = input_get_drvdata(dev); 112 112 unsigned char data[3]; 113 113 114 114 data[0] = 0x03; ··· 126 126 */ 127 127 static int iforce_upload_effect(struct input_dev *dev, struct ff_effect *effect, struct ff_effect *old) 128 128 { 129 - struct iforce* iforce = dev->private; 129 + struct iforce *iforce = input_get_drvdata(dev); 130 130 struct iforce_core_effect *core_effect = &iforce->core_effects[effect->id]; 131 131 int ret; 132 132 ··· 173 173 */ 174 174 static int iforce_erase_effect(struct input_dev *dev, int effect_id) 175 175 { 176 - struct iforce *iforce = dev->private; 176 + struct iforce *iforce = input_get_drvdata(dev); 177 177 struct iforce_core_effect *core_effect = &iforce->core_effects[effect_id]; 178 178 int err = 0; 179 179 ··· 191 191 192 192 static int iforce_open(struct input_dev *dev) 193 193 { 194 - struct iforce *iforce = dev->private; 194 + struct iforce *iforce = input_get_drvdata(dev); 195 195 196 196 switch (iforce->bus) { 197 197 #ifdef CONFIG_JOYSTICK_IFORCE_USB ··· 213 213 214 214 static void iforce_release(struct input_dev *dev) 215 215 { 216 - struct iforce *iforce = dev->private; 216 + struct iforce *iforce = input_get_drvdata(dev); 217 217 int i; 218 218 219 219 if (test_bit(EV_FF, dev->evbit)) { ··· 298 298 #endif 299 299 } 300 300 301 - input_dev->private = iforce; 301 + input_set_drvdata(input_dev, iforce); 302 + 302 303 input_dev->name = "Unknown I-Force device"; 303 304 input_dev->open = iforce_open; 304 305 input_dev->close = iforce_release;
-1
drivers/input/joystick/turbografx.c
··· 35 35 #include <linux/parport.h> 36 36 #include <linux/input.h> 37 37 #include <linux/module.h> 38 - #include <linux/moduleparam.h> 39 38 #include <linux/init.h> 40 39 #include <linux/mutex.h> 41 40
-1
drivers/input/joystick/xpad.c
··· 75 75 #include <linux/slab.h> 76 76 #include <linux/stat.h> 77 77 #include <linux/module.h> 78 - #include <linux/moduleparam.h> 79 78 #include <linux/usb/input.h> 80 79 81 80 #define DRIVER_VERSION "v0.0.6"
+25 -4
drivers/input/keyboard/Kconfig
··· 154 154 To compile this driver as a module, choose M here: the 155 155 module will be called spitzkbd. 156 156 157 + config KEYBOARD_TOSA 158 + tristate "Tosa keyboard" 159 + depends on MACH_TOSA 160 + default y 161 + help 162 + Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) 163 + 164 + To compile this driver as a module, choose M here: the 165 + module will be called tosakbd. 166 + 167 + config KEYBOARD_TOSA_USE_EXT_KEYCODES 168 + bool "Tosa keyboard: use extended keycodes" 169 + depends on KEYBOARD_TOSA 170 + default n 171 + help 172 + Say Y here to enable the tosa keyboard driver to generate extended 173 + (>= 127) keycodes. Be aware, that they can't be correctly interpreted 174 + by either console keyboard driver or by Kdrive keybd driver. 175 + 176 + Say Y only if you know, what you are doing! 177 + 157 178 config KEYBOARD_AMIGA 158 179 tristate "Amiga keyboard" 159 180 depends on AMIGA ··· 260 239 module will be called omap-keypad. 261 240 262 241 config KEYBOARD_PXA27x 263 - tristate "PXA27x keyboard support" 264 - depends on PXA27x 242 + tristate "PXA27x/PXA3xx keypad support" 243 + depends on PXA27x || PXA3xx 265 244 help 266 - Enable support for PXA27x matrix keyboard controller 245 + Enable support for PXA27x/PXA3xx keypad controller 267 246 268 247 To compile this driver as a module, choose M here: the 269 - module will be called pxa27x_keyboard. 248 + module will be called pxa27x_keypad. 270 249 271 250 config KEYBOARD_AAED2000 272 251 tristate "AAED-2000 keyboard"
+2 -1
drivers/input/keyboard/Makefile
··· 15 15 obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o 16 16 obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o 17 17 obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o 18 + obj-$(CONFIG_KEYBOARD_TOSA) += tosakbd.o 18 19 obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o 19 20 obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o 20 21 obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o 21 - obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o 22 + obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o 22 23 obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o 23 24 obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o 24 25 obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o
+72 -19
drivers/input/keyboard/atkbd.c
··· 19 19 20 20 #include <linux/delay.h> 21 21 #include <linux/module.h> 22 - #include <linux/moduleparam.h> 23 22 #include <linux/slab.h> 24 23 #include <linux/interrupt.h> 25 24 #include <linux/init.h> ··· 27 28 #include <linux/workqueue.h> 28 29 #include <linux/libps2.h> 29 30 #include <linux/mutex.h> 31 + #include <linux/dmi.h> 30 32 31 33 #define DRIVER_DESC "AT and PS/2 keyboard driver" 32 34 ··· 201 201 202 202 unsigned short id; 203 203 unsigned char keycode[512]; 204 + DECLARE_BITMAP(force_release_mask, 512); 204 205 unsigned char set; 205 206 unsigned char translated; 206 207 unsigned char extra; ··· 225 224 struct mutex event_mutex; 226 225 unsigned long event_mask; 227 226 }; 227 + 228 + /* 229 + * System-specific ketymap fixup routine 230 + */ 231 + static void (*atkbd_platform_fixup)(struct atkbd *); 228 232 229 233 static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, 230 234 ssize_t (*handler)(struct atkbd *, char *)); ··· 355 349 struct atkbd *atkbd = serio_get_drvdata(serio); 356 350 struct input_dev *dev = atkbd->dev; 357 351 unsigned int code = data; 358 - int scroll = 0, hscroll = 0, click = -1, add_release_event = 0; 352 + int scroll = 0, hscroll = 0, click = -1; 359 353 int value; 360 354 unsigned char keycode; 361 355 ··· 420 414 "Some program might be trying access hardware directly.\n", 421 415 data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); 422 416 goto out; 423 - case ATKBD_RET_HANGEUL: 424 - case ATKBD_RET_HANJA: 425 - /* 426 - * These keys do not report release and thus need to be 427 - * flagged properly 428 - */ 429 - add_release_event = 1; 430 - break; 431 417 case ATKBD_RET_ERR: 432 418 atkbd->err_count++; 433 419 #ifdef ATKBD_DEBUG ··· 489 491 input_event(dev, EV_KEY, keycode, value); 490 492 input_sync(dev); 491 493 492 - if (value && add_release_event) { 494 + if (value && test_bit(code, atkbd->force_release_mask)) { 493 495 input_report_key(dev, keycode, 0); 494 496 input_sync(dev); 495 497 } ··· 822 824 atkbd_disable(atkbd); 823 825 824 826 /* make sure we don't have a command in flight */ 825 - synchronize_sched(); /* Allow atkbd_interrupt()s to complete. */ 826 827 flush_scheduled_work(); 827 828 828 829 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); ··· 831 834 kfree(atkbd); 832 835 } 833 836 837 + /* 838 + * Most special keys (Fn+F?) on Dell Latitudes do not generate release 839 + * events so we have to do it ourselves. 840 + */ 841 + static void atkbd_latitude_keymap_fixup(struct atkbd *atkbd) 842 + { 843 + const unsigned int forced_release_keys[] = { 844 + 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, 845 + }; 846 + int i; 847 + 848 + if (atkbd->set == 2) 849 + for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 850 + __set_bit(forced_release_keys[i], 851 + atkbd->force_release_mask); 852 + } 834 853 835 854 /* 836 855 * atkbd_set_keycode_table() initializes keyboard's keycode table ··· 855 842 856 843 static void atkbd_set_keycode_table(struct atkbd *atkbd) 857 844 { 845 + unsigned int scancode; 858 846 int i, j; 859 847 860 848 memset(atkbd->keycode, 0, sizeof(atkbd->keycode)); 849 + bitmap_zero(atkbd->force_release_mask, 512); 861 850 862 851 if (atkbd->translated) { 863 852 for (i = 0; i < 128; i++) { 864 - atkbd->keycode[i] = atkbd_set2_keycode[atkbd_unxlate_table[i]]; 865 - atkbd->keycode[i | 0x80] = atkbd_set2_keycode[atkbd_unxlate_table[i] | 0x80]; 853 + scancode = atkbd_unxlate_table[i]; 854 + atkbd->keycode[i] = atkbd_set2_keycode[scancode]; 855 + atkbd->keycode[i | 0x80] = atkbd_set2_keycode[scancode | 0x80]; 866 856 if (atkbd->scroll) 867 857 for (j = 0; j < ARRAY_SIZE(atkbd_scroll_keys); j++) 868 - if ((atkbd_unxlate_table[i] | 0x80) == atkbd_scroll_keys[j].set2) 858 + if ((scancode | 0x80) == atkbd_scroll_keys[j].set2) 869 859 atkbd->keycode[i | 0x80] = atkbd_scroll_keys[j].keycode; 870 860 } 871 861 } else if (atkbd->set == 3) { ··· 877 861 memcpy(atkbd->keycode, atkbd_set2_keycode, sizeof(atkbd->keycode)); 878 862 879 863 if (atkbd->scroll) 880 - for (i = 0; i < ARRAY_SIZE(atkbd_scroll_keys); i++) 881 - atkbd->keycode[atkbd_scroll_keys[i].set2] = atkbd_scroll_keys[i].keycode; 864 + for (i = 0; i < ARRAY_SIZE(atkbd_scroll_keys); i++) { 865 + scancode = atkbd_scroll_keys[i].set2; 866 + atkbd->keycode[scancode] = atkbd_scroll_keys[i].keycode; 867 + } 882 868 } 883 869 884 - atkbd->keycode[atkbd_compat_scancode(atkbd, ATKBD_RET_HANGEUL)] = KEY_HANGUEL; 885 - atkbd->keycode[atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA)] = KEY_HANJA; 870 + /* 871 + * HANGEUL and HANJA keys do not send release events so we need to 872 + * generate such events ourselves 873 + */ 874 + scancode = atkbd_compat_scancode(atkbd, ATKBD_RET_HANGEUL); 875 + atkbd->keycode[scancode] = KEY_HANGEUL; 876 + __set_bit(scancode, atkbd->force_release_mask); 877 + 878 + scancode = atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA); 879 + atkbd->keycode[scancode] = KEY_HANJA; 880 + __set_bit(scancode, atkbd->force_release_mask); 881 + 882 + /* 883 + * Perform additional fixups 884 + */ 885 + if (atkbd_platform_fixup) 886 + atkbd_platform_fixup(atkbd); 886 887 } 887 888 888 889 /* ··· 1434 1401 return sprintf(buf, "%lu\n", atkbd->err_count); 1435 1402 } 1436 1403 1404 + static int __init atkbd_setup_fixup(const struct dmi_system_id *id) 1405 + { 1406 + atkbd_platform_fixup = id->driver_data; 1407 + return 0; 1408 + } 1409 + 1410 + static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { 1411 + { 1412 + .ident = "Dell Latitude series", 1413 + .matches = { 1414 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1415 + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"), 1416 + }, 1417 + .callback = atkbd_setup_fixup, 1418 + .driver_data = atkbd_latitude_keymap_fixup, 1419 + }, 1420 + { } 1421 + }; 1437 1422 1438 1423 static int __init atkbd_init(void) 1439 1424 { 1425 + dmi_check_system(atkbd_dmi_quirk_table); 1426 + 1440 1427 return serio_register_driver(&atkbd_drv); 1441 1428 } 1442 1429
-1
drivers/input/keyboard/lkkbd.c
··· 64 64 #include <linux/delay.h> 65 65 #include <linux/slab.h> 66 66 #include <linux/module.h> 67 - #include <linux/moduleparam.h> 68 67 #include <linux/interrupt.h> 69 68 #include <linux/init.h> 70 69 #include <linux/input.h>
-274
drivers/input/keyboard/pxa27x_keyboard.c
··· 1 - /* 2 - * linux/drivers/input/keyboard/pxa27x_keyboard.c 3 - * 4 - * Driver for the pxa27x matrix keyboard controller. 5 - * 6 - * Created: Feb 22, 2007 7 - * Author: Rodolfo Giometti <giometti@linux.it> 8 - * 9 - * Based on a previous implementations by Kevin O'Connor 10 - * <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and 11 - * on some suggestions by Nicolas Pitre <nico@cam.org>. 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License version 2 as 15 - * published by the Free Software Foundation. 16 - */ 17 - 18 - 19 - #include <linux/kernel.h> 20 - #include <linux/module.h> 21 - #include <linux/init.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/input.h> 24 - #include <linux/device.h> 25 - #include <linux/platform_device.h> 26 - #include <linux/clk.h> 27 - #include <linux/err.h> 28 - 29 - #include <asm/mach-types.h> 30 - #include <asm/mach/arch.h> 31 - #include <asm/mach/map.h> 32 - 33 - #include <asm/arch/hardware.h> 34 - #include <asm/arch/pxa-regs.h> 35 - #include <asm/arch/irqs.h> 36 - #include <asm/arch/pxa27x_keyboard.h> 37 - 38 - #define DRIVER_NAME "pxa27x-keyboard" 39 - 40 - #define KPASMKP(col) (col/2 == 0 ? KPASMKP0 : \ 41 - col/2 == 1 ? KPASMKP1 : \ 42 - col/2 == 2 ? KPASMKP2 : KPASMKP3) 43 - #define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2))) 44 - 45 - static struct clk *pxakbd_clk; 46 - 47 - static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id) 48 - { 49 - struct platform_device *pdev = dev_id; 50 - struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; 51 - struct input_dev *input_dev = platform_get_drvdata(pdev); 52 - unsigned long kpc = KPC; 53 - int p, row, col, rel; 54 - 55 - if (kpc & KPC_DI) { 56 - unsigned long kpdk = KPDK; 57 - 58 - if (!(kpdk & KPDK_DKP)) { 59 - /* better luck next time */ 60 - } else if (kpc & KPC_REE0) { 61 - unsigned long kprec = KPREC; 62 - KPREC = 0x7f; 63 - 64 - if (kprec & KPREC_OF0) 65 - rel = (kprec & 0xff) + 0x7f; 66 - else if (kprec & KPREC_UF0) 67 - rel = (kprec & 0xff) - 0x7f - 0xff; 68 - else 69 - rel = (kprec & 0xff) - 0x7f; 70 - 71 - if (rel) { 72 - input_report_rel(input_dev, REL_WHEEL, rel); 73 - input_sync(input_dev); 74 - } 75 - } 76 - } 77 - 78 - if (kpc & KPC_MI) { 79 - /* report the status of every button */ 80 - for (row = 0; row < pdata->nr_rows; row++) { 81 - for (col = 0; col < pdata->nr_cols; col++) { 82 - p = KPASMKP(col) & KPASMKPx_MKC(row, col) ? 83 - 1 : 0; 84 - pr_debug("keycode %x - pressed %x\n", 85 - pdata->keycodes[row][col], p); 86 - input_report_key(input_dev, 87 - pdata->keycodes[row][col], p); 88 - } 89 - } 90 - input_sync(input_dev); 91 - } 92 - 93 - return IRQ_HANDLED; 94 - } 95 - 96 - static int pxakbd_open(struct input_dev *dev) 97 - { 98 - /* Set keypad control register */ 99 - KPC |= (KPC_ASACT | 100 - KPC_MS_ALL | 101 - (2 << 6) | KPC_REE0 | KPC_DK_DEB_SEL | 102 - KPC_ME | KPC_MIE | KPC_DE | KPC_DIE); 103 - 104 - KPC &= ~KPC_AS; /* disable automatic scan */ 105 - KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */ 106 - 107 - /* Set rotary count to mid-point value */ 108 - KPREC = 0x7F; 109 - 110 - /* Enable unit clock */ 111 - clk_enable(pxakbd_clk); 112 - 113 - return 0; 114 - } 115 - 116 - static void pxakbd_close(struct input_dev *dev) 117 - { 118 - /* Disable clock unit */ 119 - clk_disable(pxakbd_clk); 120 - } 121 - 122 - #ifdef CONFIG_PM 123 - static int pxakbd_suspend(struct platform_device *pdev, pm_message_t state) 124 - { 125 - struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; 126 - 127 - /* Save controller status */ 128 - pdata->reg_kpc = KPC; 129 - pdata->reg_kprec = KPREC; 130 - 131 - return 0; 132 - } 133 - 134 - static int pxakbd_resume(struct platform_device *pdev) 135 - { 136 - struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; 137 - struct input_dev *input_dev = platform_get_drvdata(pdev); 138 - 139 - mutex_lock(&input_dev->mutex); 140 - 141 - if (input_dev->users) { 142 - /* Restore controller status */ 143 - KPC = pdata->reg_kpc; 144 - KPREC = pdata->reg_kprec; 145 - 146 - /* Enable unit clock */ 147 - clk_disable(pxakbd_clk); 148 - clk_enable(pxakbd_clk); 149 - } 150 - 151 - mutex_unlock(&input_dev->mutex); 152 - 153 - return 0; 154 - } 155 - #else 156 - #define pxakbd_suspend NULL 157 - #define pxakbd_resume NULL 158 - #endif 159 - 160 - static int __devinit pxakbd_probe(struct platform_device *pdev) 161 - { 162 - struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; 163 - struct input_dev *input_dev; 164 - int i, row, col, error; 165 - 166 - pxakbd_clk = clk_get(&pdev->dev, "KBDCLK"); 167 - if (IS_ERR(pxakbd_clk)) { 168 - error = PTR_ERR(pxakbd_clk); 169 - goto err_clk; 170 - } 171 - 172 - /* Create and register the input driver. */ 173 - input_dev = input_allocate_device(); 174 - if (!input_dev) { 175 - printk(KERN_ERR "Cannot request keypad device\n"); 176 - error = -ENOMEM; 177 - goto err_alloc; 178 - } 179 - 180 - input_dev->name = DRIVER_NAME; 181 - input_dev->id.bustype = BUS_HOST; 182 - input_dev->open = pxakbd_open; 183 - input_dev->close = pxakbd_close; 184 - input_dev->dev.parent = &pdev->dev; 185 - 186 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | 187 - BIT_MASK(EV_REL); 188 - input_dev->relbit[BIT_WORD(REL_WHEEL)] = BIT_MASK(REL_WHEEL); 189 - for (row = 0; row < pdata->nr_rows; row++) { 190 - for (col = 0; col < pdata->nr_cols; col++) { 191 - int code = pdata->keycodes[row][col]; 192 - if (code > 0) 193 - set_bit(code, input_dev->keybit); 194 - } 195 - } 196 - 197 - error = request_irq(IRQ_KEYPAD, pxakbd_irq_handler, IRQF_DISABLED, 198 - DRIVER_NAME, pdev); 199 - if (error) { 200 - printk(KERN_ERR "Cannot request keypad IRQ\n"); 201 - goto err_free_dev; 202 - } 203 - 204 - platform_set_drvdata(pdev, input_dev); 205 - 206 - /* Register the input device */ 207 - error = input_register_device(input_dev); 208 - if (error) 209 - goto err_free_irq; 210 - 211 - /* Setup GPIOs. */ 212 - for (i = 0; i < pdata->nr_rows + pdata->nr_cols; i++) 213 - pxa_gpio_mode(pdata->gpio_modes[i]); 214 - 215 - /* 216 - * Store rows/cols info into keyboard registers. 217 - */ 218 - 219 - KPC |= (pdata->nr_rows - 1) << 26; 220 - KPC |= (pdata->nr_cols - 1) << 23; 221 - 222 - for (col = 0; col < pdata->nr_cols; col++) 223 - KPC |= KPC_MS0 << col; 224 - 225 - return 0; 226 - 227 - err_free_irq: 228 - platform_set_drvdata(pdev, NULL); 229 - free_irq(IRQ_KEYPAD, pdev); 230 - err_free_dev: 231 - input_free_device(input_dev); 232 - err_alloc: 233 - clk_put(pxakbd_clk); 234 - err_clk: 235 - return error; 236 - } 237 - 238 - static int __devexit pxakbd_remove(struct platform_device *pdev) 239 - { 240 - struct input_dev *input_dev = platform_get_drvdata(pdev); 241 - 242 - input_unregister_device(input_dev); 243 - free_irq(IRQ_KEYPAD, pdev); 244 - clk_put(pxakbd_clk); 245 - platform_set_drvdata(pdev, NULL); 246 - 247 - return 0; 248 - } 249 - 250 - static struct platform_driver pxakbd_driver = { 251 - .probe = pxakbd_probe, 252 - .remove = __devexit_p(pxakbd_remove), 253 - .suspend = pxakbd_suspend, 254 - .resume = pxakbd_resume, 255 - .driver = { 256 - .name = DRIVER_NAME, 257 - }, 258 - }; 259 - 260 - static int __init pxakbd_init(void) 261 - { 262 - return platform_driver_register(&pxakbd_driver); 263 - } 264 - 265 - static void __exit pxakbd_exit(void) 266 - { 267 - platform_driver_unregister(&pxakbd_driver); 268 - } 269 - 270 - module_init(pxakbd_init); 271 - module_exit(pxakbd_exit); 272 - 273 - MODULE_DESCRIPTION("PXA27x Matrix Keyboard Driver"); 274 - MODULE_LICENSE("GPL");
+572
drivers/input/keyboard/pxa27x_keypad.c
··· 1 + /* 2 + * linux/drivers/input/keyboard/pxa27x_keypad.c 3 + * 4 + * Driver for the pxa27x matrix keyboard controller. 5 + * 6 + * Created: Feb 22, 2007 7 + * Author: Rodolfo Giometti <giometti@linux.it> 8 + * 9 + * Based on a previous implementations by Kevin O'Connor 10 + * <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and 11 + * on some suggestions by Nicolas Pitre <nico@cam.org>. 12 + * 13 + * This program is free software; you can redistribute it and/or modify 14 + * it under the terms of the GNU General Public License version 2 as 15 + * published by the Free Software Foundation. 16 + */ 17 + 18 + 19 + #include <linux/kernel.h> 20 + #include <linux/module.h> 21 + #include <linux/init.h> 22 + #include <linux/interrupt.h> 23 + #include <linux/input.h> 24 + #include <linux/device.h> 25 + #include <linux/platform_device.h> 26 + #include <linux/clk.h> 27 + #include <linux/err.h> 28 + 29 + #include <asm/mach-types.h> 30 + #include <asm/mach/arch.h> 31 + #include <asm/mach/map.h> 32 + 33 + #include <asm/arch/hardware.h> 34 + #include <asm/arch/pxa27x_keypad.h> 35 + 36 + /* 37 + * Keypad Controller registers 38 + */ 39 + #define KPC 0x0000 /* Keypad Control register */ 40 + #define KPDK 0x0008 /* Keypad Direct Key register */ 41 + #define KPREC 0x0010 /* Keypad Rotary Encoder register */ 42 + #define KPMK 0x0018 /* Keypad Matrix Key register */ 43 + #define KPAS 0x0020 /* Keypad Automatic Scan register */ 44 + 45 + /* Keypad Automatic Scan Multiple Key Presser register 0-3 */ 46 + #define KPASMKP0 0x0028 47 + #define KPASMKP1 0x0030 48 + #define KPASMKP2 0x0038 49 + #define KPASMKP3 0x0040 50 + #define KPKDI 0x0048 51 + 52 + /* bit definitions */ 53 + #define KPC_MKRN(n) ((((n) & 0x7) - 1) << 26) /* matrix key row number */ 54 + #define KPC_MKCN(n) ((((n) & 0x7) - 1) << 23) /* matrix key column number */ 55 + #define KPC_DKN(n) ((((n) & 0x7) - 1) << 6) /* direct key number */ 56 + 57 + #define KPC_AS (0x1 << 30) /* Automatic Scan bit */ 58 + #define KPC_ASACT (0x1 << 29) /* Automatic Scan on Activity */ 59 + #define KPC_MI (0x1 << 22) /* Matrix interrupt bit */ 60 + #define KPC_IMKP (0x1 << 21) /* Ignore Multiple Key Press */ 61 + 62 + #define KPC_MS(n) (0x1 << (13 + (n))) /* Matrix scan line 'n' */ 63 + #define KPC_MS_ALL (0xff << 13) 64 + 65 + #define KPC_ME (0x1 << 12) /* Matrix Keypad Enable */ 66 + #define KPC_MIE (0x1 << 11) /* Matrix Interrupt Enable */ 67 + #define KPC_DK_DEB_SEL (0x1 << 9) /* Direct Keypad Debounce Select */ 68 + #define KPC_DI (0x1 << 5) /* Direct key interrupt bit */ 69 + #define KPC_RE_ZERO_DEB (0x1 << 4) /* Rotary Encoder Zero Debounce */ 70 + #define KPC_REE1 (0x1 << 3) /* Rotary Encoder1 Enable */ 71 + #define KPC_REE0 (0x1 << 2) /* Rotary Encoder0 Enable */ 72 + #define KPC_DE (0x1 << 1) /* Direct Keypad Enable */ 73 + #define KPC_DIE (0x1 << 0) /* Direct Keypad interrupt Enable */ 74 + 75 + #define KPDK_DKP (0x1 << 31) 76 + #define KPDK_DK(n) ((n) & 0xff) 77 + 78 + #define KPREC_OF1 (0x1 << 31) 79 + #define kPREC_UF1 (0x1 << 30) 80 + #define KPREC_OF0 (0x1 << 15) 81 + #define KPREC_UF0 (0x1 << 14) 82 + 83 + #define KPREC_RECOUNT0(n) ((n) & 0xff) 84 + #define KPREC_RECOUNT1(n) (((n) >> 16) & 0xff) 85 + 86 + #define KPMK_MKP (0x1 << 31) 87 + #define KPAS_SO (0x1 << 31) 88 + #define KPASMKPx_SO (0x1 << 31) 89 + 90 + #define KPAS_MUKP(n) (((n) >> 26) & 0x1f) 91 + #define KPAS_RP(n) (((n) >> 4) & 0xf) 92 + #define KPAS_CP(n) ((n) & 0xf) 93 + 94 + #define KPASMKP_MKC_MASK (0xff) 95 + 96 + #define keypad_readl(off) __raw_readl(keypad->mmio_base + (off)) 97 + #define keypad_writel(off, v) __raw_writel((v), keypad->mmio_base + (off)) 98 + 99 + #define MAX_MATRIX_KEY_NUM (8 * 8) 100 + 101 + struct pxa27x_keypad { 102 + struct pxa27x_keypad_platform_data *pdata; 103 + 104 + struct clk *clk; 105 + struct input_dev *input_dev; 106 + void __iomem *mmio_base; 107 + 108 + /* matrix key code map */ 109 + unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM]; 110 + 111 + /* state row bits of each column scan */ 112 + uint32_t matrix_key_state[MAX_MATRIX_KEY_COLS]; 113 + uint32_t direct_key_state; 114 + 115 + unsigned int direct_key_mask; 116 + 117 + int rotary_rel_code[2]; 118 + int rotary_up_key[2]; 119 + int rotary_down_key[2]; 120 + }; 121 + 122 + static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) 123 + { 124 + struct pxa27x_keypad_platform_data *pdata = keypad->pdata; 125 + struct input_dev *input_dev = keypad->input_dev; 126 + unsigned int *key; 127 + int i; 128 + 129 + key = &pdata->matrix_key_map[0]; 130 + for (i = 0; i < pdata->matrix_key_map_size; i++, key++) { 131 + int row = ((*key) >> 28) & 0xf; 132 + int col = ((*key) >> 24) & 0xf; 133 + int code = (*key) & 0xffffff; 134 + 135 + keypad->matrix_keycodes[(row << 3) + col] = code; 136 + set_bit(code, input_dev->keybit); 137 + } 138 + 139 + keypad->rotary_up_key[0] = pdata->rotary0_up_key; 140 + keypad->rotary_up_key[1] = pdata->rotary1_up_key; 141 + keypad->rotary_down_key[0] = pdata->rotary0_down_key; 142 + keypad->rotary_down_key[1] = pdata->rotary1_down_key; 143 + keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; 144 + keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; 145 + 146 + if (pdata->rotary0_up_key && pdata->rotary0_down_key) { 147 + set_bit(pdata->rotary0_up_key, input_dev->keybit); 148 + set_bit(pdata->rotary0_down_key, input_dev->keybit); 149 + } else 150 + set_bit(pdata->rotary0_rel_code, input_dev->relbit); 151 + 152 + if (pdata->rotary1_up_key && pdata->rotary1_down_key) { 153 + set_bit(pdata->rotary1_up_key, input_dev->keybit); 154 + set_bit(pdata->rotary1_down_key, input_dev->keybit); 155 + } else 156 + set_bit(pdata->rotary1_rel_code, input_dev->relbit); 157 + } 158 + 159 + static inline unsigned int lookup_matrix_keycode( 160 + struct pxa27x_keypad *keypad, int row, int col) 161 + { 162 + return keypad->matrix_keycodes[(row << 3) + col]; 163 + } 164 + 165 + static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) 166 + { 167 + struct pxa27x_keypad_platform_data *pdata = keypad->pdata; 168 + int row, col, num_keys_pressed = 0; 169 + uint32_t new_state[MAX_MATRIX_KEY_COLS]; 170 + uint32_t kpas = keypad_readl(KPAS); 171 + 172 + num_keys_pressed = KPAS_MUKP(kpas); 173 + 174 + memset(new_state, 0, sizeof(new_state)); 175 + 176 + if (num_keys_pressed == 0) 177 + goto scan; 178 + 179 + if (num_keys_pressed == 1) { 180 + col = KPAS_CP(kpas); 181 + row = KPAS_RP(kpas); 182 + 183 + /* if invalid row/col, treat as no key pressed */ 184 + if (col >= pdata->matrix_key_cols || 185 + row >= pdata->matrix_key_rows) 186 + goto scan; 187 + 188 + new_state[col] = (1 << row); 189 + goto scan; 190 + } 191 + 192 + if (num_keys_pressed > 1) { 193 + uint32_t kpasmkp0 = keypad_readl(KPASMKP0); 194 + uint32_t kpasmkp1 = keypad_readl(KPASMKP1); 195 + uint32_t kpasmkp2 = keypad_readl(KPASMKP2); 196 + uint32_t kpasmkp3 = keypad_readl(KPASMKP3); 197 + 198 + new_state[0] = kpasmkp0 & KPASMKP_MKC_MASK; 199 + new_state[1] = (kpasmkp0 >> 16) & KPASMKP_MKC_MASK; 200 + new_state[2] = kpasmkp1 & KPASMKP_MKC_MASK; 201 + new_state[3] = (kpasmkp1 >> 16) & KPASMKP_MKC_MASK; 202 + new_state[4] = kpasmkp2 & KPASMKP_MKC_MASK; 203 + new_state[5] = (kpasmkp2 >> 16) & KPASMKP_MKC_MASK; 204 + new_state[6] = kpasmkp3 & KPASMKP_MKC_MASK; 205 + new_state[7] = (kpasmkp3 >> 16) & KPASMKP_MKC_MASK; 206 + } 207 + scan: 208 + for (col = 0; col < pdata->matrix_key_cols; col++) { 209 + uint32_t bits_changed; 210 + 211 + bits_changed = keypad->matrix_key_state[col] ^ new_state[col]; 212 + if (bits_changed == 0) 213 + continue; 214 + 215 + for (row = 0; row < pdata->matrix_key_rows; row++) { 216 + if ((bits_changed & (1 << row)) == 0) 217 + continue; 218 + 219 + input_report_key(keypad->input_dev, 220 + lookup_matrix_keycode(keypad, row, col), 221 + new_state[col] & (1 << row)); 222 + } 223 + } 224 + input_sync(keypad->input_dev); 225 + memcpy(keypad->matrix_key_state, new_state, sizeof(new_state)); 226 + } 227 + 228 + #define DEFAULT_KPREC (0x007f007f) 229 + 230 + static inline int rotary_delta(uint32_t kprec) 231 + { 232 + if (kprec & KPREC_OF0) 233 + return (kprec & 0xff) + 0x7f; 234 + else if (kprec & KPREC_UF0) 235 + return (kprec & 0xff) - 0x7f - 0xff; 236 + else 237 + return (kprec & 0xff) - 0x7f; 238 + } 239 + 240 + static void report_rotary_event(struct pxa27x_keypad *keypad, int r, int delta) 241 + { 242 + struct input_dev *dev = keypad->input_dev; 243 + 244 + if (delta == 0) 245 + return; 246 + 247 + if (keypad->rotary_up_key[r] && keypad->rotary_down_key[r]) { 248 + int keycode = (delta > 0) ? keypad->rotary_up_key[r] : 249 + keypad->rotary_down_key[r]; 250 + 251 + /* simulate a press-n-release */ 252 + input_report_key(dev, keycode, 1); 253 + input_sync(dev); 254 + input_report_key(dev, keycode, 0); 255 + input_sync(dev); 256 + } else { 257 + input_report_rel(dev, keypad->rotary_rel_code[r], delta); 258 + input_sync(dev); 259 + } 260 + } 261 + 262 + static void pxa27x_keypad_scan_rotary(struct pxa27x_keypad *keypad) 263 + { 264 + struct pxa27x_keypad_platform_data *pdata = keypad->pdata; 265 + uint32_t kprec; 266 + 267 + /* read and reset to default count value */ 268 + kprec = keypad_readl(KPREC); 269 + keypad_writel(KPREC, DEFAULT_KPREC); 270 + 271 + if (pdata->enable_rotary0) 272 + report_rotary_event(keypad, 0, rotary_delta(kprec)); 273 + 274 + if (pdata->enable_rotary1) 275 + report_rotary_event(keypad, 1, rotary_delta(kprec >> 16)); 276 + } 277 + 278 + static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) 279 + { 280 + struct pxa27x_keypad_platform_data *pdata = keypad->pdata; 281 + unsigned int new_state; 282 + uint32_t kpdk, bits_changed; 283 + int i; 284 + 285 + kpdk = keypad_readl(KPDK); 286 + 287 + if (pdata->enable_rotary0 || pdata->enable_rotary1) 288 + pxa27x_keypad_scan_rotary(keypad); 289 + 290 + if (pdata->direct_key_map == NULL) 291 + return; 292 + 293 + new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; 294 + bits_changed = keypad->direct_key_state ^ new_state; 295 + 296 + if (bits_changed == 0) 297 + return; 298 + 299 + for (i = 0; i < pdata->direct_key_num; i++) { 300 + if (bits_changed & (1 << i)) 301 + input_report_key(keypad->input_dev, 302 + pdata->direct_key_map[i], 303 + (new_state & (1 << i))); 304 + } 305 + input_sync(keypad->input_dev); 306 + keypad->direct_key_state = new_state; 307 + } 308 + 309 + static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) 310 + { 311 + struct pxa27x_keypad *keypad = dev_id; 312 + unsigned long kpc = keypad_readl(KPC); 313 + 314 + if (kpc & KPC_DI) 315 + pxa27x_keypad_scan_direct(keypad); 316 + 317 + if (kpc & KPC_MI) 318 + pxa27x_keypad_scan_matrix(keypad); 319 + 320 + return IRQ_HANDLED; 321 + } 322 + 323 + static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) 324 + { 325 + struct pxa27x_keypad_platform_data *pdata = keypad->pdata; 326 + unsigned int mask = 0, direct_key_num = 0; 327 + unsigned long kpc = 0; 328 + 329 + /* enable matrix keys with automatic scan */ 330 + if (pdata->matrix_key_rows && pdata->matrix_key_cols) { 331 + kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL; 332 + kpc |= KPC_MKRN(pdata->matrix_key_rows) | 333 + KPC_MKCN(pdata->matrix_key_cols); 334 + } 335 + 336 + /* enable rotary key, debounce interval same as direct keys */ 337 + if (pdata->enable_rotary0) { 338 + mask |= 0x03; 339 + direct_key_num = 2; 340 + kpc |= KPC_REE0; 341 + } 342 + 343 + if (pdata->enable_rotary1) { 344 + mask |= 0x0c; 345 + direct_key_num = 4; 346 + kpc |= KPC_REE1; 347 + } 348 + 349 + if (pdata->direct_key_num > direct_key_num) 350 + direct_key_num = pdata->direct_key_num; 351 + 352 + keypad->direct_key_mask = ((2 << direct_key_num) - 1) & ~mask; 353 + 354 + /* enable direct key */ 355 + if (direct_key_num) 356 + kpc |= KPC_DE | KPC_DIE | KPC_DKN(direct_key_num); 357 + 358 + keypad_writel(KPC, kpc | KPC_RE_ZERO_DEB); 359 + keypad_writel(KPREC, DEFAULT_KPREC); 360 + keypad_writel(KPKDI, pdata->debounce_interval); 361 + } 362 + 363 + static int pxa27x_keypad_open(struct input_dev *dev) 364 + { 365 + struct pxa27x_keypad *keypad = input_get_drvdata(dev); 366 + 367 + /* Enable unit clock */ 368 + clk_enable(keypad->clk); 369 + pxa27x_keypad_config(keypad); 370 + 371 + return 0; 372 + } 373 + 374 + static void pxa27x_keypad_close(struct input_dev *dev) 375 + { 376 + struct pxa27x_keypad *keypad = input_get_drvdata(dev); 377 + 378 + /* Disable clock unit */ 379 + clk_disable(keypad->clk); 380 + } 381 + 382 + #ifdef CONFIG_PM 383 + static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t state) 384 + { 385 + struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 386 + 387 + clk_disable(keypad->clk); 388 + return 0; 389 + } 390 + 391 + static int pxa27x_keypad_resume(struct platform_device *pdev) 392 + { 393 + struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 394 + struct input_dev *input_dev = keypad->input_dev; 395 + 396 + mutex_lock(&input_dev->mutex); 397 + 398 + if (input_dev->users) { 399 + /* Enable unit clock */ 400 + clk_enable(keypad->clk); 401 + pxa27x_keypad_config(keypad); 402 + } 403 + 404 + mutex_unlock(&input_dev->mutex); 405 + 406 + return 0; 407 + } 408 + #else 409 + #define pxa27x_keypad_suspend NULL 410 + #define pxa27x_keypad_resume NULL 411 + #endif 412 + 413 + #define res_size(res) ((res)->end - (res)->start + 1) 414 + 415 + static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) 416 + { 417 + struct pxa27x_keypad *keypad; 418 + struct input_dev *input_dev; 419 + struct resource *res; 420 + int irq, error; 421 + 422 + keypad = kzalloc(sizeof(struct pxa27x_keypad), GFP_KERNEL); 423 + if (keypad == NULL) { 424 + dev_err(&pdev->dev, "failed to allocate driver data\n"); 425 + return -ENOMEM; 426 + } 427 + 428 + keypad->pdata = pdev->dev.platform_data; 429 + if (keypad->pdata == NULL) { 430 + dev_err(&pdev->dev, "no platform data defined\n"); 431 + error = -EINVAL; 432 + goto failed_free; 433 + } 434 + 435 + irq = platform_get_irq(pdev, 0); 436 + if (irq < 0) { 437 + dev_err(&pdev->dev, "failed to get keypad irq\n"); 438 + error = -ENXIO; 439 + goto failed_free; 440 + } 441 + 442 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 443 + if (res == NULL) { 444 + dev_err(&pdev->dev, "failed to get I/O memory\n"); 445 + error = -ENXIO; 446 + goto failed_free; 447 + } 448 + 449 + res = request_mem_region(res->start, res_size(res), pdev->name); 450 + if (res == NULL) { 451 + dev_err(&pdev->dev, "failed to request I/O memory\n"); 452 + error = -EBUSY; 453 + goto failed_free; 454 + } 455 + 456 + keypad->mmio_base = ioremap(res->start, res_size(res)); 457 + if (keypad->mmio_base == NULL) { 458 + dev_err(&pdev->dev, "failed to remap I/O memory\n"); 459 + error = -ENXIO; 460 + goto failed_free_mem; 461 + } 462 + 463 + keypad->clk = clk_get(&pdev->dev, "KBDCLK"); 464 + if (IS_ERR(keypad->clk)) { 465 + dev_err(&pdev->dev, "failed to get keypad clock\n"); 466 + error = PTR_ERR(keypad->clk); 467 + goto failed_free_io; 468 + } 469 + 470 + /* Create and register the input driver. */ 471 + input_dev = input_allocate_device(); 472 + if (!input_dev) { 473 + dev_err(&pdev->dev, "failed to allocate input device\n"); 474 + error = -ENOMEM; 475 + goto failed_put_clk; 476 + } 477 + 478 + input_dev->name = pdev->name; 479 + input_dev->id.bustype = BUS_HOST; 480 + input_dev->open = pxa27x_keypad_open; 481 + input_dev->close = pxa27x_keypad_close; 482 + input_dev->dev.parent = &pdev->dev; 483 + 484 + keypad->input_dev = input_dev; 485 + input_set_drvdata(input_dev, keypad); 486 + 487 + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | 488 + BIT_MASK(EV_REL); 489 + 490 + pxa27x_keypad_build_keycode(keypad); 491 + platform_set_drvdata(pdev, keypad); 492 + 493 + error = request_irq(irq, pxa27x_keypad_irq_handler, IRQF_DISABLED, 494 + pdev->name, keypad); 495 + if (error) { 496 + dev_err(&pdev->dev, "failed to request IRQ\n"); 497 + goto failed_free_dev; 498 + } 499 + 500 + /* Register the input device */ 501 + error = input_register_device(input_dev); 502 + if (error) { 503 + dev_err(&pdev->dev, "failed to register input device\n"); 504 + goto failed_free_irq; 505 + } 506 + 507 + return 0; 508 + 509 + failed_free_irq: 510 + free_irq(irq, pdev); 511 + platform_set_drvdata(pdev, NULL); 512 + failed_free_dev: 513 + input_free_device(input_dev); 514 + failed_put_clk: 515 + clk_put(keypad->clk); 516 + failed_free_io: 517 + iounmap(keypad->mmio_base); 518 + failed_free_mem: 519 + release_mem_region(res->start, res_size(res)); 520 + failed_free: 521 + kfree(keypad); 522 + return error; 523 + } 524 + 525 + static int __devexit pxa27x_keypad_remove(struct platform_device *pdev) 526 + { 527 + struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 528 + struct resource *res; 529 + 530 + free_irq(platform_get_irq(pdev, 0), pdev); 531 + 532 + clk_disable(keypad->clk); 533 + clk_put(keypad->clk); 534 + 535 + input_unregister_device(keypad->input_dev); 536 + input_free_device(keypad->input_dev); 537 + 538 + iounmap(keypad->mmio_base); 539 + 540 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 541 + release_mem_region(res->start, res_size(res)); 542 + 543 + platform_set_drvdata(pdev, NULL); 544 + kfree(keypad); 545 + return 0; 546 + } 547 + 548 + static struct platform_driver pxa27x_keypad_driver = { 549 + .probe = pxa27x_keypad_probe, 550 + .remove = __devexit_p(pxa27x_keypad_remove), 551 + .suspend = pxa27x_keypad_suspend, 552 + .resume = pxa27x_keypad_resume, 553 + .driver = { 554 + .name = "pxa27x-keypad", 555 + }, 556 + }; 557 + 558 + static int __init pxa27x_keypad_init(void) 559 + { 560 + return platform_driver_register(&pxa27x_keypad_driver); 561 + } 562 + 563 + static void __exit pxa27x_keypad_exit(void) 564 + { 565 + platform_driver_unregister(&pxa27x_keypad_driver); 566 + } 567 + 568 + module_init(pxa27x_keypad_init); 569 + module_exit(pxa27x_keypad_exit); 570 + 571 + MODULE_DESCRIPTION("PXA27x Keypad Controller Driver"); 572 + MODULE_LICENSE("GPL");
+415
drivers/input/keyboard/tosakbd.c
··· 1 + /* 2 + * Keyboard driver for Sharp Tosa models (SL-6000x) 3 + * 4 + * Copyright (c) 2005 Dirk Opfer 5 + * Copyright (c) 2007 Dmitry Baryshkov 6 + * 7 + * Based on xtkbd.c/locomkbd.c/corgikbd.c 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + * 13 + */ 14 + 15 + #include <linux/kernel.h> 16 + #include <linux/module.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/input.h> 19 + #include <linux/delay.h> 20 + #include <linux/interrupt.h> 21 + 22 + #include <asm/arch/gpio.h> 23 + #include <asm/arch/tosa.h> 24 + 25 + #define KB_ROWMASK(r) (1 << (r)) 26 + #define SCANCODE(r, c) (((r)<<4) + (c) + 1) 27 + #define NR_SCANCODES SCANCODE(TOSA_KEY_SENSE_NUM - 1, TOSA_KEY_STROBE_NUM - 1) + 1 28 + 29 + #define SCAN_INTERVAL (HZ/10) 30 + 31 + #define KB_DISCHARGE_DELAY 10 32 + #define KB_ACTIVATE_DELAY 10 33 + 34 + static unsigned int tosakbd_keycode[NR_SCANCODES] = { 35 + 0, 36 + 0, KEY_W, 0, 0, 0, KEY_K, KEY_BACKSPACE, KEY_P, 37 + 0, 0, 0, 0, 0, 0, 0, 0, 38 + KEY_Q, KEY_E, KEY_T, KEY_Y, 0, KEY_O, KEY_I, KEY_COMMA, 39 + 0, 0, 0, 0, 0, 0, 0, 0, 40 + KEY_A, KEY_D, KEY_G, KEY_U, 0, KEY_L, KEY_ENTER, KEY_DOT, 41 + 0, 0, 0, 0, 0, 0, 0, 0, 42 + KEY_Z, KEY_C, KEY_V, KEY_J, TOSA_KEY_ADDRESSBOOK, TOSA_KEY_CANCEL, TOSA_KEY_CENTER, TOSA_KEY_OK, 43 + KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, 0, 44 + KEY_S, KEY_R, KEY_B, KEY_N, TOSA_KEY_CALENDAR, TOSA_KEY_HOMEPAGE, KEY_LEFTCTRL, TOSA_KEY_LIGHT, 45 + 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, 0, 46 + KEY_TAB, KEY_SLASH, KEY_H, KEY_M, TOSA_KEY_MENU, 0, KEY_UP, 0, 47 + 0, 0, TOSA_KEY_FN, 0, 0, 0, 0, 0, 48 + KEY_X, KEY_F, KEY_SPACE, KEY_APOSTROPHE, TOSA_KEY_MAIL, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 49 + 0, 0, 0, 50 + }; 51 + 52 + struct tosakbd { 53 + unsigned int keycode[ARRAY_SIZE(tosakbd_keycode)]; 54 + struct input_dev *input; 55 + 56 + spinlock_t lock; /* protect kbd scanning */ 57 + struct timer_list timer; 58 + }; 59 + 60 + 61 + /* Helper functions for reading the keyboard matrix 62 + * Note: We should really be using pxa_gpio_mode to alter GPDR but it 63 + * requires a function call per GPIO bit which is excessive 64 + * when we need to access 12 bits at once, multiple times. 65 + * These functions must be called within local_irq_save()/local_irq_restore() 66 + * or similar. 67 + */ 68 + #define GET_ROWS_STATUS(c) ((GPLR2 & TOSA_GPIO_ALL_SENSE_BIT) >> TOSA_GPIO_ALL_SENSE_RSHIFT) 69 + 70 + static inline void tosakbd_discharge_all(void) 71 + { 72 + /* STROBE All HiZ */ 73 + GPCR1 = TOSA_GPIO_HIGH_STROBE_BIT; 74 + GPDR1 &= ~TOSA_GPIO_HIGH_STROBE_BIT; 75 + GPCR2 = TOSA_GPIO_LOW_STROBE_BIT; 76 + GPDR2 &= ~TOSA_GPIO_LOW_STROBE_BIT; 77 + } 78 + 79 + static inline void tosakbd_activate_all(void) 80 + { 81 + /* STROBE ALL -> High */ 82 + GPSR1 = TOSA_GPIO_HIGH_STROBE_BIT; 83 + GPDR1 |= TOSA_GPIO_HIGH_STROBE_BIT; 84 + GPSR2 = TOSA_GPIO_LOW_STROBE_BIT; 85 + GPDR2 |= TOSA_GPIO_LOW_STROBE_BIT; 86 + 87 + udelay(KB_DISCHARGE_DELAY); 88 + 89 + /* STATE CLEAR */ 90 + GEDR2 |= TOSA_GPIO_ALL_SENSE_BIT; 91 + } 92 + 93 + static inline void tosakbd_activate_col(int col) 94 + { 95 + if (col <= 5) { 96 + /* STROBE col -> High, not col -> HiZ */ 97 + GPSR1 = TOSA_GPIO_STROBE_BIT(col); 98 + GPDR1 = (GPDR1 & ~TOSA_GPIO_HIGH_STROBE_BIT) | TOSA_GPIO_STROBE_BIT(col); 99 + } else { 100 + /* STROBE col -> High, not col -> HiZ */ 101 + GPSR2 = TOSA_GPIO_STROBE_BIT(col); 102 + GPDR2 = (GPDR2 & ~TOSA_GPIO_LOW_STROBE_BIT) | TOSA_GPIO_STROBE_BIT(col); 103 + } 104 + } 105 + 106 + static inline void tosakbd_reset_col(int col) 107 + { 108 + if (col <= 5) { 109 + /* STROBE col -> Low */ 110 + GPCR1 = TOSA_GPIO_STROBE_BIT(col); 111 + /* STROBE col -> out, not col -> HiZ */ 112 + GPDR1 = (GPDR1 & ~TOSA_GPIO_HIGH_STROBE_BIT) | TOSA_GPIO_STROBE_BIT(col); 113 + } else { 114 + /* STROBE col -> Low */ 115 + GPCR2 = TOSA_GPIO_STROBE_BIT(col); 116 + /* STROBE col -> out, not col -> HiZ */ 117 + GPDR2 = (GPDR2 & ~TOSA_GPIO_LOW_STROBE_BIT) | TOSA_GPIO_STROBE_BIT(col); 118 + } 119 + } 120 + /* 121 + * The tosa keyboard only generates interrupts when a key is pressed. 122 + * So when a key is pressed, we enable a timer. This timer scans the 123 + * keyboard, and this is how we detect when the key is released. 124 + */ 125 + 126 + /* Scan the hardware keyboard and push any changes up through the input layer */ 127 + static void tosakbd_scankeyboard(struct platform_device *dev) 128 + { 129 + struct tosakbd *tosakbd = platform_get_drvdata(dev); 130 + unsigned int row, col, rowd; 131 + unsigned long flags; 132 + unsigned int num_pressed = 0; 133 + 134 + spin_lock_irqsave(&tosakbd->lock, flags); 135 + 136 + for (col = 0; col < TOSA_KEY_STROBE_NUM; col++) { 137 + /* 138 + * Discharge the output driver capacitatance 139 + * in the keyboard matrix. (Yes it is significant..) 140 + */ 141 + tosakbd_discharge_all(); 142 + udelay(KB_DISCHARGE_DELAY); 143 + 144 + tosakbd_activate_col(col); 145 + udelay(KB_ACTIVATE_DELAY); 146 + 147 + rowd = GET_ROWS_STATUS(col); 148 + 149 + for (row = 0; row < TOSA_KEY_SENSE_NUM; row++) { 150 + unsigned int scancode, pressed; 151 + scancode = SCANCODE(row, col); 152 + pressed = rowd & KB_ROWMASK(row); 153 + 154 + if (pressed && !tosakbd->keycode[scancode]) 155 + dev_warn(&dev->dev, 156 + "unhandled scancode: 0x%02x\n", 157 + scancode); 158 + 159 + input_report_key(tosakbd->input, 160 + tosakbd->keycode[scancode], 161 + pressed); 162 + if (pressed) 163 + num_pressed++; 164 + } 165 + 166 + tosakbd_reset_col(col); 167 + } 168 + 169 + tosakbd_activate_all(); 170 + 171 + input_sync(tosakbd->input); 172 + 173 + /* if any keys are pressed, enable the timer */ 174 + if (num_pressed) 175 + mod_timer(&tosakbd->timer, jiffies + SCAN_INTERVAL); 176 + 177 + spin_unlock_irqrestore(&tosakbd->lock, flags); 178 + } 179 + 180 + /* 181 + * tosa keyboard interrupt handler. 182 + */ 183 + static irqreturn_t tosakbd_interrupt(int irq, void *__dev) 184 + { 185 + struct platform_device *dev = __dev; 186 + struct tosakbd *tosakbd = platform_get_drvdata(dev); 187 + 188 + if (!timer_pending(&tosakbd->timer)) { 189 + /** wait chattering delay **/ 190 + udelay(20); 191 + tosakbd_scankeyboard(dev); 192 + } 193 + 194 + return IRQ_HANDLED; 195 + } 196 + 197 + /* 198 + * tosa timer checking for released keys 199 + */ 200 + static void tosakbd_timer_callback(unsigned long __dev) 201 + { 202 + struct platform_device *dev = (struct platform_device *)__dev; 203 + tosakbd_scankeyboard(dev); 204 + } 205 + 206 + #ifdef CONFIG_PM 207 + static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) 208 + { 209 + struct tosakbd *tosakbd = platform_get_drvdata(dev); 210 + 211 + del_timer_sync(&tosakbd->timer); 212 + 213 + return 0; 214 + } 215 + 216 + static int tosakbd_resume(struct platform_device *dev) 217 + { 218 + tosakbd_scankeyboard(dev); 219 + 220 + return 0; 221 + } 222 + #else 223 + #define tosakbd_suspend NULL 224 + #define tosakbd_resume NULL 225 + #endif 226 + 227 + static int __devinit tosakbd_probe(struct platform_device *pdev) { 228 + 229 + int i; 230 + struct tosakbd *tosakbd; 231 + struct input_dev *input_dev; 232 + int error; 233 + 234 + tosakbd = kzalloc(sizeof(struct tosakbd), GFP_KERNEL); 235 + if (!tosakbd) 236 + return -ENOMEM; 237 + 238 + input_dev = input_allocate_device(); 239 + if (!input_dev) { 240 + kfree(tosakbd); 241 + return -ENOMEM; 242 + } 243 + 244 + platform_set_drvdata(pdev, tosakbd); 245 + 246 + spin_lock_init(&tosakbd->lock); 247 + 248 + /* Init Keyboard rescan timer */ 249 + init_timer(&tosakbd->timer); 250 + tosakbd->timer.function = tosakbd_timer_callback; 251 + tosakbd->timer.data = (unsigned long) pdev; 252 + 253 + tosakbd->input = input_dev; 254 + 255 + input_set_drvdata(input_dev, tosakbd); 256 + input_dev->name = "Tosa Keyboard"; 257 + input_dev->phys = "tosakbd/input0"; 258 + input_dev->dev.parent = &pdev->dev; 259 + 260 + input_dev->id.bustype = BUS_HOST; 261 + input_dev->id.vendor = 0x0001; 262 + input_dev->id.product = 0x0001; 263 + input_dev->id.version = 0x0100; 264 + 265 + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 266 + input_dev->keycode = tosakbd->keycode; 267 + input_dev->keycodesize = sizeof(unsigned int); 268 + input_dev->keycodemax = ARRAY_SIZE(tosakbd_keycode); 269 + 270 + memcpy(tosakbd->keycode, tosakbd_keycode, sizeof(tosakbd_keycode)); 271 + 272 + for (i = 0; i < ARRAY_SIZE(tosakbd_keycode); i++) 273 + __set_bit(tosakbd->keycode[i], input_dev->keybit); 274 + clear_bit(0, input_dev->keybit); 275 + 276 + /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */ 277 + for (i = 0; i < TOSA_KEY_SENSE_NUM; i++) { 278 + int gpio = TOSA_GPIO_KEY_SENSE(i); 279 + int irq; 280 + error = gpio_request(gpio, "tosakbd"); 281 + if (error < 0) { 282 + printk(KERN_ERR "tosakbd: failed to request GPIO %d, " 283 + " error %d\n", gpio, error); 284 + goto fail; 285 + } 286 + 287 + error = gpio_direction_input(TOSA_GPIO_KEY_SENSE(i)); 288 + if (error < 0) { 289 + printk(KERN_ERR "tosakbd: failed to configure input" 290 + " direction for GPIO %d, error %d\n", 291 + gpio, error); 292 + gpio_free(gpio); 293 + goto fail; 294 + } 295 + 296 + irq = gpio_to_irq(gpio); 297 + if (irq < 0) { 298 + error = irq; 299 + printk(KERN_ERR "gpio-keys: Unable to get irq number" 300 + " for GPIO %d, error %d\n", 301 + gpio, error); 302 + gpio_free(gpio); 303 + goto fail; 304 + } 305 + 306 + error = request_irq(irq, tosakbd_interrupt, 307 + IRQF_DISABLED | IRQF_TRIGGER_RISING, 308 + "tosakbd", pdev); 309 + 310 + if (error) { 311 + printk("tosakbd: Can't get IRQ: %d: error %d!\n", 312 + irq, error); 313 + gpio_free(gpio); 314 + goto fail; 315 + } 316 + } 317 + 318 + /* Set Strobe lines as outputs - set high */ 319 + for (i = 0; i < TOSA_KEY_STROBE_NUM; i++) { 320 + int gpio = TOSA_GPIO_KEY_STROBE(i); 321 + error = gpio_request(gpio, "tosakbd"); 322 + if (error < 0) { 323 + printk(KERN_ERR "tosakbd: failed to request GPIO %d, " 324 + " error %d\n", gpio, error); 325 + goto fail2; 326 + } 327 + 328 + error = gpio_direction_output(gpio, 1); 329 + if (error < 0) { 330 + printk(KERN_ERR "tosakbd: failed to configure input" 331 + " direction for GPIO %d, error %d\n", 332 + gpio, error); 333 + gpio_free(gpio); 334 + goto fail; 335 + } 336 + 337 + } 338 + 339 + error = input_register_device(input_dev); 340 + if (error) { 341 + printk(KERN_ERR "tosakbd: Unable to register input device, " 342 + "error: %d\n", error); 343 + goto fail; 344 + } 345 + 346 + printk(KERN_INFO "input: Tosa Keyboard Registered\n"); 347 + 348 + return 0; 349 + 350 + fail2: 351 + while (--i >= 0) 352 + gpio_free(TOSA_GPIO_KEY_STROBE(i)); 353 + 354 + i = TOSA_KEY_SENSE_NUM; 355 + fail: 356 + while (--i >= 0) { 357 + free_irq(gpio_to_irq(TOSA_GPIO_KEY_SENSE(i)), pdev); 358 + gpio_free(TOSA_GPIO_KEY_SENSE(i)); 359 + } 360 + 361 + platform_set_drvdata(pdev, NULL); 362 + input_free_device(input_dev); 363 + kfree(tosakbd); 364 + 365 + return error; 366 + } 367 + 368 + static int __devexit tosakbd_remove(struct platform_device *dev) { 369 + 370 + int i; 371 + struct tosakbd *tosakbd = platform_get_drvdata(dev); 372 + 373 + for (i = 0; i < TOSA_KEY_STROBE_NUM; i++) 374 + gpio_free(TOSA_GPIO_KEY_STROBE(i)); 375 + 376 + for (i = 0; i < TOSA_KEY_SENSE_NUM; i++) { 377 + free_irq(gpio_to_irq(TOSA_GPIO_KEY_SENSE(i)), dev); 378 + gpio_free(TOSA_GPIO_KEY_SENSE(i)); 379 + } 380 + 381 + del_timer_sync(&tosakbd->timer); 382 + 383 + input_unregister_device(tosakbd->input); 384 + 385 + kfree(tosakbd); 386 + 387 + return 0; 388 + } 389 + 390 + static struct platform_driver tosakbd_driver = { 391 + .probe = tosakbd_probe, 392 + .remove = __devexit_p(tosakbd_remove), 393 + .suspend = tosakbd_suspend, 394 + .resume = tosakbd_resume, 395 + .driver = { 396 + .name = "tosa-keyboard", 397 + }, 398 + }; 399 + 400 + static int __devinit tosakbd_init(void) 401 + { 402 + return platform_driver_register(&tosakbd_driver); 403 + } 404 + 405 + static void __exit tosakbd_exit(void) 406 + { 407 + platform_driver_unregister(&tosakbd_driver); 408 + } 409 + 410 + module_init(tosakbd_init); 411 + module_exit(tosakbd_exit); 412 + 413 + MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>"); 414 + MODULE_DESCRIPTION("Tosa Keyboard Driver"); 415 + MODULE_LICENSE("GPL v2");
+14
drivers/input/misc/Kconfig
··· 40 40 tristate "M68k Beeper support" 41 41 depends on M68K 42 42 43 + config INPUT_APANEL 44 + tristate "Fujitsu Lifebook Application Panel buttons" 45 + depends on X86 46 + select I2C_I801 47 + select INPUT_POLLDEV 48 + select CHECK_SIGNATURE 49 + help 50 + Say Y here for support of the Application Panel buttons, used on 51 + Fujitsu Lifebook. These are attached to the mainboard through 52 + an SMBus interface managed by the I2C Intel ICH (i801) driver. 53 + 54 + To compile this driver as a module, choose M here: the module will 55 + be called apanel. 56 + 43 57 config INPUT_IXP4XX_BEEPER 44 58 tristate "IXP4XX Beeper support" 45 59 depends on ARCH_IXP4XX
+1
drivers/input/misc/Makefile
··· 18 18 obj-$(CONFIG_INPUT_YEALINK) += yealink.o 19 19 obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 20 20 obj-$(CONFIG_INPUT_UINPUT) += uinput.o 21 + obj-$(CONFIG_INPUT_APANEL) += apanel.o
+378
drivers/input/misc/apanel.c
··· 1 + /* 2 + * Fujitsu Lifebook Application Panel button drive 3 + * 4 + * Copyright (C) 2007 Stephen Hemminger <shemminger@linux-foundation.org> 5 + * Copyright (C) 2001-2003 Jochen Eisinger <jochen@penguin-breeder.org> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License version 2 as published by 9 + * the Free Software Foundation. 10 + * 11 + * Many Fujitsu Lifebook laptops have a small panel of buttons that are 12 + * accessible via the i2c/smbus interface. This driver polls those 13 + * buttons and generates input events. 14 + * 15 + * For more details see: 16 + * http://apanel.sourceforge.net/tech.php 17 + */ 18 + 19 + #include <linux/kernel.h> 20 + #include <linux/module.h> 21 + #include <linux/ioport.h> 22 + #include <linux/io.h> 23 + #include <linux/module.h> 24 + #include <linux/input-polldev.h> 25 + #include <linux/i2c.h> 26 + #include <linux/workqueue.h> 27 + #include <linux/leds.h> 28 + 29 + #define APANEL_NAME "Fujitsu Application Panel" 30 + #define APANEL_VERSION "1.3.1" 31 + #define APANEL "apanel" 32 + 33 + /* How often we poll keys - msecs */ 34 + #define POLL_INTERVAL_DEFAULT 1000 35 + 36 + /* Magic constants in BIOS that tell about buttons */ 37 + enum apanel_devid { 38 + APANEL_DEV_NONE = 0, 39 + APANEL_DEV_APPBTN = 1, 40 + APANEL_DEV_CDBTN = 2, 41 + APANEL_DEV_LCD = 3, 42 + APANEL_DEV_LED = 4, 43 + 44 + APANEL_DEV_MAX, 45 + }; 46 + 47 + enum apanel_chip { 48 + CHIP_NONE = 0, 49 + CHIP_OZ992C = 1, 50 + CHIP_OZ163T = 2, 51 + CHIP_OZ711M3 = 4, 52 + }; 53 + 54 + /* Result of BIOS snooping/probing -- what features are supported */ 55 + static enum apanel_chip device_chip[APANEL_DEV_MAX]; 56 + 57 + #define MAX_PANEL_KEYS 12 58 + 59 + struct apanel { 60 + struct input_polled_dev *ipdev; 61 + struct i2c_client client; 62 + unsigned short keymap[MAX_PANEL_KEYS]; 63 + u16 nkeys; 64 + u16 led_bits; 65 + struct work_struct led_work; 66 + struct led_classdev mail_led; 67 + }; 68 + 69 + 70 + static int apanel_probe(struct i2c_adapter *, int, int); 71 + 72 + /* for now, we only support one address */ 73 + static unsigned short normal_i2c[] = {0, I2C_CLIENT_END}; 74 + static unsigned short ignore = I2C_CLIENT_END; 75 + static struct i2c_client_address_data addr_data = { 76 + .normal_i2c = normal_i2c, 77 + .probe = &ignore, 78 + .ignore = &ignore, 79 + }; 80 + 81 + static void report_key(struct input_dev *input, unsigned keycode) 82 + { 83 + pr_debug(APANEL ": report key %#x\n", keycode); 84 + input_report_key(input, keycode, 1); 85 + input_sync(input); 86 + 87 + input_report_key(input, keycode, 0); 88 + input_sync(input); 89 + } 90 + 91 + /* Poll for key changes 92 + * 93 + * Read Application keys via SMI 94 + * A (0x4), B (0x8), Internet (0x2), Email (0x1). 95 + * 96 + * CD keys: 97 + * Forward (0x100), Rewind (0x200), Stop (0x400), Pause (0x800) 98 + */ 99 + static void apanel_poll(struct input_polled_dev *ipdev) 100 + { 101 + struct apanel *ap = ipdev->private; 102 + struct input_dev *idev = ipdev->input; 103 + u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; 104 + s32 data; 105 + int i; 106 + 107 + data = i2c_smbus_read_word_data(&ap->client, cmd); 108 + if (data < 0) 109 + return; /* ignore errors (due to ACPI??) */ 110 + 111 + /* write back to clear latch */ 112 + i2c_smbus_write_word_data(&ap->client, cmd, 0); 113 + 114 + if (!data) 115 + return; 116 + 117 + dev_dbg(&idev->dev, APANEL ": data %#x\n", data); 118 + for (i = 0; i < idev->keycodemax; i++) 119 + if ((1u << i) & data) 120 + report_key(idev, ap->keymap[i]); 121 + } 122 + 123 + /* Track state changes of LED */ 124 + static void led_update(struct work_struct *work) 125 + { 126 + struct apanel *ap = container_of(work, struct apanel, led_work); 127 + 128 + i2c_smbus_write_word_data(&ap->client, 0x10, ap->led_bits); 129 + } 130 + 131 + static void mail_led_set(struct led_classdev *led, 132 + enum led_brightness value) 133 + { 134 + struct apanel *ap = container_of(led, struct apanel, mail_led); 135 + 136 + if (value != LED_OFF) 137 + ap->led_bits |= 0x8000; 138 + else 139 + ap->led_bits &= ~0x8000; 140 + 141 + schedule_work(&ap->led_work); 142 + } 143 + 144 + static int apanel_detach_client(struct i2c_client *client) 145 + { 146 + struct apanel *ap = i2c_get_clientdata(client); 147 + 148 + if (device_chip[APANEL_DEV_LED] != CHIP_NONE) 149 + led_classdev_unregister(&ap->mail_led); 150 + 151 + input_unregister_polled_device(ap->ipdev); 152 + i2c_detach_client(&ap->client); 153 + input_free_polled_device(ap->ipdev); 154 + 155 + return 0; 156 + } 157 + 158 + /* Function is invoked for every i2c adapter. */ 159 + static int apanel_attach_adapter(struct i2c_adapter *adap) 160 + { 161 + dev_dbg(&adap->dev, APANEL ": attach adapter id=%d\n", adap->id); 162 + 163 + /* Our device is connected only to i801 on laptop */ 164 + if (adap->id != I2C_HW_SMBUS_I801) 165 + return -ENODEV; 166 + 167 + return i2c_probe(adap, &addr_data, apanel_probe); 168 + } 169 + 170 + static void apanel_shutdown(struct i2c_client *client) 171 + { 172 + apanel_detach_client(client); 173 + } 174 + 175 + static struct i2c_driver apanel_driver = { 176 + .driver = { 177 + .name = APANEL, 178 + }, 179 + .attach_adapter = &apanel_attach_adapter, 180 + .detach_client = &apanel_detach_client, 181 + .shutdown = &apanel_shutdown, 182 + }; 183 + 184 + static struct apanel apanel = { 185 + .client = { 186 + .driver = &apanel_driver, 187 + .name = APANEL, 188 + }, 189 + .keymap = { 190 + [0] = KEY_MAIL, 191 + [1] = KEY_WWW, 192 + [2] = KEY_PROG2, 193 + [3] = KEY_PROG1, 194 + 195 + [8] = KEY_FORWARD, 196 + [9] = KEY_REWIND, 197 + [10] = KEY_STOPCD, 198 + [11] = KEY_PLAYPAUSE, 199 + 200 + }, 201 + .mail_led = { 202 + .name = "mail:blue", 203 + .brightness_set = mail_led_set, 204 + }, 205 + }; 206 + 207 + /* NB: Only one panel on the i2c. */ 208 + static int apanel_probe(struct i2c_adapter *bus, int address, int kind) 209 + { 210 + struct apanel *ap; 211 + struct input_polled_dev *ipdev; 212 + struct input_dev *idev; 213 + u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; 214 + int i, err = -ENOMEM; 215 + 216 + dev_dbg(&bus->dev, APANEL ": probe adapter %p addr %d kind %d\n", 217 + bus, address, kind); 218 + 219 + ap = &apanel; 220 + 221 + ipdev = input_allocate_polled_device(); 222 + if (!ipdev) 223 + goto out1; 224 + 225 + ap->ipdev = ipdev; 226 + ap->client.adapter = bus; 227 + ap->client.addr = address; 228 + 229 + i2c_set_clientdata(&ap->client, ap); 230 + 231 + err = i2c_attach_client(&ap->client); 232 + if (err) 233 + goto out2; 234 + 235 + err = i2c_smbus_write_word_data(&ap->client, cmd, 0); 236 + if (err) { 237 + dev_warn(&ap->client.dev, APANEL ": smbus write error %d\n", 238 + err); 239 + goto out3; 240 + } 241 + 242 + ipdev->poll = apanel_poll; 243 + ipdev->poll_interval = POLL_INTERVAL_DEFAULT; 244 + ipdev->private = ap; 245 + 246 + idev = ipdev->input; 247 + idev->name = APANEL_NAME " buttons"; 248 + idev->phys = "apanel/input0"; 249 + idev->id.bustype = BUS_HOST; 250 + idev->dev.parent = &ap->client.dev; 251 + 252 + set_bit(EV_KEY, idev->evbit); 253 + 254 + idev->keycode = ap->keymap; 255 + idev->keycodesize = sizeof(ap->keymap[0]); 256 + idev->keycodemax = (device_chip[APANEL_DEV_CDBTN] != CHIP_NONE) ? 12 : 4; 257 + 258 + for (i = 0; i < idev->keycodemax; i++) 259 + if (ap->keymap[i]) 260 + set_bit(ap->keymap[i], idev->keybit); 261 + 262 + err = input_register_polled_device(ipdev); 263 + if (err) 264 + goto out3; 265 + 266 + INIT_WORK(&ap->led_work, led_update); 267 + if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { 268 + err = led_classdev_register(&ap->client.dev, &ap->mail_led); 269 + if (err) 270 + goto out4; 271 + } 272 + 273 + return 0; 274 + out4: 275 + input_unregister_polled_device(ipdev); 276 + out3: 277 + i2c_detach_client(&ap->client); 278 + out2: 279 + input_free_polled_device(ipdev); 280 + out1: 281 + return err; 282 + } 283 + 284 + /* Scan the system ROM for the signature "FJKEYINF" */ 285 + static __init const void __iomem *bios_signature(const void __iomem *bios) 286 + { 287 + ssize_t offset; 288 + const unsigned char signature[] = "FJKEYINF"; 289 + 290 + for (offset = 0; offset < 0x10000; offset += 0x10) { 291 + if (check_signature(bios + offset, signature, 292 + sizeof(signature)-1)) 293 + return bios + offset; 294 + } 295 + pr_notice(APANEL ": Fujitsu BIOS signature '%s' not found...\n", 296 + signature); 297 + return NULL; 298 + } 299 + 300 + static int __init apanel_init(void) 301 + { 302 + void __iomem *bios; 303 + const void __iomem *p; 304 + u8 devno; 305 + int found = 0; 306 + 307 + bios = ioremap(0xF0000, 0x10000); /* Can't fail */ 308 + 309 + p = bios_signature(bios); 310 + if (!p) { 311 + iounmap(bios); 312 + return -ENODEV; 313 + } 314 + 315 + /* just use the first address */ 316 + p += 8; 317 + normal_i2c[0] = readb(p+3) >> 1; 318 + 319 + for ( ; (devno = readb(p)) & 0x7f; p += 4) { 320 + unsigned char method, slave, chip; 321 + 322 + method = readb(p + 1); 323 + chip = readb(p + 2); 324 + slave = readb(p + 3) >> 1; 325 + 326 + if (slave != normal_i2c[0]) { 327 + pr_notice(APANEL ": only one SMBus slave " 328 + "address supported, skiping device...\n"); 329 + continue; 330 + } 331 + 332 + /* translate alternative device numbers */ 333 + switch (devno) { 334 + case 6: 335 + devno = APANEL_DEV_APPBTN; 336 + break; 337 + case 7: 338 + devno = APANEL_DEV_LED; 339 + break; 340 + } 341 + 342 + if (devno >= APANEL_DEV_MAX) 343 + pr_notice(APANEL ": unknown device %u found\n", devno); 344 + else if (device_chip[devno] != CHIP_NONE) 345 + pr_warning(APANEL ": duplicate entry for devno %u\n", devno); 346 + 347 + else if (method != 1 && method != 2 && method != 4) { 348 + pr_notice(APANEL ": unknown method %u for devno %u\n", 349 + method, devno); 350 + } else { 351 + device_chip[devno] = (enum apanel_chip) chip; 352 + ++found; 353 + } 354 + } 355 + iounmap(bios); 356 + 357 + if (found == 0) { 358 + pr_info(APANEL ": no input devices reported by BIOS\n"); 359 + return -EIO; 360 + } 361 + 362 + return i2c_add_driver(&apanel_driver); 363 + } 364 + module_init(apanel_init); 365 + 366 + static void __exit apanel_cleanup(void) 367 + { 368 + i2c_del_driver(&apanel_driver); 369 + } 370 + module_exit(apanel_cleanup); 371 + 372 + MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>"); 373 + MODULE_DESCRIPTION(APANEL_NAME " driver"); 374 + MODULE_LICENSE("GPL"); 375 + MODULE_VERSION(APANEL_VERSION); 376 + 377 + MODULE_ALIAS("dmi:*:svnFUJITSU:pnLifeBook*:pvr*:rvnFUJITSU:*"); 378 + MODULE_ALIAS("dmi:*:svnFUJITSU:pnLifebook*:pvr*:rvnFUJITSU:*");
-1
drivers/input/misc/ati_remote.c
··· 90 90 #include <linux/init.h> 91 91 #include <linux/slab.h> 92 92 #include <linux/module.h> 93 - #include <linux/moduleparam.h> 94 93 #include <linux/usb/input.h> 95 94 #include <linux/wait.h> 96 95 #include <linux/jiffies.h>
+22 -15
drivers/input/misc/atlas_btns.c
··· 29 29 #include <asm/uaccess.h> 30 30 #include <acpi/acpi_drivers.h> 31 31 32 - #define ACPI_ATLAS_NAME "Atlas ACPI" 33 - #define ACPI_ATLAS_CLASS "Atlas" 32 + #define ACPI_ATLAS_NAME "Atlas ACPI" 33 + #define ACPI_ATLAS_CLASS "Atlas" 34 34 35 + static unsigned short atlas_keymap[16]; 35 36 static struct input_dev *input_dev; 36 37 37 38 /* button handling code */ ··· 51 50 void *handler_context, void *region_context) 52 51 { 53 52 acpi_status status; 54 - int keycode; 55 53 56 54 if (function == ACPI_WRITE) { 57 - keycode = KEY_F1 + (address & 0x0F); 58 - input_report_key(input_dev, keycode, !(address & 0x10)); 55 + int code = address & 0x0f; 56 + int key_down = !(address & 0x10); 57 + 58 + input_event(input_dev, EV_MSC, MSC_SCAN, code); 59 + input_report_key(input_dev, atlas_keymap[code], key_down); 59 60 input_sync(input_dev); 61 + 60 62 status = 0; 61 63 } else { 62 64 printk(KERN_WARNING "atlas: shrugged on unexpected function" ··· 74 70 static int atlas_acpi_button_add(struct acpi_device *device) 75 71 { 76 72 acpi_status status; 73 + int i; 77 74 int err; 78 75 79 76 input_dev = input_allocate_device(); ··· 86 81 input_dev->name = "Atlas ACPI button driver"; 87 82 input_dev->phys = "ASIM0000/atlas/input0"; 88 83 input_dev->id.bustype = BUS_HOST; 89 - input_dev->evbit[BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY); 84 + input_dev->keycode = atlas_keymap; 85 + input_dev->keycodesize = sizeof(unsigned short); 86 + input_dev->keycodemax = ARRAY_SIZE(atlas_keymap); 90 87 91 - set_bit(KEY_F1, input_dev->keybit); 92 - set_bit(KEY_F2, input_dev->keybit); 93 - set_bit(KEY_F3, input_dev->keybit); 94 - set_bit(KEY_F4, input_dev->keybit); 95 - set_bit(KEY_F5, input_dev->keybit); 96 - set_bit(KEY_F6, input_dev->keybit); 97 - set_bit(KEY_F7, input_dev->keybit); 98 - set_bit(KEY_F8, input_dev->keybit); 99 - set_bit(KEY_F9, input_dev->keybit); 88 + input_set_capability(input_dev, EV_MSC, MSC_SCAN); 89 + __set_bit(EV_KEY, input_dev->evbit); 90 + for (i = 0; i < ARRAY_SIZE(atlas_keymap); i++) { 91 + if (i < 9) { 92 + atlas_keymap[i] = KEY_F1 + i; 93 + __set_bit(KEY_F1 + i, input_dev->keybit); 94 + } else 95 + atlas_keymap[i] = KEY_RESERVED; 96 + } 100 97 101 98 err = input_register_device(input_dev); 102 99 if (err) {
+37 -38
drivers/input/misc/cobalt_btns.c
··· 27 27 #define BUTTONS_COUNT_THRESHOLD 3 28 28 #define BUTTONS_STATUS_MASK 0xfe000000 29 29 30 + static const unsigned short cobalt_map[] = { 31 + KEY_RESERVED, 32 + KEY_RESTART, 33 + KEY_LEFT, 34 + KEY_UP, 35 + KEY_DOWN, 36 + KEY_RIGHT, 37 + KEY_ENTER, 38 + KEY_SELECT 39 + }; 40 + 30 41 struct buttons_dev { 31 42 struct input_polled_dev *poll_dev; 43 + unsigned short keymap[ARRAY_SIZE(cobalt_map)]; 44 + int count[ARRAY_SIZE(cobalt_map)]; 32 45 void __iomem *reg; 33 - }; 34 - 35 - struct buttons_map { 36 - uint32_t mask; 37 - int keycode; 38 - int count; 39 - }; 40 - 41 - static struct buttons_map buttons_map[] = { 42 - { 0x02000000, KEY_RESTART, }, 43 - { 0x04000000, KEY_LEFT, }, 44 - { 0x08000000, KEY_UP, }, 45 - { 0x10000000, KEY_DOWN, }, 46 - { 0x20000000, KEY_RIGHT, }, 47 - { 0x40000000, KEY_ENTER, }, 48 - { 0x80000000, KEY_SELECT, }, 49 46 }; 50 47 51 48 static void handle_buttons(struct input_polled_dev *dev) 52 49 { 53 - struct buttons_map *button = buttons_map; 54 50 struct buttons_dev *bdev = dev->private; 55 51 struct input_dev *input = dev->input; 56 52 uint32_t status; 57 53 int i; 58 54 59 - status = readl(bdev->reg); 60 - status = ~status & BUTTONS_STATUS_MASK; 55 + status = ~readl(bdev->reg) >> 24; 61 56 62 - for (i = 0; i < ARRAY_SIZE(buttons_map); i++) { 63 - if (status & button->mask) { 64 - button->count++; 65 - } else { 66 - if (button->count >= BUTTONS_COUNT_THRESHOLD) { 67 - input_report_key(input, button->keycode, 0); 57 + for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) { 58 + if (status & (1UL << i)) { 59 + if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) { 60 + input_event(input, EV_MSC, MSC_SCAN, i); 61 + input_report_key(input, bdev->keymap[i], 1); 68 62 input_sync(input); 69 63 } 70 - button->count = 0; 64 + } else { 65 + if (bdev->count[i] >= BUTTONS_COUNT_THRESHOLD) { 66 + input_event(input, EV_MSC, MSC_SCAN, i); 67 + input_report_key(input, bdev->keymap[i], 0); 68 + input_sync(input); 69 + } 70 + bdev->count[i] = 0; 71 71 } 72 - 73 - if (button->count == BUTTONS_COUNT_THRESHOLD) { 74 - input_report_key(input, button->keycode, 1); 75 - input_sync(input); 76 - } 77 - 78 - button++; 79 72 } 80 73 } 81 74 ··· 87 94 goto err_free_mem; 88 95 } 89 96 97 + memcpy(bdev->keymap, cobalt_map, sizeof(bdev->keymap)); 98 + 90 99 poll_dev->private = bdev; 91 100 poll_dev->poll = handle_buttons; 92 101 poll_dev->poll_interval = BUTTONS_POLL_INTERVAL; ··· 99 104 input->id.bustype = BUS_HOST; 100 105 input->cdev.dev = &pdev->dev; 101 106 102 - input->evbit[0] = BIT_MASK(EV_KEY); 103 - for (i = 0; i < ARRAY_SIZE(buttons_map); i++) { 104 - set_bit(buttons_map[i].keycode, input->keybit); 105 - buttons_map[i].count = 0; 106 - } 107 + input->keycode = pdev->keymap; 108 + input->keycodemax = ARRAY_SIZE(pdev->keymap); 109 + input->keycodesize = sizeof(unsigned short); 110 + 111 + input_set_capability(input, EV_MSC, MSC_SCAN); 112 + __set_bit(EV_KEY, input->evbit); 113 + for (i = 0; i < ARRAY_SIZE(buttons_map); i++) 114 + __set_bit(input->keycode[i], input->keybit); 115 + __clear_bit(KEY_RESERVED, input->keybit); 107 116 108 117 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 109 118 if (!res) {
+67 -52
drivers/input/misc/keyspan_remote.c
··· 16 16 #include <linux/init.h> 17 17 #include <linux/slab.h> 18 18 #include <linux/module.h> 19 - #include <linux/moduleparam.h> 20 19 #include <linux/usb/input.h> 21 20 22 21 #define DRIVER_VERSION "v0.1" ··· 45 46 46 47 #define RECV_SIZE 8 /* The UIA-11 type have a 8 byte limit. */ 47 48 48 - /* table of devices that work with this driver */ 49 - static struct usb_device_id keyspan_table[] = { 50 - { USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) }, 51 - { } /* Terminating entry */ 52 - }; 53 - 54 - /* Structure to store all the real stuff that a remote sends to us. */ 55 - struct keyspan_message { 56 - u16 system; 57 - u8 button; 58 - u8 toggle; 59 - }; 60 - 61 - /* Structure used for all the bit testing magic needed to be done. */ 62 - struct bit_tester { 63 - u32 tester; 64 - int len; 65 - int pos; 66 - int bits_left; 67 - u8 buffer[32]; 68 - }; 69 - 70 - /* Structure to hold all of our driver specific stuff */ 71 - struct usb_keyspan { 72 - char name[128]; 73 - char phys[64]; 74 - struct usb_device* udev; 75 - struct input_dev *input; 76 - struct usb_interface* interface; 77 - struct usb_endpoint_descriptor* in_endpoint; 78 - struct urb* irq_urb; 79 - int open; 80 - dma_addr_t in_dma; 81 - unsigned char* in_buffer; 82 - 83 - /* variables used to parse messages from remote. */ 84 - struct bit_tester data; 85 - int stage; 86 - int toggle; 87 - }; 88 - 89 49 /* 90 50 * Table that maps the 31 possible keycodes to input keys. 91 51 * Currently there are 15 and 17 button models so RESERVED codes 92 52 * are blank areas in the mapping. 93 53 */ 94 - static const int keyspan_key_table[] = { 54 + static const unsigned short keyspan_key_table[] = { 95 55 KEY_RESERVED, /* 0 is just a place holder. */ 96 56 KEY_RESERVED, 97 57 KEY_STOP, ··· 83 125 KEY_KPASTERISK, 84 126 KEY_RESERVED, 85 127 KEY_MENU 128 + }; 129 + 130 + /* table of devices that work with this driver */ 131 + static struct usb_device_id keyspan_table[] = { 132 + { USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) }, 133 + { } /* Terminating entry */ 134 + }; 135 + 136 + /* Structure to store all the real stuff that a remote sends to us. */ 137 + struct keyspan_message { 138 + u16 system; 139 + u8 button; 140 + u8 toggle; 141 + }; 142 + 143 + /* Structure used for all the bit testing magic needed to be done. */ 144 + struct bit_tester { 145 + u32 tester; 146 + int len; 147 + int pos; 148 + int bits_left; 149 + u8 buffer[32]; 150 + }; 151 + 152 + /* Structure to hold all of our driver specific stuff */ 153 + struct usb_keyspan { 154 + char name[128]; 155 + char phys[64]; 156 + unsigned short keymap[ARRAY_SIZE(keyspan_key_table)]; 157 + struct usb_device *udev; 158 + struct input_dev *input; 159 + struct usb_interface *interface; 160 + struct usb_endpoint_descriptor *in_endpoint; 161 + struct urb* irq_urb; 162 + int open; 163 + dma_addr_t in_dma; 164 + unsigned char *in_buffer; 165 + 166 + /* variables used to parse messages from remote. */ 167 + struct bit_tester data; 168 + int stage; 169 + int toggle; 86 170 }; 87 171 88 172 static struct usb_driver keyspan_driver; ··· 171 171 } 172 172 173 173 return 0; 174 + } 175 + 176 + static void keyspan_report_button(struct usb_keyspan *remote, int button, int press) 177 + { 178 + struct input_dev *input = remote->input; 179 + 180 + input_event(input, EV_MSC, MSC_SCAN, button); 181 + input_report_key(input, remote->keymap[button], press); 182 + input_sync(input); 174 183 } 175 184 176 185 /* ··· 320 311 __FUNCTION__, message.system, message.button, message.toggle); 321 312 322 313 if (message.toggle != remote->toggle) { 323 - input_report_key(remote->input, keyspan_key_table[message.button], 1); 324 - input_report_key(remote->input, keyspan_key_table[message.button], 0); 325 - input_sync(remote->input); 314 + keyspan_report_button(remote, message.button, 1); 315 + keyspan_report_button(remote, message.button, 0); 326 316 remote->toggle = message.toggle; 327 317 } 328 318 ··· 499 491 500 492 usb_make_path(udev, remote->phys, sizeof(remote->phys)); 501 493 strlcat(remote->phys, "/input0", sizeof(remote->phys)); 494 + memcpy(remote->keymap, keyspan_key_table, sizeof(remote->keymap)); 502 495 503 496 input_dev->name = remote->name; 504 497 input_dev->phys = remote->phys; 505 498 usb_to_input_id(udev, &input_dev->id); 506 499 input_dev->dev.parent = &interface->dev; 500 + input_dev->keycode = remote->keymap; 501 + input_dev->keycodesize = sizeof(unsigned short); 502 + input_dev->keycodemax = ARRAY_SIZE(remote->keymap); 507 503 508 - input_dev->evbit[0] = BIT_MASK(EV_KEY); /* We will only report KEY events. */ 504 + input_set_capability(input_dev, EV_MSC, MSC_SCAN); 505 + __set_bit(EV_KEY, input_dev->evbit); 509 506 for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++) 510 - if (keyspan_key_table[i] != KEY_RESERVED) 511 - set_bit(keyspan_key_table[i], input_dev->keybit); 507 + __set_bit(keyspan_key_table[i], input_dev->keybit); 508 + __clear_bit(KEY_RESERVED, input_dev->keybit); 512 509 513 510 input_set_drvdata(input_dev, remote); 514 511 ··· 521 508 input_dev->close = keyspan_close; 522 509 523 510 /* 524 - * Initialize the URB to access the device. The urb gets sent to the device in keyspan_open() 511 + * Initialize the URB to access the device. 512 + * The urb gets sent to the device in keyspan_open() 525 513 */ 526 514 usb_fill_int_urb(remote->irq_urb, 527 - remote->udev, usb_rcvintpipe(remote->udev, remote->in_endpoint->bEndpointAddress), 515 + remote->udev, 516 + usb_rcvintpipe(remote->udev, endpoint->bEndpointAddress), 528 517 remote->in_buffer, RECV_SIZE, keyspan_irq_recv, remote, 529 - remote->in_endpoint->bInterval); 518 + endpoint->bInterval); 530 519 remote->irq_urb->transfer_dma = remote->in_dma; 531 520 remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 532 521
-1
drivers/input/mouse/inport.c
··· 35 35 */ 36 36 37 37 #include <linux/module.h> 38 - #include <linux/moduleparam.h> 39 38 #include <linux/ioport.h> 40 39 #include <linux/init.h> 41 40 #include <linux/interrupt.h>
-1
drivers/input/mouse/logibm.c
··· 36 36 */ 37 37 38 38 #include <linux/module.h> 39 - #include <linux/moduleparam.h> 40 39 #include <linux/delay.h> 41 40 #include <linux/ioport.h> 42 41 #include <linux/init.h>
-1
drivers/input/mouse/psmouse-base.c
··· 13 13 14 14 #include <linux/delay.h> 15 15 #include <linux/module.h> 16 - #include <linux/moduleparam.h> 17 16 #include <linux/slab.h> 18 17 #include <linux/interrupt.h> 19 18 #include <linux/input.h>
-1
drivers/input/mouse/trackpoint.c
··· 11 11 #include <linux/delay.h> 12 12 #include <linux/serio.h> 13 13 #include <linux/module.h> 14 - #include <linux/moduleparam.h> 15 14 #include <linux/input.h> 16 15 #include <linux/libps2.h> 17 16 #include <linux/proc_fs.h>
+1 -2
drivers/input/mousedev.c
··· 16 16 #include <linux/slab.h> 17 17 #include <linux/poll.h> 18 18 #include <linux/module.h> 19 - #include <linux/moduleparam.h> 20 19 #include <linux/init.h> 21 20 #include <linux/input.h> 22 21 #include <linux/random.h> ··· 1032 1033 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 1033 1034 INPUT_DEVICE_ID_MATCH_KEYBIT | 1034 1035 INPUT_DEVICE_ID_MATCH_ABSBIT, 1035 - .evbit = { BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_SYN) }, 1036 + .evbit = { BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) }, 1036 1037 .keybit = { [BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) }, 1037 1038 .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) }, 1038 1039 }, /* Mouse-like device with absolute X and Y but ordinary
+65 -2
drivers/input/serio/i8042-x86ia64io.h
··· 63 63 outb(val, I8042_COMMAND_REG); 64 64 } 65 65 66 - #if defined(__i386__) 66 + #if defined(__i386__) || defined(__x86_64__) 67 67 68 68 #include <linux/dmi.h> 69 69 ··· 186 186 }, 187 187 }, 188 188 { 189 + .ident = "Fujitsu-Siemens Amilo Pro 2010", 190 + .matches = { 191 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 192 + DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"), 193 + }, 194 + }, 195 + { 189 196 /* 190 197 * No data is coming from the touchscreen unless KBC 191 198 * is in legacy mode. ··· 283 276 284 277 285 278 #endif 279 + 280 + #ifdef CONFIG_X86 281 + 282 + #include <linux/dmi.h> 283 + 284 + /* 285 + * Some Wistron based laptops need us to explicitly enable the 'Dritek 286 + * keyboard extension' to make their extra keys start generating scancodes. 287 + * Originally, this was just confined to older laptops, but a few Acer laptops 288 + * have turned up in 2007 that also need this again. 289 + */ 290 + static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { 291 + { 292 + .ident = "Acer Aspire 5630", 293 + .matches = { 294 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 295 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"), 296 + }, 297 + }, 298 + { 299 + .ident = "Acer Aspire 5650", 300 + .matches = { 301 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 302 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"), 303 + }, 304 + }, 305 + { 306 + .ident = "Acer Aspire 5680", 307 + .matches = { 308 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 309 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"), 310 + }, 311 + }, 312 + { 313 + .ident = "Acer Aspire 9110", 314 + .matches = { 315 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 316 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"), 317 + }, 318 + }, 319 + { 320 + .ident = "Acer TravelMate 2490", 321 + .matches = { 322 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 323 + DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"), 324 + }, 325 + }, 326 + { } 327 + }; 328 + 329 + #endif /* CONFIG_X86 */ 286 330 287 331 288 332 #ifdef CONFIG_PNP ··· 570 512 i8042_reset = 1; 571 513 #endif 572 514 573 - #if defined(__i386__) 515 + #if defined(__i386__) || defined(__x86_64__) 574 516 if (dmi_check_system(i8042_dmi_noloop_table)) 575 517 i8042_noloop = 1; 576 518 577 519 if (dmi_check_system(i8042_dmi_nomux_table)) 578 520 i8042_nomux = 1; 579 521 #endif 522 + 523 + #ifdef CONFIG_X86 524 + if (dmi_check_system(i8042_dmi_dritek_table)) 525 + i8042_dritek = 1; 526 + #endif /* CONFIG_X86 */ 580 527 581 528 return retval; 582 529 }
+23 -3
drivers/input/serio/i8042.c
··· 12 12 13 13 #include <linux/delay.h> 14 14 #include <linux/module.h> 15 - #include <linux/moduleparam.h> 16 15 #include <linux/interrupt.h> 17 16 #include <linux/ioport.h> 18 17 #include <linux/init.h> ··· 62 63 static unsigned int i8042_blink_frequency = 500; 63 64 module_param_named(panicblink, i8042_blink_frequency, uint, 0600); 64 65 MODULE_PARM_DESC(panicblink, "Frequency with which keyboard LEDs should blink when kernel panics"); 66 + 67 + #ifdef CONFIG_X86 68 + static unsigned int i8042_dritek; 69 + module_param_named(dritek, i8042_dritek, bool, 0); 70 + MODULE_PARM_DESC(dritek, "Force enable the Dritek keyboard extension"); 71 + #endif 65 72 66 73 #ifdef CONFIG_PNP 67 74 static int i8042_nopnp; ··· 285 280 struct i8042_port *port = serio->port_data; 286 281 287 282 port->exists = 0; 288 - synchronize_sched(); 283 + 284 + /* 285 + * We synchronize with both AUX and KBD IRQs because there is 286 + * a (very unlikely) chance that AUX IRQ is raised for KBD port 287 + * and vice versa. 288 + */ 289 + synchronize_irq(I8042_AUX_IRQ); 290 + synchronize_irq(I8042_KBD_IRQ); 289 291 port->serio = NULL; 290 292 } 291 293 ··· 1151 1139 static int __devinit i8042_probe(struct platform_device *dev) 1152 1140 { 1153 1141 int error; 1142 + char param; 1154 1143 1155 1144 error = i8042_controller_selftest(); 1156 1145 if (error) ··· 1172 1159 if (error) 1173 1160 goto out_fail; 1174 1161 } 1175 - 1162 + #ifdef CONFIG_X86 1163 + if (i8042_dritek) { 1164 + param = 0x90; 1165 + error = i8042_command(&param, 0x1059); 1166 + if (error) 1167 + goto out_fail; 1168 + } 1169 + #endif 1176 1170 /* 1177 1171 * Ok, everything is ready, let's register all serio ports 1178 1172 */
-1
drivers/input/serio/libps2.c
··· 13 13 14 14 #include <linux/delay.h> 15 15 #include <linux/module.h> 16 - #include <linux/moduleparam.h> 17 16 #include <linux/slab.h> 18 17 #include <linux/interrupt.h> 19 18 #include <linux/input.h>
+4 -4
drivers/input/touchscreen/ads7846.c
··· 116 116 // FIXME remove "irq_disabled" 117 117 unsigned irq_disabled:1; /* P: lock */ 118 118 unsigned disabled:1; 119 + unsigned is_suspended:1; 119 120 120 121 int (*filter)(void *data, int data_idx, int *val); 121 122 void *filter_data; ··· 204 203 static int device_suspended(struct device *dev) 205 204 { 206 205 struct ads7846 *ts = dev_get_drvdata(dev); 207 - return dev->power.power_state.event != PM_EVENT_ON || ts->disabled; 206 + return ts->is_suspended || ts->disabled; 208 207 } 209 208 210 209 static int ads7846_read12_ser(struct device *dev, unsigned command) ··· 795 794 796 795 spin_lock_irq(&ts->lock); 797 796 798 - spi->dev.power.power_state = message; 797 + ts->is_suspended = 1; 799 798 ads7846_disable(ts); 800 799 801 800 spin_unlock_irq(&ts->lock); ··· 810 809 811 810 spin_lock_irq(&ts->lock); 812 811 813 - spi->dev.power.power_state = PMSG_ON; 812 + ts->is_suspended = 0; 814 813 ads7846_enable(ts); 815 814 816 815 spin_unlock_irq(&ts->lock); ··· 872 871 } 873 872 874 873 dev_set_drvdata(&spi->dev, ts); 875 - spi->dev.power.power_state = PMSG_ON; 876 874 877 875 ts->spi = spi; 878 876 ts->input = input_dev;
-1
drivers/input/touchscreen/mk712.c
··· 36 36 */ 37 37 38 38 #include <linux/module.h> 39 - #include <linux/moduleparam.h> 40 39 #include <linux/kernel.h> 41 40 #include <linux/init.h> 42 41 #include <linux/errno.h>
-1
drivers/input/touchscreen/ucb1400_ts.c
··· 15 15 */ 16 16 17 17 #include <linux/module.h> 18 - #include <linux/moduleparam.h> 19 18 #include <linux/init.h> 20 19 #include <linux/completion.h> 21 20 #include <linux/delay.h>
-2
drivers/media/video/usbvideo/konicawc.c
··· 241 241 input_dev->evbit[0] = BIT_MASK(EV_KEY); 242 242 input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); 243 243 244 - input_dev->private = cam; 245 - 246 244 error = input_register_device(cam->input); 247 245 if (error) { 248 246 warn("Failed to register camera's input device, err: %d\n",
-2
drivers/media/video/usbvideo/quickcam_messenger.c
··· 105 105 input_dev->evbit[0] = BIT_MASK(EV_KEY); 106 106 input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); 107 107 108 - input_dev->private = cam; 109 - 110 108 error = input_register_device(cam->input); 111 109 if (error) { 112 110 warn("Failed to register camera's input device, err: %d\n",
-13
include/asm-arm/arch-pxa/pxa27x_keyboard.h
··· 1 - #define PXAKBD_MAXROW 8 2 - #define PXAKBD_MAXCOL 8 3 - 4 - struct pxa27x_keyboard_platform_data { 5 - int nr_rows, nr_cols; 6 - int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL]; 7 - int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL]; 8 - 9 - #ifdef CONFIG_PM 10 - u32 reg_kpc; 11 - u32 reg_kprec; 12 - #endif 13 - };
+56
include/asm-arm/arch-pxa/pxa27x_keypad.h
··· 1 + #ifndef __ASM_ARCH_PXA27x_KEYPAD_H 2 + #define __ASM_ARCH_PXA27x_KEYPAD_H 3 + 4 + #include <linux/input.h> 5 + 6 + #define MAX_MATRIX_KEY_ROWS (8) 7 + #define MAX_MATRIX_KEY_COLS (8) 8 + 9 + /* pxa3xx keypad platform specific parameters 10 + * 11 + * NOTE: 12 + * 1. direct_key_num indicates the number of keys in the direct keypad 13 + * _plus_ the number of rotary-encoder sensor inputs, this can be 14 + * left as 0 if only rotary encoders are enabled, the driver will 15 + * automatically calculate this 16 + * 17 + * 2. direct_key_map is the key code map for the direct keys, if rotary 18 + * encoder(s) are enabled, direct key 0/1(2/3) will be ignored 19 + * 20 + * 3. rotary can be either interpreted as a relative input event (e.g. 21 + * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT) 22 + * 23 + * 4. matrix key and direct key will use the same debounce_interval by 24 + * default, which should be sufficient in most cases 25 + */ 26 + struct pxa27x_keypad_platform_data { 27 + 28 + /* code map for the matrix keys */ 29 + unsigned int matrix_key_rows; 30 + unsigned int matrix_key_cols; 31 + unsigned int *matrix_key_map; 32 + int matrix_key_map_size; 33 + 34 + /* direct keys */ 35 + int direct_key_num; 36 + unsigned int direct_key_map[8]; 37 + 38 + /* rotary encoders 0 */ 39 + int enable_rotary0; 40 + int rotary0_rel_code; 41 + int rotary0_up_key; 42 + int rotary0_down_key; 43 + 44 + /* rotary encoders 1 */ 45 + int enable_rotary1; 46 + int rotary1_rel_code; 47 + int rotary1_up_key; 48 + int rotary1_down_key; 49 + 50 + /* key debounce interval */ 51 + unsigned int debounce_interval; 52 + }; 53 + 54 + #define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) 55 + 56 + #endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
+30
include/asm-arm/arch-pxa/tosa.h
··· 163 163 164 164 extern struct platform_device tosascoop_jc_device; 165 165 extern struct platform_device tosascoop_device; 166 + 167 + #define TOSA_KEY_SYNC KEY_102ND /* ??? */ 168 + 169 + 170 + #ifndef CONFIG_KEYBOARD_TOSA_USE_EXT_KEYCODES 171 + #define TOSA_KEY_RECORD KEY_YEN 172 + #define TOSA_KEY_ADDRESSBOOK KEY_KATAKANA 173 + #define TOSA_KEY_CANCEL KEY_ESC 174 + #define TOSA_KEY_CENTER KEY_HIRAGANA 175 + #define TOSA_KEY_OK KEY_HENKAN 176 + #define TOSA_KEY_CALENDAR KEY_KATAKANAHIRAGANA 177 + #define TOSA_KEY_HOMEPAGE KEY_HANGEUL 178 + #define TOSA_KEY_LIGHT KEY_MUHENKAN 179 + #define TOSA_KEY_MENU KEY_HANJA 180 + #define TOSA_KEY_FN KEY_RIGHTALT 181 + #define TOSA_KEY_MAIL KEY_ZENKAKUHANKAKU 182 + #else 183 + #define TOSA_KEY_RECORD KEY_RECORD 184 + #define TOSA_KEY_ADDRESSBOOK KEY_ADDRESSBOOK 185 + #define TOSA_KEY_CANCEL KEY_CANCEL 186 + #define TOSA_KEY_CENTER KEY_SELECT /* ??? */ 187 + #define TOSA_KEY_OK KEY_OK 188 + #define TOSA_KEY_CALENDAR KEY_CALENDAR 189 + #define TOSA_KEY_HOMEPAGE KEY_HOMEPAGE 190 + #define TOSA_KEY_LIGHT KEY_KBDILLUMTOGGLE 191 + #define TOSA_KEY_MENU KEY_MENU 192 + #define TOSA_KEY_FN KEY_FN 193 + #define TOSA_KEY_MAIL KEY_MAIL 194 + #endif 195 + 166 196 #endif /* _ASM_ARCH_TOSA_H_ */
+3 -4
include/linux/input.h
··· 1020 1020 * @going_away: marks devices that are in a middle of unregistering and 1021 1021 * causes input_open_device*() fail with -ENODEV. 1022 1022 * @dev: driver model's view of this device 1023 - * @cdev: union for struct device pointer 1024 1023 * @h_list: list of input handles associated with the device. When 1025 1024 * accessing the list dev->mutex must be held 1026 1025 * @node: used to place the device onto input_dev_list ··· 1084 1085 int going_away; 1085 1086 1086 1087 struct device dev; 1087 - union { /* temporarily so while we switching to struct device */ 1088 - struct device *dev; 1089 - } cdev; 1090 1088 1091 1089 struct list_head h_list; 1092 1090 struct list_head node; ··· 1306 1310 1307 1311 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1308 1312 } 1313 + 1314 + int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); 1315 + int input_set_keycode(struct input_dev *dev, int scancode, int keycode); 1309 1316 1310 1317 extern struct class input_class; 1311 1318