diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2006-06-23 05:04:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:43:01 -0400 |
commit | 5fa28ea42f28342ca6efaa2d23789f3fec5adff6 (patch) | |
tree | 3433408bfa592c8ca93a121422fab5f42e7c3444 | |
parent | cb7d390df391402c9630940d5a2ea1571fc5cde2 (diff) |
[PATCH] m68k: restore amikbd compatibility with 2.4
Dump the extra mapping in the amikbd interrupt handler, so old Amiga keymaps
work again. Amigas need a special keymap anyway, standard keymaps are not
usable and recreating all keymaps is simply not worth the trouble.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/input/keyboard/amikbd.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c index 4c8fb1f8631f..f1f9db9d282c 100644 --- a/drivers/input/keyboard/amikbd.c +++ b/drivers/input/keyboard/amikbd.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/input.h> | 36 | #include <linux/input.h> |
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/keyboard.h> | ||
39 | 40 | ||
40 | #include <asm/amigaints.h> | 41 | #include <asm/amigaints.h> |
41 | #include <asm/amigahw.h> | 42 | #include <asm/amigahw.h> |
@@ -45,7 +46,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | |||
45 | MODULE_DESCRIPTION("Amiga keyboard driver"); | 46 | MODULE_DESCRIPTION("Amiga keyboard driver"); |
46 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
47 | 48 | ||
48 | static unsigned char amikbd_keycode[0x78] = { | 49 | static unsigned char amikbd_keycode[0x78] __initdata = { |
49 | [0] = KEY_GRAVE, | 50 | [0] = KEY_GRAVE, |
50 | [1] = KEY_1, | 51 | [1] = KEY_1, |
51 | [2] = KEY_2, | 52 | [2] = KEY_2, |
@@ -170,12 +171,9 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp) | |||
170 | scancode >>= 1; | 171 | scancode >>= 1; |
171 | 172 | ||
172 | if (scancode < 0x78) { /* scancodes < 0x78 are keys */ | 173 | if (scancode < 0x78) { /* scancodes < 0x78 are keys */ |
173 | |||
174 | scancode = amikbd_keycode[scancode]; | ||
175 | |||
176 | input_regs(amikbd_dev, fp); | 174 | input_regs(amikbd_dev, fp); |
177 | 175 | ||
178 | if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */ | 176 | if (scancode == 98) { /* CapsLock is a toggle switch key on Amiga */ |
179 | input_report_key(amikbd_dev, scancode, 1); | 177 | input_report_key(amikbd_dev, scancode, 1); |
180 | input_report_key(amikbd_dev, scancode, 0); | 178 | input_report_key(amikbd_dev, scancode, 0); |
181 | } else { | 179 | } else { |
@@ -191,7 +189,7 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp) | |||
191 | 189 | ||
192 | static int __init amikbd_init(void) | 190 | static int __init amikbd_init(void) |
193 | { | 191 | { |
194 | int i; | 192 | int i, j; |
195 | 193 | ||
196 | if (!AMIGAHW_PRESENT(AMI_KEYBOARD)) | 194 | if (!AMIGAHW_PRESENT(AMI_KEYBOARD)) |
197 | return -EIO; | 195 | return -EIO; |
@@ -214,14 +212,26 @@ static int __init amikbd_init(void) | |||
214 | amikbd_dev->id.version = 0x0100; | 212 | amikbd_dev->id.version = 0x0100; |
215 | 213 | ||
216 | amikbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 214 | amikbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
217 | amikbd_dev->keycode = amikbd_keycode; | ||
218 | amikbd_dev->keycodesize = sizeof(unsigned char); | ||
219 | amikbd_dev->keycodemax = ARRAY_SIZE(amikbd_keycode); | ||
220 | 215 | ||
221 | for (i = 0; i < 0x78; i++) | 216 | for (i = 0; i < 0x78; i++) |
222 | if (amikbd_keycode[i]) | 217 | set_bit(i, amikbd_dev->keybit); |
223 | set_bit(amikbd_keycode[i], amikbd_dev->keybit); | 218 | |
224 | 219 | for (i = 0; i < MAX_NR_KEYMAPS; i++) { | |
220 | static u_short temp_map[NR_KEYS] __initdata; | ||
221 | if (!key_maps[i]) | ||
222 | continue; | ||
223 | memset(temp_map, 0, sizeof(temp_map)); | ||
224 | for (j = 0; j < 0x78; j++) { | ||
225 | if (!amikbd_keycode[j]) | ||
226 | continue; | ||
227 | temp_map[j] = key_maps[i][amikbd_keycode[j]]; | ||
228 | } | ||
229 | for (j = 0; j < NR_KEYS; j++) { | ||
230 | if (!temp_map[j]) | ||
231 | temp_map[j] = 0xf200; | ||
232 | } | ||
233 | memcpy(key_maps[i], temp_map, sizeof(temp_map)); | ||
234 | } | ||
225 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ | 235 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ |
226 | request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt); | 236 | request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt); |
227 | 237 | ||