Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input layer updates from Dmitry Torokhov:
- a bunch of new drivers (DA9052/53 touchscreenn controller, Synaptics
Navpoint, LM8333 keypads, Wacom I2C touhscreen);
- updates to existing touchpad drivers (ALPS, Sntelic);
- Wacom driver now supports Intuos5;
- device-tree bindings in numerous drivers;
- other cleanups and fixes.

Fix annoying conflict in drivers/input/tablet/wacom_wac.c that I think
implies that the input layer device naming is broken, but let's see. I
brough it up with Dmitry.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
Input: matrix-keymap - fix building keymaps
Input: spear-keyboard - document DT bindings
Input: spear-keyboard - add device tree bindings
Input: matrix-keymap - wire up device tree support
Input: matrix-keymap - uninline and prepare for device tree support
Input: adp5588 - add support for gpio names
Input: omap-keypad - dynamically handle register offsets
Input: synaptics - fix compile warning
MAINTAINERS: adjust input-related patterns
Input: ALPS - switch to using input_mt_report_finger_count
Input: ALPS - add semi-MT support for v4 protocol
Input: Add Synaptics NavPoint (PXA27x SSP/SPI) driver
Input: atmel_mxt_ts - dump each message on just 1 line
Input: atmel_mxt_ts - do not read extra (checksum) byte
Input: atmel_mxt_ts - verify object size in mxt_write_object
Input: atmel_mxt_ts - only allow root to update firmware
Input: atmel_mxt_ts - use CONFIG_PM_SLEEP
Input: sentelic - report device's production serial number
Input: tl6040-vibra - Device Tree support
Input: evdev - properly handle read/write with count 0
...

