aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:38:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:38:14 -0400
commitce1d5b23a8d1e19866ab82bdec0dc41fde5273d8 (patch)
tree028c80655ee8853ebf607d435bc3d6ab223aef1f /drivers/input/keyboard
parentad5e1b0f5d913d2c8bddfba81049cc07228da1a6 (diff)
parent308f0a5898033691d050374a949bbfe173987a16 (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: (40 commits) Input: wacom - add support for Cintiq 20WSX Input: ucb1400_ts - IRQ probe fix Input: at32psif - update MODULE_AUTHOR with new email Input: mac_hid - add lockdep annotation to emumousebtn Input: i8042 - fix incorrect usage of strncpy and strncat Input: bf54x-keys - add infrastructure for keypad wakeups Input: add MODULE_ALIAS() to hotpluggable platform modules Input: drivers/char/keyboard.c - use time_after Input: fix ordering in joystick Makefile Input: wm97xx-core - support use as a wakeup source Input: wm97xx-core - use IRQF_SAMPLE_RANDOM Input: wm97xx-core - only schedule interrupt handler if not already scheduled Input: add Zhen Hua driver Input: aiptek - add support for Genius G-PEN 560 tablet Input: wacom - implement suspend and autosuspend Input: xpad - set proper buffer length for outgoing requests Input: omap-keypad - fix build warning Input: gpio_keys - irq handling cleanup Input: add PS/2 serio driver for AVR32 devices Input: put ledstate in the keyboard notifier ...
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r--drivers/input/keyboard/aaed2000_kbd.c4
-rw-r--r--drivers/input/keyboard/bf54x-keys.c37
-rw-r--r--drivers/input/keyboard/corgikbd.c2
-rw-r--r--drivers/input/keyboard/gpio_keys.c5
-rw-r--r--drivers/input/keyboard/jornada680_kbd.c2
-rw-r--r--drivers/input/keyboard/jornada720_kbd.c4
-rw-r--r--drivers/input/keyboard/locomokbd.c73
-rw-r--r--drivers/input/keyboard/omap-keypad.c9
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c4
-rw-r--r--drivers/input/keyboard/spitzkbd.c1
-rw-r--r--drivers/input/keyboard/tosakbd.c23
11 files changed, 130 insertions, 34 deletions
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c
index 72abc196ce66..a293e8b3f508 100644
--- a/drivers/input/keyboard/aaed2000_kbd.c
+++ b/drivers/input/keyboard/aaed2000_kbd.c
@@ -156,11 +156,15 @@ static int __devexit aaedkbd_remove(struct platform_device *pdev)
156 return 0; 156 return 0;
157} 157}
158 158
159/* work with hotplug and coldplug */
160MODULE_ALIAS("platform:aaed2000-keyboard");
161
159static struct platform_driver aaedkbd_driver = { 162static struct platform_driver aaedkbd_driver = {
160 .probe = aaedkbd_probe, 163 .probe = aaedkbd_probe,
161 .remove = __devexit_p(aaedkbd_remove), 164 .remove = __devexit_p(aaedkbd_remove),
162 .driver = { 165 .driver = {
163 .name = "aaed2000-keyboard", 166 .name = "aaed2000-keyboard",
167 .owner = THIS_MODULE,
164 }, 168 },
165}; 169};
166 170
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 05e3494cf8b8..54ed8e2e1c02 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -312,6 +312,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev)
312 312
313 bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN); 313 bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN);
314 314
315 device_init_wakeup(&pdev->dev, 1);
316
315 printk(KERN_ERR DRV_NAME 317 printk(KERN_ERR DRV_NAME
316 ": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq); 318 ": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq);
317 319
@@ -354,12 +356,40 @@ static int __devexit bfin_kpad_remove(struct platform_device *pdev)
354 return 0; 356 return 0;
355} 357}
356 358
359#ifdef CONFIG_PM
360static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state)
361{
362 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
363
364 if (device_may_wakeup(&pdev->dev))
365 enable_irq_wake(bf54x_kpad->irq);
366
367 return 0;
368}
369
370static int bfin_kpad_resume(struct platform_device *pdev)
371{
372 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
373
374 if (device_may_wakeup(&pdev->dev))
375 disable_irq_wake(bf54x_kpad->irq);
376
377 return 0;
378}
379#else
380# define bfin_kpad_suspend NULL
381# define bfin_kpad_resume NULL
382#endif
383
357struct platform_driver bfin_kpad_device_driver = { 384struct platform_driver bfin_kpad_device_driver = {
358 .probe = bfin_kpad_probe,
359 .remove = __devexit_p(bfin_kpad_remove),
360 .driver = { 385 .driver = {
361 .name = DRV_NAME, 386 .name = DRV_NAME,
362 } 387 .owner = THIS_MODULE,
388 },
389 .probe = bfin_kpad_probe,
390 .remove = __devexit_p(bfin_kpad_remove),
391 .suspend = bfin_kpad_suspend,
392 .resume = bfin_kpad_resume,
363}; 393};
364 394
365static int __init bfin_kpad_init(void) 395static int __init bfin_kpad_init(void)
@@ -378,3 +408,4 @@ module_exit(bfin_kpad_exit);
378MODULE_LICENSE("GPL"); 408MODULE_LICENSE("GPL");
379MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 409MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
380MODULE_DESCRIPTION("Keypad driver for BF54x Processors"); 410MODULE_DESCRIPTION("Keypad driver for BF54x Processors");
411MODULE_ALIAS("platform:bf54x-keys");
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index 5d6cc7f1dc94..29fbec6218b9 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -393,6 +393,7 @@ static struct platform_driver corgikbd_driver = {
393 .resume = corgikbd_resume, 393 .resume = corgikbd_resume,
394 .driver = { 394 .driver = {
395 .name = "corgi-keyboard", 395 .name = "corgi-keyboard",
396 .owner = THIS_MODULE,
396 }, 397 },
397}; 398};
398 399
@@ -412,3 +413,4 @@ module_exit(corgikbd_exit);
412MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 413MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
413MODULE_DESCRIPTION("Corgi Keyboard Driver"); 414MODULE_DESCRIPTION("Corgi Keyboard Driver");
414MODULE_LICENSE("GPLv2"); 415MODULE_LICENSE("GPLv2");
416MODULE_ALIAS("platform:corgi-keyboard");
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 6a9ca4bdcb74..bbd00c3fe98c 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -43,10 +43,11 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
43 43
44 input_event(input, type, button->code, !!state); 44 input_event(input, type, button->code, !!state);
45 input_sync(input); 45 input_sync(input);
46 return IRQ_HANDLED;
46 } 47 }
47 } 48 }
48 49
49 return IRQ_HANDLED; 50 return IRQ_NONE;
50} 51}
51 52
52static int __devinit gpio_keys_probe(struct platform_device *pdev) 53static int __devinit gpio_keys_probe(struct platform_device *pdev)
@@ -213,6 +214,7 @@ struct platform_driver gpio_keys_device_driver = {
213 .resume = gpio_keys_resume, 214 .resume = gpio_keys_resume,
214 .driver = { 215 .driver = {
215 .name = "gpio-keys", 216 .name = "gpio-keys",
217 .owner = THIS_MODULE,
216 } 218 }
217}; 219};
218 220
@@ -232,3 +234,4 @@ module_exit(gpio_keys_exit);
232MODULE_LICENSE("GPL"); 234MODULE_LICENSE("GPL");
233MODULE_AUTHOR("Phil Blundell <pb@handhelds.org>"); 235MODULE_AUTHOR("Phil Blundell <pb@handhelds.org>");
234MODULE_DESCRIPTION("Keyboard driver for CPU GPIOs"); 236MODULE_DESCRIPTION("Keyboard driver for CPU GPIOs");
237MODULE_ALIAS("platform:gpio-keys");
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index a23633a2e1b4..9387da343f97 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -254,6 +254,7 @@ static int __devexit jornada680kbd_remove(struct platform_device *pdev)
254static struct platform_driver jornada680kbd_driver = { 254static struct platform_driver jornada680kbd_driver = {
255 .driver = { 255 .driver = {
256 .name = "jornada680_kbd", 256 .name = "jornada680_kbd",
257 .owner = THIS_MODULE,
257 }, 258 },
258 .probe = jornada680kbd_probe, 259 .probe = jornada680kbd_probe,
259 .remove = __devexit_p(jornada680kbd_remove), 260 .remove = __devexit_p(jornada680kbd_remove),
@@ -275,3 +276,4 @@ module_exit(jornada680kbd_exit);
275MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); 276MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
276MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); 277MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver");
277MODULE_LICENSE("GPLv2"); 278MODULE_LICENSE("GPLv2");
279MODULE_ALIAS("platform:jornada680_kbd");
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c
index 986f93cfc6b8..a1164a0c7736 100644
--- a/drivers/input/keyboard/jornada720_kbd.c
+++ b/drivers/input/keyboard/jornada720_kbd.c
@@ -162,9 +162,13 @@ static int __devexit jornada720_kbd_remove(struct platform_device *pdev)
162 return 0; 162 return 0;
163} 163}
164 164
165/* work with hotplug and coldplug */
166MODULE_ALIAS("platform:jornada720_kbd");
167
165static struct platform_driver jornada720_kbd_driver = { 168static struct platform_driver jornada720_kbd_driver = {
166 .driver = { 169 .driver = {
167 .name = "jornada720_kbd", 170 .name = "jornada720_kbd",
171 .owner = THIS_MODULE,
168 }, 172 },
169 .probe = jornada720_kbd_probe, 173 .probe = jornada720_kbd_probe,
170 .remove = __devexit_p(jornada720_kbd_remove), 174 .remove = __devexit_p(jornada720_kbd_remove),
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 5a0ca18d6755..9caed30f3bbb 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -1,14 +1,12 @@
1/* 1/*
2 * Copyright (c) 2005 John Lenz 2 * LoCoMo keyboard driver for Linux-based ARM PDAs:
3 * - SHARP Zaurus Collie (SL-5500)
4 * - SHARP Zaurus Poodle (SL-5600)
3 * 5 *
6 * Copyright (c) 2005 John Lenz
4 * Based on from xtkbd.c 7 * Based on from xtkbd.c
5 */ 8 *
6 9 *
7/*
8 * LoCoMo keyboard driver for Linux/ARM
9 */
10
11/*
12 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
@@ -47,7 +45,8 @@ MODULE_LICENSE("GPL");
47#define KEY_CONTACT KEY_F18 45#define KEY_CONTACT KEY_F18
48#define KEY_CENTER KEY_F15 46#define KEY_CENTER KEY_F15
49 47
50static unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS] = { 48static const unsigned char
49locomokbd_keycode[LOCOMOKBD_NUMKEYS] __devinitconst = {
51 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ 50 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */
52 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */ 51 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */
53 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ 52 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */
@@ -67,22 +66,21 @@ static unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS] = {
67#define KB_COLS 8 66#define KB_COLS 8
68#define KB_ROWMASK(r) (1 << (r)) 67#define KB_ROWMASK(r) (1 << (r))
69#define SCANCODE(c,r) ( ((c)<<4) + (r) + 1 ) 68#define SCANCODE(c,r) ( ((c)<<4) + (r) + 1 )
70#define NR_SCANCODES 128
71 69
72#define KB_DELAY 8 70#define KB_DELAY 8
73#define SCAN_INTERVAL (HZ/10) 71#define SCAN_INTERVAL (HZ/10)
74#define LOCOMOKBD_PRESSED 1
75 72
76struct locomokbd { 73struct locomokbd {
77 unsigned char keycode[LOCOMOKBD_NUMKEYS]; 74 unsigned char keycode[LOCOMOKBD_NUMKEYS];
78 struct input_dev *input; 75 struct input_dev *input;
79 char phys[32]; 76 char phys[32];
80 77
81 struct locomo_dev *ldev;
82 unsigned long base; 78 unsigned long base;
83 spinlock_t lock; 79 spinlock_t lock;
84 80
85 struct timer_list timer; 81 struct timer_list timer;
82 unsigned long suspend_jiffies;
83 unsigned int count_cancel;
86}; 84};
87 85
88/* helper functions for reading the keyboard matrix */ 86/* helper functions for reading the keyboard matrix */
@@ -128,7 +126,7 @@ static inline void locomokbd_reset_col(unsigned long membase, int col)
128/* Scan the hardware keyboard and push any changes up through the input layer */ 126/* Scan the hardware keyboard and push any changes up through the input layer */
129static void locomokbd_scankeyboard(struct locomokbd *locomokbd) 127static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
130{ 128{
131 unsigned int row, col, rowd, scancode; 129 unsigned int row, col, rowd;
132 unsigned long flags; 130 unsigned long flags;
133 unsigned int num_pressed; 131 unsigned int num_pressed;
134 unsigned long membase = locomokbd->base; 132 unsigned long membase = locomokbd->base;
@@ -145,13 +143,33 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
145 143
146 rowd = ~locomo_readl(membase + LOCOMO_KIB); 144 rowd = ~locomo_readl(membase + LOCOMO_KIB);
147 for (row = 0; row < KB_ROWS; row++) { 145 for (row = 0; row < KB_ROWS; row++) {
146 unsigned int scancode, pressed, key;
147
148 scancode = SCANCODE(col, row); 148 scancode = SCANCODE(col, row);
149 if (rowd & KB_ROWMASK(row)) { 149 pressed = rowd & KB_ROWMASK(row);
150 num_pressed += 1; 150 key = locomokbd->keycode[scancode];
151 input_report_key(locomokbd->input, locomokbd->keycode[scancode], 1); 151
152 } else { 152 input_report_key(locomokbd->input, key, pressed);
153 input_report_key(locomokbd->input, locomokbd->keycode[scancode], 0); 153 if (likely(!pressed))
154 } 154 continue;
155
156 num_pressed++;
157
158 /* The "Cancel/ESC" key is labeled "On/Off" on
159 * Collie and Poodle and should suspend the device
160 * if it was pressed for more than a second. */
161 if (unlikely(key == KEY_ESC)) {
162 if (!time_after(jiffies,
163 locomokbd->suspend_jiffies + HZ))
164 continue;
165 if (locomokbd->count_cancel++
166 != (HZ/SCAN_INTERVAL + 1))
167 continue;
168 input_event(locomokbd->input, EV_PWR,
169 KEY_SUSPEND, 1);
170 locomokbd->suspend_jiffies = jiffies;
171 } else
172 locomokbd->count_cancel = 0;
155 } 173 }
156 locomokbd_reset_col(membase, col); 174 locomokbd_reset_col(membase, col);
157 } 175 }
@@ -162,6 +180,8 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
162 /* if any keys are pressed, enable the timer */ 180 /* if any keys are pressed, enable the timer */
163 if (num_pressed) 181 if (num_pressed)
164 mod_timer(&locomokbd->timer, jiffies + SCAN_INTERVAL); 182 mod_timer(&locomokbd->timer, jiffies + SCAN_INTERVAL);
183 else
184 locomokbd->count_cancel = 0;
165 185
166 spin_unlock_irqrestore(&locomokbd->lock, flags); 186 spin_unlock_irqrestore(&locomokbd->lock, flags);
167} 187}
@@ -186,10 +206,11 @@ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
186static void locomokbd_timer_callback(unsigned long data) 206static void locomokbd_timer_callback(unsigned long data)
187{ 207{
188 struct locomokbd *locomokbd = (struct locomokbd *) data; 208 struct locomokbd *locomokbd = (struct locomokbd *) data;
209
189 locomokbd_scankeyboard(locomokbd); 210 locomokbd_scankeyboard(locomokbd);
190} 211}
191 212
192static int locomokbd_probe(struct locomo_dev *dev) 213static int __devinit locomokbd_probe(struct locomo_dev *dev)
193{ 214{
194 struct locomokbd *locomokbd; 215 struct locomokbd *locomokbd;
195 struct input_dev *input_dev; 216 struct input_dev *input_dev;
@@ -211,7 +232,6 @@ static int locomokbd_probe(struct locomo_dev *dev)
211 goto err_free_mem; 232 goto err_free_mem;
212 } 233 }
213 234
214 locomokbd->ldev = dev;
215 locomo_set_drvdata(dev, locomokbd); 235 locomo_set_drvdata(dev, locomokbd);
216 236
217 locomokbd->base = (unsigned long) dev->mapbase; 237 locomokbd->base = (unsigned long) dev->mapbase;
@@ -222,6 +242,8 @@ static int locomokbd_probe(struct locomo_dev *dev)
222 locomokbd->timer.function = locomokbd_timer_callback; 242 locomokbd->timer.function = locomokbd_timer_callback;
223 locomokbd->timer.data = (unsigned long) locomokbd; 243 locomokbd->timer.data = (unsigned long) locomokbd;
224 244
245 locomokbd->suspend_jiffies = jiffies;
246
225 locomokbd->input = input_dev; 247 locomokbd->input = input_dev;
226 strcpy(locomokbd->phys, "locomokbd/input0"); 248 strcpy(locomokbd->phys, "locomokbd/input0");
227 249
@@ -233,9 +255,10 @@ static int locomokbd_probe(struct locomo_dev *dev)
233 input_dev->id.version = 0x0100; 255 input_dev->id.version = 0x0100;
234 input_dev->dev.parent = &dev->dev; 256 input_dev->dev.parent = &dev->dev;
235 257
236 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); 258 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
259 BIT_MASK(EV_PWR);
237 input_dev->keycode = locomokbd->keycode; 260 input_dev->keycode = locomokbd->keycode;
238 input_dev->keycodesize = sizeof(unsigned char); 261 input_dev->keycodesize = sizeof(locomokbd_keycode[0]);
239 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode); 262 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode);
240 263
241 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode)); 264 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode));
@@ -268,7 +291,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
268 return err; 291 return err;
269} 292}
270 293
271static int locomokbd_remove(struct locomo_dev *dev) 294static int __devexit locomokbd_remove(struct locomo_dev *dev)
272{ 295{
273 struct locomokbd *locomokbd = locomo_get_drvdata(dev); 296 struct locomokbd *locomokbd = locomo_get_drvdata(dev);
274 297
@@ -292,7 +315,7 @@ static struct locomo_driver keyboard_driver = {
292 }, 315 },
293 .devid = LOCOMO_DEVID_KEYBOARD, 316 .devid = LOCOMO_DEVID_KEYBOARD,
294 .probe = locomokbd_probe, 317 .probe = locomokbd_probe,
295 .remove = locomokbd_remove, 318 .remove = __devexit_p(locomokbd_remove),
296}; 319};
297 320
298static int __init locomokbd_init(void) 321static int __init locomokbd_init(void)
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index babc913d5492..10afd2068068 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -352,6 +352,9 @@ static int __init omap_kp_probe(struct platform_device *pdev)
352 } 352 }
353 omap_set_gpio_direction(row_gpios[row_idx], 1); 353 omap_set_gpio_direction(row_gpios[row_idx], 1);
354 } 354 }
355 } else {
356 col_idx = 0;
357 row_idx = 0;
355 } 358 }
356 359
357 setup_timer(&omap_kp->timer, omap_kp_timer, (unsigned long)omap_kp); 360 setup_timer(&omap_kp->timer, omap_kp_timer, (unsigned long)omap_kp);
@@ -415,10 +418,10 @@ err4:
415err3: 418err3:
416 device_remove_file(&pdev->dev, &dev_attr_enable); 419 device_remove_file(&pdev->dev, &dev_attr_enable);
417err2: 420err2:
418 for (i = row_idx-1; i >=0; i--) 421 for (i = row_idx - 1; i >=0; i--)
419 omap_free_gpio(row_gpios[i]); 422 omap_free_gpio(row_gpios[i]);
420err1: 423err1:
421 for (i = col_idx-1; i >=0; i--) 424 for (i = col_idx - 1; i >=0; i--)
422 omap_free_gpio(col_gpios[i]); 425 omap_free_gpio(col_gpios[i]);
423 426
424 kfree(omap_kp); 427 kfree(omap_kp);
@@ -464,6 +467,7 @@ static struct platform_driver omap_kp_driver = {
464 .resume = omap_kp_resume, 467 .resume = omap_kp_resume,
465 .driver = { 468 .driver = {
466 .name = "omap-keypad", 469 .name = "omap-keypad",
470 .owner = THIS_MODULE,
467 }, 471 },
468}; 472};
469 473
@@ -484,3 +488,4 @@ module_exit(omap_kp_exit);
484MODULE_AUTHOR("Timo Teräs"); 488MODULE_AUTHOR("Timo Teräs");
485MODULE_DESCRIPTION("OMAP Keypad Driver"); 489MODULE_DESCRIPTION("OMAP Keypad Driver");
486MODULE_LICENSE("GPL"); 490MODULE_LICENSE("GPL");
491MODULE_ALIAS("platform:omap-keypad");
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 4e651c11c1da..3dea0c5077a9 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -545,6 +545,9 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev)
545 return 0; 545 return 0;
546} 546}
547 547
548/* work with hotplug and coldplug */
549MODULE_ALIAS("platform:pxa27x-keypad");
550
548static struct platform_driver pxa27x_keypad_driver = { 551static struct platform_driver pxa27x_keypad_driver = {
549 .probe = pxa27x_keypad_probe, 552 .probe = pxa27x_keypad_probe,
550 .remove = __devexit_p(pxa27x_keypad_remove), 553 .remove = __devexit_p(pxa27x_keypad_remove),
@@ -552,6 +555,7 @@ static struct platform_driver pxa27x_keypad_driver = {
552 .resume = pxa27x_keypad_resume, 555 .resume = pxa27x_keypad_resume,
553 .driver = { 556 .driver = {
554 .name = "pxa27x-keypad", 557 .name = "pxa27x-keypad",
558 .owner = THIS_MODULE,
555 }, 559 },
556}; 560};
557 561
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 0be74bfc58fe..61e401bc9109 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -495,3 +495,4 @@ module_exit(spitzkbd_exit);
495MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 495MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
496MODULE_DESCRIPTION("Spitz Keyboard Driver"); 496MODULE_DESCRIPTION("Spitz Keyboard Driver");
497MODULE_LICENSE("GPLv2"); 497MODULE_LICENSE("GPLv2");
498MODULE_ALIAS("platform:spitz-keyboard");
diff --git a/drivers/input/keyboard/tosakbd.c b/drivers/input/keyboard/tosakbd.c
index 3884d1e3f070..94e444b4ee15 100644
--- a/drivers/input/keyboard/tosakbd.c
+++ b/drivers/input/keyboard/tosakbd.c
@@ -52,7 +52,7 @@ KEY_X, KEY_F, KEY_SPACE, KEY_APOSTROPHE, TOSA_KEY_MAIL, KEY_LEFT, KEY_DOWN, KEY_
52struct tosakbd { 52struct tosakbd {
53 unsigned int keycode[ARRAY_SIZE(tosakbd_keycode)]; 53 unsigned int keycode[ARRAY_SIZE(tosakbd_keycode)];
54 struct input_dev *input; 54 struct input_dev *input;
55 55 int suspended;
56 spinlock_t lock; /* protect kbd scanning */ 56 spinlock_t lock; /* protect kbd scanning */
57 struct timer_list timer; 57 struct timer_list timer;
58}; 58};
@@ -133,6 +133,9 @@ static void tosakbd_scankeyboard(struct platform_device *dev)
133 133
134 spin_lock_irqsave(&tosakbd->lock, flags); 134 spin_lock_irqsave(&tosakbd->lock, flags);
135 135
136 if (tosakbd->suspended)
137 goto out;
138
136 for (col = 0; col < TOSA_KEY_STROBE_NUM; col++) { 139 for (col = 0; col < TOSA_KEY_STROBE_NUM; col++) {
137 /* 140 /*
138 * Discharge the output driver capacitatance 141 * Discharge the output driver capacitatance
@@ -174,6 +177,7 @@ static void tosakbd_scankeyboard(struct platform_device *dev)
174 if (num_pressed) 177 if (num_pressed)
175 mod_timer(&tosakbd->timer, jiffies + SCAN_INTERVAL); 178 mod_timer(&tosakbd->timer, jiffies + SCAN_INTERVAL);
176 179
180 out:
177 spin_unlock_irqrestore(&tosakbd->lock, flags); 181 spin_unlock_irqrestore(&tosakbd->lock, flags);
178} 182}
179 183
@@ -200,6 +204,7 @@ static irqreturn_t tosakbd_interrupt(int irq, void *__dev)
200static void tosakbd_timer_callback(unsigned long __dev) 204static void tosakbd_timer_callback(unsigned long __dev)
201{ 205{
202 struct platform_device *dev = (struct platform_device *)__dev; 206 struct platform_device *dev = (struct platform_device *)__dev;
207
203 tosakbd_scankeyboard(dev); 208 tosakbd_scankeyboard(dev);
204} 209}
205 210
@@ -207,6 +212,13 @@ static void tosakbd_timer_callback(unsigned long __dev)
207static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) 212static int tosakbd_suspend(struct platform_device *dev, pm_message_t state)
208{ 213{
209 struct tosakbd *tosakbd = platform_get_drvdata(dev); 214 struct tosakbd *tosakbd = platform_get_drvdata(dev);
215 unsigned long flags;
216
217 spin_lock_irqsave(&tosakbd->lock, flags);
218 PGSR1 = (PGSR1 & ~TOSA_GPIO_LOW_STROBE_BIT);
219 PGSR2 = (PGSR2 & ~TOSA_GPIO_HIGH_STROBE_BIT);
220 tosakbd->suspended = 1;
221 spin_unlock_irqrestore(&tosakbd->lock, flags);
210 222
211 del_timer_sync(&tosakbd->timer); 223 del_timer_sync(&tosakbd->timer);
212 224
@@ -215,6 +227,9 @@ static int tosakbd_suspend(struct platform_device *dev, pm_message_t state)
215 227
216static int tosakbd_resume(struct platform_device *dev) 228static int tosakbd_resume(struct platform_device *dev)
217{ 229{
230 struct tosakbd *tosakbd = platform_get_drvdata(dev);
231
232 tosakbd->suspended = 0;
218 tosakbd_scankeyboard(dev); 233 tosakbd_scankeyboard(dev);
219 234
220 return 0; 235 return 0;
@@ -365,8 +380,8 @@ fail:
365 return error; 380 return error;
366} 381}
367 382
368static int __devexit tosakbd_remove(struct platform_device *dev) { 383static int __devexit tosakbd_remove(struct platform_device *dev)
369 384{
370 int i; 385 int i;
371 struct tosakbd *tosakbd = platform_get_drvdata(dev); 386 struct tosakbd *tosakbd = platform_get_drvdata(dev);
372 387
@@ -394,6 +409,7 @@ static struct platform_driver tosakbd_driver = {
394 .resume = tosakbd_resume, 409 .resume = tosakbd_resume,
395 .driver = { 410 .driver = {
396 .name = "tosa-keyboard", 411 .name = "tosa-keyboard",
412 .owner = THIS_MODULE,
397 }, 413 },
398}; 414};
399 415
@@ -413,3 +429,4 @@ module_exit(tosakbd_exit);
413MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>"); 429MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>");
414MODULE_DESCRIPTION("Tosa Keyboard Driver"); 430MODULE_DESCRIPTION("Tosa Keyboard Driver");
415MODULE_LICENSE("GPL v2"); 431MODULE_LICENSE("GPL v2");
432MODULE_ALIAS("platform:tosa-keyboard");