diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-03-14 00:12:32 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-14 00:12:32 -0500 |
commit | 4872f7888855fa52182f3d69de1ff3746fd43c07 (patch) | |
tree | e2b16a34cfae7b75e39a855b4e3b43aac3aa29d6 /drivers/input | |
parent | 2bfc3c6e9516ece6856ec7904319650a5d4d9871 (diff) |
Input: zaurus keyboard driver updates
* Change the scan interval from 100ms to 50ms. This stops the key
repeat from triggering on double letter presses.
* Remove unneeded stale hinge code from corgikbd
* Change unneeded corgi GPIO pins to inputs when suspended
* Add support for the headphone jack switch for both corgi and spitz
(as switch SW_2)
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/corgikbd.c | 35 | ||||
-rw-r--r-- | drivers/input/keyboard/spitzkbd.c | 10 |
2 files changed, 33 insertions, 12 deletions
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index e301ee4ca264..96c6bf77248a 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -29,11 +29,11 @@ | |||
29 | #define KB_COLS 12 | 29 | #define KB_COLS 12 |
30 | #define KB_ROWMASK(r) (1 << (r)) | 30 | #define KB_ROWMASK(r) (1 << (r)) |
31 | #define SCANCODE(r,c) ( ((r)<<4) + (c) + 1 ) | 31 | #define SCANCODE(r,c) ( ((r)<<4) + (c) + 1 ) |
32 | /* zero code, 124 scancodes + 3 hinge combinations */ | 32 | /* zero code, 124 scancodes */ |
33 | #define NR_SCANCODES ( SCANCODE(KB_ROWS-1,KB_COLS-1) +1 +1 +3 ) | 33 | #define NR_SCANCODES ( SCANCODE(KB_ROWS-1,KB_COLS-1) +1 +1 ) |
34 | #define SCAN_INTERVAL (HZ/10) | ||
35 | 34 | ||
36 | #define HINGE_SCAN_INTERVAL (HZ/4) | 35 | #define SCAN_INTERVAL (50) /* ms */ |
36 | #define HINGE_SCAN_INTERVAL (250) /* ms */ | ||
37 | 37 | ||
38 | #define CORGI_KEY_CALENDER KEY_F1 | 38 | #define CORGI_KEY_CALENDER KEY_F1 |
39 | #define CORGI_KEY_ADDRESS KEY_F2 | 39 | #define CORGI_KEY_ADDRESS KEY_F2 |
@@ -49,9 +49,6 @@ | |||
49 | #define CORGI_KEY_MAIL KEY_F10 | 49 | #define CORGI_KEY_MAIL KEY_F10 |
50 | #define CORGI_KEY_OK KEY_F11 | 50 | #define CORGI_KEY_OK KEY_F11 |
51 | #define CORGI_KEY_MENU KEY_F12 | 51 | #define CORGI_KEY_MENU KEY_F12 |
52 | #define CORGI_HINGE_0 KEY_KP0 | ||
53 | #define CORGI_HINGE_1 KEY_KP1 | ||
54 | #define CORGI_HINGE_2 KEY_KP2 | ||
55 | 52 | ||
56 | static unsigned char corgikbd_keycode[NR_SCANCODES] = { | 53 | static unsigned char corgikbd_keycode[NR_SCANCODES] = { |
57 | 0, /* 0 */ | 54 | 0, /* 0 */ |
@@ -63,7 +60,6 @@ static unsigned char corgikbd_keycode[NR_SCANCODES] = { | |||
63 | CORGI_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, 0, CORGI_KEY_FN, 0, 0, 0, 0, /* 81-96 */ | 60 | CORGI_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, 0, CORGI_KEY_FN, 0, 0, 0, 0, /* 81-96 */ |
64 | KEY_SYSRQ, CORGI_KEY_JAP1, CORGI_KEY_JAP2, CORGI_KEY_CANCEL, CORGI_KEY_OK, CORGI_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0, /* 97-112 */ | 61 | KEY_SYSRQ, CORGI_KEY_JAP1, CORGI_KEY_JAP2, CORGI_KEY_CANCEL, CORGI_KEY_OK, CORGI_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0, /* 97-112 */ |
65 | CORGI_KEY_OFF, CORGI_KEY_EXOK, CORGI_KEY_EXCANCEL, CORGI_KEY_EXJOGDOWN, CORGI_KEY_EXJOGUP, 0, 0, 0, 0, 0, 0, 0, /* 113-124 */ | 62 | CORGI_KEY_OFF, CORGI_KEY_EXOK, CORGI_KEY_EXCANCEL, CORGI_KEY_EXJOGDOWN, CORGI_KEY_EXJOGUP, 0, 0, 0, 0, 0, 0, 0, /* 113-124 */ |
66 | CORGI_HINGE_0, CORGI_HINGE_1, CORGI_HINGE_2 /* 125-127 */ | ||
67 | }; | 63 | }; |
68 | 64 | ||
69 | 65 | ||
@@ -187,7 +183,7 @@ static void corgikbd_scankeyboard(struct corgikbd *corgikbd_data, struct pt_regs | |||
187 | 183 | ||
188 | /* if any keys are pressed, enable the timer */ | 184 | /* if any keys are pressed, enable the timer */ |
189 | if (num_pressed) | 185 | if (num_pressed) |
190 | mod_timer(&corgikbd_data->timer, jiffies + SCAN_INTERVAL); | 186 | mod_timer(&corgikbd_data->timer, jiffies + msecs_to_jiffies(SCAN_INTERVAL)); |
191 | 187 | ||
192 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); | 188 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); |
193 | } | 189 | } |
@@ -228,6 +224,7 @@ static void corgikbd_timer_callback(unsigned long data) | |||
228 | * 0x0c - Keyboard and Screen Closed | 224 | * 0x0c - Keyboard and Screen Closed |
229 | */ | 225 | */ |
230 | 226 | ||
227 | #define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x)) | ||
231 | #define HINGE_STABLE_COUNT 2 | 228 | #define HINGE_STABLE_COUNT 2 |
232 | static int sharpsl_hinge_state; | 229 | static int sharpsl_hinge_state; |
233 | static int hinge_count; | 230 | static int hinge_count; |
@@ -239,6 +236,7 @@ static void corgikbd_hinge_timer(unsigned long data) | |||
239 | unsigned long flags; | 236 | unsigned long flags; |
240 | 237 | ||
241 | gprr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_GPRR) & (CORGI_SCP_SWA | CORGI_SCP_SWB); | 238 | gprr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_GPRR) & (CORGI_SCP_SWA | CORGI_SCP_SWB); |
239 | gprr |= (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0); | ||
242 | if (gprr != sharpsl_hinge_state) { | 240 | if (gprr != sharpsl_hinge_state) { |
243 | hinge_count = 0; | 241 | hinge_count = 0; |
244 | sharpsl_hinge_state = gprr; | 242 | sharpsl_hinge_state = gprr; |
@@ -249,27 +247,38 @@ static void corgikbd_hinge_timer(unsigned long data) | |||
249 | 247 | ||
250 | input_report_switch(corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0)); | 248 | input_report_switch(corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0)); |
251 | input_report_switch(corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0)); | 249 | input_report_switch(corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0)); |
250 | input_report_switch(corgikbd_data->input, SW_2, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0)); | ||
252 | input_sync(corgikbd_data->input); | 251 | input_sync(corgikbd_data->input); |
253 | 252 | ||
254 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); | 253 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); |
255 | } | 254 | } |
256 | } | 255 | } |
257 | mod_timer(&corgikbd_data->htimer, jiffies + HINGE_SCAN_INTERVAL); | 256 | mod_timer(&corgikbd_data->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL)); |
258 | } | 257 | } |
259 | 258 | ||
260 | #ifdef CONFIG_PM | 259 | #ifdef CONFIG_PM |
261 | static int corgikbd_suspend(struct platform_device *dev, pm_message_t state) | 260 | static int corgikbd_suspend(struct platform_device *dev, pm_message_t state) |
262 | { | 261 | { |
262 | int i; | ||
263 | struct corgikbd *corgikbd = platform_get_drvdata(dev); | 263 | struct corgikbd *corgikbd = platform_get_drvdata(dev); |
264 | |||
264 | corgikbd->suspended = 1; | 265 | corgikbd->suspended = 1; |
266 | /* strobe 0 is the power key so this can't be made an input for | ||
267 | powersaving therefore i = 1 */ | ||
268 | for (i = 1; i < CORGI_KEY_STROBE_NUM; i++) | ||
269 | pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_IN); | ||
265 | 270 | ||
266 | return 0; | 271 | return 0; |
267 | } | 272 | } |
268 | 273 | ||
269 | static int corgikbd_resume(struct platform_device *dev) | 274 | static int corgikbd_resume(struct platform_device *dev) |
270 | { | 275 | { |
276 | int i; | ||
271 | struct corgikbd *corgikbd = platform_get_drvdata(dev); | 277 | struct corgikbd *corgikbd = platform_get_drvdata(dev); |
272 | 278 | ||
279 | for (i = 1; i < CORGI_KEY_STROBE_NUM; i++) | ||
280 | pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH); | ||
281 | |||
273 | /* Upon resume, ignore the suspend key for a short while */ | 282 | /* Upon resume, ignore the suspend key for a short while */ |
274 | corgikbd->suspend_jiffies=jiffies; | 283 | corgikbd->suspend_jiffies=jiffies; |
275 | corgikbd->suspended = 0; | 284 | corgikbd->suspended = 0; |
@@ -333,10 +342,11 @@ static int __init corgikbd_probe(struct platform_device *pdev) | |||
333 | clear_bit(0, input_dev->keybit); | 342 | clear_bit(0, input_dev->keybit); |
334 | set_bit(SW_0, input_dev->swbit); | 343 | set_bit(SW_0, input_dev->swbit); |
335 | set_bit(SW_1, input_dev->swbit); | 344 | set_bit(SW_1, input_dev->swbit); |
345 | set_bit(SW_2, input_dev->swbit); | ||
336 | 346 | ||
337 | input_register_device(corgikbd->input); | 347 | input_register_device(corgikbd->input); |
338 | 348 | ||
339 | mod_timer(&corgikbd->htimer, jiffies + HINGE_SCAN_INTERVAL); | 349 | mod_timer(&corgikbd->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL)); |
340 | 350 | ||
341 | /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */ | 351 | /* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */ |
342 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) { | 352 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) { |
@@ -351,6 +361,9 @@ static int __init corgikbd_probe(struct platform_device *pdev) | |||
351 | for (i = 0; i < CORGI_KEY_STROBE_NUM; i++) | 361 | for (i = 0; i < CORGI_KEY_STROBE_NUM; i++) |
352 | pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH); | 362 | pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH); |
353 | 363 | ||
364 | /* Setup the headphone jack as an input */ | ||
365 | pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN); | ||
366 | |||
354 | return 0; | 367 | return 0; |
355 | } | 368 | } |
356 | 369 | ||
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 83999d583122..bc61cf8cfc65 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #define SCANCODE(r,c) (((r)<<4) + (c) + 1) | 30 | #define SCANCODE(r,c) (((r)<<4) + (c) + 1) |
31 | #define NR_SCANCODES ((KB_ROWS<<4) + 1) | 31 | #define NR_SCANCODES ((KB_ROWS<<4) + 1) |
32 | 32 | ||
33 | #define SCAN_INTERVAL (50) /* ms */ | ||
33 | #define HINGE_SCAN_INTERVAL (150) /* ms */ | 34 | #define HINGE_SCAN_INTERVAL (150) /* ms */ |
34 | 35 | ||
35 | #define SPITZ_KEY_CALENDER KEY_F1 | 36 | #define SPITZ_KEY_CALENDER KEY_F1 |
@@ -230,7 +231,7 @@ static void spitzkbd_scankeyboard(struct spitzkbd *spitzkbd_data, struct pt_regs | |||
230 | 231 | ||
231 | /* if any keys are pressed, enable the timer */ | 232 | /* if any keys are pressed, enable the timer */ |
232 | if (num_pressed) | 233 | if (num_pressed) |
233 | mod_timer(&spitzkbd_data->timer, jiffies + msecs_to_jiffies(100)); | 234 | mod_timer(&spitzkbd_data->timer, jiffies + msecs_to_jiffies(SCAN_INTERVAL)); |
234 | 235 | ||
235 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); | 236 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); |
236 | } | 237 | } |
@@ -287,6 +288,7 @@ static void spitzkbd_hinge_timer(unsigned long data) | |||
287 | unsigned long flags; | 288 | unsigned long flags; |
288 | 289 | ||
289 | state = GPLR(SPITZ_GPIO_SWA) & (GPIO_bit(SPITZ_GPIO_SWA)|GPIO_bit(SPITZ_GPIO_SWB)); | 290 | state = GPLR(SPITZ_GPIO_SWA) & (GPIO_bit(SPITZ_GPIO_SWA)|GPIO_bit(SPITZ_GPIO_SWB)); |
291 | state |= (GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)); | ||
290 | if (state != sharpsl_hinge_state) { | 292 | if (state != sharpsl_hinge_state) { |
291 | hinge_count = 0; | 293 | hinge_count = 0; |
292 | sharpsl_hinge_state = state; | 294 | sharpsl_hinge_state = state; |
@@ -299,6 +301,7 @@ static void spitzkbd_hinge_timer(unsigned long data) | |||
299 | 301 | ||
300 | input_report_switch(spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); | 302 | input_report_switch(spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); |
301 | input_report_switch(spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); | 303 | input_report_switch(spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); |
304 | input_report_switch(spitzkbd_data->input, SW_2, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0)); | ||
302 | input_sync(spitzkbd_data->input); | 305 | input_sync(spitzkbd_data->input); |
303 | 306 | ||
304 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); | 307 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); |
@@ -397,6 +400,7 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
397 | clear_bit(0, input_dev->keybit); | 400 | clear_bit(0, input_dev->keybit); |
398 | set_bit(SW_0, input_dev->swbit); | 401 | set_bit(SW_0, input_dev->swbit); |
399 | set_bit(SW_1, input_dev->swbit); | 402 | set_bit(SW_1, input_dev->swbit); |
403 | set_bit(SW_2, input_dev->swbit); | ||
400 | 404 | ||
401 | input_register_device(input_dev); | 405 | input_register_device(input_dev); |
402 | 406 | ||
@@ -432,6 +436,9 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
432 | request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, | 436 | request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, |
433 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, | 437 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, |
434 | "Spitzkbd SWB", spitzkbd); | 438 | "Spitzkbd SWB", spitzkbd); |
439 | request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr, | ||
440 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, | ||
441 | "Spitzkbd HP", spitzkbd); | ||
435 | 442 | ||
436 | printk(KERN_INFO "input: Spitz Keyboard Registered\n"); | 443 | printk(KERN_INFO "input: Spitz Keyboard Registered\n"); |
437 | 444 | ||
@@ -450,6 +457,7 @@ static int spitzkbd_remove(struct platform_device *dev) | |||
450 | free_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd); | 457 | free_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd); |
451 | free_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd); | 458 | free_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd); |
452 | free_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd); | 459 | free_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd); |
460 | free_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd); | ||
453 | 461 | ||
454 | del_timer_sync(&spitzkbd->htimer); | 462 | del_timer_sync(&spitzkbd->htimer); |
455 | del_timer_sync(&spitzkbd->timer); | 463 | del_timer_sync(&spitzkbd->timer); |