Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: Atari keyboard ACIA driver cleanup

m68k: Atari keyboard ACIA driver cleanup:
- removed dead key autorepeat code
- removed hardcoded initial keymap

Signed-off-by: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Geert Uytterhoeven and committed by
Linus Torvalds
3d83a2a5 6615c5b2

+7 -97
+7 -97
arch/m68k/atari/atakeyb.c
··· 1 1 /* 2 - * linux/atari/atakeyb.c 2 + * linux/arch/m68k/atari/atakeyb.c 3 3 * 4 4 * Atari Keyboard driver for 680x0 Linux 5 5 * ··· 11 11 /* 12 12 * Atari support by Robert de Vries 13 13 * enhanced by Bjoern Brauel and Roman Hodek 14 + * 15 + * 2.6 and input cleanup (removed autorepeat stuff) for 2.6.21 16 + * 06/07 Michael Schmitz 14 17 */ 15 18 16 19 #include <linux/module.h> ··· 35 32 #include <asm/atari_joystick.h> 36 33 #include <asm/irq.h> 37 34 38 - static void atakeyb_rep(unsigned long ignore); 39 35 extern unsigned int keymap_count; 40 36 41 37 /* Hook for MIDI serial driver */ ··· 106 104 * - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR] 107 105 */ 108 106 109 - static u_short ataplain_map[NR_KEYS] __initdata = { 110 - 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 111 - 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009, 112 - 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 113 - 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, 114 - 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 115 - 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 116 - 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200, 117 - 0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 118 - 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114, 119 - 0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200, 120 - 0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200, 121 - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 122 - 0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307, 123 - 0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303, 124 - 0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 125 - 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200 126 - }; 127 - 128 107 typedef enum kb_state_t { 129 108 KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC 130 109 } KB_STATE_T; ··· 119 136 } KEYBOARD_STATE; 120 137 121 138 KEYBOARD_STATE kb_state; 122 - 123 - #define DEFAULT_KEYB_REP_DELAY (HZ/4) 124 - #define DEFAULT_KEYB_REP_RATE (HZ/25) 125 - 126 - /* These could be settable by some ioctl() in future... */ 127 - static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY; 128 - static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE; 129 - 130 - static unsigned char rep_scancode; 131 - static struct timer_list atakeyb_rep_timer = { 132 - .function = atakeyb_rep, 133 - }; 134 - 135 - static void atakeyb_rep(unsigned long ignore) 136 - { 137 - /* Disable keyboard for the time we call handle_scancode(), else a race 138 - * in the keyboard tty queue may happen */ 139 - atari_disable_irq(IRQ_MFP_ACIA); 140 - del_timer(&atakeyb_rep_timer); 141 - 142 - /* A keyboard int may have come in before we disabled the irq, so 143 - * double-check whether rep_scancode is still != 0 */ 144 - if (rep_scancode) { 145 - init_timer(&atakeyb_rep_timer); 146 - atakeyb_rep_timer.expires = jiffies + key_repeat_rate; 147 - add_timer(&atakeyb_rep_timer); 148 - 149 - //handle_scancode(rep_scancode, 1); 150 - if (atari_input_keyboard_interrupt_hook) 151 - atari_input_keyboard_interrupt_hook(rep_scancode, 1); 152 - } 153 - 154 - atari_enable_irq(IRQ_MFP_ACIA); 155 - } 156 - 157 139 158 140 /* ++roman: If a keyboard overrun happened, we can't tell in general how much 159 141 * bytes have been lost and in which state of the packet structure we are now. ··· 157 209 /* ...happens often if interrupts were disabled for too long */ 158 210 printk(KERN_DEBUG "Keyboard overrun\n"); 159 211 scancode = acia.key_data; 160 - /* Turn off autorepeating in case a break code has been lost */ 161 - del_timer(&atakeyb_rep_timer); 162 - rep_scancode = 0; 163 212 if (ikbd_self_test) 164 213 /* During self test, don't do resyncing, just process the code */ 165 214 goto interpret_scancode; ··· 226 281 * make codes instead. Therefore, simply ignore 227 282 * break_flag... 228 283 */ 229 - int keyval = plain_map[scancode], keytyp; 284 + int keyval, keytyp; 230 285 231 286 set_bit(scancode, broken_keys); 232 287 self_test_last_rcv = jiffies; 233 - keyval = plain_map[scancode]; 288 + /* new Linux scancodes; approx. */ 289 + keyval = scancode; 234 290 keytyp = KTYP(keyval) - 0xf0; 235 291 keyval = KVAL(keyval); 236 292 ··· 247 301 } else if (test_bit(scancode, broken_keys)) 248 302 break; 249 303 250 - #if 0 // FIXME; hangs at boot 251 - if (break_flag) { 252 - del_timer(&atakeyb_rep_timer); 253 - rep_scancode = 0; 254 - } else { 255 - del_timer(&atakeyb_rep_timer); 256 - rep_scancode = scancode; 257 - atakeyb_rep_timer.expires = jiffies + key_repeat_delay; 258 - add_timer(&atakeyb_rep_timer); 259 - } 260 - #endif 261 - 262 - // handle_scancode(scancode, !break_flag); 263 304 if (atari_input_keyboard_interrupt_hook) 264 305 atari_input_keyboard_interrupt_hook((unsigned char)scancode, !break_flag); 265 306 break; ··· 572 639 if (atari_keyb_done) 573 640 return 0; 574 641 575 - /* setup key map */ 576 - memcpy(key_maps[0], ataplain_map, sizeof(plain_map)); 577 - 578 642 kb_state.state = KEYBOARD; 579 643 kb_state.len = 0; 580 644 ··· 631 701 632 702 // flag init done 633 703 atari_keyb_done = 1; 634 - return 0; 635 - } 636 - 637 - int atari_kbdrate(struct kbd_repeat *k) 638 - { 639 - if (k->delay > 0) { 640 - /* convert from msec to jiffies */ 641 - key_repeat_delay = (k->delay * HZ + 500) / 1000; 642 - if (key_repeat_delay < 1) 643 - key_repeat_delay = 1; 644 - } 645 - if (k->period > 0) { 646 - key_repeat_rate = (k->period * HZ + 500) / 1000; 647 - if (key_repeat_rate < 1) 648 - key_repeat_rate = 1; 649 - } 650 - 651 - k->delay = key_repeat_delay * 1000 / HZ; 652 - k->period = key_repeat_rate * 1000 / HZ; 653 - 654 704 return 0; 655 705 } 656 706