public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: zippel@linux-m68k.org
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 07/11] restore amikbd compatibility with 2.4
Date: Thu, 25 May 2006 02:27:49 +0200	[thread overview]
Message-ID: <20060525003421.958272000@linux-m68k.org> (raw)
In-Reply-To: 20060525002742.723577000@linux-m68k.org

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>

---

 drivers/input/keyboard/amikbd.c |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

Index: linux-2.6-mm/drivers/input/keyboard/amikbd.c
===================================================================
--- linux-2.6-mm.orig/drivers/input/keyboard/amikbd.c
+++ linux-2.6-mm/drivers/input/keyboard/amikbd.c
@@ -36,6 +36,7 @@
 #include <linux/input.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/keyboard.h>
 
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
@@ -45,7 +46,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@u
 MODULE_DESCRIPTION("Amiga keyboard driver");
 MODULE_LICENSE("GPL");
 
-static unsigned char amikbd_keycode[0x78] = {
+static unsigned char amikbd_keycode[0x78] __initdata = {
 	[0]	 = KEY_GRAVE,
 	[1]	 = KEY_1,
 	[2]	 = KEY_2,
@@ -170,12 +171,9 @@ static irqreturn_t amikbd_interrupt(int 
 	scancode >>= 1;
 
 	if (scancode < 0x78) {		/* scancodes < 0x78 are keys */
-
-		scancode = amikbd_keycode[scancode];
-
 		input_regs(amikbd_dev, fp);
 
-		if (scancode == KEY_CAPSLOCK) {	/* CapsLock is a toggle switch key on Amiga */
+		if (scancode == 98) {	/* CapsLock is a toggle switch key on Amiga */
 			input_report_key(amikbd_dev, scancode, 1);
 			input_report_key(amikbd_dev, scancode, 0);
 		} else {
@@ -191,7 +189,7 @@ static irqreturn_t amikbd_interrupt(int 
 
 static int __init amikbd_init(void)
 {
-	int i;
+	int i, j;
 
 	if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
 		return -EIO;
@@ -214,14 +212,26 @@ static int __init amikbd_init(void)
 	amikbd_dev->id.version = 0x0100;
 
 	amikbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
-	amikbd_dev->keycode = amikbd_keycode;
-	amikbd_dev->keycodesize = sizeof(unsigned char);
-	amikbd_dev->keycodemax = ARRAY_SIZE(amikbd_keycode);
 
 	for (i = 0; i < 0x78; i++)
-		if (amikbd_keycode[i])
-			set_bit(amikbd_keycode[i], amikbd_dev->keybit);
+		set_bit(i, amikbd_dev->keybit);
 
+	for (i = 0; i < MAX_NR_KEYMAPS; i++) {
+		static u_short temp_map[NR_KEYS] __initdata;
+		if (!key_maps[i])
+			continue;
+		memset(temp_map, 0, sizeof(temp_map));
+		for (j = 0; j < 0x78; j++) {
+			if (!amikbd_keycode[j])
+				continue;
+			temp_map[j] = key_maps[i][amikbd_keycode[j]];
+		}
+		for (j = 0; j < NR_KEYS; j++) {
+			if (!temp_map[j])
+				temp_map[j] = 0xf200;
+		}
+		memcpy(key_maps[i], temp_map, sizeof(temp_map));
+	}
 	ciaa.cra &= ~0x41;	 /* serial data in, turn off TA */
 	request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt);
 

--


  parent reply	other threads:[~2006-05-25  1:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-25  0:27 [PATCH 00/11] various m68k patches zippel
2006-05-25  0:27 ` [PATCH 01/11] completely initialize hw_regs_t in ide_setup_ports zippel
2006-05-25  0:27 ` [PATCH 02/11] atyfb_base compile fix for CONFIG_PCI=n zippel
2006-05-25  1:33   ` Andrew Morton
2006-05-25  4:07     ` Greg KH
2006-05-25  4:28       ` Andrew Morton
2006-05-30 12:21       ` Roman Zippel
2006-05-25  0:27 ` [PATCH 03/11] cleanup unistd.h zippel
2006-05-25  0:27 ` [PATCH 04/11] Remove some unused definitions in zorro.h zippel
2006-05-25  0:27 ` [PATCH 05/11] use c99 initializer zippel
2006-05-25  0:27 ` [PATCH 06/11] print correct stack trace zippel
2006-05-25  0:27 ` zippel [this message]
2006-05-25  1:36   ` [PATCH 07/11] restore amikbd compatibility with 2.4 Andrew Morton
2006-05-25  1:50     ` Roman Zippel
2006-05-25  0:27 ` [PATCH 08/11] extra delay zippel
2006-05-25  0:27 ` [PATCH 09/11] use proper defines for zone initialization zippel
2006-05-25  0:27 ` [PATCH 10/11] adjust to changed HARDIRQ_MASK zippel
2006-05-25  0:27 ` [PATCH 11/11] m68k mac VIA2 fixes and cleanups zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060525003421.958272000@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox