aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 10:59:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 10:59:01 -0400
commit3a99c6319064af3f2e18eb929f638d555dbf7a62 (patch)
treee611927f41142123dc8efed7e07a3a91151edb01 /drivers/input/misc
parent1dfd166e93f98892aa4427069a23ed73259983c8 (diff)
parent49327ad2bbbaf1945d5ba431522201574219d150 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (75 commits) Input: wacom - specify Cinitq supported tools Input: ab8500-ponkey - fix IRQ freeing in error path Input: adp5588-keys - use more obvious i2c_device_id name string Input: ad7877 - switch to using threaded IRQ Input: ad7877 - use attribute group to control visibility of attributes Input: serio - add support for PS2Mult multiplexer protocol Input: wacom - properly enable runtime PM Input: ad7877 - filter events where pressure is beyond the maximum Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting Input: ad7877 - implement specified chip select behavior Input: hp680_ts_input - use cancel_delayed_work_sync() Input: mousedev - correct lockdep annotation Input: ads7846 - switch to using threaded IRQ Input: serio - support multiple child devices per single parent Input: synaptics - simplify pass-through port handling Input: add ROHM BU21013 touch panel controller support Input: omap4-keypad - wake-up on events & long presses Input: omap4-keypad - fix interrupt line configuration Input: omap4-keypad - SYSCONFIG register configuration Input: omap4-keypad - use platform device helpers ...
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/Kconfig10
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/ab8500-ponkey.c157
-rw-r--r--drivers/input/misc/ati_remote2.c93
-rw-r--r--drivers/input/misc/powermate.c2
5 files changed, 234 insertions, 29 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index b49e23379723..b99b8cbde02f 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -22,6 +22,16 @@ config INPUT_88PM860X_ONKEY
22 To compile this driver as a module, choose M here: the module 22 To compile this driver as a module, choose M here: the module
23 will be called 88pm860x_onkey. 23 will be called 88pm860x_onkey.
24 24
25config INPUT_AB8500_PONKEY
26 tristate "AB8500 Pon (PowerOn) Key"
27 depends on AB8500_CORE
28 help
29 Say Y here to use the PowerOn Key for ST-Ericsson's AB8500
30 Mix-Sig PMIC.
31
32 To compile this driver as a module, choose M here: the module
33 will be called ab8500-ponkey.
34
25config INPUT_AD714X 35config INPUT_AD714X
26 tristate "Analog Devices AD714x Capacitance Touch Sensor" 36 tristate "Analog Devices AD714x Capacitance Touch Sensor"
27 help 37 help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 19ccca78fa76..1fe1f6c8b737 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -5,6 +5,7 @@
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_INPUT_88PM860X_ONKEY) += 88pm860x_onkey.o 7obj-$(CONFIG_INPUT_88PM860X_ONKEY) += 88pm860x_onkey.o
8obj-$(CONFIG_INPUT_AB8500_PONKEY) += ab8500-ponkey.o
8obj-$(CONFIG_INPUT_AD714X) += ad714x.o 9obj-$(CONFIG_INPUT_AD714X) += ad714x.o
9obj-$(CONFIG_INPUT_AD714X_I2C) += ad714x-i2c.o 10obj-$(CONFIG_INPUT_AD714X_I2C) += ad714x-i2c.o
10obj-$(CONFIG_INPUT_AD714X_SPI) += ad714x-spi.o 11obj-$(CONFIG_INPUT_AD714X_SPI) += ad714x-spi.o
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c
new file mode 100644
index 000000000000..3d3288a78fdc
--- /dev/null
+++ b/drivers/input/misc/ab8500-ponkey.c
@@ -0,0 +1,157 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 * Author: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
6 *
7 * AB8500 Power-On Key handler
8 */
9
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/platform_device.h>
13#include <linux/input.h>
14#include <linux/interrupt.h>
15#include <linux/mfd/ab8500.h>
16#include <linux/slab.h>
17
18/**
19 * struct ab8500_ponkey - ab8500 ponkey information
20 * @input_dev: pointer to input device
21 * @ab8500: ab8500 parent
22 * @irq_dbf: irq number for falling transition
23 * @irq_dbr: irq number for rising transition
24 */
25struct ab8500_ponkey {
26 struct input_dev *idev;
27 struct ab8500 *ab8500;
28 int irq_dbf;
29 int irq_dbr;
30};
31
32/* AB8500 gives us an interrupt when ONKEY is held */
33static irqreturn_t ab8500_ponkey_handler(int irq, void *data)
34{
35 struct ab8500_ponkey *ponkey = data;
36
37 if (irq == ponkey->irq_dbf)
38 input_report_key(ponkey->idev, KEY_POWER, true);
39 else if (irq == ponkey->irq_dbr)
40 input_report_key(ponkey->idev, KEY_POWER, false);
41
42 input_sync(ponkey->idev);
43
44 return IRQ_HANDLED;
45}
46
47static int __devinit ab8500_ponkey_probe(struct platform_device *pdev)
48{
49 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
50 struct ab8500_ponkey *ponkey;
51 struct input_dev *input;
52 int irq_dbf, irq_dbr;
53 int error;
54
55 irq_dbf = platform_get_irq_byname(pdev, "ONKEY_DBF");
56 if (irq_dbf < 0) {
57 dev_err(&pdev->dev, "No IRQ for ONKEY_DBF, error=%d\n", irq_dbf);
58 return irq_dbf;
59 }
60
61 irq_dbr = platform_get_irq_byname(pdev, "ONKEY_DBR");
62 if (irq_dbr < 0) {
63 dev_err(&pdev->dev, "No IRQ for ONKEY_DBR, error=%d\n", irq_dbr);
64 return irq_dbr;
65 }
66
67 ponkey = kzalloc(sizeof(struct ab8500_ponkey), GFP_KERNEL);
68 input = input_allocate_device();
69 if (!ponkey || !input) {
70 error = -ENOMEM;
71 goto err_free_mem;
72 }
73
74 ponkey->idev = input;
75 ponkey->ab8500 = ab8500;
76 ponkey->irq_dbf = irq_dbf;
77 ponkey->irq_dbr = irq_dbr;
78
79 input->name = "AB8500 POn(PowerOn) Key";
80 input->dev.parent = &pdev->dev;
81
82 input_set_capability(input, EV_KEY, KEY_POWER);
83
84 error = request_any_context_irq(ponkey->irq_dbf, ab8500_ponkey_handler,
85 0, "ab8500-ponkey-dbf", ponkey);
86 if (error < 0) {
87 dev_err(ab8500->dev, "Failed to request dbf IRQ#%d: %d\n",
88 ponkey->irq_dbf, error);
89 goto err_free_mem;
90 }
91
92 error = request_any_context_irq(ponkey->irq_dbr, ab8500_ponkey_handler,
93 0, "ab8500-ponkey-dbr", ponkey);
94 if (error < 0) {
95 dev_err(ab8500->dev, "Failed to request dbr IRQ#%d: %d\n",
96 ponkey->irq_dbr, error);
97 goto err_free_dbf_irq;
98 }
99
100 error = input_register_device(ponkey->idev);
101 if (error) {
102 dev_err(ab8500->dev, "Can't register input device: %d\n", error);
103 goto err_free_dbr_irq;
104 }
105
106 platform_set_drvdata(pdev, ponkey);
107 return 0;
108
109err_free_dbr_irq:
110 free_irq(ponkey->irq_dbr, ponkey);
111err_free_dbf_irq:
112 free_irq(ponkey->irq_dbf, ponkey);
113err_free_mem:
114 input_free_device(input);
115 kfree(ponkey);
116
117 return error;
118}
119
120static int __devexit ab8500_ponkey_remove(struct platform_device *pdev)
121{
122 struct ab8500_ponkey *ponkey = platform_get_drvdata(pdev);
123
124 free_irq(ponkey->irq_dbf, ponkey);
125 free_irq(ponkey->irq_dbr, ponkey);
126 input_unregister_device(ponkey->idev);
127 kfree(ponkey);
128
129 platform_set_drvdata(pdev, NULL);
130
131 return 0;
132}
133
134static struct platform_driver ab8500_ponkey_driver = {
135 .driver = {
136 .name = "ab8500-poweron-key",
137 .owner = THIS_MODULE,
138 },
139 .probe = ab8500_ponkey_probe,
140 .remove = __devexit_p(ab8500_ponkey_remove),
141};
142
143static int __init ab8500_ponkey_init(void)
144{
145 return platform_driver_register(&ab8500_ponkey_driver);
146}
147module_init(ab8500_ponkey_init);
148
149static void __exit ab8500_ponkey_exit(void)
150{
151 platform_driver_unregister(&ab8500_ponkey_driver);
152}
153module_exit(ab8500_ponkey_exit);
154
155MODULE_LICENSE("GPL v2");
156MODULE_AUTHOR("Sundar Iyer <sundar.iyer@stericsson.com>");
157MODULE_DESCRIPTION("ST-Ericsson AB8500 Power-ON(Pon) Key driver");
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 23257652b8e8..0b0e9be63542 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -483,51 +483,88 @@ static void ati_remote2_complete_key(struct urb *urb)
483} 483}
484 484
485static int ati_remote2_getkeycode(struct input_dev *idev, 485static int ati_remote2_getkeycode(struct input_dev *idev,
486 unsigned int scancode, unsigned int *keycode) 486 struct input_keymap_entry *ke)
487{ 487{
488 struct ati_remote2 *ar2 = input_get_drvdata(idev); 488 struct ati_remote2 *ar2 = input_get_drvdata(idev);
489 unsigned int mode; 489 unsigned int mode;
490 int index; 490 int offset;
491 unsigned int index;
492 unsigned int scancode;
493
494 if (ke->flags & INPUT_KEYMAP_BY_INDEX) {
495 index = ke->index;
496 if (index >= ATI_REMOTE2_MODES *
497 ARRAY_SIZE(ati_remote2_key_table))
498 return -EINVAL;
499
500 mode = ke->index / ARRAY_SIZE(ati_remote2_key_table);
501 offset = ke->index % ARRAY_SIZE(ati_remote2_key_table);
502 scancode = (mode << 8) + ati_remote2_key_table[offset].hw_code;
503 } else {
504 if (input_scancode_to_scalar(ke, &scancode))
505 return -EINVAL;
506
507 mode = scancode >> 8;
508 if (mode > ATI_REMOTE2_PC)
509 return -EINVAL;
510
511 offset = ati_remote2_lookup(scancode & 0xff);
512 if (offset < 0)
513 return -EINVAL;
514
515 index = mode * ARRAY_SIZE(ati_remote2_key_table) + offset;
516 }
491 517
492 mode = scancode >> 8; 518 ke->keycode = ar2->keycode[mode][offset];
493 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) 519 ke->len = sizeof(scancode);
494 return -EINVAL; 520 memcpy(&ke->scancode, &scancode, sizeof(scancode));
521 ke->index = index;
495 522
496 index = ati_remote2_lookup(scancode & 0xFF);
497 if (index < 0)
498 return -EINVAL;
499
500 *keycode = ar2->keycode[mode][index];
501 return 0; 523 return 0;
502} 524}
503 525
504static int ati_remote2_setkeycode(struct input_dev *idev, 526static int ati_remote2_setkeycode(struct input_dev *idev,
505 unsigned int scancode, unsigned int keycode) 527 const struct input_keymap_entry *ke,
528 unsigned int *old_keycode)
506{ 529{
507 struct ati_remote2 *ar2 = input_get_drvdata(idev); 530 struct ati_remote2 *ar2 = input_get_drvdata(idev);
508 unsigned int mode, old_keycode; 531 unsigned int mode;
509 int index; 532 int offset;
510 533 unsigned int index;
511 mode = scancode >> 8; 534 unsigned int scancode;
512 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) 535
513 return -EINVAL; 536 if (ke->flags & INPUT_KEYMAP_BY_INDEX) {
514 537 if (ke->index >= ATI_REMOTE2_MODES *
515 index = ati_remote2_lookup(scancode & 0xFF); 538 ARRAY_SIZE(ati_remote2_key_table))
516 if (index < 0) 539 return -EINVAL;
517 return -EINVAL; 540
541 mode = ke->index / ARRAY_SIZE(ati_remote2_key_table);
542 offset = ke->index % ARRAY_SIZE(ati_remote2_key_table);
543 } else {
544 if (input_scancode_to_scalar(ke, &scancode))
545 return -EINVAL;
546
547 mode = scancode >> 8;
548 if (mode > ATI_REMOTE2_PC)
549 return -EINVAL;
550
551 offset = ati_remote2_lookup(scancode & 0xff);
552 if (offset < 0)
553 return -EINVAL;
554 }
518 555
519 old_keycode = ar2->keycode[mode][index]; 556 *old_keycode = ar2->keycode[mode][offset];
520 ar2->keycode[mode][index] = keycode; 557 ar2->keycode[mode][offset] = ke->keycode;
521 __set_bit(keycode, idev->keybit); 558 __set_bit(ke->keycode, idev->keybit);
522 559
523 for (mode = 0; mode < ATI_REMOTE2_MODES; mode++) { 560 for (mode = 0; mode < ATI_REMOTE2_MODES; mode++) {
524 for (index = 0; index < ARRAY_SIZE(ati_remote2_key_table); index++) { 561 for (index = 0; index < ARRAY_SIZE(ati_remote2_key_table); index++) {
525 if (ar2->keycode[mode][index] == old_keycode) 562 if (ar2->keycode[mode][index] == *old_keycode)
526 return 0; 563 return 0;
527 } 564 }
528 } 565 }
529 566
530 __clear_bit(old_keycode, idev->keybit); 567 __clear_bit(*old_keycode, idev->keybit);
531 568
532 return 0; 569 return 0;
533} 570}
@@ -575,8 +612,8 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
575 idev->open = ati_remote2_open; 612 idev->open = ati_remote2_open;
576 idev->close = ati_remote2_close; 613 idev->close = ati_remote2_close;
577 614
578 idev->getkeycode = ati_remote2_getkeycode; 615 idev->getkeycode_new = ati_remote2_getkeycode;
579 idev->setkeycode = ati_remote2_setkeycode; 616 idev->setkeycode_new = ati_remote2_setkeycode;
580 617
581 idev->name = ar2->name; 618 idev->name = ar2->name;
582 idev->phys = ar2->phys; 619 idev->phys = ar2->phys;
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index bf170f6b4422..f45947190e4f 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -280,7 +280,7 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
280 280
281 pm->configcr = kmalloc(sizeof(*(pm->configcr)), GFP_KERNEL); 281 pm->configcr = kmalloc(sizeof(*(pm->configcr)), GFP_KERNEL);
282 if (!pm->configcr) 282 if (!pm->configcr)
283 return -1; 283 return -ENOMEM;
284 284
285 return 0; 285 return 0;
286} 286}