+2848 -1308
+8 -7
Documentation/ABI/testing/sysfs-driver-wacom
··· 23 23 Description: 24 24 Attribute group for control of the status LEDs and the OLEDs. 25 25 This attribute group is only available for Intuos 4 M, L, 26 - and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD 27 - (LEDs only). Therefore its presence implicitly signifies the 28 - presence of said LEDs and OLEDs on the tablet device. 26 + and XL (with LEDs and OLEDs), Intuos 5 (LEDs only), and Cintiq 27 + 21UX2 and Cintiq 24HD (LEDs only). Therefore its presence 28 + implicitly signifies the presence of said LEDs and OLEDs on the 29 + tablet device. 29 30 30 31 What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance 31 32 Date: August 2011 ··· 49 48 Date: August 2011 50 49 Contact: linux-input@vger.kernel.org 51 50 Description: 52 - Writing to this file sets which one of the four (for Intuos 4) 53 - or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status 54 - LEDs is active (0..3). The other three LEDs on the same side are 55 - always inactive. 51 + Writing to this file sets which one of the four (for Intuos 4 52 + and Intuos 5) or of the right four (for Cintiq 21UX2 and Cintiq 53 + 24HD) status LEDs is active (0..3). The other three LEDs on the 54 + same side are always inactive. 56 55 57 56 What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select 58 57 Date: September 2011
+20
Documentation/devicetree/bindings/input/spear-keyboard.txt
··· 1 + * SPEAr keyboard controller 2 + 3 + Required properties: 4 + - compatible: "st,spear300-kbd" 5 + 6 + Optional properties, in addition to those specified by the shared 7 + matrix-keyboard bindings: 8 + - autorepeat: bool: enables key autorepeat 9 + - st,mode: keyboard mode: 0 - 9x9, 1 - 6x6, 2 - 2x2 10 + 11 + Example: 12 + 13 + kbd@fc400000 { 14 + compatible = "st,spear300-kbd"; 15 + reg = <0xfc400000 0x100>; 16 + linux,keymap = < 0x00030012 17 + 0x0102003a >; 18 + autorepeat; 19 + st,mode = <0>; 20 + };
+16
Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt
··· 1 + * NXP LPC32xx SoC Touchscreen Controller (TSC) 2 + 3 + Required properties: 4 + - compatible: must be "nxp,lpc3220-tsc" 5 + - reg: physical base address of the controller and length of memory mapped 6 + region. 7 + - interrupts: The TSC/ADC interrupt 8 + 9 + Example: 10 + 11 + tsc@40048000 { 12 + compatible = "nxp,lpc3220-tsc"; 13 + reg = <0x40048000 0x1000>; 14 + interrupt-parent = <&mic>; 15 + interrupts = <39 0>; 16 + };
+37
Documentation/devicetree/bindings/input/twl6040-vibra.txt
··· 1 + Vibra driver for the twl6040 family 2 + 3 + The vibra driver is a child of the twl6040 MFD dirver. 4 + Documentation/devicetree/bindings/mfd/twl6040.txt 5 + 6 + Required properties: 7 + - compatible : Must be "ti,twl6040-vibra"; 8 + - interrupts: 4, Vibra overcurrent interrupt 9 + - vddvibl-supply: Regulator supplying the left vibra motor 10 + - vddvibr-supply: Regulator supplying the right vibra motor 11 + - vibldrv_res: Board specific left driver resistance 12 + - vibrdrv_res: Board specific right driver resistance 13 + - viblmotor_res: Board specific left motor resistance 14 + - vibrmotor_res: Board specific right motor resistance 15 + 16 + Optional properties: 17 + - vddvibl_uV: If the vddvibl default voltage need to be changed 18 + - vddvibr_uV: If the vddvibr default voltage need to be changed 19 + 20 + Example: 21 + /* 22 + * 8-channel high quality low-power audio codec 23 + * http://www.ti.com/lit/ds/symlink/twl6040.pdf 24 + */ 25 + twl6040: twl6040@4b { 26 + ... 27 + twl6040_vibra: twl6040@1 { 28 + compatible = "ti,twl6040-vibra"; 29 + interrupts = <4>; 30 + vddvibl-supply = <&vbat>; 31 + vddvibr-supply = <&vbat>; 32 + vibldrv_res = <8>; 33 + vibrdrv_res = <3>; 34 + viblmotor_res = <10>; 35 + vibrmotor_res = <10>; 36 + }; 37 + };
+2
MAINTAINERS
··· 3465 3465 T: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git 3466 3466 S: Maintained 3467 3467 F: drivers/input/ 3468 + F: include/linux/input.h 3469 + F: include/linux/input/ 3468 3470 3469 3471 INPUT MULTITOUCH (MT) PROTOCOL 3470 3472 M: Henrik Rydberg <rydberg@euromail.se>
+13 -4
drivers/input/Kconfig
··· 25 25 26 26 if INPUT 27 27 28 - config INPUT_OF_MATRIX_KEYMAP 29 - depends on USE_OF 30 - bool 31 - 32 28 config INPUT_FF_MEMLESS 33 29 tristate "Support for memoryless force-feedback devices" 34 30 help ··· 63 67 64 68 To compile this driver as a module, choose M here: the 65 69 module will be called sparse-keymap. 70 + 71 + config INPUT_MATRIXKMAP 72 + tristate "Matrix keymap support library" 73 + help 74 + Say Y here if you are using a driver for an input 75 + device that uses matrix keymap. This option is only 76 + useful for out-of-tree drivers since in-tree drivers 77 + select it automatically. 78 + 79 + If unsure, say N. 80 + 81 + To compile this driver as a module, choose M here: the 82 + module will be called matrix-keymap. 66 83 67 84 comment "Userland interfaces" 68 85
+1 -1
drivers/input/Makefile
··· 10 10 obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o 11 11 obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o 12 12 obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o 13 + obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o 13 14 14 15 obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o 15 16 obj-$(CONFIG_INPUT_JOYDEV) += joydev.o ··· 25 24 obj-$(CONFIG_INPUT_MISC) += misc/ 26 25 27 26 obj-$(CONFIG_INPUT_APMPOWER) += apm-power.o 28 - obj-$(CONFIG_INPUT_OF_MATRIX_KEYMAP) += of_keymap.o
+47 -30
drivers/input/evdev.c
··· 180 180 181 181 static int evdev_ungrab(struct evdev *evdev, struct evdev_client *client) 182 182 { 183 - if (evdev->grab != client) 183 + struct evdev_client *grab = rcu_dereference_protected(evdev->grab, 184 + lockdep_is_held(&evdev->mutex)); 185 + 186 + if (grab != client) 184 187 return -EINVAL; 185 188 186 189 rcu_assign_pointer(evdev->grab, NULL); ··· 262 259 struct evdev *evdev = client->evdev; 263 260 264 261 mutex_lock(&evdev->mutex); 265 - if (evdev->grab == client) 266 - evdev_ungrab(evdev, client); 262 + evdev_ungrab(evdev, client); 267 263 mutex_unlock(&evdev->mutex); 268 264 269 265 evdev_detach_client(evdev, client); ··· 345 343 struct input_event event; 346 344 int retval = 0; 347 345 348 - if (count < input_event_size()) 346 + if (count != 0 && count < input_event_size()) 349 347 return -EINVAL; 350 348 351 349 retval = mutex_lock_interruptible(&evdev->mutex); ··· 357 355 goto out; 358 356 } 359 357 360 - do { 358 + while (retval + input_event_size() <= count) { 359 + 361 360 if (input_event_from_user(buffer + retval, &event)) { 362 361 retval = -EFAULT; 363 362 goto out; ··· 367 364 368 365 input_inject_event(&evdev->handle, 369 366 event.type, event.code, event.value); 370 - } while (retval + input_event_size() <= count); 367 + } 371 368 372 369 out: 373 370 mutex_unlock(&evdev->mutex); ··· 398 395 struct evdev_client *client = file->private_data; 399 396 struct evdev *evdev = client->evdev; 400 397 struct input_event event; 401 - int retval = 0; 398 + size_t read = 0; 399 + int error; 402 400 403 - if (count < input_event_size()) 401 + if (count != 0 && count < input_event_size()) 404 402 return -EINVAL; 405 403 406 - if (!(file->f_flags & O_NONBLOCK)) { 407 - retval = wait_event_interruptible(evdev->wait, 408 - client->packet_head != client->tail || 409 - !evdev->exist); 410 - if (retval) 411 - return retval; 404 + for (;;) { 405 + if (!evdev->exist) 406 + return -ENODEV; 407 + 408 + if (client->packet_head == client->tail && 409 + (file->f_flags & O_NONBLOCK)) 410 + return -EAGAIN; 411 + 412 + /* 413 + * count == 0 is special - no IO is done but we check 414 + * for error conditions (see above). 415 + */ 416 + if (count == 0) 417 + break; 418 + 419 + while (read + input_event_size() <= count && 420 + evdev_fetch_next_event(client, &event)) { 421 + 422 + if (input_event_to_user(buffer + read, &event)) 423 + return -EFAULT; 424 + 425 + read += input_event_size(); 426 + } 427 + 428 + if (read) 429 + break; 430 + 431 + if (!(file->f_flags & O_NONBLOCK)) { 432 + error = wait_event_interruptible(evdev->wait, 433 + client->packet_head != client->tail || 434 + !evdev->exist); 435 + if (error) 436 + return error; 437 + } 412 438 } 413 439 414 - if (!evdev->exist) 415 - return -ENODEV; 416 - 417 - while (retval + input_event_size() <= count && 418 - evdev_fetch_next_event(client, &event)) { 419 - 420 - if (input_event_to_user(buffer + retval, &event)) 421 - return -EFAULT; 422 - 423 - retval += input_event_size(); 424 - } 425 - 426 - if (retval == 0 && (file->f_flags & O_NONBLOCK)) 427 - return -EAGAIN; 428 - 429 - return retval; 440 + return read; 430 441 } 431 442 432 443 /* No kernel lock - fine */
+1 -12
drivers/input/gameport/emu10k1-gp.c
··· 125 125 .remove = __devexit_p(emu_remove), 126 126 }; 127 127 128 - static int __init emu_init(void) 129 - { 130 - return pci_register_driver(&emu_driver); 131 - } 132 - 133 - static void __exit emu_exit(void) 134 - { 135 - pci_unregister_driver(&emu_driver); 136 - } 137 - 138 - module_init(emu_init); 139 - module_exit(emu_exit); 128 + module_pci_driver(emu_driver);
+2 -14
drivers/input/gameport/fm801-gp.c
··· 144 144 { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 145 145 { 0 } 146 146 }; 147 + MODULE_DEVICE_TABLE(pci, fm801_gp_id_table); 147 148 148 149 static struct pci_driver fm801_gp_driver = { 149 150 .name = "FM801_gameport", ··· 153 152 .remove = __devexit_p(fm801_gp_remove), 154 153 }; 155 154 156 - static int __init fm801_gp_init(void) 157 - { 158 - return pci_register_driver(&fm801_gp_driver); 159 - } 160 - 161 - static void __exit fm801_gp_exit(void) 162 - { 163 - pci_unregister_driver(&fm801_gp_driver); 164 - } 165 - 166 - module_init(fm801_gp_init); 167 - module_exit(fm801_gp_exit); 168 - 169 - MODULE_DEVICE_TABLE(pci, fm801_gp_id_table); 155 + module_pci_driver(fm801_gp_driver); 170 156 171 157 MODULE_DESCRIPTION("FM801 gameport driver"); 172 158 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
+1 -12
drivers/input/joystick/a3d.c
··· 413 413 .disconnect = a3d_disconnect, 414 414 }; 415 415 416 - static int __init a3d_init(void) 417 - { 418 - return gameport_register_driver(&a3d_drv); 419 - } 420 - 421 - static void __exit a3d_exit(void) 422 - { 423 - gameport_unregister_driver(&a3d_drv); 424 - } 425 - 426 - module_init(a3d_init); 427 - module_exit(a3d_exit); 416 + module_gameport_driver(a3d_drv);
+1 -16
drivers/input/joystick/adi.c
··· 557 557 kfree(port); 558 558 } 559 559 560 - /* 561 - * The gameport device structure. 562 - */ 563 - 564 560 static struct gameport_driver adi_drv = { 565 561 .driver = { 566 562 .name = "adi", ··· 566 570 .disconnect = adi_disconnect, 567 571 }; 568 572 569 - static int __init adi_init(void) 570 - { 571 - return gameport_register_driver(&adi_drv); 572 - } 573 - 574 - static void __exit adi_exit(void) 575 - { 576 - gameport_unregister_driver(&adi_drv); 577 - } 578 - 579 - module_init(adi_init); 580 - module_exit(adi_exit); 573 + module_gameport_driver(adi_drv);
+1 -12
drivers/input/joystick/cobra.c
··· 261 261 .disconnect = cobra_disconnect, 262 262 }; 263 263 264 - static int __init cobra_init(void) 265 - { 266 - return gameport_register_driver(&cobra_drv); 267 - } 268 - 269 - static void __exit cobra_exit(void) 270 - { 271 - gameport_unregister_driver(&cobra_drv); 272 - } 273 - 274 - module_init(cobra_init); 275 - module_exit(cobra_exit); 264 + module_gameport_driver(cobra_drv);
+1 -12
drivers/input/joystick/gf2k.c
··· 373 373 .disconnect = gf2k_disconnect, 374 374 }; 375 375 376 - static int __init gf2k_init(void) 377 - { 378 - return gameport_register_driver(&gf2k_drv); 379 - } 380 - 381 - static void __exit gf2k_exit(void) 382 - { 383 - gameport_unregister_driver(&gf2k_drv); 384 - } 385 - 386 - module_init(gf2k_init); 387 - module_exit(gf2k_exit); 376 + module_gameport_driver(gf2k_drv);
+1 -12
drivers/input/joystick/grip.c
··· 424 424 .disconnect = grip_disconnect, 425 425 }; 426 426 427 - static int __init grip_init(void) 428 - { 429 - return gameport_register_driver(&grip_drv); 430 - } 431 - 432 - static void __exit grip_exit(void) 433 - { 434 - gameport_unregister_driver(&grip_drv); 435 - } 436 - 437 - module_init(grip_init); 438 - module_exit(grip_exit); 427 + module_gameport_driver(grip_drv);
+1 -12
drivers/input/joystick/grip_mp.c
··· 687 687 .disconnect = grip_disconnect, 688 688 }; 689 689 690 - static int __init grip_init(void) 691 - { 692 - return gameport_register_driver(&grip_drv); 693 - } 694 - 695 - static void __exit grip_exit(void) 696 - { 697 - gameport_unregister_driver(&grip_drv); 698 - } 699 - 700 - module_init(grip_init); 701 - module_exit(grip_exit); 690 + module_gameport_driver(grip_drv);
+1 -12
drivers/input/joystick/guillemot.c
··· 281 281 .disconnect = guillemot_disconnect, 282 282 }; 283 283 284 - static int __init guillemot_init(void) 285 - { 286 - return gameport_register_driver(&guillemot_drv); 287 - } 288 - 289 - static void __exit guillemot_exit(void) 290 - { 291 - gameport_unregister_driver(&guillemot_drv); 292 - } 293 - 294 - module_init(guillemot_init); 295 - module_exit(guillemot_exit); 284 + module_gameport_driver(guillemot_drv);
+1 -12
drivers/input/joystick/interact.c
··· 311 311 .disconnect = interact_disconnect, 312 312 }; 313 313 314 - static int __init interact_init(void) 315 - { 316 - return gameport_register_driver(&interact_drv); 317 - } 318 - 319 - static void __exit interact_exit(void) 320 - { 321 - gameport_unregister_driver(&interact_drv); 322 - } 323 - 324 - module_init(interact_init); 325 - module_exit(interact_exit); 314 + module_gameport_driver(interact_drv);
+1 -12
drivers/input/joystick/joydump.c
··· 159 159 .disconnect = joydump_disconnect, 160 160 }; 161 161 162 - static int __init joydump_init(void) 163 - { 164 - return gameport_register_driver(&joydump_drv); 165 - } 166 - 167 - static void __exit joydump_exit(void) 168 - { 169 - gameport_unregister_driver(&joydump_drv); 170 - } 171 - 172 - module_init(joydump_init); 173 - module_exit(joydump_exit); 162 + module_gameport_driver(joydump_drv);
+1 -16
drivers/input/joystick/magellan.c
··· 222 222 .disconnect = magellan_disconnect, 223 223 }; 224 224 225 - /* 226 - * The functions for inserting/removing us as a module. 227 - */ 228 - 229 - static int __init magellan_init(void) 230 - { 231 - return serio_register_driver(&magellan_drv); 232 - } 233 - 234 - static void __exit magellan_exit(void) 235 - { 236 - serio_unregister_driver(&magellan_drv); 237 - } 238 - 239 - module_init(magellan_init); 240 - module_exit(magellan_exit); 225 + module_serio_driver(magellan_drv);
+1 -12
drivers/input/joystick/sidewinder.c
··· 820 820 .disconnect = sw_disconnect, 821 821 }; 822 822 823 - static int __init sw_init(void) 824 - { 825 - return gameport_register_driver(&sw_drv); 826 - } 827 - 828 - static void __exit sw_exit(void) 829 - { 830 - gameport_unregister_driver(&sw_drv); 831 - } 832 - 833 - module_init(sw_init); 834 - module_exit(sw_exit); 823 + module_gameport_driver(sw_drv);
+1 -16
drivers/input/joystick/spaceball.c
··· 296 296 .disconnect = spaceball_disconnect, 297 297 }; 298 298 299 - /* 300 - * The functions for inserting/removing us as a module. 301 - */ 302 - 303 - static int __init spaceball_init(void) 304 - { 305 - return serio_register_driver(&spaceball_drv); 306 - } 307 - 308 - static void __exit spaceball_exit(void) 309 - { 310 - serio_unregister_driver(&spaceball_drv); 311 - } 312 - 313 - module_init(spaceball_init); 314 - module_exit(spaceball_exit); 299 + module_serio_driver(spaceball_drv);
+1 -16
drivers/input/joystick/spaceorb.c
··· 237 237 .disconnect = spaceorb_disconnect, 238 238 }; 239 239 240 - /* 241 - * The functions for inserting/removing us as a module. 242 - */ 243 - 244 - static int __init spaceorb_init(void) 245 - { 246 - return serio_register_driver(&spaceorb_drv); 247 - } 248 - 249 - static void __exit spaceorb_exit(void) 250 - { 251 - serio_unregister_driver(&spaceorb_drv); 252 - } 253 - 254 - module_init(spaceorb_init); 255 - module_exit(spaceorb_exit); 240 + module_serio_driver(spaceorb_drv);
+1 -16
drivers/input/joystick/stinger.c
··· 208 208 .disconnect = stinger_disconnect, 209 209 }; 210 210 211 - /* 212 - * The functions for inserting/removing us as a module. 213 - */ 214 - 215 - static int __init stinger_init(void) 216 - { 217 - return serio_register_driver(&stinger_drv); 218 - } 219 - 220 - static void __exit stinger_exit(void) 221 - { 222 - serio_unregister_driver(&stinger_drv); 223 - } 224 - 225 - module_init(stinger_init); 226 - module_exit(stinger_exit); 211 + module_serio_driver(stinger_drv);
+1 -12
drivers/input/joystick/tmdc.c
··· 436 436 .disconnect = tmdc_disconnect, 437 437 }; 438 438 439 - static int __init tmdc_init(void) 440 - { 441 - return gameport_register_driver(&tmdc_drv); 442 - } 443 - 444 - static void __exit tmdc_exit(void) 445 - { 446 - gameport_unregister_driver(&tmdc_drv); 447 - } 448 - 449 - module_init(tmdc_init); 450 - module_exit(tmdc_exit); 439 + module_gameport_driver(tmdc_drv);
+1 -16
drivers/input/joystick/twidjoy.c
··· 257 257 .disconnect = twidjoy_disconnect, 258 258 }; 259 259 260 - /* 261 - * The functions for inserting/removing us as a module. 262 - */ 263 - 264 - static int __init twidjoy_init(void) 265 - { 266 - return serio_register_driver(&twidjoy_drv); 267 - } 268 - 269 - static void __exit twidjoy_exit(void) 270 - { 271 - serio_unregister_driver(&twidjoy_drv); 272 - } 273 - 274 - module_init(twidjoy_init); 275 - module_exit(twidjoy_exit); 260 + module_serio_driver(twidjoy_drv);
+1 -16
drivers/input/joystick/warrior.c
··· 217 217 .disconnect = warrior_disconnect, 218 218 }; 219 219 220 - /* 221 - * The functions for inserting/removing us as a module. 222 - */ 223 - 224 - static int __init warrior_init(void) 225 - { 226 - return serio_register_driver(&warrior_drv); 227 - } 228 - 229 - static void __exit warrior_exit(void) 230 - { 231 - serio_unregister_driver(&warrior_drv); 232 - } 233 - 234 - module_init(warrior_init); 235 - module_exit(warrior_exit); 220 + module_serio_driver(warrior_drv);
+1 -16
drivers/input/joystick/zhenhua.c
··· 225 225 .disconnect = zhenhua_disconnect, 226 226 }; 227 227 228 - /* 229 - * The functions for inserting/removing us as a module. 230 - */ 231 - 232 - static int __init zhenhua_init(void) 233 - { 234 - return serio_register_driver(&zhenhua_drv); 235 - } 236 - 237 - static void __exit zhenhua_exit(void) 238 - { 239 - serio_unregister_driver(&zhenhua_drv); 240 - } 241 - 242 - module_init(zhenhua_init); 243 - module_exit(zhenhua_exit); 228 + module_serio_driver(zhenhua_drv);
+29 -3
drivers/input/keyboard/Kconfig
··· 166 166 config KEYBOARD_EP93XX 167 167 tristate "EP93xx Matrix Keypad support" 168 168 depends on ARCH_EP93XX 169 + select INPUT_MATRIXKMAP 169 170 help 170 171 Say Y here to enable the matrix keypad on the Cirrus EP93XX. 171 172 ··· 225 224 config KEYBOARD_TCA8418 226 225 tristate "TCA8418 Keypad Support" 227 226 depends on I2C 227 + select INPUT_MATRIXKMAP 228 228 help 229 229 This driver implements basic keypad functionality 230 230 for keys connected through TCA8418 keypad decoder. ··· 242 240 config KEYBOARD_MATRIX 243 241 tristate "GPIO driven matrix keypad support" 244 242 depends on GENERIC_GPIO 243 + select INPUT_MATRIXKMAP 245 244 help 246 245 Enable support for GPIO driven matrix keypad. 247 246 ··· 312 309 To compile this driver as a module, choose M here: the 313 310 module will be called lm8323. 314 311 312 + config KEYBOARD_LM8333 313 + tristate "LM8333 keypad chip" 314 + depends on I2C 315 + select INPUT_MATRIXKMAP 316 + help 317 + If you say yes here you get support for the National Semiconductor 318 + LM8333 keypad controller. 319 + 320 + To compile this driver as a module, choose M here: the 321 + module will be called lm8333. 322 + 315 323 config KEYBOARD_LOCOMO 316 324 tristate "LoCoMo Keyboard Support" 317 325 depends on SHARP_LOCOMO ··· 380 366 config KEYBOARD_IMX 381 367 tristate "IMX keypad support" 382 368 depends on ARCH_MXC 369 + select INPUT_MATRIXKMAP 383 370 help 384 371 Enable support for IMX keypad port. 385 372 ··· 399 384 config KEYBOARD_NOMADIK 400 385 tristate "ST-Ericsson Nomadik SKE keyboard" 401 386 depends on PLAT_NOMADIK 387 + select INPUT_MATRIXKMAP 402 388 help 403 389 Say Y here if you want to use a keypad provided on the SKE controller 404 390 used on the Ux500 and Nomadik platforms ··· 410 394 config KEYBOARD_TEGRA 411 395 tristate "NVIDIA Tegra internal matrix keyboard controller support" 412 396 depends on ARCH_TEGRA 413 - select INPUT_OF_MATRIX_KEYMAP if USE_OF 397 + select INPUT_MATRIXKMAP 414 398 help 415 399 Say Y here if you want to use a matrix keyboard connected directly 416 400 to the internal keyboard controller on Tegra SoCs. ··· 448 432 config KEYBOARD_PMIC8XXX 449 433 tristate "Qualcomm PMIC8XXX keypad support" 450 434 depends on MFD_PM8XXX 435 + select INPUT_MATRIXKMAP 451 436 help 452 437 Say Y here if you want to enable the driver for the PMIC8XXX 453 438 keypad provided as a reference design from Qualcomm. This is intended ··· 460 443 config KEYBOARD_SAMSUNG 461 444 tristate "Samsung keypad support" 462 445 depends on HAVE_CLK 446 + select INPUT_MATRIXKMAP 463 447 help 464 448 Say Y here if you want to use the keypad on your Samsung mobile 465 449 device. ··· 503 485 config KEYBOARD_STMPE 504 486 tristate "STMPE keypad support" 505 487 depends on MFD_STMPE 488 + select INPUT_MATRIXKMAP 506 489 help 507 490 Say Y here if you want to use the keypad controller on STMPE I/O 508 491 expanders. ··· 524 505 config KEYBOARD_OMAP 525 506 tristate "TI OMAP keypad support" 526 507 depends on (ARCH_OMAP1 || ARCH_OMAP2) 508 + select INPUT_MATRIXKMAP 527 509 help 528 510 Say Y here if you want to use the OMAP keypad. 529 511 ··· 532 512 module will be called omap-keypad. 533 513 534 514 config KEYBOARD_OMAP4 535 - tristate "TI OMAP4 keypad support" 515 + tristate "TI OMAP4+ keypad support" 516 + select INPUT_MATRIXKMAP 536 517 help 537 - Say Y here if you want to use the OMAP4 keypad. 518 + Say Y here if you want to use the OMAP4+ keypad. 538 519 539 520 To compile this driver as a module, choose M here: the 540 521 module will be called omap4-keypad. ··· 543 522 config KEYBOARD_SPEAR 544 523 tristate "ST SPEAR keyboard support" 545 524 depends on PLAT_SPEAR 525 + select INPUT_MATRIXKMAP 546 526 help 547 527 Say Y here if you want to use the SPEAR keyboard. 548 528 ··· 553 531 config KEYBOARD_TC3589X 554 532 tristate "TC3589X Keypad support" 555 533 depends on MFD_TC3589X 534 + select INPUT_MATRIXKMAP 556 535 help 557 536 Say Y here if you want to use the keypad controller on 558 537 TC35892/3 I/O expander. ··· 564 541 config KEYBOARD_TNETV107X 565 542 tristate "TI TNETV107X keypad support" 566 543 depends on ARCH_DAVINCI_TNETV107X 544 + select INPUT_MATRIXKMAP 567 545 help 568 546 Say Y here if you want to use the TNETV107X keypad. 569 547 ··· 574 550 config KEYBOARD_TWL4030 575 551 tristate "TI TWL4030/TWL5030/TPS659x0 keypad support" 576 552 depends on TWL4030_CORE 553 + select INPUT_MATRIXKMAP 577 554 help 578 555 Say Y here if your board use the keypad controller on 579 556 TWL4030 family chips. It's safe to say enable this ··· 598 573 config KEYBOARD_W90P910 599 574 tristate "W90P910 Matrix Keypad support" 600 575 depends on ARCH_W90X900 576 + select INPUT_MATRIXKMAP 601 577 help 602 578 Say Y here to enable the matrix keypad on evaluation board 603 579 based on W90P910.
+1
drivers/input/keyboard/Makefile
··· 24 24 obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o 25 25 obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o 26 26 obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o 27 + obj-$(CONFIG_KEYBOARD_LM8333) += lm8333.o 27 28 obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o 28 29 obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o 29 30 obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o
+1
drivers/input/keyboard/adp5588-keys.c
··· 197 197 kpad->gc.base = gpio_data->gpio_start; 198 198 kpad->gc.label = kpad->client->name; 199 199 kpad->gc.owner = THIS_MODULE; 200 + kpad->gc.names = gpio_data->names; 200 201 201 202 mutex_init(&kpad->gpio_lock); 202 203
+1 -1
drivers/input/keyboard/atkbd.c
··· 433 433 if (printk_ratelimit()) 434 434 dev_warn(&serio->dev, 435 435 "Spurious %s on %s. " 436 - "Some program might be trying access hardware directly.\n", 436 + "Some program might be trying to access hardware directly.\n", 437 437 data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); 438 438 goto out; 439 439 case ATKBD_RET_ERR:
+18 -26
drivers/input/keyboard/ep93xx_keypad.c
··· 182 182 } 183 183 184 184 185 - #ifdef CONFIG_PM 186 - /* 187 - * NOTE: I don't know if this is correct, or will work on the ep93xx. 188 - * 189 - * None of the existing ep93xx drivers have power management support. 190 - * But, this is basically what the pxa27x_keypad driver does. 191 - */ 192 - static int ep93xx_keypad_suspend(struct platform_device *pdev, 193 - pm_message_t state) 185 + #ifdef CONFIG_PM_SLEEP 186 + static int ep93xx_keypad_suspend(struct device *dev) 194 187 { 188 + struct platform_device *pdev = to_platform_device(dev); 195 189 struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); 196 190 struct input_dev *input_dev = keypad->input_dev; 197 191 ··· 204 210 return 0; 205 211 } 206 212 207 - static int ep93xx_keypad_resume(struct platform_device *pdev) 213 + static int ep93xx_keypad_resume(struct device *dev) 208 214 { 215 + struct platform_device *pdev = to_platform_device(dev); 209 216 struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); 210 217 struct input_dev *input_dev = keypad->input_dev; 211 218 ··· 227 232 228 233 return 0; 229 234 } 230 - #else /* !CONFIG_PM */ 231 - #define ep93xx_keypad_suspend NULL 232 - #define ep93xx_keypad_resume NULL 233 - #endif /* !CONFIG_PM */ 235 + #endif 236 + 237 + static SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops, 238 + ep93xx_keypad_suspend, ep93xx_keypad_resume); 234 239 235 240 static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) 236 241 { ··· 303 308 input_dev->open = ep93xx_keypad_open; 304 309 input_dev->close = ep93xx_keypad_close; 305 310 input_dev->dev.parent = &pdev->dev; 306 - input_dev->keycode = keypad->keycodes; 307 - input_dev->keycodesize = sizeof(keypad->keycodes[0]); 308 - input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); 309 311 310 - input_set_drvdata(input_dev, keypad); 312 + err = matrix_keypad_build_keymap(keymap_data, NULL, 313 + EP93XX_MATRIX_ROWS, EP93XX_MATRIX_COLS, 314 + keypad->keycodes, input_dev); 315 + if (err) 316 + goto failed_free_dev; 311 317 312 - input_dev->evbit[0] = BIT_MASK(EV_KEY); 313 318 if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT) 314 - input_dev->evbit[0] |= BIT_MASK(EV_REP); 315 - 316 - matrix_keypad_build_keymap(keymap_data, 3, 317 - input_dev->keycode, input_dev->keybit); 318 - platform_set_drvdata(pdev, keypad); 319 + __set_bit(EV_REP, input_dev->evbit); 320 + input_set_drvdata(input_dev, keypad); 319 321 320 322 err = request_irq(keypad->irq, ep93xx_keypad_irq_handler, 321 323 0, pdev->name, keypad); ··· 323 331 if (err) 324 332 goto failed_free_irq; 325 333 334 + platform_set_drvdata(pdev, keypad); 326 335 device_init_wakeup(&pdev->dev, 1); 327 336 328 337 return 0; ··· 377 384 .driver = { 378 385 .name = "ep93xx-keypad", 379 386 .owner = THIS_MODULE, 387 + .pm = &ep93xx_keypad_pm_ops, 380 388 }, 381 389 .probe = ep93xx_keypad_probe, 382 390 .remove = __devexit_p(ep93xx_keypad_remove), 383 - .suspend = ep93xx_keypad_suspend, 384 - .resume = ep93xx_keypad_resume, 385 391 }; 386 392 module_platform_driver(ep93xx_keypad_driver); 387 393
+1 -12
drivers/input/keyboard/hil_kbd.c
··· 583 583 .interrupt = hil_dev_interrupt 584 584 }; 585 585 586 - static int __init hil_dev_init(void) 587 - { 588 - return serio_register_driver(&hil_serio_drv); 589 - } 590 - 591 - static void __exit hil_dev_exit(void) 592 - { 593 - serio_unregister_driver(&hil_serio_drv); 594 - } 595 - 596 - module_init(hil_dev_init); 597 - module_exit(hil_dev_exit); 586 + module_serio_driver(hil_serio_drv);
+10 -7
drivers/input/keyboard/imx_keypad.c
··· 481 481 } 482 482 483 483 if (keypad->rows_en_mask > ((1 << MAX_MATRIX_KEY_ROWS) - 1) || 484 - keypad->cols_en_mask > ((1 << MAX_MATRIX_KEY_COLS) - 1)) { 484 + keypad->cols_en_mask > ((1 << MAX_MATRIX_KEY_COLS) - 1)) { 485 485 dev_err(&pdev->dev, 486 486 "invalid key data (too many rows or colums)\n"); 487 487 error = -EINVAL; ··· 496 496 input_dev->dev.parent = &pdev->dev; 497 497 input_dev->open = imx_keypad_open; 498 498 input_dev->close = imx_keypad_close; 499 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); 500 - input_dev->keycode = keypad->keycodes; 501 - input_dev->keycodesize = sizeof(keypad->keycodes[0]); 502 - input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); 503 499 504 - matrix_keypad_build_keymap(keymap_data, MATRIX_ROW_SHIFT, 505 - keypad->keycodes, input_dev->keybit); 500 + error = matrix_keypad_build_keymap(keymap_data, NULL, 501 + MAX_MATRIX_KEY_ROWS, 502 + MAX_MATRIX_KEY_COLS, 503 + keypad->keycodes, input_dev); 504 + if (error) { 505 + dev_err(&pdev->dev, "failed to build keymap\n"); 506 + goto failed_clock_put; 507 + } 506 508 509 + __set_bit(EV_REP, input_dev->evbit); 507 510 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 508 511 input_set_drvdata(input_dev, keypad); 509 512
+1 -16
drivers/input/keyboard/lkkbd.c
··· 731 731 .interrupt = lkkbd_interrupt, 732 732 }; 733 733 734 - /* 735 - * The functions for insering/removing us as a module. 736 - */ 737 - static int __init lkkbd_init(void) 738 - { 739 - return serio_register_driver(&lkkbd_drv); 740 - } 741 - 742 - static void __exit lkkbd_exit(void) 743 - { 744 - serio_unregister_driver(&lkkbd_drv); 745 - } 746 - 747 - module_init(lkkbd_init); 748 - module_exit(lkkbd_exit); 749 - 734 + module_serio_driver(lkkbd_drv);
+235
drivers/input/keyboard/lm8333.c
··· 1 + /* 2 + * LM8333 keypad driver 3 + * Copyright (C) 2012 Wolfram Sang, Pengutronix <w.sang@pengutronix.de> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License as published by 7 + * the Free Software Foundation; either version 2 of the License. 8 + */ 9 + 10 + #include <linux/module.h> 11 + #include <linux/slab.h> 12 + #include <linux/irq.h> 13 + #include <linux/i2c.h> 14 + #include <linux/interrupt.h> 15 + #include <linux/input/matrix_keypad.h> 16 + #include <linux/input/lm8333.h> 17 + 18 + #define LM8333_FIFO_READ 0x20 19 + #define LM8333_DEBOUNCE 0x22 20 + #define LM8333_READ_INT 0xD0 21 + #define LM8333_ACTIVE 0xE4 22 + #define LM8333_READ_ERROR 0xF0 23 + 24 + #define LM8333_KEYPAD_IRQ (1 << 0) 25 + #define LM8333_ERROR_IRQ (1 << 3) 26 + 27 + #define LM8333_ERROR_KEYOVR 0x04 28 + #define LM8333_ERROR_FIFOOVR 0x40 29 + 30 + #define LM8333_FIFO_TRANSFER_SIZE 16 31 + 32 + #define LM8333_NUM_ROWS 8 33 + #define LM8333_NUM_COLS 16 34 + #define LM8333_ROW_SHIFT 4 35 + 36 + struct lm8333 { 37 + struct i2c_client *client; 38 + struct input_dev *input; 39 + unsigned short keycodes[LM8333_NUM_ROWS << LM8333_ROW_SHIFT]; 40 + }; 41 + 42 + /* The accessors try twice because the first access may be needed for wakeup */ 43 + #define LM8333_READ_RETRIES 2 44 + 45 + int lm8333_read8(struct lm8333 *lm8333, u8 cmd) 46 + { 47 + int retries = 0, ret; 48 + 49 + do { 50 + ret = i2c_smbus_read_byte_data(lm8333->client, cmd); 51 + } while (ret < 0 && retries++ < LM8333_READ_RETRIES); 52 + 53 + return ret; 54 + } 55 + 56 + int lm8333_write8(struct lm8333 *lm8333, u8 cmd, u8 val) 57 + { 58 + int retries = 0, ret; 59 + 60 + do { 61 + ret = i2c_smbus_write_byte_data(lm8333->client, cmd, val); 62 + } while (ret < 0 && retries++ < LM8333_READ_RETRIES); 63 + 64 + return ret; 65 + } 66 + 67 + int lm8333_read_block(struct lm8333 *lm8333, u8 cmd, u8 len, u8 *buf) 68 + { 69 + int retries = 0, ret; 70 + 71 + do { 72 + ret = i2c_smbus_read_i2c_block_data(lm8333->client, 73 + cmd, len, buf); 74 + } while (ret < 0 && retries++ < LM8333_READ_RETRIES); 75 + 76 + return ret; 77 + } 78 + 79 + static void lm8333_key_handler(struct lm8333 *lm8333) 80 + { 81 + struct input_dev *input = lm8333->input; 82 + u8 keys[LM8333_FIFO_TRANSFER_SIZE]; 83 + u8 code, pressed; 84 + int i, ret; 85 + 86 + ret = lm8333_read_block(lm8333, LM8333_FIFO_READ, 87 + LM8333_FIFO_TRANSFER_SIZE, keys); 88 + if (ret != LM8333_FIFO_TRANSFER_SIZE) { 89 + dev_err(&lm8333->client->dev, 90 + "Error %d while reading FIFO\n", ret); 91 + return; 92 + } 93 + 94 + for (i = 0; keys[i] && i < LM8333_FIFO_TRANSFER_SIZE; i++) { 95 + pressed = keys[i] & 0x80; 96 + code = keys[i] & 0x7f; 97 + 98 + input_event(input, EV_MSC, MSC_SCAN, code); 99 + input_report_key(input, lm8333->keycodes[code], pressed); 100 + } 101 + 102 + input_sync(input); 103 + } 104 + 105 + static irqreturn_t lm8333_irq_thread(int irq, void *data) 106 + { 107 + struct lm8333 *lm8333 = data; 108 + u8 status = lm8333_read8(lm8333, LM8333_READ_INT); 109 + 110 + if (!status) 111 + return IRQ_NONE; 112 + 113 + if (status & LM8333_ERROR_IRQ) { 114 + u8 err = lm8333_read8(lm8333, LM8333_READ_ERROR); 115 + 116 + if (err & (LM8333_ERROR_KEYOVR | LM8333_ERROR_FIFOOVR)) { 117 + u8 dummy[LM8333_FIFO_TRANSFER_SIZE]; 118 + 119 + lm8333_read_block(lm8333, LM8333_FIFO_READ, 120 + LM8333_FIFO_TRANSFER_SIZE, dummy); 121 + } 122 + dev_err(&lm8333->client->dev, "Got error %02x\n", err); 123 + } 124 + 125 + if (status & LM8333_KEYPAD_IRQ) 126 + lm8333_key_handler(lm8333); 127 + 128 + return IRQ_HANDLED; 129 + } 130 + 131 + static int __devinit lm8333_probe(struct i2c_client *client, 132 + const struct i2c_device_id *id) 133 + { 134 + const struct lm8333_platform_data *pdata = client->dev.platform_data; 135 + struct lm8333 *lm8333; 136 + struct input_dev *input; 137 + int err, active_time; 138 + 139 + if (!pdata) 140 + return -EINVAL; 141 + 142 + active_time = pdata->active_time ?: 500; 143 + if (active_time / 3 <= pdata->debounce_time / 3) { 144 + dev_err(&client->dev, "Active time not big enough!\n"); 145 + return -EINVAL; 146 + } 147 + 148 + lm8333 = kzalloc(sizeof(*lm8333), GFP_KERNEL); 149 + input = input_allocate_device(); 150 + if (!lm8333 || !input) { 151 + err = -ENOMEM; 152 + goto free_mem; 153 + } 154 + 155 + lm8333->client = client; 156 + lm8333->input = input; 157 + 158 + input->name = client->name; 159 + input->dev.parent = &client->dev; 160 + input->id.bustype = BUS_I2C; 161 + 162 + input_set_capability(input, EV_MSC, MSC_SCAN); 163 + 164 + err = matrix_keypad_build_keymap(pdata->matrix_data, NULL, 165 + LM8333_NUM_ROWS, LM8333_NUM_COLS, 166 + lm8333->keycodes, input); 167 + if (err) 168 + goto free_mem; 169 + 170 + if (pdata->debounce_time) { 171 + err = lm8333_write8(lm8333, LM8333_DEBOUNCE, 172 + pdata->debounce_time / 3); 173 + if (err) 174 + dev_warn(&client->dev, "Unable to set debounce time\n"); 175 + } 176 + 177 + if (pdata->active_time) { 178 + err = lm8333_write8(lm8333, LM8333_ACTIVE, 179 + pdata->active_time / 3); 180 + if (err) 181 + dev_warn(&client->dev, "Unable to set active time\n"); 182 + } 183 + 184 + err = request_threaded_irq(client->irq, NULL, lm8333_irq_thread, 185 + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 186 + "lm8333", lm8333); 187 + if (err) 188 + goto free_mem; 189 + 190 + err = input_register_device(input); 191 + if (err) 192 + goto free_irq; 193 + 194 + i2c_set_clientdata(client, lm8333); 195 + return 0; 196 + 197 + free_irq: 198 + free_irq(client->irq, lm8333); 199 + free_mem: 200 + input_free_device(input); 201 + kfree(lm8333); 202 + return err; 203 + } 204 + 205 + static int __devexit lm8333_remove(struct i2c_client *client) 206 + { 207 + struct lm8333 *lm8333 = i2c_get_clientdata(client); 208 + 209 + free_irq(client->irq, lm8333); 210 + input_unregister_device(lm8333->input); 211 + kfree(lm8333); 212 + 213 + return 0; 214 + } 215 + 216 + static const struct i2c_device_id lm8333_id[] = { 217 + { "lm8333", 0 }, 218 + { } 219 + }; 220 + MODULE_DEVICE_TABLE(i2c, lm8333_id); 221 + 222 + static struct i2c_driver lm8333_driver = { 223 + .driver = { 224 + .name = "lm8333", 225 + .owner = THIS_MODULE, 226 + }, 227 + .probe = lm8333_probe, 228 + .remove = __devexit_p(lm8333_remove), 229 + .id_table = lm8333_id, 230 + }; 231 + module_i2c_driver(lm8333_driver); 232 + 233 + MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>"); 234 + MODULE_DESCRIPTION("LM8333 keyboard driver"); 235 + MODULE_LICENSE("GPL v2");
+50 -49
drivers/input/keyboard/matrix_keypad.c
··· 27 27 struct matrix_keypad { 28 28 const struct matrix_keypad_platform_data *pdata; 29 29 struct input_dev *input_dev; 30 - unsigned short *keycodes; 31 30 unsigned int row_shift; 32 31 33 32 DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS); ··· 37 38 bool scan_pending; 38 39 bool stopped; 39 40 bool gpio_all_disabled; 41 + 42 + unsigned short keycodes[]; 40 43 }; 41 44 42 45 /* ··· 225 224 disable_row_irqs(keypad); 226 225 } 227 226 228 - #ifdef CONFIG_PM 227 + #ifdef CONFIG_PM_SLEEP 229 228 static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad) 230 229 { 231 230 const struct matrix_keypad_platform_data *pdata = keypad->pdata; ··· 294 293 295 294 return 0; 296 295 } 297 - 298 - static const SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, 299 - matrix_keypad_suspend, matrix_keypad_resume); 300 296 #endif 301 297 302 - static int __devinit init_matrix_gpio(struct platform_device *pdev, 303 - struct matrix_keypad *keypad) 298 + static SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, 299 + matrix_keypad_suspend, matrix_keypad_resume); 300 + 301 + static int __devinit matrix_keypad_init_gpio(struct platform_device *pdev, 302 + struct matrix_keypad *keypad) 304 303 { 305 304 const struct matrix_keypad_platform_data *pdata = keypad->pdata; 306 - int i, err = -EINVAL; 305 + int i, err; 307 306 308 307 /* initialized strobe lines as outputs, activated */ 309 308 for (i = 0; i < pdata->num_col_gpios; i++) { ··· 349 348 "matrix-keypad", keypad); 350 349 if (err) { 351 350 dev_err(&pdev->dev, 352 - "Unable to acquire interrupt " 353 - "for GPIO line %i\n", 351 + "Unable to acquire interrupt for GPIO line %i\n", 354 352 pdata->row_gpios[i]); 355 353 goto err_free_irqs; 356 354 } ··· 375 375 return err; 376 376 } 377 377 378 + static void matrix_keypad_free_gpio(struct matrix_keypad *keypad) 379 + { 380 + const struct matrix_keypad_platform_data *pdata = keypad->pdata; 381 + int i; 382 + 383 + if (pdata->clustered_irq > 0) { 384 + free_irq(pdata->clustered_irq, keypad); 385 + } else { 386 + for (i = 0; i < pdata->num_row_gpios; i++) 387 + free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); 388 + } 389 + 390 + for (i = 0; i < pdata->num_row_gpios; i++) 391 + gpio_free(pdata->row_gpios[i]); 392 + 393 + for (i = 0; i < pdata->num_col_gpios; i++) 394 + gpio_free(pdata->col_gpios[i]); 395 + } 396 + 378 397 static int __devinit matrix_keypad_probe(struct platform_device *pdev) 379 398 { 380 399 const struct matrix_keypad_platform_data *pdata; 381 400 const struct matrix_keymap_data *keymap_data; 382 401 struct matrix_keypad *keypad; 383 402 struct input_dev *input_dev; 384 - unsigned short *keycodes; 385 403 unsigned int row_shift; 404 + size_t keymap_size; 386 405 int err; 387 406 388 407 pdata = pdev->dev.platform_data; ··· 417 398 } 418 399 419 400 row_shift = get_count_order(pdata->num_col_gpios); 420 - 421 - keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); 422 - keycodes = kzalloc((pdata->num_row_gpios << row_shift) * 423 - sizeof(*keycodes), 424 - GFP_KERNEL); 401 + keymap_size = (pdata->num_row_gpios << row_shift) * 402 + sizeof(keypad->keycodes[0]); 403 + keypad = kzalloc(sizeof(struct matrix_keypad) + keymap_size, 404 + GFP_KERNEL); 425 405 input_dev = input_allocate_device(); 426 - if (!keypad || !keycodes || !input_dev) { 406 + if (!keypad || !input_dev) { 427 407 err = -ENOMEM; 428 408 goto err_free_mem; 429 409 } 430 410 431 411 keypad->input_dev = input_dev; 432 412 keypad->pdata = pdata; 433 - keypad->keycodes = keycodes; 434 413 keypad->row_shift = row_shift; 435 414 keypad->stopped = true; 436 415 INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); ··· 437 420 input_dev->name = pdev->name; 438 421 input_dev->id.bustype = BUS_HOST; 439 422 input_dev->dev.parent = &pdev->dev; 440 - input_dev->evbit[0] = BIT_MASK(EV_KEY); 441 - if (!pdata->no_autorepeat) 442 - input_dev->evbit[0] |= BIT_MASK(EV_REP); 443 423 input_dev->open = matrix_keypad_start; 444 424 input_dev->close = matrix_keypad_stop; 445 425 446 - input_dev->keycode = keycodes; 447 - input_dev->keycodesize = sizeof(*keycodes); 448 - input_dev->keycodemax = pdata->num_row_gpios << row_shift; 426 + err = matrix_keypad_build_keymap(keymap_data, NULL, 427 + pdata->num_row_gpios, 428 + pdata->num_col_gpios, 429 + keypad->keycodes, input_dev); 430 + if (err) 431 + goto err_free_mem; 449 432 450 - matrix_keypad_build_keymap(keymap_data, row_shift, 451 - input_dev->keycode, input_dev->keybit); 452 - 433 + if (!pdata->no_autorepeat) 434 + __set_bit(EV_REP, input_dev->evbit); 453 435 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 454 436 input_set_drvdata(input_dev, keypad); 455 437 456 - err = init_matrix_gpio(pdev, keypad); 438 + err = matrix_keypad_init_gpio(pdev, keypad); 457 439 if (err) 458 440 goto err_free_mem; 459 441 460 442 err = input_register_device(keypad->input_dev); 461 443 if (err) 462 - goto err_free_mem; 444 + goto err_free_gpio; 463 445 464 446 device_init_wakeup(&pdev->dev, pdata->wakeup); 465 447 platform_set_drvdata(pdev, keypad); 466 448 467 449 return 0; 468 450 451 + err_free_gpio: 452 + matrix_keypad_free_gpio(keypad); 469 453 err_free_mem: 470 454 input_free_device(input_dev); 471 - kfree(keycodes); 472 455 kfree(keypad); 473 456 return err; 474 457 } ··· 476 459 static int __devexit matrix_keypad_remove(struct platform_device *pdev) 477 460 { 478 461 struct matrix_keypad *keypad = platform_get_drvdata(pdev); 479 - const struct matrix_keypad_platform_data *pdata = keypad->pdata; 480 - int i; 481 462 482 463 device_init_wakeup(&pdev->dev, 0); 483 464 484 - if (pdata->clustered_irq > 0) { 485 - free_irq(pdata->clustered_irq, keypad); 486 - } else { 487 - for (i = 0; i < pdata->num_row_gpios; i++) 488 - free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); 489 - } 490 - 491 - for (i = 0; i < pdata->num_row_gpios; i++) 492 - gpio_free(pdata->row_gpios[i]); 493 - 494 - for (i = 0; i < pdata->num_col_gpios; i++) 495 - gpio_free(pdata->col_gpios[i]); 496 - 465 + matrix_keypad_free_gpio(keypad); 497 466 input_unregister_device(keypad->input_dev); 498 - platform_set_drvdata(pdev, NULL); 499 - kfree(keypad->keycodes); 500 467 kfree(keypad); 468 + 469 + platform_set_drvdata(pdev, NULL); 501 470 502 471 return 0; 503 472 } ··· 494 491 .driver = { 495 492 .name = "matrix-keypad", 496 493 .owner = THIS_MODULE, 497 - #ifdef CONFIG_PM 498 494 .pm = &matrix_keypad_pm_ops, 499 - #endif 500 495 }, 501 496 }; 502 497 module_platform_driver(matrix_keypad_driver);
+1 -12
drivers/input/keyboard/newtonkbd.c
··· 166 166 .disconnect = nkbd_disconnect, 167 167 }; 168 168 169 - static int __init nkbd_init(void) 170 - { 171 - return serio_register_driver(&nkbd_drv); 172 - } 173 - 174 - static void __exit nkbd_exit(void) 175 - { 176 - serio_unregister_driver(&nkbd_drv); 177 - } 178 - 179 - module_init(nkbd_init); 180 - module_exit(nkbd_exit); 169 + module_serio_driver(nkbd_drv);
+10 -10
drivers/input/keyboard/nomadik-ske-keypad.c
··· 39 39 #define SKE_KPRISA (0x1 << 2) 40 40 41 41 #define SKE_KEYPAD_ROW_SHIFT 3 42 - #define SKE_KPD_KEYMAP_SIZE (8 * 8) 42 + #define SKE_KPD_NUM_ROWS 8 43 + #define SKE_KPD_NUM_COLS 8 43 44 44 45 /* keypad auto scan registers */ 45 46 #define SKE_ASR0 0x20 ··· 64 63 void __iomem *reg_base; 65 64 struct input_dev *input; 66 65 const struct ske_keypad_platform_data *board; 67 - unsigned short keymap[SKE_KPD_KEYMAP_SIZE]; 66 + unsigned short keymap[SKE_KPD_NUM_ROWS * SKE_KPD_NUM_COLS]; 68 67 struct clk *clk; 69 68 spinlock_t ske_keypad_lock; 70 69 }; ··· 262 261 input->name = "ux500-ske-keypad"; 263 262 input->dev.parent = &pdev->dev; 264 263 265 - input->keycode = keypad->keymap; 266 - input->keycodesize = sizeof(keypad->keymap[0]); 267 - input->keycodemax = ARRAY_SIZE(keypad->keymap); 264 + error = matrix_keypad_build_keymap(plat->keymap_data, NULL, 265 + SKE_KPD_NUM_ROWS, SKE_KPD_NUM_COLS, 266 + keypad->keymap, input); 267 + if (error) { 268 + dev_err(&pdev->dev, "Failed to build keymap\n"); 269 + goto err_iounmap; 270 + } 268 271 269 272 input_set_capability(input, EV_MSC, MSC_SCAN); 270 - 271 - __set_bit(EV_KEY, input->evbit); 272 273 if (!plat->no_autorepeat) 273 274 __set_bit(EV_REP, input->evbit); 274 - 275 - matrix_keypad_build_keymap(plat->keymap_data, SKE_KEYPAD_ROW_SHIFT, 276 - input->keycode, input->keybit); 277 275 278 276 clk_enable(keypad->clk); 279 277
+10 -10
drivers/input/keyboard/omap-keypad.c
··· 61 61 unsigned int cols; 62 62 unsigned long delay; 63 63 unsigned int debounce; 64 + unsigned short keymap[]; 64 65 }; 65 66 66 67 static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); ··· 317 316 if (!cpu_is_omap24xx()) 318 317 omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); 319 318 320 - input_dev->keycode = &omap_kp[1]; 321 - input_dev->keycodesize = sizeof(unsigned short); 322 - input_dev->keycodemax = keycodemax; 323 - 324 - if (pdata->rep) 325 - __set_bit(EV_REP, input_dev->evbit); 326 - 327 319 if (pdata->delay) 328 320 omap_kp->delay = pdata->delay; 329 321 ··· 365 371 goto err2; 366 372 367 373 /* setup input device */ 368 - __set_bit(EV_KEY, input_dev->evbit); 369 - matrix_keypad_build_keymap(pdata->keymap_data, row_shift, 370 - input_dev->keycode, input_dev->keybit); 371 374 input_dev->name = "omap-keypad"; 372 375 input_dev->phys = "omap-keypad/input0"; 373 376 input_dev->dev.parent = &pdev->dev; ··· 373 382 input_dev->id.vendor = 0x0001; 374 383 input_dev->id.product = 0x0001; 375 384 input_dev->id.version = 0x0100; 385 + 386 + if (pdata->rep) 387 + __set_bit(EV_REP, input_dev->evbit); 388 + 389 + ret = matrix_keypad_build_keymap(pdata->keymap_data, NULL, 390 + pdata->rows, pdata->cols, 391 + omap_kp->keymap, input_dev); 392 + if (ret < 0) 393 + goto err3; 376 394 377 395 ret = input_register_device(omap_kp->input); 378 396 if (ret < 0) {
+99 -34
drivers/input/keyboard/omap4-keypad.c
··· 68 68 69 69 #define OMAP4_MASK_IRQSTATUSDISABLE 0xFFFF 70 70 71 + enum { 72 + KBD_REVISION_OMAP4 = 0, 73 + KBD_REVISION_OMAP5, 74 + }; 75 + 71 76 struct omap4_keypad { 72 77 struct input_dev *input; 73 78 74 79 void __iomem *base; 75 - int irq; 80 + unsigned int irq; 76 81 77 82 unsigned int rows; 78 83 unsigned int cols; 84 + u32 reg_offset; 85 + u32 irqreg_offset; 79 86 unsigned int row_shift; 80 87 unsigned char key_state[8]; 81 88 unsigned short keymap[]; 82 89 }; 90 + 91 + static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) 92 + { 93 + return __raw_readl(keypad_data->base + 94 + keypad_data->reg_offset + offset); 95 + } 96 + 97 + static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value) 98 + { 99 + __raw_writel(value, 100 + keypad_data->base + keypad_data->reg_offset + offset); 101 + } 102 + 103 + static int kbd_read_irqreg(struct omap4_keypad *keypad_data, u32 offset) 104 + { 105 + return __raw_readl(keypad_data->base + 106 + keypad_data->irqreg_offset + offset); 107 + } 108 + 109 + static void kbd_write_irqreg(struct omap4_keypad *keypad_data, 110 + u32 offset, u32 value) 111 + { 112 + __raw_writel(value, 113 + keypad_data->base + keypad_data->irqreg_offset + offset); 114 + } 115 + 83 116 84 117 /* Interrupt handler */ 85 118 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) ··· 124 91 u32 *new_state = (u32 *) key_state; 125 92 126 93 /* Disable interrupts */ 127 - __raw_writel(OMAP4_VAL_IRQDISABLE, 128 - keypad_data->base + OMAP4_KBD_IRQENABLE); 94 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 95 + OMAP4_VAL_IRQDISABLE); 129 96 130 - *new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0); 131 - *(new_state + 1) = __raw_readl(keypad_data->base 132 - + OMAP4_KBD_FULLCODE63_32); 97 + *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0); 98 + *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32); 133 99 134 100 for (row = 0; row < keypad_data->rows; row++) { 135 101 changed = key_state[row] ^ keypad_data->key_state[row]; ··· 153 121 sizeof(keypad_data->key_state)); 154 122 155 123 /* clear pending interrupts */ 156 - __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS), 157 - keypad_data->base + OMAP4_KBD_IRQSTATUS); 124 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, 125 + kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); 158 126 159 127 /* enable interrupts */ 160 - __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, 161 - keypad_data->base + OMAP4_KBD_IRQENABLE); 128 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 129 + OMAP4_DEF_IRQENABLE_EVENTEN | 130 + OMAP4_DEF_IRQENABLE_LONGKEY); 162 131 163 132 return IRQ_HANDLED; 164 133 } ··· 172 139 173 140 disable_irq(keypad_data->irq); 174 141 175 - __raw_writel(OMAP4_VAL_FUNCTIONALCFG, 176 - keypad_data->base + OMAP4_KBD_CTRL); 177 - __raw_writel(OMAP4_VAL_DEBOUNCINGTIME, 178 - keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME); 179 - __raw_writel(OMAP4_VAL_IRQDISABLE, 180 - keypad_data->base + OMAP4_KBD_IRQSTATUS); 181 - __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, 182 - keypad_data->base + OMAP4_KBD_IRQENABLE); 183 - __raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA, 184 - keypad_data->base + OMAP4_KBD_WAKEUPENABLE); 142 + kbd_writel(keypad_data, OMAP4_KBD_CTRL, 143 + OMAP4_VAL_FUNCTIONALCFG); 144 + kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME, 145 + OMAP4_VAL_DEBOUNCINGTIME); 146 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, 147 + OMAP4_VAL_IRQDISABLE); 148 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 149 + OMAP4_DEF_IRQENABLE_EVENTEN | 150 + OMAP4_DEF_IRQENABLE_LONGKEY); 151 + kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE, 152 + OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA); 185 153 186 154 enable_irq(keypad_data->irq); 187 155 ··· 196 162 disable_irq(keypad_data->irq); 197 163 198 164 /* Disable interrupts */ 199 - __raw_writel(OMAP4_VAL_IRQDISABLE, 200 - keypad_data->base + OMAP4_KBD_IRQENABLE); 165 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 166 + OMAP4_VAL_IRQDISABLE); 201 167 202 168 /* clear pending interrupts */ 203 - __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS), 204 - keypad_data->base + OMAP4_KBD_IRQSTATUS); 169 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, 170 + kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); 205 171 206 172 enable_irq(keypad_data->irq); 207 173 ··· 216 182 struct resource *res; 217 183 resource_size_t size; 218 184 unsigned int row_shift, max_keys; 185 + int rev; 219 186 int irq; 220 187 int error; 221 188 ··· 276 241 keypad_data->rows = pdata->rows; 277 242 keypad_data->cols = pdata->cols; 278 243 244 + /* 245 + * Enable clocks for the keypad module so that we can read 246 + * revision register. 247 + */ 248 + pm_runtime_enable(&pdev->dev); 249 + error = pm_runtime_get_sync(&pdev->dev); 250 + if (error) { 251 + dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n"); 252 + goto err_unmap; 253 + } 254 + rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); 255 + rev &= 0x03 << 30; 256 + rev >>= 30; 257 + switch (rev) { 258 + case KBD_REVISION_OMAP4: 259 + keypad_data->reg_offset = 0x00; 260 + keypad_data->irqreg_offset = 0x00; 261 + break; 262 + case KBD_REVISION_OMAP5: 263 + keypad_data->reg_offset = 0x10; 264 + keypad_data->irqreg_offset = 0x0c; 265 + break; 266 + default: 267 + dev_err(&pdev->dev, 268 + "Keypad reports unsupported revision %d", rev); 269 + error = -EINVAL; 270 + goto err_pm_put_sync; 271 + } 272 + 279 273 /* input device allocation */ 280 274 keypad_data->input = input_dev = input_allocate_device(); 281 275 if (!input_dev) { 282 276 error = -ENOMEM; 283 - goto err_unmap; 277 + goto err_pm_put_sync; 284 278 } 285 279 286 280 input_dev->name = pdev->name; ··· 322 258 input_dev->open = omap4_keypad_open; 323 259 input_dev->close = omap4_keypad_close; 324 260 325 - input_dev->keycode = keypad_data->keymap; 326 - input_dev->keycodesize = sizeof(keypad_data->keymap[0]); 327 - input_dev->keycodemax = max_keys; 261 + error = matrix_keypad_build_keymap(pdata->keymap_data, NULL, 262 + pdata->rows, pdata->cols, 263 + keypad_data->keymap, input_dev); 264 + if (error) { 265 + dev_err(&pdev->dev, "failed to build keymap\n"); 266 + goto err_free_input; 267 + } 328 268 329 - __set_bit(EV_KEY, input_dev->evbit); 330 269 __set_bit(EV_REP, input_dev->evbit); 331 - 332 270 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 333 271 334 272 input_set_drvdata(input_dev, keypad_data); 335 - 336 - matrix_keypad_build_keymap(pdata->keymap_data, row_shift, 337 - input_dev->keycode, input_dev->keybit); 338 273 339 274 error = request_irq(keypad_data->irq, omap4_keypad_interrupt, 340 275 IRQF_TRIGGER_RISING, ··· 343 280 goto err_free_input; 344 281 } 345 282 346 - pm_runtime_enable(&pdev->dev); 283 + pm_runtime_put_sync(&pdev->dev); 347 284 348 285 error = input_register_device(keypad_data->input); 349 286 if (error < 0) { ··· 359 296 free_irq(keypad_data->irq, keypad_data); 360 297 err_free_input: 361 298 input_free_device(input_dev); 299 + err_pm_put_sync: 300 + pm_runtime_put_sync(&pdev->dev); 362 301 err_unmap: 363 302 iounmap(keypad_data->base); 364 303 err_release_mem:
+10 -10
drivers/input/keyboard/pmic8xxx-keypad.c
··· 626 626 kp->input->id.product = 0x0001; 627 627 kp->input->id.vendor = 0x0001; 628 628 629 - kp->input->evbit[0] = BIT_MASK(EV_KEY); 630 - 631 - if (pdata->rep) 632 - __set_bit(EV_REP, kp->input->evbit); 633 - 634 - kp->input->keycode = kp->keycodes; 635 - kp->input->keycodemax = PM8XXX_MATRIX_MAX_SIZE; 636 - kp->input->keycodesize = sizeof(kp->keycodes); 637 629 kp->input->open = pmic8xxx_kp_open; 638 630 kp->input->close = pmic8xxx_kp_close; 639 631 640 - matrix_keypad_build_keymap(keymap_data, PM8XXX_ROW_SHIFT, 641 - kp->input->keycode, kp->input->keybit); 632 + rc = matrix_keypad_build_keymap(keymap_data, NULL, 633 + PM8XXX_MAX_ROWS, PM8XXX_MAX_COLS, 634 + kp->keycodes, kp->input); 635 + if (rc) { 636 + dev_err(&pdev->dev, "failed to build keymap\n"); 637 + goto err_get_irq; 638 + } 642 639 640 + if (pdata->rep) 641 + __set_bit(EV_REP, kp->input->evbit); 643 642 input_set_capability(kp->input, EV_MSC, MSC_SCAN); 643 + 644 644 input_set_drvdata(kp->input, kp); 645 645 646 646 /* initialize keypad state */
+10 -10
drivers/input/keyboard/samsung-keypad.c
··· 454 454 input_dev->name = pdev->name; 455 455 input_dev->id.bustype = BUS_HOST; 456 456 input_dev->dev.parent = &pdev->dev; 457 - input_set_drvdata(input_dev, keypad); 458 457 459 458 input_dev->open = samsung_keypad_open; 460 459 input_dev->close = samsung_keypad_close; 461 460 462 - input_dev->evbit[0] = BIT_MASK(EV_KEY); 463 - if (!pdata->no_autorepeat) 464 - input_dev->evbit[0] |= BIT_MASK(EV_REP); 461 + error = matrix_keypad_build_keymap(keymap_data, NULL, 462 + pdata->rows, pdata->cols, 463 + keypad->keycodes, input_dev); 464 + if (error) { 465 + dev_err(&pdev->dev, "failed to build keymap\n"); 466 + goto err_put_clk; 467 + } 465 468 466 469 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 470 + if (!pdata->no_autorepeat) 471 + __set_bit(EV_REP, input_dev->evbit); 467 472 468 - input_dev->keycode = keypad->keycodes; 469 - input_dev->keycodesize = sizeof(keypad->keycodes[0]); 470 - input_dev->keycodemax = pdata->rows << row_shift; 471 - 472 - matrix_keypad_build_keymap(keymap_data, row_shift, 473 - input_dev->keycode, input_dev->keybit); 473 + input_set_drvdata(input_dev, keypad); 474 474 475 475 keypad->irq = platform_get_irq(pdev, 0); 476 476 if (keypad->irq < 0) {
+67 -25
drivers/input/keyboard/spear-keyboard.c
··· 19 19 #include <linux/irq.h> 20 20 #include <linux/kernel.h> 21 21 #include <linux/module.h> 22 + #include <linux/of.h> 22 23 #include <linux/platform_device.h> 23 24 #include <linux/pm_wakeup.h> 24 25 #include <linux/slab.h> ··· 50 49 #define KEY_VALUE 0x00FFFFFF 51 50 #define ROW_MASK 0xF0 52 51 #define COLUMN_MASK 0x0F 53 - #define ROW_SHIFT 4 52 + #define NUM_ROWS 16 53 + #define NUM_COLS 16 54 + 54 55 #define KEY_MATRIX_SHIFT 6 55 56 56 57 struct spear_kbd { ··· 63 60 unsigned int irq; 64 61 unsigned int mode; 65 62 unsigned short last_key; 66 - unsigned short keycodes[256]; 63 + unsigned short keycodes[NUM_ROWS * NUM_COLS]; 64 + bool rep; 67 65 }; 68 66 69 67 static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) ··· 140 136 kbd->last_key = KEY_RESERVED; 141 137 } 142 138 139 + #ifdef CONFIG_OF 140 + static int __devinit spear_kbd_parse_dt(struct platform_device *pdev, 141 + struct spear_kbd *kbd) 142 + { 143 + struct device_node *np = pdev->dev.of_node; 144 + int error; 145 + u32 val; 146 + 147 + if (!np) { 148 + dev_err(&pdev->dev, "Missing DT data\n"); 149 + return -EINVAL; 150 + } 151 + 152 + if (of_property_read_bool(np, "autorepeat")) 153 + kbd->rep = true; 154 + 155 + error = of_property_read_u32(np, "st,mode", &val); 156 + if (error) { 157 + dev_err(&pdev->dev, "DT: Invalid or missing mode\n"); 158 + return error; 159 + } 160 + 161 + kbd->mode = val; 162 + return 0; 163 + } 164 + #else 165 + static inline int spear_kbd_parse_dt(struct platform_device *pdev, 166 + struct spear_kbd *kbd) 167 + { 168 + return -ENOSYS; 169 + } 170 + #endif 171 + 143 172 static int __devinit spear_kbd_probe(struct platform_device *pdev) 144 173 { 145 - const struct kbd_platform_data *pdata = pdev->dev.platform_data; 146 - const struct matrix_keymap_data *keymap; 174 + struct kbd_platform_data *pdata = dev_get_platdata(&pdev->dev); 175 + const struct matrix_keymap_data *keymap = pdata ? pdata->keymap : NULL; 147 176 struct spear_kbd *kbd; 148 177 struct input_dev *input_dev; 149 178 struct resource *res; 150 179 int irq; 151 180 int error; 152 - 153 - if (!pdata) { 154 - dev_err(&pdev->dev, "Invalid platform data\n"); 155 - return -EINVAL; 156 - } 157 - 158 - keymap = pdata->keymap; 159 - if (!keymap) { 160 - dev_err(&pdev->dev, "no keymap defined\n"); 161 - return -EINVAL; 162 - } 163 181 164 182 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 165 183 if (!res) { ··· 205 179 206 180 kbd->input = input_dev; 207 181 kbd->irq = irq; 208 - kbd->mode = pdata->mode; 182 + 183 + if (!pdata) { 184 + error = spear_kbd_parse_dt(pdev, kbd); 185 + if (error) 186 + goto err_free_mem; 187 + } else { 188 + kbd->mode = pdata->mode; 189 + kbd->rep = pdata->rep; 190 + } 209 191 210 192 kbd->res = request_mem_region(res->start, resource_size(res), 211 193 pdev->name); ··· 246 212 input_dev->open = spear_kbd_open; 247 213 input_dev->close = spear_kbd_close; 248 214 249 - __set_bit(EV_KEY, input_dev->evbit); 250 - if (pdata->rep) 215 + error = matrix_keypad_build_keymap(keymap, NULL, NUM_ROWS, NUM_COLS, 216 + kbd->keycodes, input_dev); 217 + if (error) { 218 + dev_err(&pdev->dev, "Failed to build keymap\n"); 219 + goto err_put_clk; 220 + } 221 + 222 + if (kbd->rep) 251 223 __set_bit(EV_REP, input_dev->evbit); 252 224 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 253 - 254 - input_dev->keycode = kbd->keycodes; 255 - input_dev->keycodesize = sizeof(kbd->keycodes[0]); 256 - input_dev->keycodemax = ARRAY_SIZE(kbd->keycodes); 257 - 258 - matrix_keypad_build_keymap(keymap, ROW_SHIFT, 259 - input_dev->keycode, input_dev->keybit); 260 225 261 226 input_set_drvdata(input_dev, kbd); 262 227 ··· 350 317 351 318 static SIMPLE_DEV_PM_OPS(spear_kbd_pm_ops, spear_kbd_suspend, spear_kbd_resume); 352 319 320 + #ifdef CONFIG_OF 321 + static const struct of_device_id spear_kbd_id_table[] = { 322 + { .compatible = "st,spear300-kbd" }, 323 + {} 324 + }; 325 + MODULE_DEVICE_TABLE(of, spear_kbd_id_table); 326 + #endif 327 + 353 328 static struct platform_driver spear_kbd_driver = { 354 329 .probe = spear_kbd_probe, 355 330 .remove = __devexit_p(spear_kbd_remove), ··· 365 324 .name = "keyboard", 366 325 .owner = THIS_MODULE, 367 326 .pm = &spear_kbd_pm_ops, 327 + .of_match_table = of_match_ptr(spear_kbd_id_table), 368 328 }, 369 329 }; 370 330 module_platform_driver(spear_kbd_driver);
+7 -9
drivers/input/keyboard/stmpe-keypad.c
··· 289 289 input->id.bustype = BUS_I2C; 290 290 input->dev.parent = &pdev->dev; 291 291 292 - input_set_capability(input, EV_MSC, MSC_SCAN); 292 + ret = matrix_keypad_build_keymap(plat->keymap_data, NULL, 293 + STMPE_KEYPAD_MAX_ROWS, 294 + STMPE_KEYPAD_MAX_COLS, 295 + keypad->keymap, input); 296 + if (ret) 297 + goto out_freeinput; 293 298 294 - __set_bit(EV_KEY, input->evbit); 299 + input_set_capability(input, EV_MSC, MSC_SCAN); 295 300 if (!plat->no_autorepeat) 296 301 __set_bit(EV_REP, input->evbit); 297 - 298 - input->keycode = keypad->keymap; 299 - input->keycodesize = sizeof(keypad->keymap[0]); 300 - input->keycodemax = ARRAY_SIZE(keypad->keymap); 301 - 302 - matrix_keypad_build_keymap(plat->keymap_data, STMPE_KEYPAD_ROW_SHIFT, 303 - input->keycode, input->keybit); 304 302 305 303 for (i = 0; i < plat->keymap_data->keymap_size; i++) { 306 304 unsigned int key = plat->keymap_data->keymap[i];
+1 -12
drivers/input/keyboard/stowaway.c
··· 170 170 .disconnect = skbd_disconnect, 171 171 }; 172 172 173 - static int __init skbd_init(void) 174 - { 175 - return serio_register_driver(&skbd_drv); 176 - } 177 - 178 - static void __exit skbd_exit(void) 179 - { 180 - serio_unregister_driver(&skbd_drv); 181 - } 182 - 183 - module_init(skbd_init); 184 - module_exit(skbd_exit); 173 + module_serio_driver(skbd_drv);
+1 -16
drivers/input/keyboard/sunkbd.c
··· 369 369 .disconnect = sunkbd_disconnect, 370 370 }; 371 371 372 - /* 373 - * The functions for insering/removing us as a module. 374 - */ 375 - 376 - static int __init sunkbd_init(void) 377 - { 378 - return serio_register_driver(&sunkbd_drv); 379 - } 380 - 381 - static void __exit sunkbd_exit(void) 382 - { 383 - serio_unregister_driver(&sunkbd_drv); 384 - } 385 - 386 - module_init(sunkbd_init); 387 - module_exit(sunkbd_exit); 372 + module_serio_driver(sunkbd_drv);
+17 -22
drivers/input/keyboard/tc3589x-keypad.c
··· 78 78 * @input: pointer to input device object 79 79 * @board: keypad platform device 80 80 * @krow: number of rows 81 - * @kcol: number of coloumns 81 + * @kcol: number of columns 82 82 * @keymap: matrix scan code table for keycodes 83 83 * @keypad_stopped: holds keypad status 84 84 */ ··· 96 96 { 97 97 int ret; 98 98 struct tc3589x *tc3589x = keypad->tc3589x; 99 - u8 settle_time = keypad->board->settle_time; 100 - u8 dbounce_period = keypad->board->debounce_period; 101 - u8 rows = keypad->board->krow & 0xf; /* mask out the nibble */ 102 - u8 column = keypad->board->kcol & 0xf; /* mask out the nibble */ 99 + const struct tc3589x_keypad_platform_data *board = keypad->board; 103 100 104 - /* validate platform configurations */ 105 - if (keypad->board->kcol > TC3589x_MAX_KPCOL || 106 - keypad->board->krow > TC3589x_MAX_KPROW || 107 - keypad->board->debounce_period > TC3589x_MAX_DEBOUNCE_SETTLE || 108 - keypad->board->settle_time > TC3589x_MAX_DEBOUNCE_SETTLE) 101 + /* validate platform configuration */ 102 + if (board->kcol > TC3589x_MAX_KPCOL || board->krow > TC3589x_MAX_KPROW) 109 103 return -EINVAL; 110 104 111 105 /* configure KBDSIZE 4 LSbits for cols and 4 MSbits for rows */ 112 106 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSIZE, 113 - (rows << KP_ROW_SHIFT) | column); 107 + (board->krow << KP_ROW_SHIFT) | board->kcol); 114 108 if (ret < 0) 115 109 return ret; 116 110 ··· 118 124 return ret; 119 125 120 126 /* Configure settle time */ 121 - ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSETTLE_REG, settle_time); 127 + ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSETTLE_REG, 128 + board->settle_time); 122 129 if (ret < 0) 123 130 return ret; 124 131 125 132 /* Configure debounce time */ 126 - ret = tc3589x_reg_write(tc3589x, TC3589x_KBDBOUNCE, dbounce_period); 133 + ret = tc3589x_reg_write(tc3589x, TC3589x_KBDBOUNCE, 134 + board->debounce_period); 127 135 if (ret < 0) 128 136 return ret; 129 137 ··· 333 337 input->name = pdev->name; 334 338 input->dev.parent = &pdev->dev; 335 339 336 - input->keycode = keypad->keymap; 337 - input->keycodesize = sizeof(keypad->keymap[0]); 338 - input->keycodemax = ARRAY_SIZE(keypad->keymap); 339 - 340 340 input->open = tc3589x_keypad_open; 341 341 input->close = tc3589x_keypad_close; 342 342 343 - input_set_drvdata(input, keypad); 343 + error = matrix_keypad_build_keymap(plat->keymap_data, NULL, 344 + TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, 345 + keypad->keymap, input); 346 + if (error) { 347 + dev_err(&pdev->dev, "Failed to build keymap\n"); 348 + goto err_free_mem; 349 + } 344 350 345 351 input_set_capability(input, EV_MSC, MSC_SCAN); 346 - 347 - __set_bit(EV_KEY, input->evbit); 348 352 if (!plat->no_autorepeat) 349 353 __set_bit(EV_REP, input->evbit); 350 354 351 - matrix_keypad_build_keymap(plat->keymap_data, 0x3, 352 - input->keycode, input->keybit); 355 + input_set_drvdata(input, keypad); 353 356 354 357 error = request_threaded_irq(irq, NULL, 355 358 tc3589x_keypad_irq, plat->irqtype,
+7 -8
drivers/input/keyboard/tca8418_keypad.c
··· 342 342 input->id.product = 0x001; 343 343 input->id.version = 0x0001; 344 344 345 - input->keycode = keypad_data->keymap; 346 - input->keycodesize = sizeof(keypad_data->keymap[0]); 347 - input->keycodemax = max_keys; 345 + error = matrix_keypad_build_keymap(pdata->keymap_data, NULL, 346 + pdata->rows, pdata->cols, 347 + keypad_data->keymap, input); 348 + if (error) { 349 + dev_dbg(&client->dev, "Failed to build keymap\n"); 350 + goto fail2; 351 + } 348 352 349 - __set_bit(EV_KEY, input->evbit); 350 353 if (pdata->rep) 351 354 __set_bit(EV_REP, input->evbit); 352 - 353 355 input_set_capability(input, EV_MSC, MSC_SCAN); 354 356 355 357 input_set_drvdata(input, keypad_data); 356 - 357 - matrix_keypad_build_keymap(pdata->keymap_data, row_shift, 358 - input->keycode, input->keybit); 359 358 360 359 if (pdata->irq_is_gpio) 361 360 client->irq = gpio_to_irq(client->irq);
+41 -27
drivers/input/keyboard/tegra-kbc.c
··· 619 619 } 620 620 621 621 #ifdef CONFIG_OF 622 - static struct tegra_kbc_platform_data * __devinit 623 - tegra_kbc_dt_parse_pdata(struct platform_device *pdev) 622 + static struct tegra_kbc_platform_data * __devinit tegra_kbc_dt_parse_pdata( 623 + struct platform_device *pdev) 624 624 { 625 625 struct tegra_kbc_platform_data *pdata; 626 626 struct device_node *np = pdev->dev.of_node; ··· 660 660 pdata->pin_cfg[KBC_MAX_ROW + i].type = PIN_CFG_COL; 661 661 } 662 662 663 - pdata->keymap_data = matrix_keyboard_of_fill_keymap(np, "linux,keymap"); 664 - 665 - /* FIXME: Add handling of linux,fn-keymap here */ 666 - 667 663 return pdata; 668 664 } 669 665 #else ··· 670 674 } 671 675 #endif 672 676 677 + static int __devinit tegra_kbd_setup_keymap(struct tegra_kbc *kbc) 678 + { 679 + const struct tegra_kbc_platform_data *pdata = kbc->pdata; 680 + const struct matrix_keymap_data *keymap_data = pdata->keymap_data; 681 + unsigned int keymap_rows = KBC_MAX_KEY; 682 + int retval; 683 + 684 + if (keymap_data && pdata->use_fn_map) 685 + keymap_rows *= 2; 686 + 687 + retval = matrix_keypad_build_keymap(keymap_data, NULL, 688 + keymap_rows, KBC_MAX_COL, 689 + kbc->keycode, kbc->idev); 690 + if (retval == -ENOSYS || retval == -ENOENT) { 691 + /* 692 + * If there is no OF support in kernel or keymap 693 + * property is missing, use default keymap. 694 + */ 695 + retval = matrix_keypad_build_keymap( 696 + &tegra_kbc_default_keymap_data, NULL, 697 + keymap_rows, KBC_MAX_COL, 698 + kbc->keycode, kbc->idev); 699 + } 700 + 701 + return retval; 702 + } 703 + 673 704 static int __devinit tegra_kbc_probe(struct platform_device *pdev) 674 705 { 675 706 const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; 676 - const struct matrix_keymap_data *keymap_data; 677 707 struct tegra_kbc *kbc; 678 708 struct input_dev *input_dev; 679 709 struct resource *res; ··· 779 757 kbc->repoll_dly = KBC_ROW_SCAN_DLY + scan_time_rows + pdata->repeat_cnt; 780 758 kbc->repoll_dly = DIV_ROUND_UP(kbc->repoll_dly, KBC_CYCLE_MS); 781 759 760 + kbc->wakeup_key = pdata->wakeup_key; 761 + kbc->use_fn_map = pdata->use_fn_map; 762 + kbc->use_ghost_filter = pdata->use_ghost_filter; 763 + 782 764 input_dev->name = pdev->name; 783 765 input_dev->id.bustype = BUS_HOST; 784 766 input_dev->dev.parent = &pdev->dev; 785 767 input_dev->open = tegra_kbc_open; 786 768 input_dev->close = tegra_kbc_close; 787 769 788 - input_set_drvdata(input_dev, kbc); 770 + err = tegra_kbd_setup_keymap(kbc); 771 + if (err) { 772 + dev_err(&pdev->dev, "failed to setup keymap\n"); 773 + goto err_put_clk; 774 + } 789 775 790 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); 776 + __set_bit(EV_REP, input_dev->evbit); 791 777 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 792 778 793 - input_dev->keycode = kbc->keycode; 794 - input_dev->keycodesize = sizeof(kbc->keycode[0]); 795 - input_dev->keycodemax = KBC_MAX_KEY; 796 - if (pdata->use_fn_map) 797 - input_dev->keycodemax *= 2; 798 - 799 - kbc->use_fn_map = pdata->use_fn_map; 800 - kbc->use_ghost_filter = pdata->use_ghost_filter; 801 - keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; 802 - matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, 803 - input_dev->keycode, input_dev->keybit); 804 - kbc->wakeup_key = pdata->wakeup_key; 779 + input_set_drvdata(input_dev, kbc); 805 780 806 781 err = request_irq(kbc->irq, tegra_kbc_isr, 807 782 IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc); ··· 818 799 platform_set_drvdata(pdev, kbc); 819 800 device_init_wakeup(&pdev->dev, pdata->wakeup); 820 801 821 - if (!pdev->dev.platform_data) 822 - matrix_keyboard_of_free_keymap(pdata->keymap_data); 823 - 824 802 return 0; 825 803 826 804 err_free_irq: ··· 832 816 input_free_device(input_dev); 833 817 kfree(kbc); 834 818 err_free_pdata: 835 - if (!pdev->dev.platform_data) { 836 - matrix_keyboard_of_free_keymap(pdata->keymap_data); 819 + if (!pdev->dev.platform_data) 837 820 kfree(pdata); 838 - } 839 821 840 822 return err; 841 823 }
+11 -10
drivers/input/keyboard/tnetv107x-keypad.c
··· 247 247 error = -ENOMEM; 248 248 goto error_input; 249 249 } 250 - input_set_drvdata(kp->input_dev, kp); 251 250 252 251 kp->input_dev->name = pdev->name; 253 252 kp->input_dev->dev.parent = &pdev->dev; 254 253 kp->input_dev->open = keypad_start; 255 254 kp->input_dev->close = keypad_stop; 256 - kp->input_dev->evbit[0] = BIT_MASK(EV_KEY); 257 - if (!pdata->no_autorepeat) 258 - kp->input_dev->evbit[0] |= BIT_MASK(EV_REP); 259 255 260 256 clk_enable(kp->clk); 261 257 rev = keypad_read(kp, rev); ··· 260 264 kp->input_dev->id.version = ((rev >> 16) & 0xfff); 261 265 clk_disable(kp->clk); 262 266 263 - kp->input_dev->keycode = kp->keycodes; 264 - kp->input_dev->keycodesize = sizeof(kp->keycodes[0]); 265 - kp->input_dev->keycodemax = kp->rows << kp->row_shift; 267 + error = matrix_keypad_build_keymap(keymap_data, NULL, 268 + kp->rows, kp->cols, 269 + kp->keycodes, kp->input_dev); 270 + if (error) { 271 + dev_err(dev, "Failed to build keymap\n"); 272 + goto error_reg; 273 + } 266 274 267 - matrix_keypad_build_keymap(keymap_data, kp->row_shift, kp->keycodes, 268 - kp->input_dev->keybit); 269 - 275 + if (!pdata->no_autorepeat) 276 + kp->input_dev->evbit[0] |= BIT_MASK(EV_REP); 270 277 input_set_capability(kp->input_dev, EV_MSC, MSC_SCAN); 278 + 279 + input_set_drvdata(kp->input_dev, kp); 271 280 272 281 error = input_register_device(kp->input_dev); 273 282 if (error < 0) {
+12 -13
drivers/input/keyboard/twl4030_keypad.c
··· 361 361 kp->irq = platform_get_irq(pdev, 0); 362 362 363 363 /* setup input device */ 364 - __set_bit(EV_KEY, input->evbit); 365 - 366 - /* Enable auto repeat feature of Linux input subsystem */ 367 - if (pdata->rep) 368 - __set_bit(EV_REP, input->evbit); 369 - 370 - input_set_capability(input, EV_MSC, MSC_SCAN); 371 - 372 364 input->name = "TWL4030 Keypad"; 373 365 input->phys = "twl4030_keypad/input0"; 374 366 input->dev.parent = &pdev->dev; ··· 370 378 input->id.product = 0x0001; 371 379 input->id.version = 0x0003; 372 380 373 - input->keycode = kp->keymap; 374 - input->keycodesize = sizeof(kp->keymap[0]); 375 - input->keycodemax = ARRAY_SIZE(kp->keymap); 381 + error = matrix_keypad_build_keymap(keymap_data, NULL, 382 + TWL4030_MAX_ROWS, 383 + 1 << TWL4030_ROW_SHIFT, 384 + kp->keymap, input); 385 + if (error) { 386 + dev_err(kp->dbg_dev, "Failed to build keymap\n"); 387 + goto err1; 388 + } 376 389 377 - matrix_keypad_build_keymap(keymap_data, TWL4030_ROW_SHIFT, 378 - input->keycode, input->keybit); 390 + input_set_capability(input, EV_MSC, MSC_SCAN); 391 + /* Enable auto repeat feature of Linux input subsystem */ 392 + if (pdata->rep) 393 + __set_bit(EV_REP, input->evbit); 379 394 380 395 error = input_register_device(input); 381 396 if (error) {
+14 -13
drivers/input/keyboard/w90p910_keypad.c
··· 42 42 #define KGET_RAW(n) (((n) & KEY0R) >> 3) 43 43 #define KGET_COLUMN(n) ((n) & KEY0C) 44 44 45 - #define W90P910_MAX_KEY_NUM (8 * 8) 45 + #define W90P910_NUM_ROWS 8 46 + #define W90P910_NUM_COLS 8 46 47 #define W90P910_ROW_SHIFT 3 47 48 48 49 struct w90p910_keypad { ··· 52 51 struct input_dev *input_dev; 53 52 void __iomem *mmio_base; 54 53 int irq; 55 - unsigned short keymap[W90P910_MAX_KEY_NUM]; 54 + unsigned short keymap[W90P910_NUM_ROWS * W90P910_NUM_COLS]; 56 55 }; 57 56 58 57 static void w90p910_keypad_scan_matrix(struct w90p910_keypad *keypad, ··· 191 190 input_dev->close = w90p910_keypad_close; 192 191 input_dev->dev.parent = &pdev->dev; 193 192 194 - input_dev->keycode = keypad->keymap; 195 - input_dev->keycodesize = sizeof(keypad->keymap[0]); 196 - input_dev->keycodemax = ARRAY_SIZE(keypad->keymap); 197 - 198 - input_set_drvdata(input_dev, keypad); 199 - 200 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); 201 - input_set_capability(input_dev, EV_MSC, MSC_SCAN); 202 - 203 - matrix_keypad_build_keymap(keymap_data, W90P910_ROW_SHIFT, 204 - input_dev->keycode, input_dev->keybit); 193 + error = matrix_keypad_build_keymap(keymap_data, NULL, 194 + W90P910_NUM_ROWS, W90P910_NUM_COLS, 195 + keypad->keymap, input_dev); 196 + if (error) { 197 + dev_err(&pdev->dev, "failed to build keymap\n"); 198 + goto failed_put_clk; 199 + } 205 200 206 201 error = request_irq(keypad->irq, w90p910_keypad_irq_handler, 207 202 0, pdev->name, keypad); ··· 205 208 dev_err(&pdev->dev, "failed to request IRQ\n"); 206 209 goto failed_put_clk; 207 210 } 211 + 212 + __set_bit(EV_REP, input_dev->evbit); 213 + input_set_capability(input_dev, EV_MSC, MSC_SCAN); 214 + input_set_drvdata(input_dev, keypad); 208 215 209 216 /* Register the input device */ 210 217 error = input_register_device(input_dev);
+1 -12
drivers/input/keyboard/xtkbd.c
··· 169 169 .disconnect = xtkbd_disconnect, 170 170 }; 171 171 172 - static int __init xtkbd_init(void) 173 - { 174 - return serio_register_driver(&xtkbd_drv); 175 - } 176 - 177 - static void __exit xtkbd_exit(void) 178 - { 179 - serio_unregister_driver(&xtkbd_drv); 180 - } 181 - 182 - module_init(xtkbd_init); 183 - module_exit(xtkbd_exit); 172 + module_serio_driver(xtkbd_drv);
+163
drivers/input/matrix-keymap.c
··· 1 + /* 2 + * Helpers for matrix keyboard bindings 3 + * 4 + * Copyright (C) 2012 Google, Inc 5 + * 6 + * Author: 7 + * Olof Johansson <olof@lixom.net> 8 + * 9 + * This software is licensed under the terms of the GNU General Public 10 + * License version 2, as published by the Free Software Foundation, and 11 + * may be copied, distributed, and modified under those terms. 12 + * 13 + * This program is distributed in the hope that it will be useful, 14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + * GNU General Public License for more details. 17 + * 18 + */ 19 + 20 + #include <linux/device.h> 21 + #include <linux/kernel.h> 22 + #include <linux/types.h> 23 + #include <linux/input.h> 24 + #include <linux/of.h> 25 + #include <linux/export.h> 26 + #include <linux/input/matrix_keypad.h> 27 + 28 + static bool matrix_keypad_map_key(struct input_dev *input_dev, 29 + unsigned int rows, unsigned int cols, 30 + unsigned int row_shift, unsigned int key) 31 + { 32 + unsigned short *keymap = input_dev->keycode; 33 + unsigned int row = KEY_ROW(key); 34 + unsigned int col = KEY_COL(key); 35 + unsigned short code = KEY_VAL(key); 36 + 37 + if (row >= rows || col >= cols) { 38 + dev_err(input_dev->dev.parent, 39 + "%s: invalid keymap entry 0x%x (row: %d, col: %d, rows: %d, cols: %d)\n", 40 + __func__, key, row, col, rows, cols); 41 + return false; 42 + } 43 + 44 + keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code; 45 + __set_bit(code, input_dev->keybit); 46 + 47 + return true; 48 + } 49 + 50 + #ifdef CONFIG_OF 51 + static int matrix_keypad_parse_of_keymap(const char *propname, 52 + unsigned int rows, unsigned int cols, 53 + struct input_dev *input_dev) 54 + { 55 + struct device *dev = input_dev->dev.parent; 56 + struct device_node *np = dev->of_node; 57 + unsigned int row_shift = get_count_order(cols); 58 + unsigned int max_keys = rows << row_shift; 59 + unsigned int proplen, i, size; 60 + const __be32 *prop; 61 + 62 + if (!np) 63 + return -ENOENT; 64 + 65 + if (!propname) 66 + propname = "linux,keymap"; 67 + 68 + prop = of_get_property(np, propname, &proplen); 69 + if (!prop) { 70 + dev_err(dev, "OF: %s property not defined in %s\n", 71 + propname, np->full_name); 72 + return -ENOENT; 73 + } 74 + 75 + if (proplen % sizeof(u32)) { 76 + dev_err(dev, "OF: Malformed keycode property %s in %s\n", 77 + propname, np->full_name); 78 + return -EINVAL; 79 + } 80 + 81 + size = proplen / sizeof(u32); 82 + if (size > max_keys) { 83 + dev_err(dev, "OF: %s size overflow\n", propname); 84 + return -EINVAL; 85 + } 86 + 87 + for (i = 0; i < size; i++) { 88 + unsigned int key = be32_to_cpup(prop + i); 89 + 90 + if (!matrix_keypad_map_key(input_dev, rows, cols, 91 + row_shift, key)) 92 + return -EINVAL; 93 + } 94 + 95 + return 0; 96 + } 97 + #else 98 + static int matrix_keypad_parse_of_keymap(const char *propname, 99 + unsigned int rows, unsigned int cols, 100 + struct input_dev *input_dev) 101 + { 102 + return -ENOSYS; 103 + } 104 + #endif 105 + 106 + /** 107 + * matrix_keypad_build_keymap - convert platform keymap into matrix keymap 108 + * @keymap_data: keymap supplied by the platform code 109 + * @keymap_name: name of device tree property containing keymap (if device 110 + * tree support is enabled). 111 + * @rows: number of rows in target keymap array 112 + * @cols: number of cols in target keymap array 113 + * @keymap: expanded version of keymap that is suitable for use by 114 + * matrix keyboard driver 115 + * @input_dev: input devices for which we are setting up the keymap 116 + * 117 + * This function converts platform keymap (encoded with KEY() macro) into 118 + * an array of keycodes that is suitable for using in a standard matrix 119 + * keyboard driver that uses row and col as indices. 120 + * 121 + * If @keymap_data is not supplied and device tree support is enabled 122 + * it will attempt load the keymap from property specified by @keymap_name 123 + * argument (or "linux,keymap" if @keymap_name is %NULL). 124 + * 125 + * Callers are expected to set up input_dev->dev.parent before calling this 126 + * function. 127 + */ 128 + int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, 129 + const char *keymap_name, 130 + unsigned int rows, unsigned int cols, 131 + unsigned short *keymap, 132 + struct input_dev *input_dev) 133 + { 134 + unsigned int row_shift = get_count_order(cols); 135 + int i; 136 + int error; 137 + 138 + input_dev->keycode = keymap; 139 + input_dev->keycodesize = sizeof(*keymap); 140 + input_dev->keycodemax = rows << row_shift; 141 + 142 + __set_bit(EV_KEY, input_dev->evbit); 143 + 144 + if (keymap_data) { 145 + for (i = 0; i < keymap_data->keymap_size; i++) { 146 + unsigned int key = keymap_data->keymap[i]; 147 + 148 + if (!matrix_keypad_map_key(input_dev, rows, cols, 149 + row_shift, key)) 150 + return -EINVAL; 151 + } 152 + } else { 153 + error = matrix_keypad_parse_of_keymap(keymap_name, rows, cols, 154 + input_dev); 155 + if (error) 156 + return error; 157 + } 158 + 159 + __clear_bit(KEY_RESERVED, input_dev->keybit); 160 + 161 + return 0; 162 + } 163 + EXPORT_SYMBOL(matrix_keypad_build_keymap);
+1 -1
drivers/input/misc/cma3000_d0x.c
··· 318 318 mutex_init(&data->mutex); 319 319 320 320 data->mode = pdata->mode; 321 - if (data->mode < CMAMODE_DEFAULT || data->mode > CMAMODE_POFF) { 321 + if (data->mode > CMAMODE_POFF) { 322 322 data->mode = CMAMODE_MOTDET; 323 323 dev_warn(dev, 324 324 "Invalid mode specified, assuming Motion Detect\n");
+1 -1
drivers/input/misc/mpu3050.c
··· 367 367 368 368 error = request_threaded_irq(client->irq, 369 369 NULL, mpu3050_interrupt_thread, 370 - IRQF_TRIGGER_RISING, 370 + IRQF_TRIGGER_RISING | IRQF_ONESHOT, 371 371 "mpu3050", sensor); 372 372 if (error) { 373 373 dev_err(&client->dev,
+35 -11
drivers/input/misc/twl6040-vibra.c
··· 27 27 */ 28 28 #include <linux/module.h> 29 29 #include <linux/platform_device.h> 30 + #include <linux/of.h> 30 31 #include <linux/workqueue.h> 31 32 #include <linux/input.h> 32 33 #include <linux/mfd/twl6040.h> ··· 259 258 static int __devinit twl6040_vibra_probe(struct platform_device *pdev) 260 259 { 261 260 struct twl6040_vibra_data *pdata = pdev->dev.platform_data; 261 + struct device_node *node = pdev->dev.of_node; 262 262 struct vibra_info *info; 263 + int vddvibl_uV = 0; 264 + int vddvibr_uV = 0; 263 265 int ret; 264 266 265 - if (!pdata) { 267 + if (!pdata && !node) { 266 268 dev_err(&pdev->dev, "platform_data not available\n"); 267 269 return -EINVAL; 268 270 } ··· 277 273 } 278 274 279 275 info->dev = &pdev->dev; 276 + 280 277 info->twl6040 = dev_get_drvdata(pdev->dev.parent); 281 - info->vibldrv_res = pdata->vibldrv_res; 282 - info->vibrdrv_res = pdata->vibrdrv_res; 283 - info->viblmotor_res = pdata->viblmotor_res; 284 - info->vibrmotor_res = pdata->vibrmotor_res; 278 + if (pdata) { 279 + info->vibldrv_res = pdata->vibldrv_res; 280 + info->vibrdrv_res = pdata->vibrdrv_res; 281 + info->viblmotor_res = pdata->viblmotor_res; 282 + info->vibrmotor_res = pdata->vibrmotor_res; 283 + vddvibl_uV = pdata->vddvibl_uV; 284 + vddvibr_uV = pdata->vddvibr_uV; 285 + } else { 286 + of_property_read_u32(node, "vibldrv_res", &info->vibldrv_res); 287 + of_property_read_u32(node, "vibrdrv_res", &info->vibrdrv_res); 288 + of_property_read_u32(node, "viblmotor_res", 289 + &info->viblmotor_res); 290 + of_property_read_u32(node, "vibrmotor_res", 291 + &info->vibrmotor_res); 292 + of_property_read_u32(node, "vddvibl_uV", &vddvibl_uV); 293 + of_property_read_u32(node, "vddvibr_uV", &vddvibr_uV); 294 + } 295 + 285 296 if ((!info->vibldrv_res && !info->viblmotor_res) || 286 297 (!info->vibrdrv_res && !info->vibrmotor_res)) { 287 298 dev_err(info->dev, "invalid vibra driver/motor resistance\n"); ··· 358 339 goto err_regulator; 359 340 } 360 341 361 - if (pdata->vddvibl_uV) { 342 + if (vddvibl_uV) { 362 343 ret = regulator_set_voltage(info->supplies[0].consumer, 363 - pdata->vddvibl_uV, 364 - pdata->vddvibl_uV); 344 + vddvibl_uV, vddvibl_uV); 365 345 if (ret) { 366 346 dev_err(info->dev, "failed to set VDDVIBL volt %d\n", 367 347 ret); ··· 368 350 } 369 351 } 370 352 371 - if (pdata->vddvibr_uV) { 353 + if (vddvibr_uV) { 372 354 ret = regulator_set_voltage(info->supplies[1].consumer, 373 - pdata->vddvibr_uV, 374 - pdata->vddvibr_uV); 355 + vddvibr_uV, vddvibr_uV); 375 356 if (ret) { 376 357 dev_err(info->dev, "failed to set VDDVIBR volt %d\n", 377 358 ret); ··· 418 401 return 0; 419 402 } 420 403 404 + static const struct of_device_id twl6040_vibra_of_match[] = { 405 + {.compatible = "ti,twl6040-vibra", }, 406 + { }, 407 + }; 408 + MODULE_DEVICE_TABLE(of, twl6040_vibra_of_match); 409 + 421 410 static struct platform_driver twl6040_vibra_driver = { 422 411 .probe = twl6040_vibra_probe, 423 412 .remove = __devexit_p(twl6040_vibra_remove), ··· 431 408 .name = "twl6040-vibra", 432 409 .owner = THIS_MODULE, 433 410 .pm = &twl6040_vibra_pm_ops, 411 + .of_match_table = twl6040_vibra_of_match, 434 412 }, 435 413 }; 436 414 module_platform_driver(twl6040_vibra_driver);
+12
drivers/input/mouse/Kconfig
··· 339 339 To compile this driver as a module, choose M here: the 340 340 module will be called synaptics_usb. 341 341 342 + config MOUSE_NAVPOINT_PXA27x 343 + tristate "Synaptics NavPoint (PXA27x SSP/SPI)" 344 + depends on PXA27x && PXA_SSP 345 + help 346 + This driver adds support for the Synaptics NavPoint touchpad connected 347 + to a PXA27x SSP port in SPI slave mode. The device emulates a mouse; 348 + a tap or tap-and-a-half drag gesture emulates the left mouse button. 349 + For example, use the xf86-input-evdev driver for an X pointing device. 350 + 351 + To compile this driver as a module, choose M here: the 352 + module will be called navpoint. 353 + 342 354 endif
+1
drivers/input/mouse/Makefile
··· 12 12 obj-$(CONFIG_MOUSE_INPORT) += inport.o 13 13 obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o 14 14 obj-$(CONFIG_MOUSE_MAPLE) += maplemouse.o 15 + obj-$(CONFIG_MOUSE_NAVPOINT_PXA27x) += navpoint.o 15 16 obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o 16 17 obj-$(CONFIG_MOUSE_PS2) += psmouse.o 17 18 obj-$(CONFIG_MOUSE_PXA930_TRKBALL) += pxa930_trkball.o
+71 -10
drivers/input/mouse/alps.c
··· 553 553 554 554 alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); 555 555 556 - input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); 557 - input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); 558 - input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); 559 - input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4); 556 + input_mt_report_finger_count(dev, fingers); 560 557 561 558 input_report_key(dev, BTN_LEFT, left); 562 559 input_report_key(dev, BTN_RIGHT, right); ··· 601 604 602 605 static void alps_process_packet_v4(struct psmouse *psmouse) 603 606 { 607 + struct alps_data *priv = psmouse->private; 604 608 unsigned char *packet = psmouse->packet; 605 609 struct input_dev *dev = psmouse->dev; 610 + int offset; 606 611 int x, y, z; 607 612 int left, right; 613 + int x1, y1, x2, y2; 614 + int fingers = 0; 615 + unsigned int x_bitmap, y_bitmap; 616 + 617 + /* 618 + * v4 has a 6-byte encoding for bitmap data, but this data is 619 + * broken up between 3 normal packets. Use priv->multi_packet to 620 + * track our position in the bitmap packet. 621 + */ 622 + if (packet[6] & 0x40) { 623 + /* sync, reset position */ 624 + priv->multi_packet = 0; 625 + } 626 + 627 + if (WARN_ON_ONCE(priv->multi_packet > 2)) 628 + return; 629 + 630 + offset = 2 * priv->multi_packet; 631 + priv->multi_data[offset] = packet[6]; 632 + priv->multi_data[offset + 1] = packet[7]; 633 + 634 + if (++priv->multi_packet > 2) { 635 + priv->multi_packet = 0; 636 + 637 + x_bitmap = ((priv->multi_data[2] & 0x1f) << 10) | 638 + ((priv->multi_data[3] & 0x60) << 3) | 639 + ((priv->multi_data[0] & 0x3f) << 2) | 640 + ((priv->multi_data[1] & 0x60) >> 5); 641 + y_bitmap = ((priv->multi_data[5] & 0x01) << 10) | 642 + ((priv->multi_data[3] & 0x1f) << 5) | 643 + (priv->multi_data[1] & 0x1f); 644 + 645 + fingers = alps_process_bitmap(x_bitmap, y_bitmap, 646 + &x1, &y1, &x2, &y2); 647 + 648 + /* Store MT data.*/ 649 + priv->fingers = fingers; 650 + priv->x1 = x1; 651 + priv->x2 = x2; 652 + priv->y1 = y1; 653 + priv->y2 = y2; 654 + } 608 655 609 656 left = packet[4] & 0x01; 610 657 right = packet[4] & 0x02; ··· 658 617 y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); 659 618 z = packet[5] & 0x7f; 660 619 620 + /* 621 + * If there were no contacts in the bitmap, use ST 622 + * points in MT reports. 623 + * If there were two contacts or more, report MT data. 624 + */ 625 + if (priv->fingers < 2) { 626 + x1 = x; 627 + y1 = y; 628 + fingers = z > 0 ? 1 : 0; 629 + } else { 630 + fingers = priv->fingers; 631 + x1 = priv->x1; 632 + x2 = priv->x2; 633 + y1 = priv->y1; 634 + y2 = priv->y2; 635 + } 636 + 661 637 if (z >= 64) 662 638 input_report_key(dev, BTN_TOUCH, 1); 663 639 else 664 640 input_report_key(dev, BTN_TOUCH, 0); 641 + 642 + alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); 643 + 644 + input_mt_report_finger_count(dev, fingers); 645 + 646 + input_report_key(dev, BTN_LEFT, left); 647 + input_report_key(dev, BTN_RIGHT, right); 665 648 666 649 if (z > 0) { 667 650 input_report_abs(dev, ABS_X, x); 668 651 input_report_abs(dev, ABS_Y, y); 669 652 } 670 653 input_report_abs(dev, ABS_PRESSURE, z); 671 - 672 - input_report_key(dev, BTN_TOOL_FINGER, z > 0); 673 - input_report_key(dev, BTN_LEFT, left); 674 - input_report_key(dev, BTN_RIGHT, right); 675 654 676 655 input_sync(dev); 677 656 } ··· 1618 1557 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); 1619 1558 break; 1620 1559 case ALPS_PROTO_V3: 1560 + case ALPS_PROTO_V4: 1621 1561 set_bit(INPUT_PROP_SEMI_MT, dev1->propbit); 1622 1562 input_mt_init_slots(dev1, 2); 1623 1563 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0); ··· 1627 1565 set_bit(BTN_TOOL_DOUBLETAP, dev1->keybit); 1628 1566 set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); 1629 1567 set_bit(BTN_TOOL_QUADTAP, dev1->keybit); 1630 - /* fall through */ 1631 - case ALPS_PROTO_V4: 1568 + 1632 1569 input_set_abs_params(dev1, ABS_X, 0, ALPS_V3_X_MAX, 0, 0); 1633 1570 input_set_abs_params(dev1, ABS_Y, 0, ALPS_V3_Y_MAX, 0, 0); 1634 1571 break;
+2
drivers/input/mouse/alps.h
··· 39 39 int prev_fin; /* Finger bit from previous packet */ 40 40 int multi_packet; /* Multi-packet data in progress */ 41 41 unsigned char multi_data[6]; /* Saved multi-packet data */ 42 + int x1, x2, y1, y2; /* Coordinates from last MT report */ 43 + int fingers; /* Number of fingers from MT report */ 42 44 u8 quirks; 43 45 struct timer_list timer; 44 46 };
+369
drivers/input/mouse/navpoint.c
··· 1 + /* 2 + * Synaptics NavPoint (PXA27x SSP/SPI) driver. 3 + * 4 + * Copyright (C) 2012 Paul Parsons <lost.distance@yahoo.com> 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 + #include <linux/kernel.h> 12 + #include <linux/init.h> 13 + #include <linux/module.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/clk.h> 16 + #include <linux/delay.h> 17 + #include <linux/gpio.h> 18 + #include <linux/input.h> 19 + #include <linux/input/navpoint.h> 20 + #include <linux/interrupt.h> 21 + #include <linux/mutex.h> 22 + #include <linux/pxa2xx_ssp.h> 23 + #include <linux/slab.h> 24 + 25 + /* 26 + * Synaptics Modular Embedded Protocol: Module Packet Format. 27 + * Module header byte 2:0 = Length (# bytes that follow) 28 + * Module header byte 4:3 = Control 29 + * Module header byte 7:5 = Module Address 30 + */ 31 + #define HEADER_LENGTH(byte) ((byte) & 0x07) 32 + #define HEADER_CONTROL(byte) (((byte) >> 3) & 0x03) 33 + #define HEADER_ADDRESS(byte) ((byte) >> 5) 34 + 35 + struct navpoint { 36 + struct ssp_device *ssp; 37 + struct input_dev *input; 38 + struct device *dev; 39 + int gpio; 40 + int index; 41 + u8 data[1 + HEADER_LENGTH(0xff)]; 42 + }; 43 + 44 + /* 45 + * Initialization values for SSCR0_x, SSCR1_x, SSSR_x. 46 + */ 47 + static const u32 sscr0 = 0 48 + | SSCR0_TUM /* TIM = 1; No TUR interrupts */ 49 + | SSCR0_RIM /* RIM = 1; No ROR interrupts */ 50 + | SSCR0_SSE /* SSE = 1; SSP enabled */ 51 + | SSCR0_Motorola /* FRF = 0; Motorola SPI */ 52 + | SSCR0_DataSize(16) /* DSS = 15; Data size = 16-bit */ 53 + ; 54 + static const u32 sscr1 = 0 55 + | SSCR1_SCFR /* SCFR = 1; SSPSCLK only during transfers */ 56 + | SSCR1_SCLKDIR /* SCLKDIR = 1; Slave mode */ 57 + | SSCR1_SFRMDIR /* SFRMDIR = 1; Slave mode */ 58 + | SSCR1_RWOT /* RWOT = 1; Receive without transmit mode */ 59 + | SSCR1_RxTresh(1) /* RFT = 0; Receive FIFO threshold = 1 */ 60 + | SSCR1_SPH /* SPH = 1; SSPSCLK inactive 0.5 + 1 cycles */ 61 + | SSCR1_RIE /* RIE = 1; Receive FIFO interrupt enabled */ 62 + ; 63 + static const u32 sssr = 0 64 + | SSSR_BCE /* BCE = 1; Clear BCE */ 65 + | SSSR_TUR /* TUR = 1; Clear TUR */ 66 + | SSSR_EOC /* EOC = 1; Clear EOC */ 67 + | SSSR_TINT /* TINT = 1; Clear TINT */ 68 + | SSSR_PINT /* PINT = 1; Clear PINT */ 69 + | SSSR_ROR /* ROR = 1; Clear ROR */ 70 + ; 71 + 72 + /* 73 + * MEP Query $22: Touchpad Coordinate Range Query is not supported by 74 + * the NavPoint module, so sampled values provide the default limits. 75 + */ 76 + #define NAVPOINT_X_MIN 1278 77 + #define NAVPOINT_X_MAX 5340 78 + #define NAVPOINT_Y_MIN 1572 79 + #define NAVPOINT_Y_MAX 4396 80 + #define NAVPOINT_PRESSURE_MIN 0 81 + #define NAVPOINT_PRESSURE_MAX 255 82 + 83 + static void navpoint_packet(struct navpoint *navpoint) 84 + { 85 + int finger; 86 + int gesture; 87 + int x, y, z; 88 + 89 + switch (navpoint->data[0]) { 90 + case 0xff: /* Garbage (packet?) between reset and Hello packet */ 91 + case 0x00: /* Module 0, NULL packet */ 92 + break; 93 + 94 + case 0x0e: /* Module 0, Absolute packet */ 95 + finger = (navpoint->data[1] & 0x01); 96 + gesture = (navpoint->data[1] & 0x02); 97 + x = ((navpoint->data[2] & 0x1f) << 8) | navpoint->data[3]; 98 + y = ((navpoint->data[4] & 0x1f) << 8) | navpoint->data[5]; 99 + z = navpoint->data[6]; 100 + input_report_key(navpoint->input, BTN_TOUCH, finger); 101 + input_report_abs(navpoint->input, ABS_X, x); 102 + input_report_abs(navpoint->input, ABS_Y, y); 103 + input_report_abs(navpoint->input, ABS_PRESSURE, z); 104 + input_report_key(navpoint->input, BTN_TOOL_FINGER, finger); 105 + input_report_key(navpoint->input, BTN_LEFT, gesture); 106 + input_sync(navpoint->input); 107 + break; 108 + 109 + case 0x19: /* Module 0, Hello packet */ 110 + if ((navpoint->data[1] & 0xf0) == 0x10) 111 + break; 112 + /* FALLTHROUGH */ 113 + default: 114 + dev_warn(navpoint->dev, 115 + "spurious packet: data=0x%02x,0x%02x,...\n", 116 + navpoint->data[0], navpoint->data[1]); 117 + break; 118 + } 119 + } 120 + 121 + static irqreturn_t navpoint_irq(int irq, void *dev_id) 122 + { 123 + struct navpoint *navpoint = dev_id; 124 + struct ssp_device *ssp = navpoint->ssp; 125 + irqreturn_t ret = IRQ_NONE; 126 + u32 status; 127 + 128 + status = pxa_ssp_read_reg(ssp, SSSR); 129 + if (status & sssr) { 130 + dev_warn(navpoint->dev, 131 + "unexpected interrupt: status=0x%08x\n", status); 132 + pxa_ssp_write_reg(ssp, SSSR, (status & sssr)); 133 + ret = IRQ_HANDLED; 134 + } 135 + 136 + while (status & SSSR_RNE) { 137 + u32 data; 138 + 139 + data = pxa_ssp_read_reg(ssp, SSDR); 140 + navpoint->data[navpoint->index + 0] = (data >> 8); 141 + navpoint->data[navpoint->index + 1] = data; 142 + navpoint->index += 2; 143 + if (HEADER_LENGTH(navpoint->data[0]) < navpoint->index) { 144 + navpoint_packet(navpoint); 145 + navpoint->index = 0; 146 + } 147 + status = pxa_ssp_read_reg(ssp, SSSR); 148 + ret = IRQ_HANDLED; 149 + } 150 + 151 + return ret; 152 + } 153 + 154 + static void navpoint_up(struct navpoint *navpoint) 155 + { 156 + struct ssp_device *ssp = navpoint->ssp; 157 + int timeout; 158 + 159 + clk_prepare_enable(ssp->clk); 160 + 161 + pxa_ssp_write_reg(ssp, SSCR1, sscr1); 162 + pxa_ssp_write_reg(ssp, SSSR, sssr); 163 + pxa_ssp_write_reg(ssp, SSTO, 0); 164 + pxa_ssp_write_reg(ssp, SSCR0, sscr0); /* SSCR0_SSE written last */ 165 + 166 + /* Wait until SSP port is ready for slave clock operations */ 167 + for (timeout = 100; timeout != 0; --timeout) { 168 + if (!(pxa_ssp_read_reg(ssp, SSSR) & SSSR_CSS)) 169 + break; 170 + msleep(1); 171 + } 172 + 173 + if (timeout == 0) 174 + dev_err(navpoint->dev, 175 + "timeout waiting for SSSR[CSS] to clear\n"); 176 + 177 + if (gpio_is_valid(navpoint->gpio)) 178 + gpio_set_value(navpoint->gpio, 1); 179 + } 180 + 181 + static void navpoint_down(struct navpoint *navpoint) 182 + { 183 + struct ssp_device *ssp = navpoint->ssp; 184 + 185 + if (gpio_is_valid(navpoint->gpio)) 186 + gpio_set_value(navpoint->gpio, 0); 187 + 188 + pxa_ssp_write_reg(ssp, SSCR0, 0); 189 + 190 + clk_disable_unprepare(ssp->clk); 191 + } 192 + 193 + static int navpoint_open(struct input_dev *input) 194 + { 195 + struct navpoint *navpoint = input_get_drvdata(input); 196 + 197 + navpoint_up(navpoint); 198 + 199 + return 0; 200 + } 201 + 202 + static void navpoint_close(struct input_dev *input) 203 + { 204 + struct navpoint *navpoint = input_get_drvdata(input); 205 + 206 + navpoint_down(navpoint); 207 + } 208 + 209 + static int __devinit navpoint_probe(struct platform_device *pdev) 210 + { 211 + const struct navpoint_platform_data *pdata = 212 + dev_get_platdata(&pdev->dev); 213 + struct ssp_device *ssp; 214 + struct input_dev *input; 215 + struct navpoint *navpoint; 216 + int error; 217 + 218 + if (!pdata) { 219 + dev_err(&pdev->dev, "no platform data\n"); 220 + return -EINVAL; 221 + } 222 + 223 + if (gpio_is_valid(pdata->gpio)) { 224 + error = gpio_request_one(pdata->gpio, GPIOF_OUT_INIT_LOW, 225 + "SYNAPTICS_ON"); 226 + if (error) 227 + return error; 228 + } 229 + 230 + ssp = pxa_ssp_request(pdata->port, pdev->name); 231 + if (!ssp) { 232 + error = -ENODEV; 233 + goto err_free_gpio; 234 + } 235 + 236 + /* HaRET does not disable devices before jumping into Linux */ 237 + if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE) { 238 + pxa_ssp_write_reg(ssp, SSCR0, 0); 239 + dev_warn(&pdev->dev, "ssp%d already enabled\n", pdata->port); 240 + } 241 + 242 + navpoint = kzalloc(sizeof(*navpoint), GFP_KERNEL); 243 + input = input_allocate_device(); 244 + if (!navpoint || !input) { 245 + error = -ENOMEM; 246 + goto err_free_mem; 247 + } 248 + 249 + navpoint->ssp = ssp; 250 + navpoint->input = input; 251 + navpoint->dev = &pdev->dev; 252 + navpoint->gpio = pdata->gpio; 253 + 254 + input->name = pdev->name; 255 + input->dev.parent = &pdev->dev; 256 + 257 + __set_bit(EV_KEY, input->evbit); 258 + __set_bit(EV_ABS, input->evbit); 259 + __set_bit(BTN_LEFT, input->keybit); 260 + __set_bit(BTN_TOUCH, input->keybit); 261 + __set_bit(BTN_TOOL_FINGER, input->keybit); 262 + 263 + input_set_abs_params(input, ABS_X, 264 + NAVPOINT_X_MIN, NAVPOINT_X_MAX, 0, 0); 265 + input_set_abs_params(input, ABS_Y, 266 + NAVPOINT_Y_MIN, NAVPOINT_Y_MAX, 0, 0); 267 + input_set_abs_params(input, ABS_PRESSURE, 268 + NAVPOINT_PRESSURE_MIN, NAVPOINT_PRESSURE_MAX, 269 + 0, 0); 270 + 271 + input->open = navpoint_open; 272 + input->close = navpoint_close; 273 + 274 + input_set_drvdata(input, navpoint); 275 + 276 + error = request_irq(ssp->irq, navpoint_irq, 0, pdev->name, navpoint); 277 + if (error) 278 + goto err_free_mem; 279 + 280 + error = input_register_device(input); 281 + if (error) 282 + goto err_free_irq; 283 + 284 + platform_set_drvdata(pdev, navpoint); 285 + dev_dbg(&pdev->dev, "ssp%d, irq %d\n", pdata->port, ssp->irq); 286 + 287 + return 0; 288 + 289 + err_free_irq: 290 + free_irq(ssp->irq, &pdev->dev); 291 + err_free_mem: 292 + input_free_device(input); 293 + kfree(navpoint); 294 + pxa_ssp_free(ssp); 295 + err_free_gpio: 296 + if (gpio_is_valid(pdata->gpio)) 297 + gpio_free(pdata->gpio); 298 + 299 + return error; 300 + } 301 + 302 + static int __devexit navpoint_remove(struct platform_device *pdev) 303 + { 304 + const struct navpoint_platform_data *pdata = 305 + dev_get_platdata(&pdev->dev); 306 + struct navpoint *navpoint = platform_get_drvdata(pdev); 307 + struct ssp_device *ssp = navpoint->ssp; 308 + 309 + free_irq(ssp->irq, navpoint); 310 + 311 + input_unregister_device(navpoint->input); 312 + kfree(navpoint); 313 + 314 + pxa_ssp_free(ssp); 315 + 316 + if (gpio_is_valid(pdata->gpio)) 317 + gpio_free(pdata->gpio); 318 + 319 + return 0; 320 + } 321 + 322 + #ifdef CONFIG_PM_SLEEP 323 + static int navpoint_suspend(struct device *dev) 324 + { 325 + struct platform_device *pdev = to_platform_device(dev); 326 + struct navpoint *navpoint = platform_get_drvdata(pdev); 327 + struct input_dev *input = navpoint->input; 328 + 329 + mutex_lock(&input->mutex); 330 + if (input->users) 331 + navpoint_down(navpoint); 332 + mutex_unlock(&input->mutex); 333 + 334 + return 0; 335 + } 336 + 337 + static int navpoint_resume(struct device *dev) 338 + { 339 + struct platform_device *pdev = to_platform_device(dev); 340 + struct navpoint *navpoint = platform_get_drvdata(pdev); 341 + struct input_dev *input = navpoint->input; 342 + 343 + mutex_lock(&input->mutex); 344 + if (input->users) 345 + navpoint_up(navpoint); 346 + mutex_unlock(&input->mutex); 347 + 348 + return 0; 349 + } 350 + #endif 351 + 352 + static SIMPLE_DEV_PM_OPS(navpoint_pm_ops, navpoint_suspend, navpoint_resume); 353 + 354 + static struct platform_driver navpoint_driver = { 355 + .probe = navpoint_probe, 356 + .remove = __devexit_p(navpoint_remove), 357 + .driver = { 358 + .name = "navpoint", 359 + .owner = THIS_MODULE, 360 + .pm = &navpoint_pm_ops, 361 + }, 362 + }; 363 + 364 + module_platform_driver(navpoint_driver); 365 + 366 + MODULE_AUTHOR("Paul Parsons <lost.distance@yahoo.com>"); 367 + MODULE_DESCRIPTION("Synaptics NavPoint (PXA27x SSP/SPI) driver"); 368 + MODULE_LICENSE("GPL"); 369 + MODULE_ALIAS("platform:navpoint");
+30 -4
drivers/input/mouse/sentelic.c
··· 41 41 #define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) 42 42 43 43 /** Driver version. */ 44 - static const char fsp_drv_ver[] = "1.0.0-K"; 44 + static const char fsp_drv_ver[] = "1.1.0-K"; 45 45 46 46 /* 47 47 * Make sure that the value being sent to FSP will not conflict with ··· 301 301 return -EIO; 302 302 303 303 return 0; 304 + } 305 + 306 + static int fsp_get_sn(struct psmouse *psmouse, int *sn) 307 + { 308 + int v0, v1, v2; 309 + int rc = -EIO; 310 + 311 + /* production number since Cx is available at: 0x0b40 ~ 0x0b42 */ 312 + if (fsp_page_reg_write(psmouse, FSP_PAGE_0B)) 313 + goto out; 314 + if (fsp_reg_read(psmouse, FSP_REG_SN0, &v0)) 315 + goto out; 316 + if (fsp_reg_read(psmouse, FSP_REG_SN1, &v1)) 317 + goto out; 318 + if (fsp_reg_read(psmouse, FSP_REG_SN2, &v2)) 319 + goto out; 320 + *sn = (v0 << 16) | (v1 << 8) | v2; 321 + rc = 0; 322 + out: 323 + fsp_page_reg_write(psmouse, FSP_PAGE_DEFAULT); 324 + return rc; 304 325 } 305 326 306 327 static int fsp_get_buttons(struct psmouse *psmouse, int *btn) ··· 1021 1000 int fsp_init(struct psmouse *psmouse) 1022 1001 { 1023 1002 struct fsp_data *priv; 1024 - int ver, rev; 1003 + int ver, rev, sn = 0; 1025 1004 int error; 1026 1005 1027 1006 if (fsp_get_version(psmouse, &ver) || 1028 1007 fsp_get_revision(psmouse, &rev)) { 1029 1008 return -ENODEV; 1030 1009 } 1010 + if (ver >= FSP_VER_STL3888_C0) { 1011 + /* firmware information is only available since C0 */ 1012 + fsp_get_sn(psmouse, &sn); 1013 + } 1031 1014 1032 - psmouse_info(psmouse, "Finger Sensing Pad, hw: %d.%d.%d, sw: %s\n", 1033 - ver >> 4, ver & 0x0F, rev, fsp_drv_ver); 1015 + psmouse_info(psmouse, 1016 + "Finger Sensing Pad, hw: %d.%d.%d, sn: %x, sw: %s\n", 1017 + ver >> 4, ver & 0x0F, rev, sn, fsp_drv_ver); 1034 1018 1035 1019 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); 1036 1020 if (!priv)
+8
drivers/input/mouse/sentelic.h
··· 65 65 #define FSP_BIT_SWC1_GST_GRP1 BIT(6) 66 66 #define FSP_BIT_SWC1_BX_COMPAT BIT(7) 67 67 68 + #define FSP_PAGE_0B (0x0b) 69 + #define FSP_PAGE_82 (0x82) 70 + #define FSP_PAGE_DEFAULT FSP_PAGE_82 71 + 72 + #define FSP_REG_SN0 (0x40) 73 + #define FSP_REG_SN1 (0x41) 74 + #define FSP_REG_SN2 (0x42) 75 + 68 76 /* Finger-sensing Pad packet formating related definitions */ 69 77 70 78 /* absolute packet type */
+1 -12
drivers/input/mouse/sermouse.c
··· 355 355 .disconnect = sermouse_disconnect, 356 356 }; 357 357 358 - static int __init sermouse_init(void) 359 - { 360 - return serio_register_driver(&sermouse_drv); 361 - } 362 - 363 - static void __exit sermouse_exit(void) 364 - { 365 - serio_unregister_driver(&sermouse_drv); 366 - } 367 - 368 - module_init(sermouse_init); 369 - module_exit(sermouse_exit); 358 + module_serio_driver(sermouse_drv);
+10 -10
drivers/input/mouse/synaptics.c
··· 45 45 #define YMIN_NOMINAL 1408 46 46 #define YMAX_NOMINAL 4448 47 47 48 - /* 49 - * Synaptics touchpads report the y coordinate from bottom to top, which is 50 - * opposite from what userspace expects. 51 - * This function is used to invert y before reporting. 52 - */ 53 - static int synaptics_invert_y(int y) 54 - { 55 - return YMAX_NOMINAL + YMIN_NOMINAL - y; 56 - } 57 - 58 48 59 49 /***************************************************************************** 60 50 * Stuff we need even when we do not want native Synaptics support ··· 100 110 /***************************************************************************** 101 111 * Synaptics communications functions 102 112 ****************************************************************************/ 113 + 114 + /* 115 + * Synaptics touchpads report the y coordinate from bottom to top, which is 116 + * opposite from what userspace expects. 117 + * This function is used to invert y before reporting. 118 + */ 119 + static int synaptics_invert_y(int y) 120 + { 121 + return YMAX_NOMINAL + YMIN_NOMINAL - y; 122 + } 103 123 104 124 /* 105 125 * Send a command to the synpatics touchpad by special commands
+1 -13
drivers/input/mouse/vsxxxaa.c
··· 548 548 .disconnect = vsxxxaa_disconnect, 549 549 }; 550 550 551 - static int __init vsxxxaa_init(void) 552 - { 553 - return serio_register_driver(&vsxxxaa_drv); 554 - } 555 - 556 - static void __exit vsxxxaa_exit(void) 557 - { 558 - serio_unregister_driver(&vsxxxaa_drv); 559 - } 560 - 561 - module_init(vsxxxaa_init); 562 - module_exit(vsxxxaa_exit); 563 - 551 + module_serio_driver(vsxxxaa_drv);
-87
drivers/input/of_keymap.c
··· 1 - /* 2 - * Helpers for open firmware matrix keyboard bindings 3 - * 4 - * Copyright (C) 2012 Google, Inc 5 - * 6 - * Author: 7 - * Olof Johansson <olof@lixom.net> 8 - * 9 - * This software is licensed under the terms of the GNU General Public 10 - * License version 2, as published by the Free Software Foundation, and 11 - * may be copied, distributed, and modified under those terms. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - */ 19 - 20 - #include <linux/kernel.h> 21 - #include <linux/types.h> 22 - #include <linux/input.h> 23 - #include <linux/of.h> 24 - #include <linux/input/matrix_keypad.h> 25 - #include <linux/export.h> 26 - #include <linux/gfp.h> 27 - #include <linux/slab.h> 28 - 29 - struct matrix_keymap_data * 30 - matrix_keyboard_of_fill_keymap(struct device_node *np, 31 - const char *propname) 32 - { 33 - struct matrix_keymap_data *kd; 34 - u32 *keymap; 35 - int proplen, i; 36 - const __be32 *prop; 37 - 38 - if (!np) 39 - return NULL; 40 - 41 - if (!propname) 42 - propname = "linux,keymap"; 43 - 44 - prop = of_get_property(np, propname, &proplen); 45 - if (!prop) 46 - return NULL; 47 - 48 - if (proplen % sizeof(u32)) { 49 - pr_warn("Malformed keymap property %s in %s\n", 50 - propname, np->full_name); 51 - return NULL; 52 - } 53 - 54 - kd = kzalloc(sizeof(*kd), GFP_KERNEL); 55 - if (!kd) 56 - return NULL; 57 - 58 - kd->keymap = keymap = kzalloc(proplen, GFP_KERNEL); 59 - if (!kd->keymap) { 60 - kfree(kd); 61 - return NULL; 62 - } 63 - 64 - kd->keymap_size = proplen / sizeof(u32); 65 - 66 - for (i = 0; i < kd->keymap_size; i++) { 67 - u32 tmp = be32_to_cpup(prop + i); 68 - int key_code, row, col; 69 - 70 - row = (tmp >> 24) & 0xff; 71 - col = (tmp >> 16) & 0xff; 72 - key_code = tmp & 0xffff; 73 - keymap[i] = KEY(row, col, key_code); 74 - } 75 - 76 - return kd; 77 - } 78 - EXPORT_SYMBOL_GPL(matrix_keyboard_of_fill_keymap); 79 - 80 - void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd) 81 - { 82 - if (kd) { 83 - kfree(kd->keymap); 84 - kfree(kd); 85 - } 86 - } 87 - EXPORT_SYMBOL_GPL(matrix_keyboard_of_free_keymap);
+2 -13
drivers/input/serio/pcips2.c
··· 206 206 }, 207 207 { 0, } 208 208 }; 209 + MODULE_DEVICE_TABLE(pci, pcips2_ids); 209 210 210 211 static struct pci_driver pcips2_driver = { 211 212 .name = "pcips2", ··· 215 214 .remove = __devexit_p(pcips2_remove), 216 215 }; 217 216 218 - static int __init pcips2_init(void) 219 - { 220 - return pci_register_driver(&pcips2_driver); 221 - } 222 - 223 - static void __exit pcips2_exit(void) 224 - { 225 - pci_unregister_driver(&pcips2_driver); 226 - } 227 - 228 - module_init(pcips2_init); 229 - module_exit(pcips2_exit); 217 + module_pci_driver(pcips2_driver); 230 218 231 219 MODULE_LICENSE("GPL"); 232 220 MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); 233 221 MODULE_DESCRIPTION("PCI PS/2 keyboard/mouse driver"); 234 - MODULE_DEVICE_TABLE(pci, pcips2_ids);
+1 -12
drivers/input/serio/ps2mult.c
··· 304 304 .reconnect = ps2mult_reconnect, 305 305 }; 306 306 307 - static int __init ps2mult_init(void) 308 - { 309 - return serio_register_driver(&ps2mult_drv); 310 - } 311 - 312 - static void __exit ps2mult_exit(void) 313 - { 314 - serio_unregister_driver(&ps2mult_drv); 315 - } 316 - 317 - module_init(ps2mult_init); 318 - module_exit(ps2mult_exit); 307 + module_serio_driver(ps2mult_drv);
+34 -35
drivers/input/serio/serio_raw.c
··· 165 165 struct serio_raw *serio_raw = client->serio_raw; 166 166 char uninitialized_var(c); 167 167 ssize_t read = 0; 168 - int retval; 168 + int error; 169 169 170 - if (serio_raw->dead) 171 - return -ENODEV; 170 + for (;;) { 171 + if (serio_raw->dead) 172 + return -ENODEV; 172 173 173 - if (serio_raw->head == serio_raw->tail && (file->f_flags & O_NONBLOCK)) 174 - return -EAGAIN; 174 + if (serio_raw->head == serio_raw->tail && 175 + (file->f_flags & O_NONBLOCK)) 176 + return -EAGAIN; 175 177 176 - retval = wait_event_interruptible(serio_raw->wait, 177 - serio_raw->head != serio_raw->tail || serio_raw->dead); 178 - if (retval) 179 - return retval; 180 - 181 - if (serio_raw->dead) 182 - return -ENODEV; 183 - 184 - while (read < count && serio_raw_fetch_byte(serio_raw, &c)) { 185 - if (put_user(c, buffer++)) { 186 - retval = -EFAULT; 178 + if (count == 0) 187 179 break; 180 + 181 + while (read < count && serio_raw_fetch_byte(serio_raw, &c)) { 182 + if (put_user(c, buffer++)) 183 + return -EFAULT; 184 + read++; 188 185 } 189 - read++; 186 + 187 + if (read) 188 + break; 189 + 190 + if (!(file->f_flags & O_NONBLOCK)) { 191 + error = wait_event_interruptible(serio_raw->wait, 192 + serio_raw->head != serio_raw->tail || 193 + serio_raw->dead); 194 + if (error) 195 + return error; 196 + } 190 197 } 191 198 192 - return read ?: retval; 199 + return read; 193 200 } 194 201 195 202 static ssize_t serio_raw_write(struct file *file, const char __user *buffer, ··· 204 197 { 205 198 struct serio_raw_client *client = file->private_data; 206 199 struct serio_raw *serio_raw = client->serio_raw; 207 - ssize_t written = 0; 208 - int retval; 200 + int retval = 0; 209 201 unsigned char c; 210 202 211 203 retval = mutex_lock_interruptible(&serio_raw_mutex); ··· 224 218 retval = -EFAULT; 225 219 goto out; 226 220 } 221 + 227 222 if (serio_write(serio_raw->serio, c)) { 228 - retval = -EIO; 223 + /* Either signal error or partial write */ 224 + if (retval == 0) 225 + retval = -EIO; 229 226 goto out; 230 227 } 231 - written++; 228 + 229 + retval++; 232 230 } 233 231 234 232 out: 235 233 mutex_unlock(&serio_raw_mutex); 236 - return written ?: retval; 234 + return retval; 237 235 } 238 236 239 237 static unsigned int serio_raw_poll(struct file *file, poll_table *wait) ··· 442 432 .manual_bind = true, 443 433 }; 444 434 445 - static int __init serio_raw_init(void) 446 - { 447 - return serio_register_driver(&serio_raw_drv); 448 - } 449 - 450 - static void __exit serio_raw_exit(void) 451 - { 452 - serio_unregister_driver(&serio_raw_drv); 453 - } 454 - 455 - module_init(serio_raw_init); 456 - module_exit(serio_raw_exit); 435 + module_serio_driver(serio_raw_drv);
+18 -17
drivers/input/serio/xilinx_ps2.c
··· 73 73 spinlock_t lock; 74 74 void __iomem *base_address; /* virt. address of control registers */ 75 75 unsigned int flags; 76 - struct serio serio; /* serio */ 76 + struct serio *serio; /* serio */ 77 + struct device *dev; 77 78 }; 78 79 79 80 /************************************/ ··· 120 119 121 120 /* Check which interrupt is active */ 122 121 if (intr_sr & XPS2_IPIXR_RX_OVF) 123 - dev_warn(drvdata->serio.dev.parent, "receive overrun error\n"); 122 + dev_warn(drvdata->dev, "receive overrun error\n"); 124 123 125 124 if (intr_sr & XPS2_IPIXR_RX_ERR) 126 125 drvdata->flags |= SERIO_PARITY; ··· 133 132 134 133 /* Error, if a byte is not received */ 135 134 if (status) { 136 - dev_err(drvdata->serio.dev.parent, 135 + dev_err(drvdata->dev, 137 136 "wrong rcvd byte count (%d)\n", status); 138 137 } else { 139 - serio_interrupt(&drvdata->serio, c, drvdata->flags); 138 + serio_interrupt(drvdata->serio, c, drvdata->flags); 140 139 drvdata->flags = 0; 141 140 } 142 141 } ··· 194 193 error = request_irq(drvdata->irq, &xps2_interrupt, 0, 195 194 DRIVER_NAME, drvdata); 196 195 if (error) { 197 - dev_err(drvdata->serio.dev.parent, 196 + dev_err(drvdata->dev, 198 197 "Couldn't allocate interrupt %d\n", drvdata->irq); 199 198 return error; 200 199 } ··· 260 259 } 261 260 262 261 drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL); 263 - if (!drvdata) { 264 - dev_err(dev, "Couldn't allocate device private record\n"); 265 - return -ENOMEM; 262 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 263 + if (!drvdata || !serio) { 264 + error = -ENOMEM; 265 + goto failed1; 266 266 } 267 - 268 - dev_set_drvdata(dev, drvdata); 269 267 270 268 spin_lock_init(&drvdata->lock); 271 269 drvdata->irq = r_irq.start; 270 + drvdata->serio = serio; 271 + drvdata->dev = dev; 272 272 273 273 phys_addr = r_mem.start; 274 274 remap_size = resource_size(&r_mem); ··· 300 298 (unsigned long long)phys_addr, drvdata->base_address, 301 299 drvdata->irq); 302 300 303 - serio = &drvdata->serio; 304 301 serio->id.type = SERIO_8042; 305 302 serio->write = sxps2_write; 306 303 serio->open = sxps2_open; ··· 313 312 314 313 serio_register_port(serio); 315 314 315 + platform_set_drvdata(ofdev, drvdata); 316 316 return 0; /* success */ 317 317 318 318 failed2: 319 319 release_mem_region(phys_addr, remap_size); 320 320 failed1: 321 + kfree(serio); 321 322 kfree(drvdata); 322 - dev_set_drvdata(dev, NULL); 323 323 324 324 return error; 325 325 } ··· 335 333 */ 336 334 static int __devexit xps2_of_remove(struct platform_device *of_dev) 337 335 { 338 - struct device *dev = &of_dev->dev; 339 - struct xps2data *drvdata = dev_get_drvdata(dev); 336 + struct xps2data *drvdata = platform_get_drvdata(of_dev); 340 337 struct resource r_mem; /* IO mem resources */ 341 338 342 - serio_unregister_port(&drvdata->serio); 339 + serio_unregister_port(drvdata->serio); 343 340 iounmap(drvdata->base_address); 344 341 345 342 /* Get iospace of the device */ 346 343 if (of_address_to_resource(of_dev->dev.of_node, 0, &r_mem)) 347 - dev_err(dev, "invalid address\n"); 344 + dev_err(drvdata->dev, "invalid address\n"); 348 345 else 349 346 release_mem_region(r_mem.start, resource_size(&r_mem)); 350 347 351 348 kfree(drvdata); 352 349 353 - dev_set_drvdata(dev, NULL); 350 + platform_set_drvdata(of_dev, NULL); 354 351 355 352 return 0; 356 353 }
+1 -1
drivers/input/tablet/aiptek.c
··· 1862 1862 if (i == ARRAY_SIZE(speeds)) { 1863 1863 dev_info(&intf->dev, 1864 1864 "Aiptek tried all speeds, no sane response\n"); 1865 - goto fail2; 1865 + goto fail3; 1866 1866 } 1867 1867 1868 1868 /* Associate this driver's struct with the usb interface.
+2 -2
drivers/input/tablet/wacom.h
··· 135 135 136 136 void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); 137 137 void wacom_setup_device_quirks(struct wacom_features *features); 138 - void wacom_setup_input_capabilities(struct input_dev *input_dev, 139 - struct wacom_wac *wacom_wac); 138 + int wacom_setup_input_capabilities(struct input_dev *input_dev, 139 + struct wacom_wac *wacom_wac); 140 140 #endif
+178 -62
drivers/input/tablet/wacom_sys.c
··· 28 28 #define HID_USAGE_Y_TILT 0x3e 29 29 #define HID_USAGE_FINGER 0x22 30 30 #define HID_USAGE_STYLUS 0x20 31 + #define HID_USAGE_CONTACTMAX 0x55 31 32 #define HID_COLLECTION 0xa1 32 33 #define HID_COLLECTION_LOGICAL 0x02 33 34 #define HID_COLLECTION_END 0xc0 ··· 205 204 return length; 206 205 } 207 206 207 + static void wacom_retrieve_report_data(struct usb_interface *intf, 208 + struct wacom_features *features) 209 + { 210 + int result = 0; 211 + unsigned char *rep_data; 212 + 213 + rep_data = kmalloc(2, GFP_KERNEL); 214 + if (rep_data) { 215 + 216 + rep_data[0] = 12; 217 + result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, 218 + rep_data[0], &rep_data, 2, 219 + WAC_MSG_RETRIES); 220 + 221 + if (result >= 0 && rep_data[1] > 2) 222 + features->touch_max = rep_data[1]; 223 + 224 + kfree(rep_data); 225 + } 226 + } 227 + 208 228 /* 209 229 * Interface Descriptor of wacom devices can be incomplete and 210 230 * inconsistent so wacom_features table is used to store stylus ··· 258 236 * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical 259 237 * Collection. Instead they define a Logical Collection with a single 260 238 * Logical Maximum for both X and Y. 239 + * 240 + * Intuos5 touch interface does not contain useful data. We deal with 241 + * this after returning from this function. 261 242 */ 262 243 static int wacom_parse_hid(struct usb_interface *intf, 263 244 struct hid_descriptor *hid_desc, ··· 320 295 /* need to reset back */ 321 296 features->pktlen = WACOM_PKGLEN_TPC2FG; 322 297 } 298 + 299 + if (features->type == MTSCREEN) 300 + features->pktlen = WACOM_PKGLEN_MTOUCH; 301 + 323 302 if (features->type == BAMBOO_PT) { 324 303 /* need to reset back */ 325 304 features->pktlen = WACOM_PKGLEN_BBTOUCH; ··· 356 327 case HID_USAGE_Y: 357 328 if (usage == WCM_DESKTOP) { 358 329 if (finger) { 359 - features->device_type = BTN_TOOL_FINGER; 360 - if (features->type == TABLETPC2FG) { 361 - /* need to reset back */ 362 - features->pktlen = WACOM_PKGLEN_TPC2FG; 330 + int type = features->type; 331 + 332 + if (type == TABLETPC2FG || type == MTSCREEN) { 363 333 features->y_max = 364 334 get_unaligned_le16(&report[i + 3]); 365 335 features->y_phy = 366 336 get_unaligned_le16(&report[i + 6]); 367 337 i += 7; 368 - } else if (features->type == BAMBOO_PT) { 369 - /* need to reset back */ 370 - features->pktlen = WACOM_PKGLEN_BBTOUCH; 338 + } else if (type == BAMBOO_PT) { 371 339 features->y_phy = 372 340 get_unaligned_le16(&report[i + 3]); 373 341 features->y_max = ··· 378 352 i += 4; 379 353 } 380 354 } else if (pen) { 381 - /* penabled only accepts exact bytes of data */ 382 - if (features->type == TABLETPC2FG) 383 - features->pktlen = WACOM_PKGLEN_GRAPHIRE; 384 - features->device_type = BTN_TOOL_PEN; 385 355 features->y_max = 386 356 get_unaligned_le16(&report[i + 3]); 387 357 i += 4; ··· 397 375 */ 398 376 case HID_USAGE_STYLUS: 399 377 pen = 1; 378 + i++; 379 + break; 380 + 381 + case HID_USAGE_CONTACTMAX: 382 + wacom_retrieve_report_data(intf, features); 400 383 i++; 401 384 break; 402 385 } ··· 440 413 if (!rep_data) 441 414 return error; 442 415 443 - /* ask to report tablet data if it is MT Tablet PC or 444 - * not a Tablet PC */ 445 - if (features->type == TABLETPC2FG) { 446 - do { 447 - rep_data[0] = 3; 448 - rep_data[1] = 4; 449 - rep_data[2] = 0; 450 - rep_data[3] = 0; 451 - report_id = 3; 452 - error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT, 453 - report_id, rep_data, 4, 1); 454 - if (error >= 0) 455 - error = wacom_get_report(intf, 456 - WAC_HID_FEATURE_REPORT, 457 - report_id, rep_data, 4, 1); 458 - } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); 416 + /* ask to report Wacom data */ 417 + if (features->device_type == BTN_TOOL_FINGER) { 418 + /* if it is an MT Tablet PC touch */ 419 + if (features->type == TABLETPC2FG || 420 + features->type == MTSCREEN) { 421 + do { 422 + rep_data[0] = 3; 423 + rep_data[1] = 4; 424 + rep_data[2] = 0; 425 + rep_data[3] = 0; 426 + report_id = 3; 427 + error = wacom_set_report(intf, 428 + WAC_HID_FEATURE_REPORT, 429 + report_id, 430 + rep_data, 4, 1); 431 + if (error >= 0) 432 + error = wacom_get_report(intf, 433 + WAC_HID_FEATURE_REPORT, 434 + report_id, 435 + rep_data, 4, 1); 436 + } while ((error < 0 || rep_data[1] != 4) && 437 + limit++ < WAC_MSG_RETRIES); 438 + } 459 439 } else if (features->type != TABLETPC && 460 440 features->type != WIRELESS && 461 441 features->device_type == BTN_TOOL_PEN) { ··· 484 450 } 485 451 486 452 static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, 487 - struct wacom_features *features) 453 + struct wacom_features *features) 488 454 { 489 455 int error = 0; 490 456 struct usb_host_interface *interface = intf->cur_altsetting; ··· 512 478 } 513 479 } 514 480 515 - /* only Tablet PCs and Bamboo P&T need to retrieve the info */ 516 - if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && 517 - (features->type != BAMBOO_PT)) 481 + /* only devices that support touch need to retrieve the info */ 482 + if (features->type != TABLETPC && 483 + features->type != TABLETPC2FG && 484 + features->type != BAMBOO_PT && 485 + features->type != MTSCREEN) { 518 486 goto out; 487 + } 519 488 520 - if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { 521 - if (usb_get_extra_descriptor(&interface->endpoint[0], 522 - HID_DEVICET_REPORT, &hid_desc)) { 523 - printk("wacom: can not retrieve extra class descriptor\n"); 524 - error = 1; 489 + error = usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc); 490 + if (error) { 491 + error = usb_get_extra_descriptor(&interface->endpoint[0], 492 + HID_DEVICET_REPORT, &hid_desc); 493 + if (error) { 494 + dev_err(&intf->dev, 495 + "can not retrieve extra class descriptor\n"); 525 496 goto out; 526 497 } 527 498 } ··· 616 577 static int wacom_led_control(struct wacom *wacom) 617 578 { 618 579 unsigned char *buf; 619 - int retval, led = 0; 580 + int retval; 620 581 621 582 buf = kzalloc(9, GFP_KERNEL); 622 583 if (!buf) 623 584 return -ENOMEM; 624 585 625 - if (wacom->wacom_wac.features.type == WACOM_21UX2 || 626 - wacom->wacom_wac.features.type == WACOM_24HD) 627 - led = (wacom->led.select[1] << 4) | 0x40; 586 + if (wacom->wacom_wac.features.type >= INTUOS5S && 587 + wacom->wacom_wac.features.type <= INTUOS5L) { 588 + /* 589 + * Touch Ring and crop mark LED luminance may take on 590 + * one of four values: 591 + * 0 = Low; 1 = Medium; 2 = High; 3 = Off 592 + */ 593 + int ring_led = wacom->led.select[0] & 0x03; 594 + int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03; 595 + int crop_lum = 0; 628 596 629 - led |= wacom->led.select[0] | 0x4; 597 + buf[0] = WAC_CMD_LED_CONTROL; 598 + buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led); 599 + } 600 + else { 601 + int led = wacom->led.select[0] | 0x4; 630 602 631 - buf[0] = WAC_CMD_LED_CONTROL; 632 - buf[1] = led; 633 - buf[2] = wacom->led.llv; 634 - buf[3] = wacom->led.hlv; 635 - buf[4] = wacom->led.img_lum; 603 + if (wacom->wacom_wac.features.type == WACOM_21UX2 || 604 + wacom->wacom_wac.features.type == WACOM_24HD) 605 + led |= (wacom->led.select[1] << 4) | 0x40; 606 + 607 + buf[0] = WAC_CMD_LED_CONTROL; 608 + buf[1] = led; 609 + buf[2] = wacom->led.llv; 610 + buf[3] = wacom->led.hlv; 611 + buf[4] = wacom->led.img_lum; 612 + } 636 613 637 614 retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, 638 615 buf, 9, WAC_CMD_RETRIES); ··· 841 786 .attrs = intuos4_led_attrs, 842 787 }; 843 788 789 + static struct attribute *intuos5_led_attrs[] = { 790 + &dev_attr_status0_luminance.attr, 791 + &dev_attr_status_led0_select.attr, 792 + NULL 793 + }; 794 + 795 + static struct attribute_group intuos5_led_attr_group = { 796 + .name = "wacom_led", 797 + .attrs = intuos5_led_attrs, 798 + }; 799 + 844 800 static int wacom_initialize_leds(struct wacom *wacom) 845 801 { 846 802 int error; ··· 881 815 &cintiq_led_attr_group); 882 816 break; 883 817 818 + case INTUOS5S: 819 + case INTUOS5: 820 + case INTUOS5L: 821 + wacom->led.select[0] = 0; 822 + wacom->led.select[1] = 0; 823 + wacom->led.llv = 32; 824 + wacom->led.hlv = 0; 825 + wacom->led.img_lum = 0; 826 + 827 + error = sysfs_create_group(&wacom->intf->dev.kobj, 828 + &intuos5_led_attr_group); 829 + break; 830 + 884 831 default: 885 832 return 0; 886 833 } ··· 921 842 case WACOM_21UX2: 922 843 sysfs_remove_group(&wacom->intf->dev.kobj, 923 844 &cintiq_led_attr_group); 845 + break; 846 + 847 + case INTUOS5S: 848 + case INTUOS5: 849 + case INTUOS5L: 850 + sysfs_remove_group(&wacom->intf->dev.kobj, 851 + &intuos5_led_attr_group); 924 852 break; 925 853 } 926 854 } ··· 990 904 int error; 991 905 992 906 input_dev = input_allocate_device(); 993 - if (!input_dev) 994 - return -ENOMEM; 907 + if (!input_dev) { 908 + error = -ENOMEM; 909 + goto fail1; 910 + } 995 911 996 912 input_dev->name = wacom_wac->name; 997 913 input_dev->dev.parent = &intf->dev; ··· 1003 915 input_set_drvdata(input_dev, wacom); 1004 916 1005 917 wacom_wac->input = input_dev; 1006 - wacom_setup_input_capabilities(input_dev, wacom_wac); 918 + error = wacom_setup_input_capabilities(input_dev, wacom_wac); 919 + if (error) 920 + goto fail1; 1007 921 1008 922 error = input_register_device(input_dev); 1009 - if (error) { 1010 - input_free_device(input_dev); 1011 - wacom_wac->input = NULL; 1012 - } 923 + if (error) 924 + goto fail2; 1013 925 926 + return 0; 927 + 928 + fail2: 929 + input_free_device(input_dev); 930 + wacom_wac->input = NULL; 931 + fail1: 1014 932 return error; 1015 933 } 1016 934 ··· 1035 941 wacom = usb_get_intfdata(usbdev->config->interface[1]); 1036 942 if (wacom->wacom_wac.input) 1037 943 input_unregister_device(wacom->wacom_wac.input); 1038 - wacom->wacom_wac.input = 0; 944 + wacom->wacom_wac.input = NULL; 1039 945 1040 946 /* Touch interface */ 1041 947 wacom = usb_get_intfdata(usbdev->config->interface[2]); 1042 948 if (wacom->wacom_wac.input) 1043 949 input_unregister_device(wacom->wacom_wac.input); 1044 - wacom->wacom_wac.input = 0; 950 + wacom->wacom_wac.input = NULL; 1045 951 1046 952 if (wacom_wac->pid == 0) { 1047 - printk(KERN_INFO "wacom: wireless tablet disconnected\n"); 953 + dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); 1048 954 } else { 1049 955 const struct usb_device_id *id = wacom_ids; 1050 956 1051 - printk(KERN_INFO 1052 - "wacom: wireless tablet connected with PID %x\n", 1053 - wacom_wac->pid); 957 + dev_info(&wacom->intf->dev, 958 + "wireless tablet connected with PID %x\n", 959 + wacom_wac->pid); 1054 960 1055 961 while (id->match_flags) { 1056 962 if (id->idVendor == USB_VENDOR_ID_WACOM && ··· 1060 966 } 1061 967 1062 968 if (!id->match_flags) { 1063 - printk(KERN_INFO 1064 - "wacom: ignorning unknown PID.\n"); 969 + dev_info(&wacom->intf->dev, 970 + "ignoring unknown PID.\n"); 1065 971 return; 1066 972 } 1067 973 ··· 1132 1038 1133 1039 endpoint = &intf->cur_altsetting->endpoint[0].desc; 1134 1040 1135 - /* Retrieve the physical and logical size for OEM devices */ 1041 + /* Retrieve the physical and logical size for touch devices */ 1136 1042 error = wacom_retrieve_hid_descriptor(intf, features); 1137 1043 if (error) 1138 1044 goto fail3; 1045 + 1046 + /* 1047 + * Intuos5 has no useful data about its touch interface in its 1048 + * HID descriptor. If this is the touch interface (wMaxPacketSize 1049 + * of WACOM_PKGLEN_BBTOUCH3), override the table values. 1050 + */ 1051 + if (features->type >= INTUOS5S && features->type <= INTUOS5L) { 1052 + if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) { 1053 + features->device_type = BTN_TOOL_FINGER; 1054 + features->pktlen = WACOM_PKGLEN_BBTOUCH3; 1055 + 1056 + features->x_phy = 1057 + (features->x_max * 100) / features->x_resolution; 1058 + features->y_phy = 1059 + (features->y_max * 100) / features->y_resolution; 1060 + 1061 + features->x_max = 4096; 1062 + features->y_max = 4096; 1063 + } else { 1064 + features->device_type = BTN_TOOL_PEN; 1065 + } 1066 + } 1139 1067 1140 1068 wacom_setup_device_quirks(features); 1141 1069
+261 -43
drivers/input/tablet/wacom_wac.c
··· 61 61 break; 62 62 63 63 default: 64 - printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]); 64 + dev_dbg(input->dev.parent, 65 + "%s: received unknown report #%d\n", __func__, data[0]); 65 66 return 0; 66 67 } 67 68 ··· 77 76 int prox, pressure; 78 77 79 78 if (data[0] != WACOM_REPORT_PENABLED) { 80 - dev_dbg(&input->dev, 81 - "wacom_pl_irq: received unknown report #%d\n", data[0]); 79 + dev_dbg(input->dev.parent, 80 + "%s: received unknown report #%d\n", __func__, data[0]); 82 81 return 0; 83 82 } 84 83 ··· 148 147 struct input_dev *input = wacom->input; 149 148 150 149 if (data[0] != WACOM_REPORT_PENABLED) { 151 - printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); 150 + dev_dbg(input->dev.parent, 151 + "%s: received unknown report #%d\n", __func__, data[0]); 152 152 return 0; 153 153 } 154 154 ··· 178 176 struct input_dev *input = wacom->input; 179 177 int prox = data[1] & 0x20, pressure; 180 178 181 - dev_dbg(&input->dev, "wacom_dtu_irq: received report #%d\n", data[0]); 179 + dev_dbg(input->dev.parent, 180 + "%s: received report #%d", __func__, data[0]); 182 181 183 182 if (prox) { 184 183 /* Going into proximity select tool */ ··· 215 212 int retval = 0; 216 213 217 214 if (data[0] != WACOM_REPORT_PENABLED) { 218 - dev_dbg(&input->dev, 219 - "wacom_graphire_irq: received unknown report #%d\n", 220 - data[0]); 215 + dev_dbg(input->dev.parent, 216 + "%s: received unknown report #%d\n", __func__, data[0]); 221 217 goto exit; 222 218 } 223 219 ··· 326 324 327 325 /* Enter report */ 328 326 if ((data[1] & 0xfc) == 0xc0) { 327 + if (features->type >= INTUOS5S && features->type <= INTUOS5L) 328 + wacom->shared->stylus_in_proximity = true; 329 + 329 330 /* serial number of the tool */ 330 331 wacom->serial[idx] = ((data[3] & 0x0f) << 28) + 331 332 (data[4] << 20) + (data[5] << 12) + ··· 414 409 415 410 /* Exit report */ 416 411 if ((data[1] & 0xfe) == 0x80) { 412 + if (features->type >= INTUOS5S && features->type <= INTUOS5L) 413 + wacom->shared->stylus_in_proximity = false; 414 + 417 415 /* 418 416 * Reset all states otherwise we lose the initial states 419 417 * when in-prox next time ··· 463 455 if ((data[1] & 0xb8) == 0xa0) { 464 456 t = (data[6] << 2) | ((data[7] >> 6) & 3); 465 457 if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || 458 + (features->type >= INTUOS5S && features->type <= INTUOS5L) || 466 459 features->type == WACOM_21UX2 || features->type == WACOM_24HD) { 467 460 t = (t << 1) | (data[1] & 1); 468 461 } ··· 494 485 unsigned int t; 495 486 int idx = 0, result; 496 487 497 - if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD 498 - && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) { 499 - dev_dbg(&input->dev, 500 - "wacom_intuos_irq: received unknown report #%d\n", 501 - data[0]); 488 + if (data[0] != WACOM_REPORT_PENABLED && 489 + data[0] != WACOM_REPORT_INTUOSREAD && 490 + data[0] != WACOM_REPORT_INTUOSWRITE && 491 + data[0] != WACOM_REPORT_INTUOSPAD && 492 + data[0] != WACOM_REPORT_INTUOS5PAD) { 493 + dev_dbg(input->dev.parent, 494 + "%s: received unknown report #%d\n", __func__, data[0]); 502 495 return 0; 503 496 } 504 497 ··· 509 498 idx = data[1] & 0x01; 510 499 511 500 /* pad packets. Works as a second tool and is always in prox */ 512 - if (data[0] == WACOM_REPORT_INTUOSPAD) { 501 + if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) { 513 502 if (features->type >= INTUOS4S && features->type <= INTUOS4L) { 514 503 input_report_key(input, BTN_0, (data[2] & 0x01)); 515 504 input_report_key(input, BTN_1, (data[3] & 0x01)); ··· 585 574 input_report_key(input, wacom->tool[1], 0); 586 575 input_report_abs(input, ABS_MISC, 0); 587 576 } 577 + } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { 578 + int i; 579 + 580 + /* Touch ring mode switch has no capacitive sensor */ 581 + input_report_key(input, BTN_0, (data[3] & 0x01)); 582 + 583 + /* 584 + * ExpressKeys on Intuos5 have a capacitive sensor in 585 + * addition to the mechanical switch. Switch data is 586 + * stored in data[4], capacitive data in data[5]. 587 + */ 588 + for (i = 0; i < 8; i++) 589 + input_report_key(input, BTN_1 + i, data[4] & (1 << i)); 590 + 591 + if (data[2] & 0x80) { 592 + input_report_abs(input, ABS_WHEEL, (data[2] & 0x7f)); 593 + } else { 594 + /* Out of proximity, clear wheel value. */ 595 + input_report_abs(input, ABS_WHEEL, 0); 596 + } 597 + 598 + if (data[2] | (data[3] & 0x01) | data[4]) { 599 + input_report_key(input, wacom->tool[1], 1); 600 + input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 601 + } else { 602 + input_report_key(input, wacom->tool[1], 0); 603 + input_report_abs(input, ABS_MISC, 0); 604 + } 588 605 } else { 589 606 if (features->type == WACOM_21UX2) { 590 607 input_report_key(input, BTN_0, (data[5] & 0x01)); ··· 676 637 (features->type == INTUOS3 || 677 638 features->type == INTUOS3S || 678 639 features->type == INTUOS4 || 679 - features->type == INTUOS4S)) { 640 + features->type == INTUOS4S || 641 + features->type == INTUOS5 || 642 + features->type == INTUOS5S)) { 680 643 681 644 return 0; 682 645 } ··· 731 690 732 691 } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { 733 692 /* I4 mouse */ 734 - if (features->type >= INTUOS4S && features->type <= INTUOS4L) { 693 + if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || 694 + (features->type >= INTUOS5S && features->type <= INTUOS5L)) { 735 695 input_report_key(input, BTN_LEFT, data[6] & 0x01); 736 696 input_report_key(input, BTN_MIDDLE, data[6] & 0x02); 737 697 input_report_key(input, BTN_RIGHT, data[6] & 0x04); ··· 759 717 } 760 718 } 761 719 } else if ((features->type < INTUOS3S || features->type == INTUOS3L || 762 - features->type == INTUOS4L) && 720 + features->type == INTUOS4L || features->type == INTUOS5L) && 763 721 wacom->tool[idx] == BTN_TOOL_LENS) { 764 722 /* Lens cursor packets */ 765 723 input_report_key(input, BTN_LEFT, data[8] & 0x01); ··· 773 731 input_report_abs(input, ABS_MISC, wacom->id[idx]); /* report tool id */ 774 732 input_report_key(input, wacom->tool[idx], 1); 775 733 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 734 + return 1; 735 + } 736 + 737 + static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid) 738 + { 739 + int touch_max = wacom->features.touch_max; 740 + int i; 741 + 742 + if (!wacom->slots) 743 + return -1; 744 + 745 + for (i = 0; i < touch_max; ++i) { 746 + if (wacom->slots[i] == contactid) 747 + return i; 748 + } 749 + for (i = 0; i < touch_max; ++i) { 750 + if (wacom->slots[i] == -1) 751 + return i; 752 + } 753 + return -1; 754 + } 755 + 756 + static int wacom_mt_touch(struct wacom_wac *wacom) 757 + { 758 + struct input_dev *input = wacom->input; 759 + char *data = wacom->data; 760 + int i; 761 + int current_num_contacts = data[2]; 762 + int contacts_to_send = 0; 763 + 764 + /* 765 + * First packet resets the counter since only the first 766 + * packet in series will have non-zero current_num_contacts. 767 + */ 768 + if (current_num_contacts) 769 + wacom->num_contacts_left = current_num_contacts; 770 + 771 + /* There are at most 5 contacts per packet */ 772 + contacts_to_send = min(5, wacom->num_contacts_left); 773 + 774 + for (i = 0; i < contacts_to_send; i++) { 775 + int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3; 776 + bool touch = data[offset] & 0x1; 777 + int id = le16_to_cpup((__le16 *)&data[offset + 1]); 778 + int slot = find_slot_from_contactid(wacom, id); 779 + 780 + if (slot < 0) 781 + continue; 782 + 783 + input_mt_slot(input, slot); 784 + input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); 785 + if (touch) { 786 + int x = le16_to_cpup((__le16 *)&data[offset + 7]); 787 + int y = le16_to_cpup((__le16 *)&data[offset + 9]); 788 + input_report_abs(input, ABS_MT_POSITION_X, x); 789 + input_report_abs(input, ABS_MT_POSITION_Y, y); 790 + } 791 + wacom->slots[slot] = touch ? id : -1; 792 + } 793 + 794 + input_mt_report_pointer_emulation(input, true); 795 + 796 + wacom->num_contacts_left -= contacts_to_send; 797 + if (wacom->num_contacts_left < 0) 798 + wacom->num_contacts_left = 0; 799 + 776 800 return 1; 777 801 } 778 802 ··· 879 771 struct input_dev *input = wacom->input; 880 772 bool prox; 881 773 int x = 0, y = 0; 774 + 775 + if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) 776 + return 0; 882 777 883 778 if (!wacom->shared->stylus_in_proximity) { 884 779 if (len == WACOM_PKGLEN_TPC1FG) { ··· 946 835 { 947 836 char *data = wacom->data; 948 837 949 - dev_dbg(&wacom->input->dev, "wacom_tpc_irq: received report #%d\n", 950 - data[0]); 838 + dev_dbg(wacom->input->dev.parent, 839 + "%s: received report #%d\n", __func__, data[0]); 951 840 952 841 switch (len) { 953 842 case WACOM_PKGLEN_TPC1FG: 954 - return wacom_tpc_single_touch(wacom, len); 843 + return wacom_tpc_single_touch(wacom, len); 955 844 956 845 case WACOM_PKGLEN_TPC2FG: 957 - return wacom_tpc_mt_touch(wacom); 846 + return wacom_tpc_mt_touch(wacom); 958 847 959 848 default: 960 849 switch (data[0]) { ··· 962 851 case WACOM_REPORT_TPCHID: 963 852 case WACOM_REPORT_TPCST: 964 853 return wacom_tpc_single_touch(wacom, len); 854 + 855 + case WACOM_REPORT_TPCMT: 856 + return wacom_mt_touch(wacom); 965 857 966 858 case WACOM_REPORT_PENABLED: 967 859 return wacom_tpc_pen(wacom); ··· 1234 1120 sync = wacom_intuos_irq(wacom_wac); 1235 1121 break; 1236 1122 1123 + case INTUOS5S: 1124 + case INTUOS5: 1125 + case INTUOS5L: 1126 + if (len == WACOM_PKGLEN_BBTOUCH3) 1127 + sync = wacom_bpt3_touch(wacom_wac); 1128 + else 1129 + sync = wacom_intuos_irq(wacom_wac); 1130 + break; 1131 + 1237 1132 case TABLETPC: 1238 1133 case TABLETPC2FG: 1134 + case MTSCREEN: 1239 1135 sync = wacom_tpc_irq(wacom_wac, len); 1240 1136 break; 1241 1137 ··· 1318 1194 1319 1195 /* these device have multiple inputs */ 1320 1196 if (features->type == TABLETPC || features->type == TABLETPC2FG || 1321 - features->type == BAMBOO_PT || features->type == WIRELESS) 1197 + features->type == BAMBOO_PT || features->type == WIRELESS || 1198 + (features->type >= INTUOS5S && features->type <= INTUOS5L) || 1199 + features->type == MTSCREEN) 1322 1200 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1323 1201 1324 1202 /* quirk for bamboo touch with 2 low res touches */ ··· 1351 1225 return (logical_max * 100) / physical_max; 1352 1226 } 1353 1227 1354 - void wacom_setup_input_capabilities(struct input_dev *input_dev, 1355 - struct wacom_wac *wacom_wac) 1228 + int wacom_setup_input_capabilities(struct input_dev *input_dev, 1229 + struct wacom_wac *wacom_wac) 1356 1230 { 1357 1231 struct wacom_features *features = &wacom_wac->features; 1358 1232 int i; ··· 1487 1361 wacom_setup_intuos(wacom_wac); 1488 1362 break; 1489 1363 1364 + case INTUOS5: 1365 + case INTUOS5L: 1366 + if (features->device_type == BTN_TOOL_PEN) { 1367 + __set_bit(BTN_7, input_dev->keybit); 1368 + __set_bit(BTN_8, input_dev->keybit); 1369 + } 1370 + /* fall through */ 1371 + 1372 + case INTUOS5S: 1373 + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); 1374 + 1375 + if (features->device_type == BTN_TOOL_PEN) { 1376 + for (i = 0; i < 7; i++) 1377 + __set_bit(BTN_0 + i, input_dev->keybit); 1378 + 1379 + input_set_abs_params(input_dev, ABS_DISTANCE, 0, 1380 + features->distance_max, 1381 + 0, 0); 1382 + 1383 + input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); 1384 + 1385 + wacom_setup_intuos(wacom_wac); 1386 + } else if (features->device_type == BTN_TOOL_FINGER) { 1387 + __clear_bit(ABS_MISC, input_dev->absbit); 1388 + 1389 + __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1390 + __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1391 + __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 1392 + __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); 1393 + 1394 + input_mt_init_slots(input_dev, features->touch_max); 1395 + 1396 + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 1397 + 0, 255, 0, 0); 1398 + 1399 + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1400 + 0, features->x_max, 1401 + features->x_fuzz, 0); 1402 + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 1403 + 0, features->y_max, 1404 + features->y_fuzz, 0); 1405 + } 1406 + break; 1407 + 1490 1408 case INTUOS4: 1491 1409 case INTUOS4L: 1492 1410 __set_bit(BTN_7, input_dev->keybit); ··· 1548 1378 break; 1549 1379 1550 1380 case TABLETPC2FG: 1381 + case MTSCREEN: 1551 1382 if (features->device_type == BTN_TOOL_FINGER) { 1552 1383 1553 - input_mt_init_slots(input_dev, 2); 1384 + wacom_wac->slots = kmalloc(features->touch_max * 1385 + sizeof(int), 1386 + GFP_KERNEL); 1387 + if (!wacom_wac->slots) 1388 + return -ENOMEM; 1389 + 1390 + for (i = 0; i < features->touch_max; i++) 1391 + wacom_wac->slots[i] = -1; 1392 + 1393 + input_mt_init_slots(input_dev, features->touch_max); 1554 1394 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 1555 1395 0, MT_TOOL_MAX, 0, 0); 1556 1396 input_set_abs_params(input_dev, ABS_MT_POSITION_X, ··· 1615 1435 1616 1436 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1617 1437 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1438 + input_mt_init_slots(input_dev, features->touch_max); 1618 1439 1619 1440 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 1620 1441 __set_bit(BTN_TOOL_TRIPLETAP, ··· 1623 1442 __set_bit(BTN_TOOL_QUADTAP, 1624 1443 input_dev->keybit); 1625 1444 1626 - input_mt_init_slots(input_dev, 16); 1627 - 1628 1445 input_set_abs_params(input_dev, 1629 1446 ABS_MT_TOUCH_MAJOR, 1630 1447 0, 255, 0, 0); 1631 - } else { 1632 - input_mt_init_slots(input_dev, 2); 1633 1448 } 1634 1449 1635 1450 input_set_abs_params(input_dev, ABS_MT_POSITION_X, ··· 1645 1468 } 1646 1469 break; 1647 1470 } 1471 + return 0; 1648 1472 } 1649 1473 1650 1474 static const struct wacom_features wacom_features_0x00 = ··· 1813 1635 static const struct wacom_features wacom_features_0xBC = 1814 1636 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 1815 1637 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1638 + static const struct wacom_features wacom_features_0x26 = 1639 + { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 1640 + 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 1641 + .touch_max = 16 }; 1642 + static const struct wacom_features wacom_features_0x27 = 1643 + { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 1644 + 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 1645 + .touch_max = 16 }; 1646 + static const struct wacom_features wacom_features_0x28 = 1647 + { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 1648 + 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 1649 + .touch_max = 16 }; 1650 + static const struct wacom_features wacom_features_0x29 = 1651 + { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 1652 + 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1653 + static const struct wacom_features wacom_features_0x2A = 1654 + { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 1655 + 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1816 1656 static const struct wacom_features wacom_features_0xF4 = 1817 1657 { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, 1818 1658 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ··· 1872 1676 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1873 1677 static const struct wacom_features wacom_features_0xE2 = 1874 1678 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 1875 - 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1679 + 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1680 + .touch_max = 2 }; 1876 1681 static const struct wacom_features wacom_features_0xE3 = 1877 1682 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 1878 - 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1683 + 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1684 + .touch_max = 2 }; 1685 + static const struct wacom_features wacom_features_0xE5 = 1686 + { "Wacom ISDv4 E5", WACOM_PKGLEN_MTOUCH, 26202, 16325, 255, 1687 + 0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1879 1688 static const struct wacom_features wacom_features_0xE6 = 1880 1689 { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, 1881 - 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1690 + 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1691 + .touch_max = 2 }; 1882 1692 static const struct wacom_features wacom_features_0xEC = 1883 1693 { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, 1884 1694 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ··· 1893 1691 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1894 1692 static const struct wacom_features wacom_features_0x84 = 1895 1693 { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, 1896 - 0, WIRELESS, 0, 0 }; 1694 + 0, WIRELESS, 0, 0, .touch_max = 16 }; 1897 1695 static const struct wacom_features wacom_features_0xD0 = 1898 1696 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1899 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1697 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1698 + .touch_max = 2 }; 1900 1699 static const struct wacom_features wacom_features_0xD1 = 1901 1700 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1902 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1701 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1702 + .touch_max = 2 }; 1903 1703 static const struct wacom_features wacom_features_0xD2 = 1904 1704 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1905 1705 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1906 1706 static const struct wacom_features wacom_features_0xD3 = 1907 1707 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1908 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1708 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1709 + .touch_max = 2 }; 1909 1710 static const struct wacom_features wacom_features_0xD4 = 1910 1711 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1911 1712 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ··· 1917 1712 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1918 1713 static const struct wacom_features wacom_features_0xD6 = 1919 1714 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1920 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1715 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1716 + .touch_max = 2 }; 1921 1717 static const struct wacom_features wacom_features_0xD7 = 1922 1718 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1923 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1719 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1720 + .touch_max = 2 }; 1924 1721 static const struct wacom_features wacom_features_0xD8 = 1925 1722 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1926 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1723 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1724 + .touch_max = 2 }; 1927 1725 static const struct wacom_features wacom_features_0xDA = 1928 1726 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1929 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1727 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1728 + .touch_max = 2 }; 1930 1729 static struct wacom_features wacom_features_0xDB = 1931 1730 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1932 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1731 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1732 + .touch_max = 2 }; 1933 1733 static const struct wacom_features wacom_features_0xDD = 1934 1734 { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, 1935 1735 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1936 1736 static const struct wacom_features wacom_features_0xDE = 1937 1737 { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, 1938 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1738 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1739 + .touch_max = 16 }; 1939 1740 static const struct wacom_features wacom_features_0xDF = 1940 1741 { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, 1941 - 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1742 + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 1743 + .touch_max = 16 }; 1942 1744 static const struct wacom_features wacom_features_0x6004 = 1943 1745 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 1944 1746 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ··· 2019 1807 { USB_DEVICE_WACOM(0xBA) }, 2020 1808 { USB_DEVICE_WACOM(0xBB) }, 2021 1809 { USB_DEVICE_WACOM(0xBC) }, 1810 + { USB_DEVICE_WACOM(0x26) }, 1811 + { USB_DEVICE_WACOM(0x27) }, 1812 + { USB_DEVICE_WACOM(0x28) }, 1813 + { USB_DEVICE_WACOM(0x29) }, 1814 + { USB_DEVICE_WACOM(0x2A) }, 2022 1815 { USB_DEVICE_WACOM(0x3F) }, 2023 1816 { USB_DEVICE_WACOM(0xC5) }, 2024 1817 { USB_DEVICE_WACOM(0xC6) }, ··· 2059 1842 { USB_DEVICE_WACOM(0x9F) }, 2060 1843 { USB_DEVICE_WACOM(0xE2) }, 2061 1844 { USB_DEVICE_WACOM(0xE3) }, 1845 + { USB_DEVICE_WACOM(0xE5) }, 2062 1846 { USB_DEVICE_WACOM(0xE6) }, 2063 1847 { USB_DEVICE_WACOM(0xEC) }, 2064 1848 { USB_DEVICE_WACOM(0x47) },
+13
drivers/input/tablet/wacom_wac.h
··· 25 25 #define WACOM_PKGLEN_BBTOUCH3 64 26 26 #define WACOM_PKGLEN_BBPEN 10 27 27 #define WACOM_PKGLEN_WIRELESS 32 28 + #define WACOM_PKGLEN_MTOUCH 62 29 + 30 + /* wacom data size per MT contact */ 31 + #define WACOM_BYTES_PER_MT_PACKET 11 28 32 29 33 /* device IDs */ 30 34 #define STYLUS_DEVICE_ID 0x02 ··· 42 38 #define WACOM_REPORT_INTUOSREAD 5 43 39 #define WACOM_REPORT_INTUOSWRITE 6 44 40 #define WACOM_REPORT_INTUOSPAD 12 41 + #define WACOM_REPORT_INTUOS5PAD 3 45 42 #define WACOM_REPORT_TPC1FG 6 46 43 #define WACOM_REPORT_TPC2FG 13 44 + #define WACOM_REPORT_TPCMT 13 47 45 #define WACOM_REPORT_TPCHID 15 48 46 #define WACOM_REPORT_TPCST 16 49 47 ··· 71 65 INTUOS4S, 72 66 INTUOS4, 73 67 INTUOS4L, 68 + INTUOS5S, 69 + INTUOS5, 70 + INTUOS5L, 74 71 WACOM_24HD, 75 72 WACOM_21UX2, 76 73 CINTIQ, ··· 81 72 WACOM_MO, 82 73 TABLETPC, 83 74 TABLETPC2FG, 75 + MTSCREEN, 84 76 MAX_TYPE 85 77 }; 86 78 ··· 105 95 int pressure_fuzz; 106 96 int distance_fuzz; 107 97 unsigned quirks; 98 + unsigned touch_max; 108 99 }; 109 100 110 101 struct wacom_shared { ··· 124 113 struct input_dev *input; 125 114 int pid; 126 115 int battery_capacity; 116 + int num_contacts_left; 117 + int *slots; 127 118 }; 128 119 129 120 #endif
+32 -2
drivers/input/touchscreen/Kconfig
··· 187 187 Say Y here to enable the support for the touchscreen found 188 188 on Dialog Semiconductor DA9034 PMIC. 189 189 190 + If unsure, say N. 191 + 192 + To compile this driver as a module, choose M here: the 193 + module will be called da9034-ts. 194 + 195 + config TOUCHSCREEN_DA9052 196 + tristate "Dialog DA9052/DA9053 TSI" 197 + depends on PMIC_DA9052 198 + help 199 + Say Y here to support the touchscreen found on Dialog Semiconductor 200 + DA9052-BC and DA9053-AA/Bx PMICs. 201 + 202 + If unsure, say N. 203 + 204 + To compile this driver as a module, choose M here: the 205 + module will be called da9052_tsi. 206 + 190 207 config TOUCHSCREEN_DYNAPRO 191 208 tristate "Dynapro serial touchscreen" 192 209 select SERIO ··· 322 305 323 306 To compile this driver as a module, choose M here: the 324 307 module will be called wacom_w8001. 308 + 309 + config TOUCHSCREEN_WACOM_I2C 310 + tristate "Wacom Tablet support (I2C)" 311 + depends on I2C 312 + help 313 + Say Y here if you want to use the I2C version of the Wacom 314 + Pen Tablet. 315 + 316 + If unsure, say N. 317 + 318 + To compile this driver as a module, choose M here: the module 319 + will be called wacom_i2c. 325 320 326 321 config TOUCHSCREEN_LPC32XX 327 322 tristate "LPC32XX touchscreen controller" ··· 664 635 - Zytronic controllers 665 636 - Elo TouchSystems 2700 IntelliTouch 666 637 - EasyTouch USB Touch Controller from Data Modul 638 + - e2i (Mimo monitors) 667 639 668 640 Have a look at <http://linux.chapter7.ch/touchkit/> for 669 641 a usage description and the required user-space stuff. ··· 751 721 752 722 config TOUCHSCREEN_USB_E2I 753 723 default y 754 - bool "e2i Touchscreen controller (e.g. from Mimo 740)" 724 + bool "e2i Touchscreen controller (e.g. from Mimo 740)" if EXPERT 755 725 depends on TOUCHSCREEN_USB_COMPOSITE 756 726 757 727 config TOUCHSCREEN_USB_ZYTRONIC ··· 774 744 bool "EasyTouch USB Touch controller device support" if EMBEDDED 775 745 depends on TOUCHSCREEN_USB_COMPOSITE 776 746 help 777 - Say Y here if you have a EasyTouch USB Touch controller device support. 747 + Say Y here if you have an EasyTouch USB Touch controller. 778 748 If unsure, say N. 779 749 780 750 config TOUCHSCREEN_TOUCHIT213
+2
drivers/input/touchscreen/Makefile
··· 22 22 obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C) += cyttsp_i2c.o 23 23 obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o 24 24 obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o 25 + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o 25 26 obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o 26 27 obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o 27 28 obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o ··· 60 59 obj-$(CONFIG_TOUCHSCREEN_TSC2007) += tsc2007.o 61 60 obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o 62 61 obj-$(CONFIG_TOUCHSCREEN_WACOM_W8001) += wacom_w8001.o 62 + obj-$(CONFIG_TOUCHSCREEN_WACOM_I2C) += wacom_i2c.o 63 63 obj-$(CONFIG_TOUCHSCREEN_WM831X) += wm831x-ts.o 64 64 obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o 65 65 wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o
+11 -22
drivers/input/touchscreen/atmel_mxt_ts.c
··· 236 236 struct mxt_message { 237 237 u8 reportid; 238 238 u8 message[7]; 239 - u8 checksum; 240 239 }; 241 240 242 241 struct mxt_finger { ··· 325 326 } 326 327 327 328 static void mxt_dump_message(struct device *dev, 328 - struct mxt_message *message) 329 + struct mxt_message *message) 329 330 { 330 - dev_dbg(dev, "reportid:\t0x%x\n", message->reportid); 331 - dev_dbg(dev, "message1:\t0x%x\n", message->message[0]); 332 - dev_dbg(dev, "message2:\t0x%x\n", message->message[1]); 333 - dev_dbg(dev, "message3:\t0x%x\n", message->message[2]); 334 - dev_dbg(dev, "message4:\t0x%x\n", message->message[3]); 335 - dev_dbg(dev, "message5:\t0x%x\n", message->message[4]); 336 - dev_dbg(dev, "message6:\t0x%x\n", message->message[5]); 337 - dev_dbg(dev, "message7:\t0x%x\n", message->message[6]); 338 - dev_dbg(dev, "checksum:\t0x%x\n", message->checksum); 331 + dev_dbg(dev, "reportid: %u\tmessage: %02x %02x %02x %02x %02x %02x %02x\n", 332 + message->reportid, message->message[0], message->message[1], 333 + message->message[2], message->message[3], message->message[4], 334 + message->message[5], message->message[6]); 339 335 } 340 336 341 337 static int mxt_check_bootloader(struct i2c_client *client, ··· 500 506 u16 reg; 501 507 502 508 object = mxt_get_object(data, type); 503 - if (!object) 509 + if (!object || offset >= object->size + 1) 504 510 return -EINVAL; 505 511 506 512 reg = object->start_address; ··· 1043 1049 return count; 1044 1050 } 1045 1051 1046 - static DEVICE_ATTR(object, 0444, mxt_object_show, NULL); 1047 - static DEVICE_ATTR(update_fw, 0664, NULL, mxt_update_fw_store); 1052 + static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); 1053 + static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); 1048 1054 1049 1055 static struct attribute *mxt_attrs[] = { 1050 1056 &dev_attr_object.attr, ··· 1195 1201 return 0; 1196 1202 } 1197 1203 1198 - #ifdef CONFIG_PM 1204 + #ifdef CONFIG_PM_SLEEP 1199 1205 static int mxt_suspend(struct device *dev) 1200 1206 { 1201 1207 struct i2c_client *client = to_i2c_client(dev); ··· 1233 1239 1234 1240 return 0; 1235 1241 } 1236 - 1237 - static const struct dev_pm_ops mxt_pm_ops = { 1238 - .suspend = mxt_suspend, 1239 - .resume = mxt_resume, 1240 - }; 1241 1242 #endif 1243 + 1244 + static SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume); 1242 1245 1243 1246 static const struct i2c_device_id mxt_id[] = { 1244 1247 { "qt602240_ts", 0 }, ··· 1249 1258 .driver = { 1250 1259 .name = "atmel_mxt_ts", 1251 1260 .owner = THIS_MODULE, 1252 - #ifdef CONFIG_PM 1253 1261 .pm = &mxt_pm_ops, 1254 - #endif 1255 1262 }, 1256 1263 .probe = mxt_probe, 1257 1264 .remove = __devexit_p(mxt_remove),
+370
drivers/input/touchscreen/da9052_tsi.c
··· 1 + /* 2 + * TSI driver for Dialog DA9052 3 + * 4 + * Copyright(c) 2012 Dialog Semiconductor Ltd. 5 + * 6 + * Author: David Dajun Chen <dchen@diasemi.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 12 + * 13 + */ 14 + #include <linux/module.h> 15 + #include <linux/input.h> 16 + #include <linux/delay.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/interrupt.h> 19 + 20 + #include <linux/mfd/da9052/reg.h> 21 + #include <linux/mfd/da9052/da9052.h> 22 + 23 + #define TSI_PEN_DOWN_STATUS 0x40 24 + 25 + struct da9052_tsi { 26 + struct da9052 *da9052; 27 + struct input_dev *dev; 28 + struct delayed_work ts_pen_work; 29 + struct mutex mutex; 30 + unsigned int irq_pendwn; 31 + unsigned int irq_datardy; 32 + bool stopped; 33 + bool adc_on; 34 + }; 35 + 36 + static void da9052_ts_adc_toggle(struct da9052_tsi *tsi, bool on) 37 + { 38 + da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 0, on); 39 + tsi->adc_on = on; 40 + } 41 + 42 + static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data) 43 + { 44 + struct da9052_tsi *tsi = data; 45 + 46 + if (!tsi->stopped) { 47 + /* Mask PEN_DOWN event and unmask TSI_READY event */ 48 + disable_irq_nosync(tsi->irq_pendwn); 49 + enable_irq(tsi->irq_datardy); 50 + 51 + da9052_ts_adc_toggle(tsi, true); 52 + 53 + schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); 54 + } 55 + 56 + return IRQ_HANDLED; 57 + } 58 + 59 + static void da9052_ts_read(struct da9052_tsi *tsi) 60 + { 61 + struct input_dev *input = tsi->dev; 62 + int ret; 63 + u16 x, y, z; 64 + u8 v; 65 + 66 + ret = da9052_reg_read(tsi->da9052, DA9052_TSI_X_MSB_REG); 67 + if (ret < 0) 68 + return; 69 + 70 + x = (u16) ret; 71 + 72 + ret = da9052_reg_read(tsi->da9052, DA9052_TSI_Y_MSB_REG); 73 + if (ret < 0) 74 + return; 75 + 76 + y = (u16) ret; 77 + 78 + ret = da9052_reg_read(tsi->da9052, DA9052_TSI_Z_MSB_REG); 79 + if (ret < 0) 80 + return; 81 + 82 + z = (u16) ret; 83 + 84 + ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); 85 + if (ret < 0) 86 + return; 87 + 88 + v = (u8) ret; 89 + 90 + x = ((x << 2) & 0x3fc) | (v & 0x3); 91 + y = ((y << 2) & 0x3fc) | ((v & 0xc) >> 2); 92 + z = ((z << 2) & 0x3fc) | ((v & 0x30) >> 4); 93 + 94 + input_report_key(input, BTN_TOUCH, 1); 95 + input_report_abs(input, ABS_X, x); 96 + input_report_abs(input, ABS_Y, y); 97 + input_report_abs(input, ABS_PRESSURE, z); 98 + input_sync(input); 99 + } 100 + 101 + static irqreturn_t da9052_ts_datardy_irq(int irq, void *data) 102 + { 103 + struct da9052_tsi *tsi = data; 104 + 105 + da9052_ts_read(tsi); 106 + 107 + return IRQ_HANDLED; 108 + } 109 + 110 + static void da9052_ts_pen_work(struct work_struct *work) 111 + { 112 + struct da9052_tsi *tsi = container_of(work, struct da9052_tsi, 113 + ts_pen_work.work); 114 + if (!tsi->stopped) { 115 + int ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); 116 + if (ret < 0 || (ret & TSI_PEN_DOWN_STATUS)) { 117 + /* Pen is still DOWN (or read error) */ 118 + schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); 119 + } else { 120 + struct input_dev *input = tsi->dev; 121 + 122 + /* Pen UP */ 123 + da9052_ts_adc_toggle(tsi, false); 124 + 125 + /* Report Pen UP */ 126 + input_report_key(input, BTN_TOUCH, 0); 127 + input_report_abs(input, ABS_PRESSURE, 0); 128 + input_sync(input); 129 + 130 + /* 131 + * FIXME: Fixes the unhandled irq issue when quick 132 + * pen down and pen up events occurs 133 + */ 134 + ret = da9052_reg_update(tsi->da9052, 135 + DA9052_EVENT_B_REG, 0xC0, 0xC0); 136 + if (ret < 0) 137 + return; 138 + 139 + /* Mask TSI_READY event and unmask PEN_DOWN event */ 140 + disable_irq(tsi->irq_datardy); 141 + enable_irq(tsi->irq_pendwn); 142 + } 143 + } 144 + } 145 + 146 + static int __devinit da9052_ts_configure_gpio(struct da9052 *da9052) 147 + { 148 + int error; 149 + 150 + error = da9052_reg_update(da9052, DA9052_GPIO_2_3_REG, 0x30, 0); 151 + if (error < 0) 152 + return error; 153 + 154 + error = da9052_reg_update(da9052, DA9052_GPIO_4_5_REG, 0x33, 0); 155 + if (error < 0) 156 + return error; 157 + 158 + error = da9052_reg_update(da9052, DA9052_GPIO_6_7_REG, 0x33, 0); 159 + if (error < 0) 160 + return error; 161 + 162 + return 0; 163 + } 164 + 165 + static int __devinit da9052_configure_tsi(struct da9052_tsi *tsi) 166 + { 167 + int error; 168 + 169 + error = da9052_ts_configure_gpio(tsi->da9052); 170 + if (error) 171 + return error; 172 + 173 + /* Measure TSI sample every 1ms */ 174 + error = da9052_reg_update(tsi->da9052, DA9052_ADC_CONT_REG, 175 + 1 << 6, 1 << 6); 176 + if (error < 0) 177 + return error; 178 + 179 + /* TSI_DELAY: 3 slots, TSI_SKIP: 0 slots, TSI_MODE: XYZP */ 180 + error = da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 0xFC, 0xC0); 181 + if (error < 0) 182 + return error; 183 + 184 + /* Supply TSIRef through LD09 */ 185 + error = da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x59); 186 + if (error < 0) 187 + return error; 188 + 189 + return 0; 190 + } 191 + 192 + static int da9052_ts_input_open(struct input_dev *input_dev) 193 + { 194 + struct da9052_tsi *tsi = input_get_drvdata(input_dev); 195 + 196 + tsi->stopped = false; 197 + mb(); 198 + 199 + /* Unmask PEN_DOWN event */ 200 + enable_irq(tsi->irq_pendwn); 201 + 202 + /* Enable Pen Detect Circuit */ 203 + return da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 204 + 1 << 1, 1 << 1); 205 + } 206 + 207 + static void da9052_ts_input_close(struct input_dev *input_dev) 208 + { 209 + struct da9052_tsi *tsi = input_get_drvdata(input_dev); 210 + 211 + tsi->stopped = true; 212 + mb(); 213 + disable_irq(tsi->irq_pendwn); 214 + cancel_delayed_work_sync(&tsi->ts_pen_work); 215 + 216 + if (tsi->adc_on) { 217 + disable_irq(tsi->irq_datardy); 218 + da9052_ts_adc_toggle(tsi, false); 219 + 220 + /* 221 + * If ADC was on that means that pendwn IRQ was disabled 222 + * twice and we need to enable it to keep enable/disable 223 + * counter balanced. IRQ is still off though. 224 + */ 225 + enable_irq(tsi->irq_pendwn); 226 + } 227 + 228 + /* Disable Pen Detect Circuit */ 229 + da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); 230 + } 231 + 232 + static int __devinit da9052_ts_probe(struct platform_device *pdev) 233 + { 234 + struct da9052 *da9052; 235 + struct da9052_tsi *tsi; 236 + struct input_dev *input_dev; 237 + int irq_pendwn; 238 + int irq_datardy; 239 + int error; 240 + 241 + da9052 = dev_get_drvdata(pdev->dev.parent); 242 + if (!da9052) 243 + return -EINVAL; 244 + 245 + irq_pendwn = platform_get_irq_byname(pdev, "PENDWN"); 246 + irq_datardy = platform_get_irq_byname(pdev, "TSIRDY"); 247 + if (irq_pendwn < 0 || irq_datardy < 0) { 248 + dev_err(da9052->dev, "Unable to determine device interrupts\n"); 249 + return -ENXIO; 250 + } 251 + 252 + tsi = kzalloc(sizeof(struct da9052_tsi), GFP_KERNEL); 253 + input_dev = input_allocate_device(); 254 + if (!tsi || !input_dev) { 255 + error = -ENOMEM; 256 + goto err_free_mem; 257 + } 258 + 259 + tsi->da9052 = da9052; 260 + tsi->dev = input_dev; 261 + tsi->irq_pendwn = da9052->irq_base + irq_pendwn; 262 + tsi->irq_datardy = da9052->irq_base + irq_datardy; 263 + tsi->stopped = true; 264 + INIT_DELAYED_WORK(&tsi->ts_pen_work, da9052_ts_pen_work); 265 + 266 + input_dev->id.version = 0x0101; 267 + input_dev->id.vendor = 0x15B6; 268 + input_dev->id.product = 0x9052; 269 + input_dev->name = "Dialog DA9052 TouchScreen Driver"; 270 + input_dev->dev.parent = &pdev->dev; 271 + input_dev->open = da9052_ts_input_open; 272 + input_dev->close = da9052_ts_input_close; 273 + 274 + __set_bit(EV_ABS, input_dev->evbit); 275 + __set_bit(EV_KEY, input_dev->evbit); 276 + __set_bit(BTN_TOUCH, input_dev->keybit); 277 + 278 + input_set_abs_params(input_dev, ABS_X, 0, 1023, 0, 0); 279 + input_set_abs_params(input_dev, ABS_Y, 0, 1023, 0, 0); 280 + input_set_abs_params(input_dev, ABS_PRESSURE, 0, 1023, 0, 0); 281 + 282 + input_set_drvdata(input_dev, tsi); 283 + 284 + /* Disable Pen Detect Circuit */ 285 + da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); 286 + 287 + /* Disable ADC */ 288 + da9052_ts_adc_toggle(tsi, false); 289 + 290 + error = request_threaded_irq(tsi->irq_pendwn, 291 + NULL, da9052_ts_pendwn_irq, 292 + IRQF_TRIGGER_LOW | IRQF_ONESHOT, 293 + "PENDWN", tsi); 294 + if (error) { 295 + dev_err(tsi->da9052->dev, 296 + "Failed to register PENDWN IRQ %d, error = %d\n", 297 + tsi->irq_pendwn, error); 298 + goto err_free_mem; 299 + } 300 + 301 + error = request_threaded_irq(tsi->irq_datardy, 302 + NULL, da9052_ts_datardy_irq, 303 + IRQF_TRIGGER_LOW | IRQF_ONESHOT, 304 + "TSIRDY", tsi); 305 + if (error) { 306 + dev_err(tsi->da9052->dev, 307 + "Failed to register TSIRDY IRQ %d, error = %d\n", 308 + tsi->irq_datardy, error); 309 + goto err_free_pendwn_irq; 310 + } 311 + 312 + /* Mask PEN_DOWN and TSI_READY events */ 313 + disable_irq(tsi->irq_pendwn); 314 + disable_irq(tsi->irq_datardy); 315 + 316 + error = da9052_configure_tsi(tsi); 317 + if (error) 318 + goto err_free_datardy_irq; 319 + 320 + error = input_register_device(tsi->dev); 321 + if (error) 322 + goto err_free_datardy_irq; 323 + 324 + platform_set_drvdata(pdev, tsi); 325 + 326 + return 0; 327 + 328 + err_free_datardy_irq: 329 + free_irq(tsi->irq_datardy, tsi); 330 + err_free_pendwn_irq: 331 + free_irq(tsi->irq_pendwn, tsi); 332 + err_free_mem: 333 + kfree(tsi); 334 + input_free_device(input_dev); 335 + 336 + return error; 337 + } 338 + 339 + static int __devexit da9052_ts_remove(struct platform_device *pdev) 340 + { 341 + struct da9052_tsi *tsi = platform_get_drvdata(pdev); 342 + 343 + da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x19); 344 + 345 + free_irq(tsi->irq_pendwn, tsi); 346 + free_irq(tsi->irq_datardy, tsi); 347 + 348 + input_unregister_device(tsi->dev); 349 + kfree(tsi); 350 + 351 + platform_set_drvdata(pdev, NULL); 352 + 353 + return 0; 354 + } 355 + 356 + static struct platform_driver da9052_tsi_driver = { 357 + .probe = da9052_ts_probe, 358 + .remove = __devexit_p(da9052_ts_remove), 359 + .driver = { 360 + .name = "da9052-tsi", 361 + .owner = THIS_MODULE, 362 + }, 363 + }; 364 + 365 + module_platform_driver(da9052_tsi_driver); 366 + 367 + MODULE_DESCRIPTION("Touchscreen driver for Dialog Semiconductor DA9052"); 368 + MODULE_AUTHOR("Anthony Olech <Anthony.Olech@diasemi.com>"); 369 + MODULE_LICENSE("GPL"); 370 + MODULE_ALIAS("platform:da9052-tsi");
+1 -16
drivers/input/touchscreen/dynapro.c
··· 188 188 .disconnect = dynapro_disconnect, 189 189 }; 190 190 191 - /* 192 - * The functions for inserting/removing us as a module. 193 - */ 194 - 195 - static int __init dynapro_init(void) 196 - { 197 - return serio_register_driver(&dynapro_drv); 198 - } 199 - 200 - static void __exit dynapro_exit(void) 201 - { 202 - serio_unregister_driver(&dynapro_drv); 203 - } 204 - 205 - module_init(dynapro_init); 206 - module_exit(dynapro_exit); 191 + module_serio_driver(dynapro_drv);
+1 -16
drivers/input/touchscreen/elo.c
··· 405 405 .disconnect = elo_disconnect, 406 406 }; 407 407 408 - /* 409 - * The functions for inserting/removing us as a module. 410 - */ 411 - 412 - static int __init elo_init(void) 413 - { 414 - return serio_register_driver(&elo_drv); 415 - } 416 - 417 - static void __exit elo_exit(void) 418 - { 419 - serio_unregister_driver(&elo_drv); 420 - } 421 - 422 - module_init(elo_init); 423 - module_exit(elo_exit); 408 + module_serio_driver(elo_drv);
+1 -12
drivers/input/touchscreen/fujitsu_ts.c
··· 175 175 .disconnect = fujitsu_disconnect, 176 176 }; 177 177 178 - static int __init fujitsu_init(void) 179 - { 180 - return serio_register_driver(&fujitsu_drv); 181 - } 182 - 183 - static void __exit fujitsu_exit(void) 184 - { 185 - serio_unregister_driver(&fujitsu_drv); 186 - } 187 - 188 - module_init(fujitsu_init); 189 - module_exit(fujitsu_exit); 178 + module_serio_driver(fujitsu_drv);
+1 -16
drivers/input/touchscreen/gunze.c
··· 186 186 .disconnect = gunze_disconnect, 187 187 }; 188 188 189 - /* 190 - * The functions for inserting/removing us as a module. 191 - */ 192 - 193 - static int __init gunze_init(void) 194 - { 195 - return serio_register_driver(&gunze_drv); 196 - } 197 - 198 - static void __exit gunze_exit(void) 199 - { 200 - serio_unregister_driver(&gunze_drv); 201 - } 202 - 203 - module_init(gunze_init); 204 - module_exit(gunze_exit); 189 + module_serio_driver(gunze_drv);
+1 -16
drivers/input/touchscreen/h3600_ts_input.c
··· 476 476 .disconnect = h3600ts_disconnect, 477 477 }; 478 478 479 - /* 480 - * The functions for inserting/removing us as a module. 481 - */ 482 - 483 - static int __init h3600ts_init(void) 484 - { 485 - return serio_register_driver(&h3600ts_drv); 486 - } 487 - 488 - static void __exit h3600ts_exit(void) 489 - { 490 - serio_unregister_driver(&h3600ts_drv); 491 - } 492 - 493 - module_init(h3600ts_init); 494 - module_exit(h3600ts_exit); 479 + module_serio_driver(h3600ts_drv);
+1 -16
drivers/input/touchscreen/hampshire.c
··· 187 187 .disconnect = hampshire_disconnect, 188 188 }; 189 189 190 - /* 191 - * The functions for inserting/removing us as a module. 192 - */ 193 - 194 - static int __init hampshire_init(void) 195 - { 196 - return serio_register_driver(&hampshire_drv); 197 - } 198 - 199 - static void __exit hampshire_exit(void) 200 - { 201 - serio_unregister_driver(&hampshire_drv); 202 - } 203 - 204 - module_init(hampshire_init); 205 - module_exit(hampshire_exit); 190 + module_serio_driver(hampshire_drv);
+1 -16
drivers/input/touchscreen/inexio.c
··· 189 189 .disconnect = inexio_disconnect, 190 190 }; 191 191 192 - /* 193 - * The functions for inserting/removing us as a module. 194 - */ 195 - 196 - static int __init inexio_init(void) 197 - { 198 - return serio_register_driver(&inexio_drv); 199 - } 200 - 201 - static void __exit inexio_exit(void) 202 - { 203 - serio_unregister_driver(&inexio_drv); 204 - } 205 - 206 - module_init(inexio_init); 207 - module_exit(inexio_exit); 192 + module_serio_driver(inexio_drv);
+10
drivers/input/touchscreen/lpc32xx_ts.c
··· 22 22 #include <linux/clk.h> 23 23 #include <linux/io.h> 24 24 #include <linux/slab.h> 25 + #include <linux/of.h> 25 26 26 27 /* 27 28 * Touchscreen controller register offsets ··· 384 383 #define LPC32XX_TS_PM_OPS NULL 385 384 #endif 386 385 386 + #ifdef CONFIG_OF 387 + static struct of_device_id lpc32xx_tsc_of_match[] = { 388 + { .compatible = "nxp,lpc3220-tsc", }, 389 + { }, 390 + }; 391 + MODULE_DEVICE_TABLE(of, lpc32xx_tsc_of_match); 392 + #endif 393 + 387 394 static struct platform_driver lpc32xx_ts_driver = { 388 395 .probe = lpc32xx_ts_probe, 389 396 .remove = __devexit_p(lpc32xx_ts_remove), ··· 399 390 .name = MOD_NAME, 400 391 .owner = THIS_MODULE, 401 392 .pm = LPC32XX_TS_PM_OPS, 393 + .of_match_table = of_match_ptr(lpc32xx_tsc_of_match), 402 394 }, 403 395 }; 404 396 module_platform_driver(lpc32xx_ts_driver);
+1 -16
drivers/input/touchscreen/mtouch.c
··· 202 202 .disconnect = mtouch_disconnect, 203 203 }; 204 204 205 - /* 206 - * The functions for inserting/removing us as a module. 207 - */ 208 - 209 - static int __init mtouch_init(void) 210 - { 211 - return serio_register_driver(&mtouch_drv); 212 - } 213 - 214 - static void __exit mtouch_exit(void) 215 - { 216 - serio_unregister_driver(&mtouch_drv); 217 - } 218 - 219 - module_init(mtouch_init); 220 - module_exit(mtouch_exit); 205 + module_serio_driver(mtouch_drv);
+1 -16
drivers/input/touchscreen/penmount.c
··· 317 317 .disconnect = pm_disconnect, 318 318 }; 319 319 320 - /* 321 - * The functions for inserting/removing us as a module. 322 - */ 323 - 324 - static int __init pm_init(void) 325 - { 326 - return serio_register_driver(&pm_drv); 327 - } 328 - 329 - static void __exit pm_exit(void) 330 - { 331 - serio_unregister_driver(&pm_drv); 332 - } 333 - 334 - module_init(pm_init); 335 - module_exit(pm_exit); 320 + module_serio_driver(pm_drv);
+13 -7
drivers/input/touchscreen/st1232.c
··· 218 218 return 0; 219 219 } 220 220 221 - #ifdef CONFIG_PM 221 + #ifdef CONFIG_PM_SLEEP 222 222 static int st1232_ts_suspend(struct device *dev) 223 223 { 224 224 struct i2c_client *client = to_i2c_client(dev); ··· 243 243 return 0; 244 244 } 245 245 246 - static const struct dev_pm_ops st1232_ts_pm_ops = { 247 - .suspend = st1232_ts_suspend, 248 - .resume = st1232_ts_resume, 249 - }; 250 246 #endif 247 + 248 + static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops, 249 + st1232_ts_suspend, st1232_ts_resume); 251 250 252 251 static const struct i2c_device_id st1232_ts_id[] = { 253 252 { ST1232_TS_NAME, 0 }, 254 253 { } 255 254 }; 256 255 MODULE_DEVICE_TABLE(i2c, st1232_ts_id); 256 + 257 + #ifdef CONFIG_OF 258 + static const struct of_device_id st1232_ts_dt_ids[] __devinitconst = { 259 + { .compatible = "sitronix,st1232", }, 260 + { } 261 + }; 262 + MODULE_DEVICE_TABLE(of, st1232_ts_dt_ids); 263 + #endif 257 264 258 265 static struct i2c_driver st1232_ts_driver = { 259 266 .probe = st1232_ts_probe, ··· 269 262 .driver = { 270 263 .name = ST1232_TS_NAME, 271 264 .owner = THIS_MODULE, 272 - #ifdef CONFIG_PM 265 + .of_match_table = of_match_ptr(st1232_ts_dt_ids), 273 266 .pm = &st1232_ts_pm_ops, 274 - #endif 275 267 }, 276 268 }; 277 269
+1 -16
drivers/input/touchscreen/touchit213.c
··· 216 216 .disconnect = touchit213_disconnect, 217 217 }; 218 218 219 - /* 220 - * The functions for inserting/removing us as a module. 221 - */ 222 - 223 - static int __init touchit213_init(void) 224 - { 225 - return serio_register_driver(&touchit213_drv); 226 - } 227 - 228 - static void __exit touchit213_exit(void) 229 - { 230 - serio_unregister_driver(&touchit213_drv); 231 - } 232 - 233 - module_init(touchit213_init); 234 - module_exit(touchit213_exit); 219 + module_serio_driver(touchit213_drv);
+1 -16
drivers/input/touchscreen/touchright.c
··· 176 176 .disconnect = tr_disconnect, 177 177 }; 178 178 179 - /* 180 - * The functions for inserting/removing us as a module. 181 - */ 182 - 183 - static int __init tr_init(void) 184 - { 185 - return serio_register_driver(&tr_drv); 186 - } 187 - 188 - static void __exit tr_exit(void) 189 - { 190 - serio_unregister_driver(&tr_drv); 191 - } 192 - 193 - module_init(tr_init); 194 - module_exit(tr_exit); 179 + module_serio_driver(tr_drv);
+1 -16
drivers/input/touchscreen/touchwin.c
··· 183 183 .disconnect = tw_disconnect, 184 184 }; 185 185 186 - /* 187 - * The functions for inserting/removing us as a module. 188 - */ 189 - 190 - static int __init tw_init(void) 191 - { 192 - return serio_register_driver(&tw_drv); 193 - } 194 - 195 - static void __exit tw_exit(void) 196 - { 197 - serio_unregister_driver(&tw_drv); 198 - } 199 - 200 - module_init(tw_init); 201 - module_exit(tw_exit); 186 + module_serio_driver(tw_drv);
+1 -11
drivers/input/touchscreen/tsc40.c
··· 167 167 .disconnect = tsc_disconnect, 168 168 }; 169 169 170 - static int __init tsc_ser_init(void) 171 - { 172 - return serio_register_driver(&tsc_drv); 173 - } 174 - module_init(tsc_ser_init); 175 - 176 - static void __exit tsc_exit(void) 177 - { 178 - serio_unregister_driver(&tsc_drv); 179 - } 180 - module_exit(tsc_exit); 170 + module_serio_driver(tsc_drv); 181 171 182 172 MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>"); 183 173 MODULE_DESCRIPTION(DRIVER_DESC);
+282
drivers/input/touchscreen/wacom_i2c.c
··· 1 + /* 2 + * Wacom Penabled Driver for I2C 3 + * 4 + * Copyright (c) 2011 Tatsunosuke Tobita, Wacom. 5 + * <tobita.tatsunosuke@wacom.co.jp> 6 + * 7 + * This program is free software; you can redistribute it 8 + * and/or modify it under the terms of the GNU General 9 + * Public License as published by the Free Software 10 + * Foundation; either version of 2 of the License, 11 + * or (at your option) any later version. 12 + */ 13 + 14 + #include <linux/module.h> 15 + #include <linux/input.h> 16 + #include <linux/i2c.h> 17 + #include <linux/slab.h> 18 + #include <linux/irq.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/gpio.h> 21 + #include <asm/unaligned.h> 22 + 23 + #define WACOM_CMD_QUERY0 0x04 24 + #define WACOM_CMD_QUERY1 0x00 25 + #define WACOM_CMD_QUERY2 0x33 26 + #define WACOM_CMD_QUERY3 0x02 27 + #define WACOM_CMD_THROW0 0x05 28 + #define WACOM_CMD_THROW1 0x00 29 + #define WACOM_QUERY_SIZE 19 30 + #define WACOM_RETRY_CNT 100 31 + 32 + struct wacom_features { 33 + int x_max; 34 + int y_max; 35 + int pressure_max; 36 + char fw_version; 37 + }; 38 + 39 + struct wacom_i2c { 40 + struct i2c_client *client; 41 + struct input_dev *input; 42 + u8 data[WACOM_QUERY_SIZE]; 43 + }; 44 + 45 + static int wacom_query_device(struct i2c_client *client, 46 + struct wacom_features *features) 47 + { 48 + int ret; 49 + u8 cmd1[] = { WACOM_CMD_QUERY0, WACOM_CMD_QUERY1, 50 + WACOM_CMD_QUERY2, WACOM_CMD_QUERY3 }; 51 + u8 cmd2[] = { WACOM_CMD_THROW0, WACOM_CMD_THROW1 }; 52 + u8 data[WACOM_QUERY_SIZE]; 53 + struct i2c_msg msgs[] = { 54 + { 55 + .addr = client->addr, 56 + .flags = 0, 57 + .len = sizeof(cmd1), 58 + .buf = cmd1, 59 + }, 60 + { 61 + .addr = client->addr, 62 + .flags = 0, 63 + .len = sizeof(cmd2), 64 + .buf = cmd2, 65 + }, 66 + { 67 + .addr = client->addr, 68 + .flags = I2C_M_RD, 69 + .len = sizeof(data), 70 + .buf = data, 71 + }, 72 + }; 73 + 74 + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 75 + if (ret < 0) 76 + return ret; 77 + if (ret != ARRAY_SIZE(msgs)) 78 + return -EIO; 79 + 80 + features->x_max = get_unaligned_le16(&data[3]); 81 + features->y_max = get_unaligned_le16(&data[5]); 82 + features->pressure_max = get_unaligned_le16(&data[11]); 83 + features->fw_version = get_unaligned_le16(&data[13]); 84 + 85 + dev_dbg(&client->dev, 86 + "x_max:%d, y_max:%d, pressure:%d, fw:%d\n", 87 + features->x_max, features->y_max, 88 + features->pressure_max, features->fw_version); 89 + 90 + return 0; 91 + } 92 + 93 + static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) 94 + { 95 + struct wacom_i2c *wac_i2c = dev_id; 96 + struct input_dev *input = wac_i2c->input; 97 + u8 *data = wac_i2c->data; 98 + unsigned int x, y, pressure; 99 + unsigned char tsw, f1, f2, ers; 100 + int error; 101 + 102 + error = i2c_master_recv(wac_i2c->client, 103 + wac_i2c->data, sizeof(wac_i2c->data)); 104 + if (error < 0) 105 + goto out; 106 + 107 + tsw = data[3] & 0x01; 108 + ers = data[3] & 0x04; 109 + f1 = data[3] & 0x02; 110 + f2 = data[3] & 0x10; 111 + x = le16_to_cpup((__le16 *)&data[4]); 112 + y = le16_to_cpup((__le16 *)&data[6]); 113 + pressure = le16_to_cpup((__le16 *)&data[8]); 114 + 115 + input_report_key(input, BTN_TOUCH, tsw || ers); 116 + input_report_key(input, BTN_TOOL_PEN, tsw); 117 + input_report_key(input, BTN_TOOL_RUBBER, ers); 118 + input_report_key(input, BTN_STYLUS, f1); 119 + input_report_key(input, BTN_STYLUS2, f2); 120 + input_report_abs(input, ABS_X, x); 121 + input_report_abs(input, ABS_Y, y); 122 + input_report_abs(input, ABS_PRESSURE, pressure); 123 + input_sync(input); 124 + 125 + out: 126 + return IRQ_HANDLED; 127 + } 128 + 129 + static int wacom_i2c_open(struct input_dev *dev) 130 + { 131 + struct wacom_i2c *wac_i2c = input_get_drvdata(dev); 132 + struct i2c_client *client = wac_i2c->client; 133 + 134 + enable_irq(client->irq); 135 + 136 + return 0; 137 + } 138 + 139 + static void wacom_i2c_close(struct input_dev *dev) 140 + { 141 + struct wacom_i2c *wac_i2c = input_get_drvdata(dev); 142 + struct i2c_client *client = wac_i2c->client; 143 + 144 + disable_irq(client->irq); 145 + } 146 + 147 + static int __devinit wacom_i2c_probe(struct i2c_client *client, 148 + const struct i2c_device_id *id) 149 + { 150 + struct wacom_i2c *wac_i2c; 151 + struct input_dev *input; 152 + struct wacom_features features; 153 + int error; 154 + 155 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 156 + dev_err(&client->dev, "i2c_check_functionality error\n"); 157 + return -EIO; 158 + } 159 + 160 + error = wacom_query_device(client, &features); 161 + if (error) 162 + return error; 163 + 164 + wac_i2c = kzalloc(sizeof(*wac_i2c), GFP_KERNEL); 165 + input = input_allocate_device(); 166 + if (!wac_i2c || !input) { 167 + error = -ENOMEM; 168 + goto err_free_mem; 169 + } 170 + 171 + wac_i2c->client = client; 172 + wac_i2c->input = input; 173 + 174 + input->name = "Wacom I2C Digitizer"; 175 + input->id.bustype = BUS_I2C; 176 + input->id.vendor = 0x56a; 177 + input->id.version = features.fw_version; 178 + input->dev.parent = &client->dev; 179 + input->open = wacom_i2c_open; 180 + input->close = wacom_i2c_close; 181 + 182 + input->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 183 + 184 + __set_bit(BTN_TOOL_PEN, input->keybit); 185 + __set_bit(BTN_TOOL_RUBBER, input->keybit); 186 + __set_bit(BTN_STYLUS, input->keybit); 187 + __set_bit(BTN_STYLUS2, input->keybit); 188 + __set_bit(BTN_TOUCH, input->keybit); 189 + 190 + input_set_abs_params(input, ABS_X, 0, features.x_max, 0, 0); 191 + input_set_abs_params(input, ABS_Y, 0, features.y_max, 0, 0); 192 + input_set_abs_params(input, ABS_PRESSURE, 193 + 0, features.pressure_max, 0, 0); 194 + 195 + input_set_drvdata(input, wac_i2c); 196 + 197 + error = request_threaded_irq(client->irq, NULL, wacom_i2c_irq, 198 + IRQF_TRIGGER_LOW | IRQF_ONESHOT, 199 + "wacom_i2c", wac_i2c); 200 + if (error) { 201 + dev_err(&client->dev, 202 + "Failed to enable IRQ, error: %d\n", error); 203 + goto err_free_mem; 204 + } 205 + 206 + /* Disable the IRQ, we'll enable it in wac_i2c_open() */ 207 + disable_irq(client->irq); 208 + 209 + error = input_register_device(wac_i2c->input); 210 + if (error) { 211 + dev_err(&client->dev, 212 + "Failed to register input device, error: %d\n", error); 213 + goto err_free_irq; 214 + } 215 + 216 + i2c_set_clientdata(client, wac_i2c); 217 + return 0; 218 + 219 + err_free_irq: 220 + free_irq(client->irq, wac_i2c); 221 + err_free_mem: 222 + input_free_device(input); 223 + kfree(wac_i2c); 224 + 225 + return error; 226 + } 227 + 228 + static int __devexit wacom_i2c_remove(struct i2c_client *client) 229 + { 230 + struct wacom_i2c *wac_i2c = i2c_get_clientdata(client); 231 + 232 + free_irq(client->irq, wac_i2c); 233 + input_unregister_device(wac_i2c->input); 234 + kfree(wac_i2c); 235 + 236 + return 0; 237 + } 238 + 239 + #ifdef CONFIG_PM_SLEEP 240 + static int wacom_i2c_suspend(struct device *dev) 241 + { 242 + struct i2c_client *client = to_i2c_client(dev); 243 + 244 + disable_irq(client->irq); 245 + 246 + return 0; 247 + } 248 + 249 + static int wacom_i2c_resume(struct device *dev) 250 + { 251 + struct i2c_client *client = to_i2c_client(dev); 252 + 253 + enable_irq(client->irq); 254 + 255 + return 0; 256 + } 257 + #endif 258 + 259 + static SIMPLE_DEV_PM_OPS(wacom_i2c_pm, wacom_i2c_suspend, wacom_i2c_resume); 260 + 261 + static const struct i2c_device_id wacom_i2c_id[] = { 262 + { "WAC_I2C_EMR", 0 }, 263 + { }, 264 + }; 265 + MODULE_DEVICE_TABLE(i2c, wacom_i2c_id); 266 + 267 + static struct i2c_driver wacom_i2c_driver = { 268 + .driver = { 269 + .name = "wacom_i2c", 270 + .owner = THIS_MODULE, 271 + .pm = &wacom_i2c_pm, 272 + }, 273 + 274 + .probe = wacom_i2c_probe, 275 + .remove = __devexit_p(wacom_i2c_remove), 276 + .id_table = wacom_i2c_id, 277 + }; 278 + module_i2c_driver(wacom_i2c_driver); 279 + 280 + MODULE_AUTHOR("Tatsunosuke Tobita <tobita.tatsunosuke@wacom.co.jp>"); 281 + MODULE_DESCRIPTION("WACOM EMR I2C Driver"); 282 + MODULE_LICENSE("GPL");
+1 -12
drivers/input/touchscreen/wacom_w8001.c
··· 594 594 .disconnect = w8001_disconnect, 595 595 }; 596 596 597 - static int __init w8001_init(void) 598 - { 599 - return serio_register_driver(&w8001_drv); 600 - } 601 - 602 - static void __exit w8001_exit(void) 603 - { 604 - serio_unregister_driver(&w8001_drv); 605 - } 606 - 607 - module_init(w8001_init); 608 - module_exit(w8001_exit); 597 + module_serio_driver(w8001_drv);
+13
include/linux/gameport.h
··· 153 153 154 154 void gameport_unregister_driver(struct gameport_driver *drv); 155 155 156 + /** 157 + * module_gameport_driver() - Helper macro for registering a gameport driver 158 + * @__gameport_driver: gameport_driver struct 159 + * 160 + * Helper macro for gameport drivers which do not do anything special in 161 + * module init/exit. This eliminates a lot of boilerplate. Each module may 162 + * only use this macro once, and calling it replaces module_init() and 163 + * module_exit(). 164 + */ 165 + #define module_gameport_driver(__gameport_driver) \ 166 + module_driver(__gameport_driver, gameport_register_driver, \ 167 + gameport_unregister_driver) 168 + 156 169 #endif /* __KERNEL__ */ 157 170 158 171 #define GAMEPORT_MODE_DISABLED 0
+1
include/linux/i2c/adp5588.h
··· 157 157 158 158 struct adp5588_gpio_platform_data { 159 159 int gpio_start; /* GPIO Chip base # */ 160 + const char *const *names; 160 161 unsigned irq_base; /* interrupt base # */ 161 162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 162 163 int (*setup)(struct i2c_client *client,
+24
include/linux/input/lm8333.h
··· 1 + /* 2 + * public include for LM8333 keypad driver - same license as driver 3 + * Copyright (C) 2012 Wolfram Sang, Pengutronix <w.sang@pengutronix.de> 4 + */ 5 + 6 + #ifndef _LM8333_H 7 + #define _LM8333_H 8 + 9 + struct lm8333; 10 + 11 + struct lm8333_platform_data { 12 + /* Keymap data */ 13 + const struct matrix_keymap_data *matrix_data; 14 + /* Active timeout before enter HALT mode in microseconds */ 15 + unsigned active_time; 16 + /* Debounce interval in microseconds */ 17 + unsigned debounce_time; 18 + }; 19 + 20 + extern int lm8333_read8(struct lm8333 *lm8333, u8 cmd); 21 + extern int lm8333_write8(struct lm8333 *lm8333, u8 cmd, u8 val); 22 + extern int lm8333_read_block(struct lm8333 *lm8333, u8 cmd, u8 len, u8 *buf); 23 + 24 + #endif /* _LM8333_H */
+5 -49
include/linux/input/matrix_keypad.h
··· 75 75 bool no_autorepeat; 76 76 }; 77 77 78 - /** 79 - * matrix_keypad_build_keymap - convert platform keymap into matrix keymap 80 - * @keymap_data: keymap supplied by the platform code 81 - * @row_shift: number of bits to shift row value by to advance to the next 82 - * line in the keymap 83 - * @keymap: expanded version of keymap that is suitable for use by 84 - * matrix keyboad driver 85 - * @keybit: pointer to bitmap of keys supported by input device 86 - * 87 - * This function converts platform keymap (encoded with KEY() macro) into 88 - * an array of keycodes that is suitable for using in a standard matrix 89 - * keyboard driver that uses row and col as indices. 90 - */ 91 - static inline void 92 - matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, 93 - unsigned int row_shift, 94 - unsigned short *keymap, unsigned long *keybit) 95 - { 96 - int i; 97 - 98 - for (i = 0; i < keymap_data->keymap_size; i++) { 99 - unsigned int key = keymap_data->keymap[i]; 100 - unsigned int row = KEY_ROW(key); 101 - unsigned int col = KEY_COL(key); 102 - unsigned short code = KEY_VAL(key); 103 - 104 - keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code; 105 - __set_bit(code, keybit); 106 - } 107 - __clear_bit(KEY_RESERVED, keybit); 108 - } 109 - 110 - #ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP 111 - struct matrix_keymap_data * 112 - matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname); 113 - 114 - void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd); 115 - #else 116 - static inline struct matrix_keymap_data * 117 - matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname) 118 - { 119 - return NULL; 120 - } 121 - 122 - static inline void 123 - matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd) 124 - { 125 - } 126 - #endif 78 + int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, 79 + const char *keymap_name, 80 + unsigned int rows, unsigned int cols, 81 + unsigned short *keymap, 82 + struct input_dev *input_dev); 127 83 128 84 #endif /* _MATRIX_KEYPAD_H */
+12
include/linux/input/navpoint.h
··· 1 + /* 2 + * Copyright (C) 2012 Paul Parsons <lost.distance@yahoo.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + struct navpoint_platform_data { 10 + int port; /* PXA SSP port for pxa_ssp_request() */ 11 + int gpio; /* GPIO for power on/off */ 12 + };
+13
include/linux/serio.h
··· 96 96 97 97 void serio_unregister_driver(struct serio_driver *drv); 98 98 99 + /** 100 + * module_serio_driver() - Helper macro for registering a serio driver 101 + * @__serio_driver: serio_driver struct 102 + * 103 + * Helper macro for serio drivers which do not do anything special in 104 + * module init/exit. This eliminates a lot of boilerplate. Each module 105 + * may only use this macro once, and calling it replaces module_init() 106 + * and module_exit(). 107 + */ 108 + #define module_serio_driver(__serio_driver) \ 109 + module_driver(__serio_driver, serio_register_driver, \ 110 + serio_unregister_driver) 111 + 99 112 static inline int serio_write(struct serio *serio, unsigned char data) 100 113 { 101 114 if (serio->write)