aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/atari/atakeyb.c104
1 files changed, 7 insertions, 97 deletions
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 2b5f64726a2e..fbbccb5e7511 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/atari/atakeyb.c 2 * linux/arch/m68k/atari/atakeyb.c
3 * 3 *
4 * Atari Keyboard driver for 680x0 Linux 4 * Atari Keyboard driver for 680x0 Linux
5 * 5 *
@@ -11,6 +11,9 @@
11/* 11/*
12 * Atari support by Robert de Vries 12 * Atari support by Robert de Vries
13 * enhanced by Bjoern Brauel and Roman Hodek 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#include <linux/module.h> 19#include <linux/module.h>
@@ -32,7 +35,6 @@
32#include <asm/atari_joystick.h> 35#include <asm/atari_joystick.h>
33#include <asm/irq.h> 36#include <asm/irq.h>
34 37
35static void atakeyb_rep(unsigned long ignore);
36extern unsigned int keymap_count; 38extern unsigned int keymap_count;
37 39
38/* Hook for MIDI serial driver */ 40/* Hook for MIDI serial driver */
@@ -104,25 +106,6 @@ static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, };
104 * - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR] 106 * - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
105 */ 107 */
106 108
107static u_short ataplain_map[NR_KEYS] __initdata = {
108 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
109 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
110 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
111 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
112 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
113 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
114 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200,
115 0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
116 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
117 0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
118 0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
119 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
120 0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
121 0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
122 0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
123 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
124};
125
126typedef enum kb_state_t { 109typedef enum kb_state_t {
127 KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC 110 KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC
128} KB_STATE_T; 111} KB_STATE_T;
@@ -137,41 +120,6 @@ typedef struct keyboard_state {
137 120
138KEYBOARD_STATE kb_state; 121KEYBOARD_STATE kb_state;
139 122
140#define DEFAULT_KEYB_REP_DELAY (HZ/4)
141#define DEFAULT_KEYB_REP_RATE (HZ/25)
142
143/* These could be settable by some ioctl() in future... */
144static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY;
145static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
146
147static unsigned char rep_scancode;
148static struct timer_list atakeyb_rep_timer = {
149 .function = atakeyb_rep,
150};
151
152static void atakeyb_rep(unsigned long ignore)
153{
154 /* Disable keyboard for the time we call handle_scancode(), else a race
155 * in the keyboard tty queue may happen */
156 atari_disable_irq(IRQ_MFP_ACIA);
157 del_timer(&atakeyb_rep_timer);
158
159 /* A keyboard int may have come in before we disabled the irq, so
160 * double-check whether rep_scancode is still != 0 */
161 if (rep_scancode) {
162 init_timer(&atakeyb_rep_timer);
163 atakeyb_rep_timer.expires = jiffies + key_repeat_rate;
164 add_timer(&atakeyb_rep_timer);
165
166 //handle_scancode(rep_scancode, 1);
167 if (atari_input_keyboard_interrupt_hook)
168 atari_input_keyboard_interrupt_hook(rep_scancode, 1);
169 }
170
171 atari_enable_irq(IRQ_MFP_ACIA);
172}
173
174
175/* ++roman: If a keyboard overrun happened, we can't tell in general how much 123/* ++roman: If a keyboard overrun happened, we can't tell in general how much
176 * bytes have been lost and in which state of the packet structure we are now. 124 * bytes have been lost and in which state of the packet structure we are now.
177 * This usually causes keyboards bytes to be interpreted as mouse movements 125 * This usually causes keyboards bytes to be interpreted as mouse movements
@@ -209,9 +157,6 @@ repeat:
209 /* ...happens often if interrupts were disabled for too long */ 157 /* ...happens often if interrupts were disabled for too long */
210 printk(KERN_DEBUG "Keyboard overrun\n"); 158 printk(KERN_DEBUG "Keyboard overrun\n");
211 scancode = acia.key_data; 159 scancode = acia.key_data;
212 /* Turn off autorepeating in case a break code has been lost */
213 del_timer(&atakeyb_rep_timer);
214 rep_scancode = 0;
215 if (ikbd_self_test) 160 if (ikbd_self_test)
216 /* During self test, don't do resyncing, just process the code */ 161 /* During self test, don't do resyncing, just process the code */
217 goto interpret_scancode; 162 goto interpret_scancode;
@@ -281,11 +226,12 @@ repeat:
281 * make codes instead. Therefore, simply ignore 226 * make codes instead. Therefore, simply ignore
282 * break_flag... 227 * break_flag...
283 */ 228 */
284 int keyval = plain_map[scancode], keytyp; 229 int keyval, keytyp;
285 230
286 set_bit(scancode, broken_keys); 231 set_bit(scancode, broken_keys);
287 self_test_last_rcv = jiffies; 232 self_test_last_rcv = jiffies;
288 keyval = plain_map[scancode]; 233 /* new Linux scancodes; approx. */
234 keyval = scancode;
289 keytyp = KTYP(keyval) - 0xf0; 235 keytyp = KTYP(keyval) - 0xf0;
290 keyval = KVAL(keyval); 236 keyval = KVAL(keyval);
291 237
@@ -301,19 +247,6 @@ repeat:
301 } else if (test_bit(scancode, broken_keys)) 247 } else if (test_bit(scancode, broken_keys))
302 break; 248 break;
303 249
304#if 0 // FIXME; hangs at boot
305 if (break_flag) {
306 del_timer(&atakeyb_rep_timer);
307 rep_scancode = 0;
308 } else {
309 del_timer(&atakeyb_rep_timer);
310 rep_scancode = scancode;
311 atakeyb_rep_timer.expires = jiffies + key_repeat_delay;
312 add_timer(&atakeyb_rep_timer);
313 }
314#endif
315
316 // handle_scancode(scancode, !break_flag);
317 if (atari_input_keyboard_interrupt_hook) 250 if (atari_input_keyboard_interrupt_hook)
318 atari_input_keyboard_interrupt_hook((unsigned char)scancode, !break_flag); 251 atari_input_keyboard_interrupt_hook((unsigned char)scancode, !break_flag);
319 break; 252 break;
@@ -639,9 +572,6 @@ int __init atari_keyb_init(void)
639 if (atari_keyb_done) 572 if (atari_keyb_done)
640 return 0; 573 return 0;
641 574
642 /* setup key map */
643 memcpy(key_maps[0], ataplain_map, sizeof(plain_map));
644
645 kb_state.state = KEYBOARD; 575 kb_state.state = KEYBOARD;
646 kb_state.len = 0; 576 kb_state.len = 0;
647 577
@@ -704,26 +634,6 @@ int __init atari_keyb_init(void)
704 return 0; 634 return 0;
705} 635}
706 636
707int atari_kbdrate(struct kbd_repeat *k)
708{
709 if (k->delay > 0) {
710 /* convert from msec to jiffies */
711 key_repeat_delay = (k->delay * HZ + 500) / 1000;
712 if (key_repeat_delay < 1)
713 key_repeat_delay = 1;
714 }
715 if (k->period > 0) {
716 key_repeat_rate = (k->period * HZ + 500) / 1000;
717 if (key_repeat_rate < 1)
718 key_repeat_rate = 1;
719 }
720
721 k->delay = key_repeat_delay * 1000 / HZ;
722 k->period = key_repeat_rate * 1000 / HZ;
723
724 return 0;
725}
726
727int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode) 637int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
728{ 638{
729#ifdef CONFIG_MAGIC_SYSRQ 639#ifdef CONFIG_MAGIC_SYSRQ