summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Pavlik <vojtech@twilight.ucw.cz>2002-07-08 16:59:44 +0200
committerVojtech Pavlik <vojtech@twilight.ucw.cz>2002-07-08 16:59:44 +0200
commitf076d8e8dd3568472bcc613794c40e8137c2f6fd (patch)
treed8509441ab7d33605fb578ed1349800cab7c9c10
parent476627b580b144d433351ade8c49d4add29f91c0 (diff)
Fixes (to make it compile), cleanups (in comments) for Amiga and
Acorn RiscPC mice.
-rw-r--r--drivers/input/mouse/amimouse.c38
-rw-r--r--drivers/input/mouse/rpcmouse.c59
2 files changed, 31 insertions, 66 deletions
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c
index 819d96827187..60acbca5332b 100644
--- a/drivers/input/mouse/amimouse.c
+++ b/drivers/input/mouse/amimouse.c
@@ -1,38 +1,20 @@
/*
- * $Id: amimouse.c,v 1.9 2001/09/25 10:12:07 vojtech Exp $
+ * Amiga mouse driver for Linux/m68k
*
- * Copyright (c) 2000-2001 Vojtech Pavlik
+ * Copyright (c) 2000-2002 Vojtech Pavlik
*
* Based on the work of:
* Michael Rausch James Banks
* Matther Dillon David Giller
* Nathan Laredo Linus Torvalds
* Johan Myreen Jes Sorensen
- * Russel King
+ * Russell King
*/
/*
- * Amiga mouse driver for Linux/m68k
- */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
- * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation
*/
#include <linux/module.h>
@@ -70,10 +52,10 @@ static void amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp)
dx = nx - amimouse_lastx;
dy = ny - amimouse_lasty;
- if (dx < -127) dx = (256 + nx) - lastx;
- if (dx > 127) dx = (nx - 256) - lastx;
- if (dy < -127) dy = (256 + ny) - lasty;
- if (dy > 127) dy = (ny - 256) - lasty;
+ if (dx < -127) dx = (256 + nx) - amimouse_lastx;
+ if (dx > 127) dx = (nx - 256) - amimouse_lastx;
+ if (dy < -127) dy = (256 + ny) - amimouse_lasty;
+ if (dy > 127) dy = (ny - 256) - amimouse_lasty;
amimouse_lastx = nx;
amimouse_lasty = ny;
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c
index 04d16de5defc..b330e9804787 100644
--- a/drivers/input/mouse/rpcmouse.c
+++ b/drivers/input/mouse/rpcmouse.c
@@ -1,37 +1,22 @@
/*
- * $Id: rpcmouse.c,v 1.11 2001/09/25 10:12:07 vojtech Exp $
+ * Acorn RiscPC mouse driver for Linux/ARM
*
- * Copyright (c) 2000-2001 Vojtech Pavlik
+ * Copyright (c) 2000-2002 Vojtech Pavlik
+ * Copyright (C) 1996-1998 Russell King
*
- * Based on the work of:
- * Russel King
*/
/*
- * Acorn RiscPC mouse driver for Linux/ARM
- */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
- * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ * This handles the Acorn RiscPCs mouse. We basically have a couple of
+ * hardware registers that track the sensor count for the X-Y movement and
+ * another register holding the button state. On every VSYNC interrupt we read
+ * the complete state and then work out if something has changed.
*/
-
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/ptrace.h>
@@ -41,14 +26,12 @@
#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/io.h>
-#include <asm/iomd.h>
+#include <asm/hardware/iomd.h>
-MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
+MODULE_AUTHOR("Vojtech Pavlik, Russell King");
MODULE_DESCRIPTION("Acorn RiscPC mouse driver");
MODULE_LICENSE("GPL");
-#define IOMD_MOUSEBTN 0x800C4000
-
static short rpcmouse_lastx, rpcmouse_lasty;
static struct input_dev rpcmouse_dev = {
@@ -67,9 +50,9 @@ static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
{
short x, y, dx, dy, b;
- x = (short) inl(IOMD_MOUSEX);
- y = (short) inl(IOMD_MOUSEY);
- b = (short) inl(IOMD_MOUSEBTN);
+ x = (short) iomd_readl(IOMD_MOUSEX);
+ y = (short) iomd_readl(IOMD_MOUSEY);
+ b = (short) (__raw_readl(0xe0310000) >> 4) & 7;
dx = x - rpcmouse_lastx;
dy = y - rpcmouse_lasty;
@@ -80,15 +63,15 @@ static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
input_report_rel(&rpcmouse_dev, REL_X, dx);
input_report_rel(&rpcmouse_dev, REL_Y, dy);
- input_report_key(&amimouse_dev, BTN_LEFT, buttons & 0x10);
- input_report_key(&amimouse_dev, BTN_MIDDLE, buttons & 0x20);
- input_report_key(&amimouse_dev, BTN_RIGHT, buttons & 0x40);
+ input_report_key(&rpcmouse_dev, BTN_LEFT, buttons & 0x10);
+ input_report_key(&rpcmouse_dev, BTN_MIDDLE, buttons & 0x20);
+ input_report_key(&rpcmouse_dev, BTN_RIGHT, buttons & 0x40);
}
static int __init rpcmouse_init(void)
{
- rpcmouse_lastx = (short) inl(IOMD_MOUSEX);
- rpcmouse_lasty = (short) inl(IOMD_MOUSEY);
+ rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX);
+ rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY);
if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, SA_SHIRQ, "rpcmouse", NULL)) {
printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n");
@@ -96,7 +79,7 @@ static int __init rpcmouse_init(void)
}
input_register_device(&rpcmouse_dev);
- printk(KERN_INFO "input%d: Acorn RiscPC mouse irq %d", IRQ_VSYNCPULSE);
+ printk(KERN_INFO "input: Acorn RiscPC mouse irq %d", IRQ_VSYNCPULSE);
return 0;
}