Commit c04cb856 authored by Michael Schmitz's avatar Michael Schmitz Committed by Linus Torvalds

m68k: Atari keyboard and mouse support.

Atari keyboard and mouse support.
(reformating and Kconfig fixes by Roman Zippel)
Signed-off-by: default avatarMichael Schmitz <schmitz@debian.org>
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3130d905
...@@ -409,6 +409,9 @@ config STRAM_PROC ...@@ -409,6 +409,9 @@ config STRAM_PROC
help help
Say Y here to report ST-RAM usage statistics in /proc/stram. Say Y here to report ST-RAM usage statistics in /proc/stram.
config ATARI_KBD_CORE
bool
config HEARTBEAT config HEARTBEAT
bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
......
...@@ -8,3 +8,4 @@ obj-y := config.o time.o debug.o ataints.o stdma.o \ ...@@ -8,3 +8,4 @@ obj-y := config.o time.o debug.o ataints.o stdma.o \
ifeq ($(CONFIG_PCI),y) ifeq ($(CONFIG_PCI),y)
obj-$(CONFIG_HADES) += hades-pci.o obj-$(CONFIG_HADES) += hades-pci.o
endif endif
obj-$(CONFIG_ATARI_KBD_CORE) += atakeyb.o
This diff is collapsed.
...@@ -164,6 +164,17 @@ config KEYBOARD_AMIGA ...@@ -164,6 +164,17 @@ config KEYBOARD_AMIGA
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called amikbd. module will be called amikbd.
config KEYBOARD_ATARI
tristate "Atari keyboard"
depends on ATARI
select ATARI_KBD_CORE
help
Say Y here if you are running Linux on any Atari and have a keyboard
attached.
To compile this driver as a module, choose M here: the
module will be called atakbd.
config KEYBOARD_HIL_OLD config KEYBOARD_HIL_OLD
tristate "HP HIL keyboard support (simple driver)" tristate "HP HIL keyboard support (simple driver)"
depends on GSC || HP300 depends on GSC || HP300
......
...@@ -9,6 +9,7 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o ...@@ -9,6 +9,7 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o
obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o
obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o
obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o
obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o
......
/*
* atakbd.c
*
* Copyright (c) 2005 Michael Schmitz
*
* Based on amikbd.c, which is
*
* Copyright (c) 2000-2001 Vojtech Pavlik
*
* Based on the work of:
* Hamish Macdonald
*/
/*
* Atari keyboard driver for Linux/m68k
*
* The low level init and interrupt stuff is handled in arch/mm68k/atari/atakeyb.c
* (the keyboard ACIA also handles the mouse and joystick data, and the keyboard
* interrupt is shared with the MIDI ACIA so MIDI data also get handled there).
* This driver only deals with handing key events off to the input layer.
*/
/*
* 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
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
#include <asm/atarikb.h>
#include <asm/irq.h>
MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
MODULE_DESCRIPTION("Atari keyboard driver");
MODULE_LICENSE("GPL");
static unsigned char atakbd_keycode[0x72];
static struct input_dev *atakbd_dev;
static void atakbd_interrupt(unsigned char scancode, char down)
{
if (scancode < 0x72) { /* scancodes < 0xf2 are keys */
// report raw events here?
scancode = atakbd_keycode[scancode];
if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */
input_report_key(atakbd_dev, scancode, 1);
input_report_key(atakbd_dev, scancode, 0);
input_sync(atakbd_dev);
} else {
input_report_key(atakbd_dev, scancode, down);
input_sync(atakbd_dev);
}
} else /* scancodes >= 0xf2 are mouse data, most likely */
printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode);
return;
}
static int __init atakbd_init(void)
{
int i;
if (!ATARIHW_PRESENT(ST_MFP))
return -EIO;
// TODO: request_mem_region if not done in arch code
if (!(atakbd_dev = input_allocate_device()))
return -ENOMEM;
// need to init core driver if not already done so
if (atari_keyb_init())
return -ENODEV;
atakbd_dev->name = "Atari Keyboard";
atakbd_dev->phys = "atakbd/input0";
atakbd_dev->id.bustype = BUS_ATARI;
atakbd_dev->id.vendor = 0x0001;
atakbd_dev->id.product = 0x0001;
atakbd_dev->id.version = 0x0100;
atakbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
atakbd_dev->keycode = atakbd_keycode;
atakbd_dev->keycodesize = sizeof(unsigned char);
atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode);
for (i = 1; i < 0x72; i++) {
atakbd_keycode[i] = i;
set_bit(atakbd_keycode[i], atakbd_dev->keybit);
}
input_register_device(atakbd_dev);
atari_input_keyboard_interrupt_hook = atakbd_interrupt;
printk(KERN_INFO "input: %s at IKBD ACIA\n", atakbd_dev->name);
return 0;
}
static void __exit atakbd_exit(void)
{
atari_input_keyboard_interrupt_hook = NULL;
input_unregister_device(atakbd_dev);
}
module_init(atakbd_init);
module_exit(atakbd_exit);
...@@ -96,6 +96,17 @@ config MOUSE_AMIGA ...@@ -96,6 +96,17 @@ config MOUSE_AMIGA
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called amimouse. module will be called amimouse.
config MOUSE_ATARI
tristate "Atari mouse"
depends on ATARI
select ATARI_KBD_CORE
help
Say Y here if you have an Atari and want its native mouse
supported by the kernel.
To compile this driver as a module, choose M here: the
module will be called atarimouse.
config MOUSE_RISCPC config MOUSE_RISCPC
tristate "Acorn RiscPC mouse" tristate "Acorn RiscPC mouse"
depends on ARCH_ACORN depends on ARCH_ACORN
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# Each configuration option enables a list of files. # Each configuration option enables a list of files.
obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o
obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o
obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o
obj-$(CONFIG_MOUSE_INPORT) += inport.o obj-$(CONFIG_MOUSE_INPORT) += inport.o
obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o
......
/*
* Atari mouse driver for Linux/m68k
*
* Copyright (c) 2005 Michael Schmitz
*
* Based on:
* Amiga mouse driver for Linux/m68k
*
* Copyright (c) 2000-2002 Vojtech Pavlik
*
*/
/*
* The low level init and interrupt stuff is handled in arch/mm68k/atari/atakeyb.c
* (the keyboard ACIA also handles the mouse and joystick data, and the keyboard
* interrupt is shared with the MIDI ACIA so MIDI data also get handled there).
* This driver only deals with handing key events off to the input layer.
*
* Largely based on the old:
*
* Atari Mouse Driver for Linux
* by Robert de Vries (robert@and.nl) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Compatibility with busmouse
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*
* 1996/02/11 Andreas Schwab
* Module support
* Allow multiple open's
*
* Converted to use new generic busmouse code. 5 Apr 1998
* Russell King <rmk@arm.uk.linux.org>
*/
/*
* 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>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/atarihw.h>
#include <asm/atarikb.h>
#include <asm/atariints.h>
MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
MODULE_DESCRIPTION("Atari mouse driver");
MODULE_LICENSE("GPL");
static int mouse_threshold[2] = {2,2};
#ifdef __MODULE__
MODULE_PARM(mouse_threshold, "2i");
#endif
#ifdef FIXED_ATARI_JOYSTICK
extern int atari_mouse_buttons;
#endif
static int atamouse_used = 0;
static struct input_dev *atamouse_dev;
static void atamouse_interrupt(char *buf)
{
int buttons, dx, dy;
/* ikbd_mouse_disable(); */
buttons = (buf[0] & 1) | ((buf[0] & 2) << 1);
#ifdef FIXED_ATARI_JOYSTICK
buttons |= atari_mouse_buttons & 2;
atari_mouse_buttons = buttons;
#endif
/* ikbd_mouse_rel_pos(); */
/* only relative events get here */
dx = buf[1];
dy = -buf[2];
input_report_rel(atamouse_dev, REL_X, dx);
input_report_rel(atamouse_dev, REL_Y, dy);
input_report_key(atamouse_dev, BTN_LEFT, buttons & 0x1);
input_report_key(atamouse_dev, BTN_MIDDLE, buttons & 0x2);
input_report_key(atamouse_dev, BTN_RIGHT, buttons & 0x4);
input_sync(atamouse_dev);
return;
}
static int atamouse_open(struct input_dev *dev)
{
if (atamouse_used++)
return 0;
#ifdef FIXED_ATARI_JOYSTICK
atari_mouse_buttons = 0;
#endif
ikbd_mouse_y0_top();
ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]);
ikbd_mouse_rel_pos();
atari_input_mouse_interrupt_hook = atamouse_interrupt;
return 0;
}
static void atamouse_close(struct input_dev *dev)
{
if (!--atamouse_used) {
ikbd_mouse_disable();
atari_mouse_interrupt_hook = NULL;
}
}
static int __init atamouse_init(void)
{
if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
return -ENODEV;
if (!(atamouse_dev = input_allocate_device()))
return -ENOMEM;
if (!(atari_keyb_init()))
return -ENODEV;
atamouse_dev->name = "Atari mouse";
atamouse_dev->phys = "atamouse/input0";
atamouse_dev->id.bustype = BUS_ATARI;
atamouse_dev->id.vendor = 0x0001;
atamouse_dev->id.product = 0x0002;
atamouse_dev->id.version = 0x0100;
atamouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
atamouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
atamouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
atamouse_dev->open = atamouse_open;
atamouse_dev->close = atamouse_close;
input_register_device(atamouse_dev);
printk(KERN_INFO "input: %s at keyboard ACIA\n", atamouse_dev->name);
return 0;
}
static void __exit atamouse_exit(void)
{
input_unregister_device(atamouse_dev);
}
module_init(atamouse_init);
module_exit(atamouse_exit);
...@@ -36,5 +36,11 @@ void ikbd_joystick_disable(void); ...@@ -36,5 +36,11 @@ void ikbd_joystick_disable(void);
extern void (*atari_MIDI_interrupt_hook) (void); extern void (*atari_MIDI_interrupt_hook) (void);
/* Hook for mouse driver */ /* Hook for mouse driver */
extern void (*atari_mouse_interrupt_hook) (char *); extern void (*atari_mouse_interrupt_hook) (char *);
/* Hook for keyboard inputdev driver */
extern void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
/* Hook for mouse inputdev driver */
extern void (*atari_input_mouse_interrupt_hook) (char *);
int atari_keyb_init(void);
#endif /* _LINUX_ATARIKB_H */ #endif /* _LINUX_ATARIKB_H */
...@@ -676,6 +676,7 @@ struct input_absinfo { ...@@ -676,6 +676,7 @@ struct input_absinfo {
#define BUS_I2C 0x18 #define BUS_I2C 0x18
#define BUS_HOST 0x19 #define BUS_HOST 0x19
#define BUS_GSC 0x1A #define BUS_GSC 0x1A
#define BUS_ATARI 0x1B
/* /*
* Values describing the status of a force-feedback effect * Values describing the status of a force-feedback effect
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment