diff options
author | Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de> | 2007-05-01 16:32:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 20:59:05 -0400 |
commit | c04cb856e20a8bf68762d60737b84328c1ab5900 (patch) | |
tree | c8046787b2fa708b0a5a0972444bac9df67fadff /drivers/input/keyboard | |
parent | 3130d905ba86d5f2636b2f45d5beefe82cb03df6 (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/keyboard')
-rw-r--r-- | drivers/input/keyboard/Kconfig | 11 | ||||
-rw-r--r-- | drivers/input/keyboard/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/keyboard/atakbd.c | 134 |
3 files changed, 146 insertions, 0 deletions
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index f17e9c7d4b36..c845d5c4cbba 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -164,6 +164,17 @@ config KEYBOARD_AMIGA | |||
164 | To compile this driver as a module, choose M here: the | 164 | To compile this driver as a module, choose M here: the |
165 | module will be called amikbd. | 165 | module will be called amikbd. |
166 | 166 | ||
167 | config KEYBOARD_ATARI | ||
168 | tristate "Atari keyboard" | ||
169 | depends on ATARI | ||
170 | select ATARI_KBD_CORE | ||
171 | help | ||
172 | Say Y here if you are running Linux on any Atari and have a keyboard | ||
173 | attached. | ||
174 | |||
175 | To compile this driver as a module, choose M here: the | ||
176 | module will be called atakbd. | ||
177 | |||
167 | config KEYBOARD_HIL_OLD | 178 | config KEYBOARD_HIL_OLD |
168 | tristate "HP HIL keyboard support (simple driver)" | 179 | tristate "HP HIL keyboard support (simple driver)" |
169 | depends on GSC || HP300 | 180 | depends on GSC || HP300 |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 586a0fe53be6..7aa59ee5a0b6 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -9,6 +9,7 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | |||
9 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | 9 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o |
10 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | 10 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o |
11 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o | 11 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o |
12 | obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o | ||
12 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | 13 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o |
13 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o | 14 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o |
14 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | 15 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o |
diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c new file mode 100644 index 000000000000..ded1d6ac6ff3 --- /dev/null +++ b/drivers/input/keyboard/atakbd.c | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * atakbd.c | ||
3 | * | ||
4 | * Copyright (c) 2005 Michael Schmitz | ||
5 | * | ||
6 | * Based on amikbd.c, which is | ||
7 | * | ||
8 | * Copyright (c) 2000-2001 Vojtech Pavlik | ||
9 | * | ||
10 | * Based on the work of: | ||
11 | * Hamish Macdonald | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * Atari keyboard driver for Linux/m68k | ||
16 | * | ||
17 | * The low level init and interrupt stuff is handled in arch/mm68k/atari/atakeyb.c | ||
18 | * (the keyboard ACIA also handles the mouse and joystick data, and the keyboard | ||
19 | * interrupt is shared with the MIDI ACIA so MIDI data also get handled there). | ||
20 | * This driver only deals with handing key events off to the input layer. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * This program is free software; you can redistribute it and/or modify | ||
25 | * it under the terms of the GNU General Public License as published by | ||
26 | * the Free Software Foundation; either version 2 of the License, or | ||
27 | * (at your option) any later version. | ||
28 | * | ||
29 | * This program is distributed in the hope that it will be useful, | ||
30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
32 | * GNU General Public License for more details. | ||
33 | * | ||
34 | * You should have received a copy of the GNU General Public License | ||
35 | * along with this program; if not, write to the Free Software | ||
36 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
37 | * | ||
38 | * Should you need to contact me, the author, you can do so either by | ||
39 | * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: | ||
40 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | ||
41 | */ | ||
42 | |||
43 | #include <linux/module.h> | ||
44 | #include <linux/init.h> | ||
45 | #include <linux/input.h> | ||
46 | #include <linux/delay.h> | ||
47 | #include <linux/interrupt.h> | ||
48 | |||
49 | #include <asm/atariints.h> | ||
50 | #include <asm/atarihw.h> | ||
51 | #include <asm/atarikb.h> | ||
52 | #include <asm/irq.h> | ||
53 | |||
54 | MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>"); | ||
55 | MODULE_DESCRIPTION("Atari keyboard driver"); | ||
56 | MODULE_LICENSE("GPL"); | ||
57 | |||
58 | static unsigned char atakbd_keycode[0x72]; | ||
59 | |||
60 | static struct input_dev *atakbd_dev; | ||
61 | |||
62 | static void atakbd_interrupt(unsigned char scancode, char down) | ||
63 | { | ||
64 | |||
65 | if (scancode < 0x72) { /* scancodes < 0xf2 are keys */ | ||
66 | |||
67 | // report raw events here? | ||
68 | |||
69 | scancode = atakbd_keycode[scancode]; | ||
70 | |||
71 | if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */ | ||
72 | input_report_key(atakbd_dev, scancode, 1); | ||
73 | input_report_key(atakbd_dev, scancode, 0); | ||
74 | input_sync(atakbd_dev); | ||
75 | } else { | ||
76 | input_report_key(atakbd_dev, scancode, down); | ||
77 | input_sync(atakbd_dev); | ||
78 | } | ||
79 | } else /* scancodes >= 0xf2 are mouse data, most likely */ | ||
80 | printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode); | ||
81 | |||
82 | return; | ||
83 | } | ||
84 | |||
85 | static int __init atakbd_init(void) | ||
86 | { | ||
87 | int i; | ||
88 | |||
89 | if (!ATARIHW_PRESENT(ST_MFP)) | ||
90 | return -EIO; | ||
91 | |||
92 | // TODO: request_mem_region if not done in arch code | ||
93 | |||
94 | if (!(atakbd_dev = input_allocate_device())) | ||
95 | return -ENOMEM; | ||
96 | |||
97 | // need to init core driver if not already done so | ||
98 | if (atari_keyb_init()) | ||
99 | return -ENODEV; | ||
100 | |||
101 | atakbd_dev->name = "Atari Keyboard"; | ||
102 | atakbd_dev->phys = "atakbd/input0"; | ||
103 | atakbd_dev->id.bustype = BUS_ATARI; | ||
104 | atakbd_dev->id.vendor = 0x0001; | ||
105 | atakbd_dev->id.product = 0x0001; | ||
106 | atakbd_dev->id.version = 0x0100; | ||
107 | |||
108 | atakbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | ||
109 | atakbd_dev->keycode = atakbd_keycode; | ||
110 | atakbd_dev->keycodesize = sizeof(unsigned char); | ||
111 | atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode); | ||
112 | |||
113 | for (i = 1; i < 0x72; i++) { | ||
114 | atakbd_keycode[i] = i; | ||
115 | set_bit(atakbd_keycode[i], atakbd_dev->keybit); | ||
116 | } | ||
117 | |||
118 | input_register_device(atakbd_dev); | ||
119 | |||
120 | atari_input_keyboard_interrupt_hook = atakbd_interrupt; | ||
121 | |||
122 | printk(KERN_INFO "input: %s at IKBD ACIA\n", atakbd_dev->name); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void __exit atakbd_exit(void) | ||
128 | { | ||
129 | atari_input_keyboard_interrupt_hook = NULL; | ||
130 | input_unregister_device(atakbd_dev); | ||
131 | } | ||
132 | |||
133 | module_init(atakbd_init); | ||
134 | module_exit(atakbd_exit); | ||