aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorMichael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>2007-05-01 16:32:38 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:05 -0400
commitc04cb856e20a8bf68762d60737b84328c1ab5900 (patch)
treec8046787b2fa708b0a5a0972444bac9df67fadff /drivers/input/mouse
parent3130d905ba86d5f2636b2f45d5beefe82cb03df6 (diff)
m68k: Atari keyboard and mouse support.
Atari keyboard and mouse support. (reformating and Kconfig fixes by Roman Zippel) Signed-off-by: Michael Schmitz <schmitz@debian.org> Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/Kconfig11
-rw-r--r--drivers/input/mouse/Makefile1
-rw-r--r--drivers/input/mouse/atarimouse.c160
3 files changed, 172 insertions, 0 deletions
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 35d998c3e57..b40784a60aa 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -96,6 +96,17 @@ config MOUSE_AMIGA
96 To compile this driver as a module, choose M here: the 96 To compile this driver as a module, choose M here: the
97 module will be called amimouse. 97 module will be called amimouse.
98 98
99config MOUSE_ATARI
100 tristate "Atari mouse"
101 depends on ATARI
102 select ATARI_KBD_CORE
103 help
104 Say Y here if you have an Atari and want its native mouse
105 supported by the kernel.
106
107 To compile this driver as a module, choose M here: the
108 module will be called atarimouse.
109
99config MOUSE_RISCPC 110config MOUSE_RISCPC
100 tristate "Acorn RiscPC mouse" 111 tristate "Acorn RiscPC mouse"
101 depends on ARCH_ACORN 112 depends on ARCH_ACORN
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile
index 21a1de61a79..700f61200df 100644
--- a/drivers/input/mouse/Makefile
+++ b/drivers/input/mouse/Makefile
@@ -5,6 +5,7 @@
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o 7obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o
8obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o
8obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o 9obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o
9obj-$(CONFIG_MOUSE_INPORT) += inport.o 10obj-$(CONFIG_MOUSE_INPORT) += inport.o
10obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o 11obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
new file mode 100644
index 00000000000..43ab6566fb6
--- /dev/null
+++ b/drivers/input/mouse/atarimouse.c
@@ -0,0 +1,160 @@
1/*
2 * Atari mouse driver for Linux/m68k
3 *
4 * Copyright (c) 2005 Michael Schmitz
5 *
6 * Based on:
7 * Amiga mouse driver for Linux/m68k
8 *
9 * Copyright (c) 2000-2002 Vojtech Pavlik
10 *
11 */
12/*
13 * The low level init and interrupt stuff is handled in arch/mm68k/atari/atakeyb.c
14 * (the keyboard ACIA also handles the mouse and joystick data, and the keyboard
15 * interrupt is shared with the MIDI ACIA so MIDI data also get handled there).
16 * This driver only deals with handing key events off to the input layer.
17 *
18 * Largely based on the old:
19 *
20 * Atari Mouse Driver for Linux
21 * by Robert de Vries (robert@and.nl) 19Jul93
22 *
23 * 16 Nov 1994 Andreas Schwab
24 * Compatibility with busmouse
25 * Support for three button mouse (shamelessly stolen from MiNT)
26 * third button wired to one of the joystick directions on joystick 1
27 *
28 * 1996/02/11 Andreas Schwab
29 * Module support
30 * Allow multiple open's
31 *
32 * Converted to use new generic busmouse code. 5 Apr 1998
33 * Russell King <rmk@arm.uk.linux.org>
34 */
35
36
37/*
38 * This program is free software; you can redistribute it and/or modify it
39 * under the terms of the GNU General Public License version 2 as published by
40 * the Free Software Foundation
41 */
42
43#include <linux/module.h>
44#include <linux/init.h>
45#include <linux/input.h>
46#include <linux/interrupt.h>
47
48#include <asm/irq.h>
49#include <asm/setup.h>
50#include <asm/system.h>
51#include <asm/uaccess.h>
52#include <asm/atarihw.h>
53#include <asm/atarikb.h>
54#include <asm/atariints.h>
55
56MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
57MODULE_DESCRIPTION("Atari mouse driver");
58MODULE_LICENSE("GPL");
59
60static int mouse_threshold[2] = {2,2};
61
62#ifdef __MODULE__
63MODULE_PARM(mouse_threshold, "2i");
64#endif
65#ifdef FIXED_ATARI_JOYSTICK
66extern int atari_mouse_buttons;
67#endif
68static int atamouse_used = 0;
69
70static struct input_dev *atamouse_dev;
71
72static void atamouse_interrupt(char *buf)
73{
74 int buttons, dx, dy;
75
76/* ikbd_mouse_disable(); */
77
78 buttons = (buf[0] & 1) | ((buf[0] & 2) << 1);
79#ifdef FIXED_ATARI_JOYSTICK
80 buttons |= atari_mouse_buttons & 2;
81 atari_mouse_buttons = buttons;
82#endif
83/* ikbd_mouse_rel_pos(); */
84
85 /* only relative events get here */
86 dx = buf[1];
87 dy = -buf[2];
88
89 input_report_rel(atamouse_dev, REL_X, dx);
90 input_report_rel(atamouse_dev, REL_Y, dy);
91
92 input_report_key(atamouse_dev, BTN_LEFT, buttons & 0x1);
93 input_report_key(atamouse_dev, BTN_MIDDLE, buttons & 0x2);
94 input_report_key(atamouse_dev, BTN_RIGHT, buttons & 0x4);
95
96 input_sync(atamouse_dev);
97
98 return;
99}
100
101static int atamouse_open(struct input_dev *dev)
102{
103 if (atamouse_used++)
104 return 0;
105
106#ifdef FIXED_ATARI_JOYSTICK
107 atari_mouse_buttons = 0;
108#endif
109 ikbd_mouse_y0_top();
110 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]);
111 ikbd_mouse_rel_pos();
112 atari_input_mouse_interrupt_hook = atamouse_interrupt;
113 return 0;
114}
115
116static void atamouse_close(struct input_dev *dev)
117{
118 if (!--atamouse_used) {
119 ikbd_mouse_disable();
120 atari_mouse_interrupt_hook = NULL;
121 }
122}
123
124static int __init atamouse_init(void)
125{
126 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
127 return -ENODEV;
128
129 if (!(atamouse_dev = input_allocate_device()))
130 return -ENOMEM;
131
132 if (!(atari_keyb_init()))
133 return -ENODEV;
134
135 atamouse_dev->name = "Atari mouse";
136 atamouse_dev->phys = "atamouse/input0";
137 atamouse_dev->id.bustype = BUS_ATARI;
138 atamouse_dev->id.vendor = 0x0001;
139 atamouse_dev->id.product = 0x0002;
140 atamouse_dev->id.version = 0x0100;
141
142 atamouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
143 atamouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
144 atamouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
145 atamouse_dev->open = atamouse_open;
146 atamouse_dev->close = atamouse_close;
147
148 input_register_device(atamouse_dev);
149
150 printk(KERN_INFO "input: %s at keyboard ACIA\n", atamouse_dev->name);
151 return 0;
152}
153
154static void __exit atamouse_exit(void)
155{
156 input_unregister_device(atamouse_dev);
157}
158
159module_init(atamouse_init);
160module_exit(atamouse_exit);