aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-12-30 04:10:06 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-12-30 04:10:06 -0500
commit1dd3294677d5484e4813c6c454ba7f192a3ef61d (patch)
treee29306ffe8b709a7499a25ecbe3234f833fc7002 /drivers/input/keyboard
parent4a6908a3a050aacc9c3a2f36b276b46c0629ad91 (diff)
parente941da3110422c4e57c3d05759fb9475b28f45f6 (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r--drivers/input/keyboard/Kconfig9
-rw-r--r--drivers/input/keyboard/Makefile1
-rw-r--r--drivers/input/keyboard/atkbd.c60
-rw-r--r--drivers/input/keyboard/gpio_keys.c4
-rw-r--r--drivers/input/keyboard/hil_kbd.c1
-rw-r--r--drivers/input/keyboard/omap-keypad.c6
-rw-r--r--drivers/input/keyboard/pxa930_rotary.c212
7 files changed, 288 insertions, 5 deletions
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index efd70a974591..35561689ff38 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -268,6 +268,15 @@ config KEYBOARD_PXA27x
268 To compile this driver as a module, choose M here: the 268 To compile this driver as a module, choose M here: the
269 module will be called pxa27x_keypad. 269 module will be called pxa27x_keypad.
270 270
271config KEYBOARD_PXA930_ROTARY
272 tristate "PXA930/PXA935 Enhanced Rotary Controller Support"
273 depends on CPU_PXA930 || CPU_PXA935
274 help
275 Enable support for PXA930/PXA935 Enhanced Rotary Controller.
276
277 To compile this driver as a module, choose M here: the
278 module will be called pxa930_rotary.
279
271config KEYBOARD_AAED2000 280config KEYBOARD_AAED2000
272 tristate "AAED-2000 keyboard" 281 tristate "AAED-2000 keyboard"
273 depends on MACH_AAED2000 282 depends on MACH_AAED2000
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 0edc8f285d1c..36351e1190f9 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
20obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o 20obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
21obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o 21obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
22obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o 22obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o
23obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o
23obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o 24obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
24obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o 25obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
25obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o 26obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 379b7ff354ec..f6e9f39a527b 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -884,6 +884,39 @@ static void atkbd_inventec_keymap_fixup(struct atkbd *atkbd)
884} 884}
885 885
886/* 886/*
887 * Perform fixup for HP Pavilion ZV6100 laptop that doesn't generate release
888 * for its volume buttons
889 */
890static void atkbd_hp_zv6100_keymap_fixup(struct atkbd *atkbd)
891{
892 const unsigned int forced_release_keys[] = {
893 0xae, 0xb0,
894 };
895 int i;
896
897 if (atkbd->set == 2)
898 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++)
899 __set_bit(forced_release_keys[i],
900 atkbd->force_release_mask);
901}
902
903/*
904 * Samsung NC10 with Fn+F? key release not working
905 */
906static void atkbd_samsung_keymap_fixup(struct atkbd *atkbd)
907{
908 const unsigned int forced_release_keys[] = {
909 0x82, 0x83, 0x84, 0x86, 0x88, 0x89, 0xb3, 0xf7, 0xf9,
910 };
911 int i;
912
913 if (atkbd->set == 2)
914 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++)
915 __set_bit(forced_release_keys[i],
916 atkbd->force_release_mask);
917}
918
919/*
887 * atkbd_set_keycode_table() initializes keyboard's keycode table 920 * atkbd_set_keycode_table() initializes keyboard's keycode table
888 * according to the selected scancode set 921 * according to the selected scancode set
889 */ 922 */
@@ -1476,6 +1509,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1476 .driver_data = atkbd_dell_laptop_keymap_fixup, 1509 .driver_data = atkbd_dell_laptop_keymap_fixup,
1477 }, 1510 },
1478 { 1511 {
1512 .ident = "Dell Laptop",
1513 .matches = {
1514 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
1515 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
1516 },
1517 .callback = atkbd_setup_fixup,
1518 .driver_data = atkbd_dell_laptop_keymap_fixup,
1519 },
1520 {
1479 .ident = "HP 2133", 1521 .ident = "HP 2133",
1480 .matches = { 1522 .matches = {
1481 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1523 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
@@ -1485,6 +1527,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1485 .driver_data = atkbd_hp_keymap_fixup, 1527 .driver_data = atkbd_hp_keymap_fixup,
1486 }, 1528 },
1487 { 1529 {
1530 .ident = "HP Pavilion ZV6100",
1531 .matches = {
1532 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1533 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"),
1534 },
1535 .callback = atkbd_setup_fixup,
1536 .driver_data = atkbd_hp_zv6100_keymap_fixup,
1537 },
1538 {
1488 .ident = "Inventec Symphony", 1539 .ident = "Inventec Symphony",
1489 .matches = { 1540 .matches = {
1490 DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"), 1541 DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"),
@@ -1493,6 +1544,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1493 .callback = atkbd_setup_fixup, 1544 .callback = atkbd_setup_fixup,
1494 .driver_data = atkbd_inventec_keymap_fixup, 1545 .driver_data = atkbd_inventec_keymap_fixup,
1495 }, 1546 },
1547 {
1548 .ident = "Samsung NC10",
1549 .matches = {
1550 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1551 DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
1552 },
1553 .callback = atkbd_setup_fixup,
1554 .driver_data = atkbd_samsung_keymap_fixup,
1555 },
1496 { } 1556 { }
1497}; 1557};
1498 1558
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 05f3f43582c2..ad67d763fdbd 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -98,6 +98,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
98 input->id.product = 0x0001; 98 input->id.product = 0x0001;
99 input->id.version = 0x0100; 99 input->id.version = 0x0100;
100 100
101 /* Enable auto repeat feature of Linux input subsystem */
102 if (pdata->rep)
103 __set_bit(EV_REP, input->evbit);
104
101 ddata->input = input; 105 ddata->input = input;
102 106
103 for (i = 0; i < pdata->nbuttons; i++) { 107 for (i = 0; i < pdata->nbuttons; i++) {
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index 71c1971abf80..6f356705ee3b 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -47,6 +47,7 @@
47MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); 47MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>");
48MODULE_DESCRIPTION(HIL_GENERIC_NAME " driver"); 48MODULE_DESCRIPTION(HIL_GENERIC_NAME " driver");
49MODULE_LICENSE("Dual BSD/GPL"); 49MODULE_LICENSE("Dual BSD/GPL");
50MODULE_ALIAS("serio:ty03pr25id00ex*");
50 51
51#define HIL_KBD_MAX_LENGTH 16 52#define HIL_KBD_MAX_LENGTH 16
52 53
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 69e674ecf19a..ec0ebee46069 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -122,14 +122,10 @@ static void omap_kp_scan_keypad(struct omap_kp *omap_kp, unsigned char *state)
122 122
123 /* read the keypad status */ 123 /* read the keypad status */
124 if (cpu_is_omap24xx()) { 124 if (cpu_is_omap24xx()) {
125 int i;
126 for (i = 0; i < omap_kp->rows; i++)
127 disable_irq(OMAP_GPIO_IRQ(row_gpios[i]));
128
129 /* read the keypad status */ 125 /* read the keypad status */
130 for (col = 0; col < omap_kp->cols; col++) { 126 for (col = 0; col < omap_kp->cols; col++) {
131 set_col_gpio_val(omap_kp, ~(1 << col)); 127 set_col_gpio_val(omap_kp, ~(1 << col));
132 state[col] = ~(get_row_gpio_val(omap_kp)) & 0x3f; 128 state[col] = ~(get_row_gpio_val(omap_kp)) & 0xff;
133 } 129 }
134 set_col_gpio_val(omap_kp, 0); 130 set_col_gpio_val(omap_kp, 0);
135 131
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c
new file mode 100644
index 000000000000..95fbba470e65
--- /dev/null
+++ b/drivers/input/keyboard/pxa930_rotary.c
@@ -0,0 +1,212 @@
1/*
2 * Driver for the enhanced rotary controller on pxa930 and pxa935
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#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/input.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16
17#include <mach/pxa930_rotary.h>
18
19#define SBCR (0x04)
20#define ERCR (0x0c)
21
22#define SBCR_ERSB (1 << 5)
23
24struct pxa930_rotary {
25 struct input_dev *input_dev;
26 void __iomem *mmio_base;
27 int last_ercr;
28
29 struct pxa930_rotary_platform_data *pdata;
30};
31
32static void clear_sbcr(struct pxa930_rotary *r)
33{
34 uint32_t sbcr = __raw_readl(r->mmio_base + SBCR);
35
36 __raw_writel(sbcr | SBCR_ERSB, r->mmio_base + SBCR);
37 __raw_writel(sbcr & ~SBCR_ERSB, r->mmio_base + SBCR);
38}
39
40static irqreturn_t rotary_irq(int irq, void *dev_id)
41{
42 struct pxa930_rotary *r = dev_id;
43 struct pxa930_rotary_platform_data *pdata = r->pdata;
44 int ercr, delta, key;
45
46 ercr = __raw_readl(r->mmio_base + ERCR) & 0xf;
47 clear_sbcr(r);
48
49 delta = ercr - r->last_ercr;
50 if (delta == 0)
51 return IRQ_HANDLED;
52
53 r->last_ercr = ercr;
54
55 if (pdata->up_key && pdata->down_key) {
56 key = (delta > 0) ? pdata->up_key : pdata->down_key;
57 input_report_key(r->input_dev, key, 1);
58 input_sync(r->input_dev);
59 input_report_key(r->input_dev, key, 0);
60 } else
61 input_report_rel(r->input_dev, pdata->rel_code, delta);
62
63 input_sync(r->input_dev);
64
65 return IRQ_HANDLED;
66}
67
68static int pxa930_rotary_open(struct input_dev *dev)
69{
70 struct pxa930_rotary *r = input_get_drvdata(dev);
71
72 clear_sbcr(r);
73
74 return 0;
75}
76
77static void pxa930_rotary_close(struct input_dev *dev)
78{
79 struct pxa930_rotary *r = input_get_drvdata(dev);
80
81 clear_sbcr(r);
82}
83
84static int __devinit pxa930_rotary_probe(struct platform_device *pdev)
85{
86 struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data;
87 struct pxa930_rotary *r;
88 struct input_dev *input_dev;
89 struct resource *res;
90 int irq;
91 int err;
92
93 irq = platform_get_irq(pdev, 0);
94 if (irq < 0) {
95 dev_err(&pdev->dev, "no irq for rotary controller\n");
96 return -ENXIO;
97 }
98
99 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
100 if (!res) {
101 dev_err(&pdev->dev, "no I/O memory defined\n");
102 return -ENXIO;
103 }
104
105 if (!pdata) {
106 dev_err(&pdev->dev, "no platform data defined\n");
107 return -EINVAL;
108 }
109
110 r = kzalloc(sizeof(struct pxa930_rotary), GFP_KERNEL);
111 if (!r)
112 return -ENOMEM;
113
114 r->mmio_base = ioremap_nocache(res->start, resource_size(res));
115 if (r->mmio_base == NULL) {
116 dev_err(&pdev->dev, "failed to remap IO memory\n");
117 err = -ENXIO;
118 goto failed_free;
119 }
120
121 r->pdata = pdata;
122 platform_set_drvdata(pdev, r);
123
124 /* allocate and register the input device */
125 input_dev = input_allocate_device();
126 if (!input_dev) {
127 dev_err(&pdev->dev, "failed to allocate input device\n");
128 err = -ENOMEM;
129 goto failed_free_io;
130 }
131
132 input_dev->name = pdev->name;
133 input_dev->id.bustype = BUS_HOST;
134 input_dev->open = pxa930_rotary_open;
135 input_dev->close = pxa930_rotary_close;
136 input_dev->dev.parent = &pdev->dev;
137
138 if (pdata->up_key && pdata->down_key) {
139 __set_bit(pdata->up_key, input_dev->keybit);
140 __set_bit(pdata->down_key, input_dev->keybit);
141 __set_bit(EV_KEY, input_dev->evbit);
142 } else {
143 __set_bit(pdata->rel_code, input_dev->relbit);
144 __set_bit(EV_REL, input_dev->evbit);
145 }
146
147 r->input_dev = input_dev;
148 input_set_drvdata(input_dev, r);
149
150 err = request_irq(irq, rotary_irq, IRQF_DISABLED,
151 "enhanced rotary", r);
152 if (err) {
153 dev_err(&pdev->dev, "failed to request IRQ\n");
154 goto failed_free_input;
155 }
156
157 err = input_register_device(input_dev);
158 if (err) {
159 dev_err(&pdev->dev, "failed to register input device\n");
160 goto failed_free_irq;
161 }
162
163 return 0;
164
165failed_free_irq:
166 free_irq(irq, r);
167failed_free_input:
168 input_free_device(input_dev);
169failed_free_io:
170 iounmap(r->mmio_base);
171failed_free:
172 kfree(r);
173 return err;
174}
175
176static int __devexit pxa930_rotary_remove(struct platform_device *pdev)
177{
178 struct pxa930_rotary *r = platform_get_drvdata(pdev);
179
180 free_irq(platform_get_irq(pdev, 0), r);
181 input_unregister_device(r->input_dev);
182 iounmap(r->mmio_base);
183 platform_set_drvdata(pdev, NULL);
184 kfree(r);
185
186 return 0;
187}
188
189static struct platform_driver pxa930_rotary_driver = {
190 .driver = {
191 .name = "pxa930-rotary",
192 .owner = THIS_MODULE,
193 },
194 .probe = pxa930_rotary_probe,
195 .remove = __devexit_p(pxa930_rotary_remove),
196};
197
198static int __init pxa930_rotary_init(void)
199{
200 return platform_driver_register(&pxa930_rotary_driver);
201}
202module_init(pxa930_rotary_init);
203
204static void __exit pxa930_rotary_exit(void)
205{
206 platform_driver_unregister(&pxa930_rotary_driver);
207}
208module_exit(pxa930_rotary_exit);
209
210MODULE_LICENSE("GPL");
211MODULE_DESCRIPTION("Driver for PXA93x Enhanced Rotary Controller");
212MODULE_AUTHOR("Yao Yong <yaoyong@marvell.com>");