[parisc-linux-cvs] linux-2.5 deller
Helge Deller
deller@gmx.de
Thu, 29 May 2003 19:24:46 +0200
--Boundary-00=_eJk1+cczJn6PEPl
Content-Type: text/plain;
charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Thursday 29 May 2003 07:21 pm, Helge Deller wrote:
> CVSROOT: /var/cvs
> Module name: linux-2.5
> Changes by: deller 03/05/29 11:21:54
>
> Modified files:
> . : Makefile
> drivers/char : keyboard.c
> drivers/input/keyboard: hilkbd.c
> drivers/input/misc: gsc_ps2.c
>
> Log message:
> 2.5.70-pa3:
> - keyboard.c: fix keyboard keypad for HIL keyboards, enable VC_NUMLOCK by
> default - hilkbd.c: make this driver compile on 2.5.70, no hacks any
> longer, irqreturn_t fixes, use wait_event_interruptible_timeout() instead
> of stupid timeout, some other smaller cleanups -> this driver works now
> pretty well!
> - gsc_ps2.c: irqreturn_t fixes, use PCI_VENDOR_ID_HP as vendor
> identification
--Boundary-00=_eJk1+cczJn6PEPl
Content-Type: text/plain;
charset="iso-8859-15";
name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="diff"
Index: linux-2.5/Makefile
===================================================================
RCS file: /var/cvs/linux-2.5/Makefile,v
retrieving revision 1.115
diff -u -p -r1.115 Makefile
--- linux-2.5/Makefile 29 May 2003 06:45:08 -0000 1.115
+++ linux-2.5/Makefile 29 May 2003 17:17:18 -0000
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 5
SUBLEVEL = 70
-EXTRAVERSION = -pa2
+EXTRAVERSION = -pa3
# *DOCUMENTATION*
# To see a list of typical targets execute "make help"
Index: linux-2.5/drivers/char/keyboard.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/char/keyboard.c,v
retrieving revision 1.12
diff -u -p -r1.12 keyboard.c
--- linux-2.5/drivers/char/keyboard.c 27 May 2003 17:22:50 -0000 1.12
+++ linux-2.5/drivers/char/keyboard.c 29 May 2003 17:17:21 -0000
@@ -52,11 +52,13 @@ extern void ctrl_alt_del(void);
/*
* Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
- * This seems a good reason to start with NumLock off. On PC9800 however there
- * is no NumLock key and everyone expects the keypad to be used for numbers.
+ * This seems a good reason to start with NumLock off. On PC9800 and HIL keyboards
+ * of PARISC machines however there is no NumLock key and everyone expects the keypad
+ * to be used for numbers.
*/
-#ifdef CONFIG_X86_PC9800
+#if defined(CONFIG_X86_PC9800) || \
+ defined(CONFIG_PARISC) && (defined(CONFIG_KEYBOARD_HIL) || defined(CONFIG_KEYBOARD_HIL_OLD))
#define KBD_DEFLEDS (1 << VC_NUMLOCK)
#else
#define KBD_DEFLEDS 0
Index: linux-2.5/drivers/input/keyboard/hilkbd.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/input/keyboard/hilkbd.c,v
retrieving revision 1.1
diff -u -p -r1.1 hilkbd.c
--- linux-2.5/drivers/input/keyboard/hilkbd.c 7 Nov 2002 04:04:36 -0000 1.1
+++ linux-2.5/drivers/input/keyboard/hilkbd.c 29 May 2003 17:17:21 -0000
@@ -3,7 +3,7 @@
*
* Copyright (C) 1998 Philip Blundell <philb@gnu.org>
* Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai>
- * Copyright (C) 1999-2002 Helge Deller <deller@gmx.de>
+ * Copyright (C) 1999-2003 Helge Deller <deller@gmx.de>
*
* Very basic HP Human Interface Loop (HIL) driver.
* This driver handles the keyboard on HP300 (m68k) and on some
@@ -28,15 +28,15 @@
MODULE_AUTHOR("Philip Blundell, Matthew Wilcox, Helge Deller");
-MODULE_DESCRIPTION("HIL driver (basic functionality)");
-MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
+MODULE_DESCRIPTION("HIL keyboard driver (basic functionality)");
+MODULE_LICENSE("GPL v2");
#if defined(CONFIG_PARISC)
#include <asm/io.h>
#include <asm/hardware.h>
+ #include <asm/parisc-device.h>
static unsigned long hil_base; /* HPA for the HIL device */
static unsigned int hil_irq;
#define HILBASE hil_base /* HPPA (parisc) port address */
@@ -96,7 +96,8 @@ EXPORT_NO_SYMBOLS;
#define HIL_WRITELPCTRL 0xEB
-static unsigned char hil_kbd_set1[128] = {
+#define KBD_TBLSIZE 128
+static unsigned int hphilkeyb_keycode[KBD_TBLSIZE] = { /* set1 keycodes */
KEY_5, KEY_RESERVED, KEY_RIGHTALT, KEY_LEFTALT,
KEY_RIGHTSHIFT, KEY_LEFTSHIFT, KEY_LEFTCTRL, KEY_SYSRQ,
KEY_KP4, KEY_KP8, KEY_KP5, KEY_KP9,
@@ -104,7 +105,7 @@ static unsigned char hil_kbd_set1[128] =
KEY_KP1, KEY_KPSLASH, KEY_KP2, KEY_KPPLUS,
KEY_KP3, KEY_KPASTERISK, KEY_KP0, KEY_KPMINUS,
KEY_B, KEY_V, KEY_C, KEY_X,
- KEY_Z, KEY_UNKNOWN, KEY_RESERVED, KEY_ESC,
+ KEY_Z, KEY_RESERVED, KEY_RESERVED, KEY_ESC,
KEY_6, KEY_F10, KEY_3, KEY_F11,
KEY_KPDOT, KEY_F9, KEY_TAB /*KP*/, KEY_F12,
KEY_H, KEY_G, KEY_F, KEY_D,
@@ -126,8 +127,8 @@ static unsigned char hil_kbd_set1[128] =
KEY_J, KEY_K, KEY_L, KEY_SEMICOLON,
KEY_APOSTROPHE, KEY_ENTER, KEY_HOME, KEY_SCROLLUP,
KEY_M, KEY_COMMA, KEY_DOT, KEY_SLASH,
- KEY_RESERVED, KEY_OPEN/*Select*/,KEY_RESERVED,KEY_SCROLLDOWN/*KPNEXT*/,
- KEY_N, KEY_SPACE, KEY_SCROLLDOWN/*Next*/, KEY_UNKNOWN,
+ KEY_RESERVED, KEY_SELECT, KEY_RESERVED, KEY_NEXT,
+ KEY_N, KEY_SPACE, KEY_NEXT, KEY_RESERVED,
KEY_LEFT, KEY_DOWN, KEY_UP, KEY_RIGHT
};
@@ -160,7 +161,7 @@ static void poll_finished(void)
case 0x40:
down = (hil_dev.data[1] & 1) == 0;
scode = hil_dev.data[1] >> 1;
- key = hil_kbd_set1[scode & 0x7f];
+ key = hphilkeyb_keycode[scode & (KBD_TBLSIZE-1)];
input_report_key(&hil_dev.dev, key, down);
break;
}
@@ -195,7 +196,7 @@ static inline void handle_data(unsigned
/*
* Handle HIL interrupts.
*/
-static void hil_interrupt(int irq, void *handle, struct pt_regs *regs)
+static irqreturn_t hil_interrupt(int irq, void *handle, struct pt_regs *regs)
{
unsigned char s, c;
@@ -216,6 +217,7 @@ static void hil_interrupt(int irq, void
hil_dev.valid = 1;
break;
}
+ return IRQ_HANDLED;
}
/*
@@ -235,7 +237,7 @@ static void hil_do(unsigned char cmd, un
/* wait */;
hil_write_data(*(data++));
}
- spin_lock_irqrestore(&hil_dev.lock, flags);
+ spin_unlock_irqrestore(&hil_dev.lock, flags);
}
@@ -247,11 +249,11 @@ static int __init
hil_keyb_init(void)
{
unsigned char c;
- unsigned int i, kbid, n = 0;
+ unsigned int i, kbid;
+ wait_queue_head_t hil_wait;
- if (hil_dev.dev.idbus) {
- printk("HIL: already initialized\n");
- return -ENODEV;
+ if (hil_dev.dev.id.bustype) {
+ return -ENODEV; /* already initialized */
}
#if defined(CONFIG_HP300)
@@ -269,12 +271,11 @@ hil_keyb_init(void)
/* Look for keyboards */
hil_dev.valid = 0; /* clear any pending data */
hil_do(HIL_READKBDSADR, NULL, 0);
- while (!hil_dev.valid) {
- if (n++ > 100000) {
- printk(KERN_DEBUG "HIL: timed out, assuming no keyboard present.\n");
- break;
- }
- mb();
+
+ init_waitqueue_head(&hil_wait);
+ wait_event_interruptible_timeout(hil_wait, hil_dev.valid, 3*HZ);
+ if (!hil_dev.valid) {
+ printk(KERN_DEBUG "HIL: timed out, assuming no keyboard present.\n");
}
c = hil_dev.c;
@@ -291,34 +292,28 @@ hil_keyb_init(void)
c = 0;
hil_do(HIL_WRITEKBDSADR, &c, 1);
+ init_input_dev(&hil_dev.dev);
- /* register input interface */
+ for (i = 0; i < KBD_TBLSIZE; i++)
+ if (hphilkeyb_keycode[i] != KEY_RESERVED)
+ set_bit(hphilkeyb_keycode[i], hil_dev.dev.keybit);
+
+ hil_dev.dev.evbit[0] = BIT(EV_KEY);
+ hil_dev.dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL);
+ hil_dev.dev.keycodemax = KBD_TBLSIZE;
+ hil_dev.dev.keycodesize = sizeof(hphilkeyb_keycode[0]);
+ hil_dev.dev.keycode = hphilkeyb_keycode;
hil_dev.dev.name = "HIL keyboard";
- hil_dev.dev.idbus = BUS_HIL;
- hil_dev.dev.idvendor = PCI_VENDOR_ID_HP;
- hil_dev.dev.idproduct = 0x0001;
- hil_dev.dev.idversion = 0x0100;
-
- hil_dev.dev.evbit[0] |= BIT(EV_KEY);
- for (i = 0; i < 128; i++)
- set_bit(hil_kbd_set1[i], hil_dev.dev.keybit);
- clear_bit(0, hil_dev.dev.keybit);
-
-#if 1
- /* XXX: HACK !!!
- * remove this call if hp_psaux.c/hp_keyb.c is converted
- * to the input layer... */
- register_ps2_keybfuncs();
-#endif
-
- input_register_device(&hil_dev.dev);
- printk(KERN_INFO "input%d: %s on hil%d (id %d)\n",
- hil_dev.dev.number, hil_dev.dev.name, 0, kbid);
+ hil_dev.dev.phys = "hpkbd/input0";
- /* HIL keyboards don't have a numlock key,
- * simulate a up-down sequence of numlock to
- * make the keypad work at expected. */
- input_report_key(&hil_dev.dev, KEY_NUMLOCK, 1);
+ hil_dev.dev.id.bustype = BUS_HIL;
+ hil_dev.dev.id.vendor = PCI_VENDOR_ID_HP;
+ hil_dev.dev.id.product = 0x0001;
+ hil_dev.dev.id.version = 0x0010;
+
+ input_register_device(&hil_dev.dev);
+ printk(KERN_INFO "input: %s, ID %d at 0x%08lx (irq %d) found and attached\n",
+ hil_dev.dev.name, kbid, HILBASE, HIL_IRQ);
return 0;
}
@@ -328,7 +323,7 @@ static int __init
hil_init_chip(struct parisc_device *dev)
{
if (!dev->irq) {
- printk(KERN_WARNING "HIL: IRQ not found for HIL at 0x%lx\n", dev->hpa);
+ printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa);
return -ENODEV;
}
@@ -336,7 +331,7 @@ hil_init_chip(struct parisc_device *dev)
hil_irq = dev->irq;
hil_dev.dev_id = dev;
- printk(KERN_INFO "Found HIL at 0x%lx, IRQ %d\n", hil_base, hil_irq);
+ printk(KERN_INFO "Found HIL bus at 0x%08lx, IRQ %d\n", hil_base, hil_irq);
return hil_keyb_init();
}
Index: linux-2.5/drivers/input/misc/gsc_ps2.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/input/misc/gsc_ps2.c,v
retrieving revision 1.7
diff -u -p -r1.7 gsc_ps2.c
--- linux-2.5/drivers/input/misc/gsc_ps2.c 12 Mar 2003 15:53:18 -0000 1.7
+++ linux-2.5/drivers/input/misc/gsc_ps2.c 29 May 2003 17:17:21 -0000
@@ -58,6 +58,7 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/kd.h>
+#include <linux/pci_ids.h>
#include <asm/irq.h>
#include <asm/io.h>
@@ -427,7 +428,7 @@ static void gscps2_mouse_docode(struct p
* key value to the system.
*/
-static void gscps2_interrupt(int irq, void *dev, struct pt_regs *reg)
+static irqreturn_t gscps2_interrupt(int irq, void *dev, struct pt_regs *reg)
{
/* process mouse actions */
while (gscps2_readb_status(hpmouse.addr) & GSC_STAT_RBNE)
@@ -436,6 +437,8 @@ static void gscps2_interrupt(int irq, vo
/* process keyboard scancode */
while (gscps2_readb_status(hpkeyb.addr) & GSC_STAT_RBNE)
gscps2_kbd_docode(reg);
+
+ return IRQ_HANDLED;
}
@@ -532,7 +535,7 @@ static int __init gscps2_kbd_probe(void)
/* TODO These need some adjustement, are they really useful ? */
hpkeyb.dev.id.bustype = BUS_GSC;
- hpkeyb.dev.id.vendor = 0x0001;
+ hpkeyb.dev.id.vendor = PCI_VENDOR_ID_HP;
hpkeyb.dev.id.product = 0x0001;
hpkeyb.dev.id.version = 0x0010;
hpkeyb.initialized = 1;
--Boundary-00=_eJk1+cczJn6PEPl--