aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-10-15 23:29:12 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-10-15 23:29:12 -0400
commit4c0e799a9a6dc64426ddb6c03aea1a154357658f (patch)
tree2d9aa9493d80fceb178a63bf15bb3d9edfc5fbae /drivers/input/keyboard
parent3fa8749e584b55f1180411ab1b51117190bac1e5 (diff)
parentb8d055a878ee0f997ded40649701089d2486f850 (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r--drivers/input/keyboard/atkbd.c30
-rw-r--r--drivers/input/keyboard/bf54x-keys.c13
-rw-r--r--drivers/input/keyboard/gpio_keys.c42
3 files changed, 38 insertions, 47 deletions
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index b1ce10f50bcf..22016ca15351 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -834,10 +834,10 @@ static void atkbd_disconnect(struct serio *serio)
834} 834}
835 835
836/* 836/*
837 * Most special keys (Fn+F?) on Dell Latitudes do not generate release 837 * Most special keys (Fn+F?) on Dell laptops do not generate release
838 * events so we have to do it ourselves. 838 * events so we have to do it ourselves.
839 */ 839 */
840static void atkbd_latitude_keymap_fixup(struct atkbd *atkbd) 840static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
841{ 841{
842 const unsigned int forced_release_keys[] = { 842 const unsigned int forced_release_keys[] = {
843 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, 843 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93,
@@ -1207,15 +1207,13 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
1207{ 1207{
1208 struct input_dev *old_dev, *new_dev; 1208 struct input_dev *old_dev, *new_dev;
1209 unsigned long value; 1209 unsigned long value;
1210 char *rest;
1211 int err; 1210 int err;
1212 unsigned char old_extra, old_set; 1211 unsigned char old_extra, old_set;
1213 1212
1214 if (!atkbd->write) 1213 if (!atkbd->write)
1215 return -EIO; 1214 return -EIO;
1216 1215
1217 value = simple_strtoul(buf, &rest, 10); 1216 if (strict_strtoul(buf, 10, &value) || value > 1)
1218 if (*rest || value > 1)
1219 return -EINVAL; 1217 return -EINVAL;
1220 1218
1221 if (atkbd->extra != value) { 1219 if (atkbd->extra != value) {
@@ -1264,12 +1262,10 @@ static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t cou
1264{ 1262{
1265 struct input_dev *old_dev, *new_dev; 1263 struct input_dev *old_dev, *new_dev;
1266 unsigned long value; 1264 unsigned long value;
1267 char *rest;
1268 int err; 1265 int err;
1269 unsigned char old_scroll; 1266 unsigned char old_scroll;
1270 1267
1271 value = simple_strtoul(buf, &rest, 10); 1268 if (strict_strtoul(buf, 10, &value) || value > 1)
1272 if (*rest || value > 1)
1273 return -EINVAL; 1269 return -EINVAL;
1274 1270
1275 if (atkbd->scroll != value) { 1271 if (atkbd->scroll != value) {
@@ -1310,15 +1306,13 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
1310{ 1306{
1311 struct input_dev *old_dev, *new_dev; 1307 struct input_dev *old_dev, *new_dev;
1312 unsigned long value; 1308 unsigned long value;
1313 char *rest;
1314 int err; 1309 int err;
1315 unsigned char old_set, old_extra; 1310 unsigned char old_set, old_extra;
1316 1311
1317 if (!atkbd->write) 1312 if (!atkbd->write)
1318 return -EIO; 1313 return -EIO;
1319 1314
1320 value = simple_strtoul(buf, &rest, 10); 1315 if (strict_strtoul(buf, 10, &value) || (value != 2 && value != 3))
1321 if (*rest || (value != 2 && value != 3))
1322 return -EINVAL; 1316 return -EINVAL;
1323 1317
1324 if (atkbd->set != value) { 1318 if (atkbd->set != value) {
@@ -1361,15 +1355,13 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t
1361{ 1355{
1362 struct input_dev *old_dev, *new_dev; 1356 struct input_dev *old_dev, *new_dev;
1363 unsigned long value; 1357 unsigned long value;
1364 char *rest;
1365 int err; 1358 int err;
1366 unsigned char old_softrepeat, old_softraw; 1359 unsigned char old_softrepeat, old_softraw;
1367 1360
1368 if (!atkbd->write) 1361 if (!atkbd->write)
1369 return -EIO; 1362 return -EIO;
1370 1363
1371 value = simple_strtoul(buf, &rest, 10); 1364 if (strict_strtoul(buf, 10, &value) || value > 1)
1372 if (*rest || value > 1)
1373 return -EINVAL; 1365 return -EINVAL;
1374 1366
1375 if (atkbd->softrepeat != value) { 1367 if (atkbd->softrepeat != value) {
@@ -1413,12 +1405,10 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co
1413{ 1405{
1414 struct input_dev *old_dev, *new_dev; 1406 struct input_dev *old_dev, *new_dev;
1415 unsigned long value; 1407 unsigned long value;
1416 char *rest;
1417 int err; 1408 int err;
1418 unsigned char old_softraw; 1409 unsigned char old_softraw;
1419 1410
1420 value = simple_strtoul(buf, &rest, 10); 1411 if (strict_strtoul(buf, 10, &value) || value > 1)
1421 if (*rest || value > 1)
1422 return -EINVAL; 1412 return -EINVAL;
1423 1413
1424 if (atkbd->softraw != value) { 1414 if (atkbd->softraw != value) {
@@ -1461,13 +1451,13 @@ static int __init atkbd_setup_fixup(const struct dmi_system_id *id)
1461 1451
1462static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { 1452static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1463 { 1453 {
1464 .ident = "Dell Latitude series", 1454 .ident = "Dell Laptop",
1465 .matches = { 1455 .matches = {
1466 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1456 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1467 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"), 1457 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
1468 }, 1458 },
1469 .callback = atkbd_setup_fixup, 1459 .callback = atkbd_setup_fixup,
1470 .driver_data = atkbd_latitude_keymap_fixup, 1460 .driver_data = atkbd_dell_laptop_keymap_fixup,
1471 }, 1461 },
1472 { 1462 {
1473 .ident = "HP 2133", 1463 .ident = "HP 2133",
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index e348cfccc17a..19284016e0f4 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * 9 *
10 * Modified: 10 * Modified:
11 * Copyright 2007 Analog Devices Inc. 11 * Copyright 2007-2008 Analog Devices Inc.
12 * 12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * 14 *
@@ -81,6 +81,9 @@ struct bf54x_kpad {
81 unsigned short *keycode; 81 unsigned short *keycode;
82 struct timer_list timer; 82 struct timer_list timer;
83 unsigned int keyup_test_jiffies; 83 unsigned int keyup_test_jiffies;
84 unsigned short kpad_msel;
85 unsigned short kpad_prescale;
86 unsigned short kpad_ctl;
84}; 87};
85 88
86static inline int bfin_kpad_find_key(struct bf54x_kpad *bf54x_kpad, 89static inline int bfin_kpad_find_key(struct bf54x_kpad *bf54x_kpad,
@@ -360,6 +363,10 @@ static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state)
360{ 363{
361 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); 364 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
362 365
366 bf54x_kpad->kpad_msel = bfin_read_KPAD_MSEL();
367 bf54x_kpad->kpad_prescale = bfin_read_KPAD_PRESCALE();
368 bf54x_kpad->kpad_ctl = bfin_read_KPAD_CTL();
369
363 if (device_may_wakeup(&pdev->dev)) 370 if (device_may_wakeup(&pdev->dev))
364 enable_irq_wake(bf54x_kpad->irq); 371 enable_irq_wake(bf54x_kpad->irq);
365 372
@@ -370,6 +377,10 @@ static int bfin_kpad_resume(struct platform_device *pdev)
370{ 377{
371 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); 378 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
372 379
380 bfin_write_KPAD_MSEL(bf54x_kpad->kpad_msel);
381 bfin_write_KPAD_PRESCALE(bf54x_kpad->kpad_prescale);
382 bfin_write_KPAD_CTL(bf54x_kpad->kpad_ctl);
383
373 if (device_may_wakeup(&pdev->dev)) 384 if (device_may_wakeup(&pdev->dev))
374 disable_irq_wake(bf54x_kpad->irq); 385 disable_irq_wake(bf54x_kpad->irq);
375 386
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ec96b369dd7a..05f3f43582c2 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -36,9 +36,10 @@ struct gpio_keys_drvdata {
36 struct gpio_button_data data[0]; 36 struct gpio_button_data data[0];
37}; 37};
38 38
39static void gpio_keys_report_event(struct gpio_keys_button *button, 39static void gpio_keys_report_event(struct gpio_button_data *bdata)
40 struct input_dev *input)
41{ 40{
41 struct gpio_keys_button *button = bdata->button;
42 struct input_dev *input = bdata->input;
42 unsigned int type = button->type ?: EV_KEY; 43 unsigned int type = button->type ?: EV_KEY;
43 int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; 44 int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;
44 45
@@ -50,34 +51,23 @@ static void gpio_check_button(unsigned long _data)
50{ 51{
51 struct gpio_button_data *data = (struct gpio_button_data *)_data; 52 struct gpio_button_data *data = (struct gpio_button_data *)_data;
52 53
53 gpio_keys_report_event(data->button, data->input); 54 gpio_keys_report_event(data);
54} 55}
55 56
56static irqreturn_t gpio_keys_isr(int irq, void *dev_id) 57static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
57{ 58{
58 struct platform_device *pdev = dev_id; 59 struct gpio_button_data *bdata = dev_id;
59 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; 60 struct gpio_keys_button *button = bdata->button;
60 struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
61 int i;
62 61
63 for (i = 0; i < pdata->nbuttons; i++) { 62 BUG_ON(irq != gpio_to_irq(button->gpio));
64 struct gpio_keys_button *button = &pdata->buttons[i];
65 63
66 if (irq == gpio_to_irq(button->gpio)) { 64 if (button->debounce_interval)
67 struct gpio_button_data *bdata = &ddata->data[i]; 65 mod_timer(&bdata->timer,
68 66 jiffies + msecs_to_jiffies(button->debounce_interval));
69 if (button->debounce_interval) 67 else
70 mod_timer(&bdata->timer, 68 gpio_keys_report_event(bdata);
71 jiffies +
72 msecs_to_jiffies(button->debounce_interval));
73 else
74 gpio_keys_report_event(button, bdata->input);
75
76 return IRQ_HANDLED;
77 }
78 }
79 69
80 return IRQ_NONE; 70 return IRQ_HANDLED;
81} 71}
82 72
83static int __devinit gpio_keys_probe(struct platform_device *pdev) 73static int __devinit gpio_keys_probe(struct platform_device *pdev)
@@ -151,7 +141,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
151 IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_RISING | 141 IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_RISING |
152 IRQF_TRIGGER_FALLING, 142 IRQF_TRIGGER_FALLING,
153 button->desc ? button->desc : "gpio_keys", 143 button->desc ? button->desc : "gpio_keys",
154 pdev); 144 bdata);
155 if (error) { 145 if (error) {
156 pr_err("gpio-keys: Unable to claim irq %d; error %d\n", 146 pr_err("gpio-keys: Unable to claim irq %d; error %d\n",
157 irq, error); 147 irq, error);
@@ -178,7 +168,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
178 168
179 fail2: 169 fail2:
180 while (--i >= 0) { 170 while (--i >= 0) {
181 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); 171 free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]);
182 if (pdata->buttons[i].debounce_interval) 172 if (pdata->buttons[i].debounce_interval)
183 del_timer_sync(&ddata->data[i].timer); 173 del_timer_sync(&ddata->data[i].timer);
184 gpio_free(pdata->buttons[i].gpio); 174 gpio_free(pdata->buttons[i].gpio);
@@ -203,7 +193,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
203 193
204 for (i = 0; i < pdata->nbuttons; i++) { 194 for (i = 0; i < pdata->nbuttons; i++) {
205 int irq = gpio_to_irq(pdata->buttons[i].gpio); 195 int irq = gpio_to_irq(pdata->buttons[i].gpio);
206 free_irq(irq, pdev); 196 free_irq(irq, &ddata->data[i]);
207 if (pdata->buttons[i].debounce_interval) 197 if (pdata->buttons[i].debounce_interval)
208 del_timer_sync(&ddata->data[i].timer); 198 del_timer_sync(&ddata->data[i].timer);
209 gpio_free(pdata->buttons[i].gpio); 199 gpio_free(pdata->buttons[i].gpio);