Commit 56107ff8 authored by Vojtech Pavlik's avatar Vojtech Pavlik

Manual merge

parents 1a8fca91 04dccf6f
......@@ -73,6 +73,7 @@ restrictions referred to are that the relevant option is valid if:
SWSUSP Software suspension is enabled.
TS Appropriate touchscreen support is enabled.
USB USB support is enabled.
USBHID USB Human Interface Device support is enabled.
V4L Video For Linux support is enabled.
VGA The VGA console has been enabled.
VT Virtual terminal support is enabled.
......@@ -514,11 +515,14 @@ running once the system is up.
i8042.dumbkbd [HW] Pretend that controlled can only read data from
keyboard and can not control its state
(Don't attempt to blink the leds)
i8042.noacpi [HW] Don't use ACPI to discover KBD/AUX controller
settings
i8042.noaux [HW] Don't check for auxiliary (== mouse) port
i8042.nomux [HW] Don't check presence of an active multiplexing
controller
i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
controllers
i8042.panicblink=
[HW] Frequency with which keyboard LEDs should blink
when kernel panics (default is 0.5 sec)
i8042.reset [HW] Reset the controller during init and cleanup
i8042.unlock [HW] Unlock (ignore) the keylock
......@@ -790,6 +794,10 @@ running once the system is up.
mtdparts= [MTD]
See drivers/mtd/cmdline.c.
mtouchusb.raw_coordinates=
[HW] Make the MicroTouch USB driver use raw coordinates ('y', default)
or cooked coordinates ('n')
n2= [NET] SDL Inc. RISCom/N2 synchronous serial card
NCR_D700= [HW,SCSI]
......@@ -1409,6 +1417,9 @@ running once the system is up.
Format: <io>,<irq>
usb-handoff [HW] Enable early USB BIOS -> OS handoff
usbhid.mousepoll=
[USBHID] The interval which mice are to be polled at.
video= [FB] Frame buffer configuration
See Documentation/fb/modedb.txt.
......
......@@ -47,8 +47,8 @@ obj-$(CONFIG_PARIDE) += block/paride/
obj-$(CONFIG_TC) += tc/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_USB_GADGET) += usb/gadget/
obj-$(CONFIG_INPUT) += input/
obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_INPUT) += input/
obj-$(CONFIG_I2O) += message/
obj-$(CONFIG_I2C) += i2c/
obj-$(CONFIG_W1) += w1/
......
......@@ -141,7 +141,7 @@ static struct ledptr {
/* Simple translation table for the SysRq keys */
#ifdef CONFIG_MAGIC_SYSRQ
unsigned char kbd_sysrq_xlate[KEY_MAX] =
unsigned char kbd_sysrq_xlate[KEY_MAX + 1] =
"\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
"qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
"dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
......@@ -173,7 +173,7 @@ int getkeycode(unsigned int scancode)
if (!dev)
return -ENODEV;
if (scancode < 0 || scancode >= dev->keycodemax)
if (scancode >= dev->keycodemax)
return -EINVAL;
return INPUT_KEYCODE(dev, scancode);
......@@ -183,7 +183,7 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
{
struct list_head * node;
struct input_dev *dev = NULL;
int i, oldkey;
unsigned int i, oldkey;
list_for_each(node,&kbd_handler.h_list) {
struct input_handle *handle = to_handle_h(node);
......@@ -196,7 +196,9 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
if (!dev)
return -ENODEV;
if (scancode < 0 || scancode >= dev->keycodemax)
if (scancode >= dev->keycodemax)
return -EINVAL;
if (keycode > KEY_MAX)
return -EINVAL;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
......@@ -355,7 +357,7 @@ static void to_utf8(struct vc_data *vc, ushort c)
*/
void compute_shiftstate(void)
{
int i, j, k, sym, val;
unsigned int i, j, k, sym, val;
shift_state = 0;
memset(shift_down, 0, sizeof(shift_down));
......@@ -396,7 +398,7 @@ void compute_shiftstate(void)
static unsigned char handle_diacr(struct vc_data *vc, unsigned char ch)
{
int d = diacr;
int i;
unsigned int i;
diacr = 0;
......@@ -931,7 +933,7 @@ static void kbd_refresh_leds(struct input_handle *handle)
#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) ||\
defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\
(defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_RPC))
(defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC))
#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\
((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001))
......
......@@ -5,7 +5,7 @@
menu "Input device support"
config INPUT
tristate "Input devices (needed for keyboard, mouse, ...)" if EMBEDDED
tristate "Generic input layer (needed for keyboard, mouse, ...)" if EMBEDDED
default y
---help---
Say Y here if you have any input device (mouse, keyboard, tablet,
......@@ -22,12 +22,13 @@ config INPUT
To compile this driver as a module, choose M here: the
module will be called input.
if INPUT
comment "Userland interfaces"
config INPUT_MOUSEDEV
tristate "Mouse interface" if EMBEDDED
default y
depends on INPUT
---help---
Say Y here if you want your mouse to be accessible as char devices
13:32+ - /dev/input/mouseX and 13:63 - /dev/input/mice as an
......@@ -74,7 +75,6 @@ config INPUT_MOUSEDEV_SCREEN_Y
config INPUT_JOYDEV
tristate "Joystick interface"
depends on INPUT
---help---
Say Y here if you want your joystick or gamepad to be
accessible as char device 13:0+ - /dev/input/jsX device.
......@@ -88,7 +88,6 @@ config INPUT_JOYDEV
config INPUT_TSDEV
tristate "Touchscreen interface"
depends on INPUT
---help---
Say Y here if you have an application that only can understand the
Compaq touchscreen protocol for absolute pointer data. This is
......@@ -111,7 +110,6 @@ config INPUT_TSDEV_SCREEN_Y
config INPUT_EVDEV
tristate "Event interface"
depends on INPUT
help
Say Y here if you want your input device events be accessible
under char device 13:64+ - /dev/input/eventX in a generic way.
......@@ -121,7 +119,6 @@ config INPUT_EVDEV
config INPUT_EVBUG
tristate "Event debugging"
depends on INPUT
---help---
Say Y here if you have a problem with the input subsystem and
want all events (keypresses, mouse movements), to be output to
......@@ -134,12 +131,6 @@ config INPUT_EVBUG
To compile this driver as a module, choose M here: the
module will be called evbug.
comment "Input I/O drivers"
source "drivers/input/gameport/Kconfig"
source "drivers/input/serio/Kconfig"
comment "Input Device Drivers"
source "drivers/input/keyboard/Kconfig"
......@@ -152,5 +143,15 @@ source "drivers/input/touchscreen/Kconfig"
source "drivers/input/misc/Kconfig"
endif
menu "Hardware I/O ports"
source "drivers/input/serio/Kconfig"
source "drivers/input/gameport/Kconfig"
endmenu
endmenu
......@@ -88,13 +88,13 @@ static struct input_handler evbug_handler = {
.id_table = evbug_ids,
};
int __init evbug_init(void)
static int __init evbug_init(void)
{
input_register_handler(&evbug_handler);
return 0;
}
void __exit evbug_exit(void)
static void __exit evbug_exit(void)
{
input_unregister_handler(&evbug_handler);
}
......
......@@ -169,6 +169,9 @@ static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count
struct evdev_list *list = file->private_data;
int retval;
if (count < sizeof(struct input_event))
return -EINVAL;
if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
......@@ -196,9 +199,8 @@ static unsigned int evdev_poll(struct file *file, poll_table *wait)
{
struct evdev_list *list = file->private_data;
poll_wait(file, &list->evdev->wait, wait);
if (list->head != list->tail)
return POLLIN | POLLRDNORM;
return 0;
return ((list->head == list->tail) ? 0 : (POLLIN | POLLRDNORM)) |
(list->evdev->exist ? 0 : (POLLHUP | POLLERR));
}
static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
......@@ -223,14 +225,15 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case EVIOCGKEYCODE:
if (get_user(t, ip)) return -EFAULT;
if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL;
if (put_user(INPUT_KEYCODE(dev, t), ip + 1)) return -EFAULT;
return 0;
case EVIOCSKEYCODE:
if (get_user(t, ip)) return -EFAULT;
if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL;
if (get_user(v, ip + 1)) return -EFAULT;
if (v < 0 || v > KEY_MAX) return -EINVAL;
u = SET_INPUT_KEYCODE(dev, t, v);
clear_bit(u, dev->keybit);
set_bit(v, dev->keybit);
......@@ -438,6 +441,7 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct
static void evdev_disconnect(struct input_handle *handle)
{
struct evdev *evdev = handle->private;
struct evdev_list *list;
class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
devfs_remove("input/event%d", evdev->minor);
......@@ -446,6 +450,8 @@ static void evdev_disconnect(struct input_handle *handle)
if (evdev->open) {
input_close_device(handle);
wake_up_interruptible(&evdev->wait);
list_for_each_entry(list, &evdev->list, node)
kill_fasync(&list->fasync, SIGIO, POLL_HUP);
} else
evdev_free(evdev);
}
......
......@@ -19,30 +19,10 @@ config GAMEPORT
To compile this driver as a module, choose M here: the
module will be called gameport.
# Yes, SOUND_GAMEPORT looks a bit odd. Yes, it ends up being turned on
# in every .config. Please don't touch it. It is here to handle an
# unusual dependency between GAMEPORT and sound drivers.
#
# Some sound drivers call gameport functions. If GAMEPORT is
# not selected, empty stubs are provided for the functions and all is
# well.
# If GAMEPORT is built in, everything is fine.
# If GAMEPORT is a module, however, it would need to be loaded for the
# sound driver to be able to link properly. Therefore, the sound
# driver must be a module as well in that case. Since there's no way
# to express that directly in Kconfig, we use SOUND_GAMEPORT to
# express it. SOUND_GAMEPORT boils down to "if GAMEPORT is 'm',
# anything that depends on SOUND_GAMEPORT must be 'm' as well. if
# GAMEPORT is 'y' or 'n', it can be anything".
config SOUND_GAMEPORT
tristate
default y if GAMEPORT!=m
default m if GAMEPORT=m
if GAMEPORT
config GAMEPORT_NS558
tristate "Classic ISA and PnP gameport support"
depends on GAMEPORT
help
Say Y here if you have an ISA or PnP gameport.
......@@ -53,7 +33,6 @@ config GAMEPORT_NS558
config GAMEPORT_L4
tristate "PDPI Lightning 4 gamecard support"
depends on GAMEPORT
help
Say Y here if you have a PDPI Lightning 4 gamecard.
......@@ -62,7 +41,6 @@ config GAMEPORT_L4
config GAMEPORT_EMU10K1
tristate "SB Live and Audigy gameport support"
depends on GAMEPORT
help
Say Y here if you have a SoundBlaster Live! or SoundBlaster
Audigy card and want to use its gameport.
......@@ -72,7 +50,6 @@ config GAMEPORT_EMU10K1
config GAMEPORT_VORTEX
tristate "Aureal Vortex, Vortex 2 gameport support"
depends on GAMEPORT
help
Say Y here if you have an Aureal Vortex 1 or 2 card and want
to use its gameport.
......@@ -82,9 +59,28 @@ config GAMEPORT_VORTEX
config GAMEPORT_FM801
tristate "ForteMedia FM801 gameport support"
depends on GAMEPORT
config GAMEPORT_CS461X
tristate "Crystal SoundFusion gameport support"
depends on GAMEPORT
endif
# Yes, SOUND_GAMEPORT looks a bit odd. Yes, it ends up being turned on
# in every .config. Please don't touch it. It is here to handle an
# unusual dependency between GAMEPORT and sound drivers.
#
# Some sound drivers call gameport functions. If GAMEPORT is
# not selected, empty stubs are provided for the functions and all is
# well.
# If GAMEPORT is built in, everything is fine.
# If GAMEPORT is a module, however, it would need to be loaded for the
# sound driver to be able to link properly. Therefore, the sound
# driver must be a module as well in that case. Since there's no way
# to express that directly in Kconfig, we use SOUND_GAMEPORT to
# express it. SOUND_GAMEPORT boils down to "if GAMEPORT is 'm',
# anything that depends on SOUND_GAMEPORT must be 'm' as well. if
# GAMEPORT is 'y' or 'n', it can be anything".
config SOUND_GAMEPORT
tristate
default m if GAMEPORT=m
default y
......@@ -16,7 +16,7 @@
#include <linux/slab.h>
#include <linux/pci.h>
MODULE_AUTHOR("Victor Krapivin <vik@belcaf.minsk.by>");
MODULE_AUTHOR("Victor Krapivin");
MODULE_LICENSE("GPL");
/*
......@@ -120,9 +120,6 @@ MODULE_LICENSE("GPL");
static unsigned long ba0_addr;
static unsigned int __iomem *ba0;
static char phys[32];
static char name[] = "CS416x Gameport";
#ifdef CS461X_FULL_MAP
static unsigned long ba1_addr;
static union ba1_t {
......@@ -160,10 +157,10 @@ static unsigned int cs461x_peekBA0(unsigned long reg)
static int cs461x_free(struct pci_dev *pdev)
{
struct gameport *port = pci_get_drvdata(pdev);
if(port){
if (port)
gameport_unregister_port(port);
kfree(port);
}
if (ba0) iounmap(ba0);
#ifdef CS461X_FULL_MAP
if (ba1.name.data0) iounmap(ba1.name.data0);
......@@ -267,18 +264,17 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev
return -ENOMEM;
}
#else
if (ba0 == NULL){
if (ba0 == NULL) {
cs461x_free(pdev);
return -ENOMEM;
}
#endif
if (!(port = kmalloc(sizeof(struct gameport), GFP_KERNEL))) {
printk(KERN_ERR "Memory allocation failed.\n");
if (!(port = gameport_allocate_port())) {
printk(KERN_ERR "cs461x: Memory allocation failed\n");
cs461x_free(pdev);
return -ENOMEM;
}
memset(port, 0, sizeof(struct gameport));
pci_set_drvdata(pdev, port);
......@@ -287,22 +283,15 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev
port->read = cs461x_gameport_read;
port->cooked_read = cs461x_gameport_cooked_read;
sprintf(phys, "pci%s/gameport0", pci_name(pdev));
port->name = name;
port->phys = phys;
port->id.bustype = BUS_PCI;
port->id.vendor = pdev->vendor;
port->id.product = pdev->device;
gameport_set_name(port, "CS416x");
gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev));
port->dev.parent = &pdev->dev;
cs461x_pokeBA0(BA0_JSIO, 0xFF); // ?
cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW);
gameport_register_port(port);
printk(KERN_INFO "gameport: %s on pci%s speed %d kHz\n",
name, pci_name(pdev), port->speed);
return 0;
}
......@@ -318,12 +307,12 @@ static struct pci_driver cs461x_pci_driver = {
.remove = __devexit_p(cs461x_pci_remove),
};
int __init cs461x_init(void)
static int __init cs461x_init(void)
{
return pci_module_init(&cs461x_pci_driver);
return pci_register_driver(&cs461x_pci_driver);
}
void __exit cs461x_exit(void)
static void __exit cs461x_exit(void)
{
pci_unregister_driver(&cs461x_pci_driver);
}
......
......@@ -44,13 +44,13 @@ MODULE_LICENSE("GPL");
struct emu {
struct pci_dev *dev;
struct gameport gameport;
struct gameport *gameport;
int io;
int size;
char phys[32];
};
static struct pci_device_id emu_tbl[] = {
{ 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
{ 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
{ 0x1102, 0x7004, PCI_ANY_ID, PCI_ANY_ID }, /* Dell SB Live */
......@@ -64,6 +64,7 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id
{
int ioport, iolen;
struct emu *emu;
struct gameport *port;
if (pci_enable_device(pdev))
return -EBUSY;
......@@ -74,31 +75,29 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id
if (!request_region(ioport, iolen, "emu10k1-gp"))
return -EBUSY;
if (!(emu = kmalloc(sizeof(struct emu), GFP_KERNEL))) {
printk(KERN_ERR "emu10k1-gp: Memory allocation failed.\n");
emu = kcalloc(1, sizeof(struct emu), GFP_KERNEL);
port = gameport_allocate_port();
if (!emu || !port) {
printk(KERN_ERR "emu10k1-gp: Memory allocation failed\n");
release_region(ioport, iolen);
kfree(emu);
gameport_free_port(port);
return -ENOMEM;
}
memset(emu, 0, sizeof(struct emu));
sprintf(emu->phys, "pci%s/gameport0", pci_name(pdev));
emu->io = ioport;
emu->size = iolen;
emu->dev = pdev;
emu->gameport = port;
emu->gameport.io = ioport;
emu->gameport.name = pci_name(pdev);
emu->gameport.phys = emu->phys;
emu->gameport.id.bustype = BUS_PCI;
emu->gameport.id.vendor = pdev->vendor;
emu->gameport.id.product = pdev->device;
gameport_set_name(port, "EMU10K1");
gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev));
port->dev.parent = &pdev->dev;
port->io = ioport;
pci_set_drvdata(pdev, emu);
gameport_register_port(&emu->gameport);
printk(KERN_INFO "gameport: pci%s speed %d kHz\n",
pci_name(pdev), emu->gameport.speed);
gameport_register_port(port);
return 0;
}
......@@ -106,8 +105,9 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id
static void __devexit emu_remove(struct pci_dev *pdev)
{
struct emu *emu = pci_get_drvdata(pdev);
gameport_unregister_port(&emu->gameport);
release_region(emu->gameport.io, emu->size);
gameport_unregister_port(emu->gameport);
release_region(emu->io, emu->size);
kfree(emu);
}
......@@ -118,12 +118,12 @@ static struct pci_driver emu_driver = {
.remove = __devexit_p(emu_remove),
};
int __init emu_init(void)
static int __init emu_init(void)
{
return pci_module_init(&emu_driver);
return pci_register_driver(&emu_driver);
}
void __exit emu_exit(void)
static void __exit emu_exit(void)
{
pci_unregister_driver(&emu_driver);
}
......
......@@ -37,10 +37,8 @@
#define HAVE_COOKED
struct fm801_gp {
struct gameport gameport;
struct gameport *gameport;
struct resource *res_port;
char phys[32];
char name[32];
};
#ifdef HAVE_COOKED
......@@ -83,40 +81,42 @@ static int fm801_gp_open(struct gameport *gameport, int mode)
static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device_id *id)
{
struct fm801_gp *gp;
struct gameport *port;
if (! (gp = kmalloc(sizeof(*gp), GFP_KERNEL))) {
printk("cannot malloc for fm801-gp\n");
return -1;
gp = kcalloc(1, sizeof(struct fm801_gp), GFP_KERNEL);
port = gameport_allocate_port();
if (!gp || !port) {
printk(KERN_ERR "fm801-gp: Memory allocation failed\n");
kfree(gp);
gameport_free_port(port);
return -ENOMEM;
}
memset(gp, 0, sizeof(*gp));
gp->gameport.open = fm801_gp_open;
pci_enable_device(pci);
port->open = fm801_gp_open;
#ifdef HAVE_COOKED
gp->gameport.cooked_read = fm801_gp_cooked_read;
port->cooked_read = fm801_gp_cooked_read;
#endif
pci_enable_device(pci);
gp->gameport.io = pci_resource_start(pci, 0);
if ((gp->res_port = request_region(gp->gameport.io, 0x10, "FM801 GP")) == NULL) {
printk("unable to grab region 0x%x-0x%x\n", gp->gameport.io, gp->gameport.io + 0x0f);
gameport_set_name(port, "FM801");
gameport_set_phys(port, "pci%s/gameport0", pci_name(pci));
port->dev.parent = &pci->dev;
port->io = pci_resource_start(pci, 0);
gp->gameport = port;
gp->res_port = request_region(port->io, 0x10, "FM801 GP");
if (!gp->res_port) {
kfree(gp);
return -1;
gameport_free_port(port);
printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n",
port->io, port->io + 0x0f);
return -EBUSY;
}
gp->gameport.phys = gp->phys;
gp->gameport.name = gp->name;
gp->gameport.id.bustype = BUS_PCI;
gp->gameport.id.vendor = pci->vendor;
gp->gameport.id.product = pci->device;
pci_set_drvdata(pci, gp);
outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */
gameport_register_port(&gp->gameport);
printk(KERN_INFO "gameport: at pci%s speed %d kHz\n",
pci_name(pci), gp->gameport.speed);
outb(0x60, port->io + 0x0d); /* enable joystick 1 and 2 */
gameport_register_port(port);
return 0;
}
......@@ -124,8 +124,9 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
static void __devexit fm801_gp_remove(struct pci_dev *pci)
{
struct fm801_gp *gp = pci_get_drvdata(pci);
if (gp) {
gameport_unregister_port(&gp->gameport);
gameport_unregister_port(gp->gameport);
release_resource(gp->res_port);
kfree(gp);
}
......@@ -143,12 +144,12 @@ static struct pci_driver fm801_gp_driver = {
.remove = __devexit_p(fm801_gp_remove),
};
int __init fm801_gp_init(void)
static int __init fm801_gp_init(void)
{
return pci_module_init(&fm801_gp_driver);
return pci_register_driver(&fm801_gp_driver);
}
void __exit fm801_gp_exit(void)
static void __exit fm801_gp_exit(void)
{
pci_unregister_driver(&fm801_gp_driver);
}
......
This diff is collapsed.
......@@ -54,12 +54,11 @@ MODULE_DESCRIPTION("PDPI Lightning 4 gamecard driver");
MODULE_LICENSE("GPL");
struct l4 {
struct gameport gameport;
struct gameport *gameport;
unsigned char port;
char phys[32];
} *l4_port[8];
};
char l4_name[] = "PDPI Lightning 4";
static struct l4 l4_ports[8];
/*
* l4_wait_ready() waits for the L4 to become ready.
......@@ -67,10 +66,10 @@ char l4_name[] = "PDPI Lightning 4";
static int l4_wait_ready(void)
{
unsigned int t;
t = L4_TIMEOUT;
unsigned int t = L4_TIMEOUT;
while ((inb(L4_PORT) & L4_BUSY) && t > 0) t--;
return -(t<=0);
return -(t <= 0);
}
/*
......@@ -79,7 +78,7 @@ static int l4_wait_ready(void)
static int l4_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{
struct l4 *l4 = gameport->driver;
struct l4 *l4 = gameport->port_data;
unsigned char status;
int i, result = -1;
......@@ -112,7 +111,8 @@ fail: outb(L4_SELECT_ANALOG, L4_PORT);
static int l4_open(struct gameport *gameport, int mode)
{
struct l4 *l4 = gameport->driver;
struct l4 *l4 = gameport->port_data;
if (l4->port != 0 && mode != GAMEPORT_MODE_COOKED)
return -1;
outb(L4_SELECT_ANALOG, L4_PORT);
......@@ -129,24 +129,29 @@ static int l4_getcal(int port, int *cal)
outb(L4_SELECT_ANALOG, L4_PORT);
outb(L4_SELECT_DIGITAL + (port >> 2), L4_PORT);
if (inb(L4_PORT) & L4_BUSY)
goto out;
if (inb(L4_PORT) & L4_BUSY) goto fail;
outb(L4_CMD_GETCAL, L4_PORT);
if (l4_wait_ready())
goto out;
if (l4_wait_ready()) goto fail;
if (inb(L4_PORT) != L4_SELECT_DIGITAL + (port >> 2)) goto fail;
if (inb(L4_PORT) != L4_SELECT_DIGITAL + (port >> 2))
goto out;
if (l4_wait_ready()) goto fail;
if (l4_wait_ready())
goto out;
outb(port & 3, L4_PORT);
for (i = 0; i < 4; i++) {
if (l4_wait_ready()) goto fail;
if (l4_wait_ready())
goto out;
cal[i] = inb(L4_PORT);
}
result = 0;
fail: outb(L4_SELECT_ANALOG, L4_PORT);
out: outb(L4_SELECT_ANALOG, L4_PORT);
return result;
}
......@@ -160,24 +165,29 @@ static int l4_setcal(int port, int *cal)
outb(L4_SELECT_ANALOG, L4_PORT);
outb(L4_SELECT_DIGITAL + (port >> 2), L4_PORT);
if (inb(L4_PORT) & L4_BUSY)
goto out;
if (inb(L4_PORT) & L4_BUSY) goto fail;
outb(L4_CMD_SETCAL, L4_PORT);
if (l4_wait_ready())
goto out;
if (l4_wait_ready()) goto fail;
if (inb(L4_PORT) != L4_SELECT_DIGITAL + (port >> 2)) goto fail;
if (inb(L4_PORT) != L4_SELECT_DIGITAL + (port >> 2))
goto out;
if (l4_wait_ready()) goto fail;
if (l4_wait_ready())
goto out;
outb(port & 3, L4_PORT);
for (i = 0; i < 4; i++) {
if (l4_wait_ready()) goto fail;
if (l4_wait_ready())
goto out;
outb(cal[i], L4_PORT);
}
result = 0;
fail: outb(L4_SELECT_ANALOG, L4_PORT);
out: outb(L4_SELECT_ANALOG, L4_PORT);
return result;
}
......@@ -190,7 +200,7 @@ static int l4_calibrate(struct gameport *gameport, int *axes, int *max)
{
int i, t;
int cal[4];
struct l4 *l4 = gameport->driver;
struct l4 *l4 = gameport->port_data;
if (l4_getcal(l4->port, cal))
return -1;
......@@ -209,73 +219,102 @@ static int l4_calibrate(struct gameport *gameport, int *axes, int *max)
return 0;
}
static int __init l4_init(void)
static int __init l4_create_ports(int card_no)
{
int cal[4] = {255,255,255,255};
int i, j, rev, cards = 0;
struct gameport *gameport;
struct l4 *l4;
struct gameport *port;
int i, idx;
if (!request_region(L4_PORT, 1, "lightning"))
return -1;
for (i = 0; i < 4; i++) {
for (i = 0; i < 2; i++) {
idx = card_no * 4 + i;
l4 = &l4_ports[idx];
outb(L4_SELECT_ANALOG, L4_PORT);
outb(L4_SELECT_DIGITAL + i, L4_PORT);
if (!(l4->gameport = port = gameport_allocate_port())) {
printk(KERN_ERR "lightning: Memory allocation failed\n");
while (--i >= 0) {
gameport_free_port(l4->gameport);
l4->gameport = NULL;
}
return -ENOMEM;
}
l4->port = idx;
if (inb(L4_PORT) & L4_BUSY) continue;
outb(L4_CMD_ID, L4_PORT);
port->port_data = l4;
port->open = l4_open;
port->cooked_read = l4_cooked_read;
port->calibrate = l4_calibrate;
if (l4_wait_ready()) continue;
if (inb(L4_PORT) != L4_SELECT_DIGITAL + i) continue;
gameport_set_name(port, "PDPI Lightning 4");
gameport_set_phys(port, "isa%04x/gameport%d", L4_PORT, idx);
if (l4_wait_ready()) continue;
if (inb(L4_PORT) != L4_ID) continue;
if (idx == 0)
port->io = L4_PORT;
}
if (l4_wait_ready()) continue;
rev = inb(L4_PORT);
return 0;
}
if (!rev) continue;
static int __init l4_add_card(int card_no)
{
int cal[4] = { 255, 255, 255, 255 };
int i, rev, result;
struct l4 *l4;
if (!(l4_port[i * 4] = kmalloc(sizeof(struct l4) * 4, GFP_KERNEL))) {
printk(KERN_ERR "lightning: Out of memory allocating ports.\n");
continue;
}
memset(l4_port[i * 4], 0, sizeof(struct l4) * 4);
outb(L4_SELECT_ANALOG, L4_PORT);
outb(L4_SELECT_DIGITAL + card_no, L4_PORT);
for (j = 0; j < 4; j++) {
if (inb(L4_PORT) & L4_BUSY)
return -1;
outb(L4_CMD_ID, L4_PORT);
l4 = l4_port[i * 4 + j] = l4_port[i * 4] + j;
l4->port = i * 4 + j;
if (l4_wait_ready())
return -1;
sprintf(l4->phys, "isa%04x/gameport%d", L4_PORT, 4 * i + j);
if (inb(L4_PORT) != L4_SELECT_DIGITAL + card_no)
return -1;
gameport = &l4->gameport;
gameport->driver = l4;
gameport->open = l4_open;
gameport->cooked_read = l4_cooked_read;
gameport->calibrate = l4_calibrate;
if (l4_wait_ready())
return -1;
if (inb(L4_PORT) != L4_ID)
return -1;
gameport->name = l4_name;
gameport->phys = l4->phys;
gameport->id.bustype = BUS_ISA;
if (l4_wait_ready())
return -1;
rev = inb(L4_PORT);
if (!i && !j)
gameport->io = L4_PORT;
if (!rev)
return -1;
if (rev > 0x28) /* on 2.9+ the setcal command works correctly */
l4_setcal(l4->port, cal);
result = l4_create_ports(card_no);
if (result)
return result;
gameport_register_port(gameport);
}
printk(KERN_INFO "gameport: PDPI Lightning 4 %s card v%d.%d at %#x\n",
card_no ? "secondary" : "primary", rev >> 4, rev, L4_PORT);
printk(KERN_INFO "gameport: PDPI Lightning 4 %s card v%d.%d at %#x\n",
i ? "secondary" : "primary", rev >> 4, rev, L4_PORT);
for (i = 0; i < 4; i++) {
l4 = &l4_ports[card_no * 4 + i];
cards++;
if (rev > 0x28) /* on 2.9+ the setcal command works correctly */
l4_setcal(l4->port, cal);
gameport_register_port(l4->gameport);
}
return 0;
}
static int __init l4_init(void)
{
int i, cards = 0;
if (!request_region(L4_PORT, 1, "lightning"))
return -1;
for (i = 0; i < 2; i++)
if (l4_add_card(i) == 0)
cards++;
outb(L4_SELECT_ANALOG, L4_PORT);
if (!cards) {
......@@ -289,13 +328,14 @@ static int __init l4_init(void)
static void __exit l4_exit(void)
{
int i;
int cal[4] = {59, 59, 59, 59};
int cal[4] = { 59, 59, 59, 59 };
for (i = 0; i < 8; i++)
if (l4_port[i]) {
l4_setcal(l4_port[i]->port, cal);
gameport_unregister_port(&l4_port[i]->gameport);
if (l4_ports[i].gameport) {
l4_setcal(l4_ports[i].port, cal);
gameport_unregister_port(l4_ports[i].gameport);
}
outb(L4_SELECT_ANALOG, L4_PORT);
release_region(L4_PORT, 1);
}
......
......@@ -44,20 +44,16 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Classic gameport (ISA/PnP) driver");
MODULE_LICENSE("GPL");
#define NS558_ISA 1
#define NS558_PNP 2
static int ns558_isa_portlist[] = { 0x201, 0x200, 0x202, 0x203, 0x204, 0x205, 0x207, 0x209,
0x20b, 0x20c, 0x20e, 0x20f, 0x211, 0x219, 0x101, 0 };
struct ns558 {
int type;
int io;
int size;
struct pnp_dev *dev;
struct gameport *gameport;
struct list_head node;
struct gameport gameport;
char phys[32];
char name[32];
};
static LIST_HEAD(ns558_list);
......@@ -68,18 +64,19 @@ static LIST_HEAD(ns558_list);
* A joystick must be attached for this to work.
*/
static void ns558_isa_probe(int io)
static int ns558_isa_probe(int io)
{
int i, j, b;
unsigned char c, u, v;
struct ns558 *port;
struct ns558 *ns558;
struct gameport *port;
/*
* No one should be using this address.
*/
if (!request_region(io, 1, "ns558-isa"))
return;
return -EBUSY;
/*
* We must not be able to write arbitrary values to the port.
......@@ -90,8 +87,8 @@ static void ns558_isa_probe(int io)
outb(~c & ~3, io);
if (~(u = v = inb(io)) & 3) {
outb(c, io);
i = 0;
goto out;
release_region(io, 1);
return -ENODEV;
}
/*
* After a trigger, there must be at least some bits changing.
......@@ -101,8 +98,8 @@ static void ns558_isa_probe(int io)
if (u == v) {
outb(c, io);
i = 0;
goto out;
release_region(io, 1);
return -ENODEV;
}
msleep(3);
/*
......@@ -113,8 +110,8 @@ static void ns558_isa_probe(int io)
for (i = 0; i < 1000; i++)
if ((u ^ inb(io)) & 0xf) {
outb(c, io);
i = 0;
goto out;
release_region(io, 1);
return -ENODEV;
}
/*
* And now find the number of mirrors of the port.
......@@ -122,17 +119,17 @@ static void ns558_isa_probe(int io)
for (i = 1; i < 5; i++) {
release_region(io & (-1 << (i-1)), (1 << (i-1)));
release_region(io & (-1 << (i - 1)), (1 << (i - 1)));
if (!request_region(io & (-1 << i), (1 << i), "ns558-isa")) /* Don't disturb anyone */
break;
if (!request_region(io & (-1 << i), (1 << i), "ns558-isa"))
break; /* Don't disturb anyone */
outb(0xff, io & (-1 << i));
for (j = b = 0; j < 1000; j++)
if (inb(io & (-1 << i)) != inb((io & (-1 << i)) + (1 << i) - 1)) b++;
msleep(3);
if (b > 300) { /* We allow 30% difference */
if (b > 300) { /* We allow 30% difference */
release_region(io & (-1 << i), (1 << i));
break;
}
......@@ -142,35 +139,33 @@ static void ns558_isa_probe(int io)
if (i != 4) {
if (!request_region(io & (-1 << i), (1 << i), "ns558-isa"))
return;
return -EBUSY;
}
if (!(port = kmalloc(sizeof(struct ns558), GFP_KERNEL))) {
ns558 = kcalloc(1, sizeof(struct ns558), GFP_KERNEL);
port = gameport_allocate_port();
if (!ns558 || !port) {
printk(KERN_ERR "ns558: Memory allocation failed.\n");
goto out;
release_region(io & (-1 << i), (1 << i));
kfree(ns558);
gameport_free_port(port);
return -ENOMEM;
}
memset(port, 0, sizeof(struct ns558));
port->type = NS558_ISA;
port->size = (1 << i);
port->gameport.io = io;
port->gameport.phys = port->phys;
port->gameport.name = port->name;
port->gameport.id.bustype = BUS_ISA;
memset(ns558, 0, sizeof(struct ns558));
ns558->io = io;
ns558->size = 1 << i;
ns558->gameport = port;
sprintf(port->phys, "isa%04x/gameport0", io & (-1 << i));
sprintf(port->name, "NS558 ISA");
port->io = io;
gameport_set_name(port, "NS558 ISA Gameport");
gameport_set_phys(port, "isa%04x/gameport0", io & (-1 << i));
gameport_register_port(&port->gameport);
gameport_register_port(port);
printk(KERN_INFO "gameport: NS558 ISA at %#x", port->gameport.io);
if (port->size > 1) printk(" size %d", port->size);
printk(" speed %d kHz\n", port->gameport.speed);
list_add(&ns558->node, &ns558_list);
list_add(&port->node, &ns558_list);
return;
out:
release_region(io & (-1 << i), (1 << i));
return 0;
}
#ifdef CONFIG_PNP
......@@ -206,46 +201,42 @@ MODULE_DEVICE_TABLE(pnp, pnp_devids);
static int ns558_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
{
int ioport, iolen;
struct ns558 *port;
struct ns558 *ns558;
struct gameport *port;
if (!pnp_port_valid(dev, 0)) {
printk(KERN_WARNING "ns558: No i/o ports on a gameport? Weird\n");
return -ENODEV;
}
ioport = pnp_port_start(dev,0);
iolen = pnp_port_len(dev,0);
ioport = pnp_port_start(dev, 0);
iolen = pnp_port_len(dev, 0);
if (!request_region(ioport, iolen, "ns558-pnp"))
return -EBUSY;
if (!(port = kmalloc(sizeof(struct ns558), GFP_KERNEL))) {
printk(KERN_ERR "ns558: Memory allocation failed.\n");
ns558 = kcalloc(1, sizeof(struct ns558), GFP_KERNEL);
port = gameport_allocate_port();
if (!ns558 || !port) {
printk(KERN_ERR "ns558: Memory allocation failed\n");
kfree(ns558);
gameport_free_port(port);
return -ENOMEM;
}
memset(port, 0, sizeof(struct ns558));
port->type = NS558_PNP;
port->size = iolen;
port->dev = dev;
port->gameport.io = ioport;
port->gameport.phys = port->phys;
port->gameport.name = port->name;
port->gameport.id.bustype = BUS_ISAPNP;
port->gameport.id.version = 0x100;
ns558->io = ioport;
ns558->size = iolen;
ns558->dev = dev;
ns558->gameport = port;
sprintf(port->phys, "pnp%s/gameport0", dev->dev.bus_id);
sprintf(port->name, "%s", "NS558 PnP Gameport");
gameport_set_name(port, "NS558 PnP Gameport");
gameport_set_phys(port, "pnp%s/gameport0", dev->dev.bus_id);
port->dev.parent = &dev->dev;
port->io = ioport;
gameport_register_port(&port->gameport);
gameport_register_port(port);
printk(KERN_INFO "gameport: NS558 PnP at pnp%s io %#x",
dev->dev.bus_id, port->gameport.io);
if (iolen > 1) printk(" size %d", iolen);
printk(" speed %d kHz\n", port->gameport.speed);
list_add_tail(&port->node, &ns558_list);
list_add_tail(&ns558->node, &ns558_list);
return 0;
}
......@@ -261,43 +252,39 @@ static struct pnp_driver ns558_pnp_driver;
#endif
int __init ns558_init(void)
static int pnp_registered = 0;
static int __init ns558_init(void)
{
int i = 0;
/*
* Probe for ISA ports.
* Probe ISA ports first so that PnP gets to choose free port addresses
* not occupied by the ISA ports.
*/
while (ns558_isa_portlist[i])
ns558_isa_probe(ns558_isa_portlist[i++]);
pnp_register_driver(&ns558_pnp_driver);
return list_empty(&ns558_list) ? -ENODEV : 0;
}
if (pnp_register_driver(&ns558_pnp_driver) >= 0)
pnp_registered = 1;
void __exit ns558_exit(void)
{
struct ns558 *port;
list_for_each_entry(port, &ns558_list, node) {
gameport_unregister_port(&port->gameport);
switch (port->type) {
return (list_empty(&ns558_list) && !pnp_registered) ? -ENODEV : 0;
}
#ifdef CONFIG_PNP
case NS558_PNP:
/* fall through */
#endif
case NS558_ISA:
release_region(port->gameport.io & ~(port->size - 1), port->size);
kfree(port);
break;
static void __exit ns558_exit(void)
{
struct ns558 *ns558;
default:
break;
}
list_for_each_entry(ns558, &ns558_list, node) {
gameport_unregister_port(ns558->gameport);
release_region(ns558->io & ~(ns558->size - 1), ns558->size);
kfree(ns558);
}
pnp_unregister_driver(&ns558_pnp_driver);
if (pnp_registered)
pnp_unregister_driver(&ns558_pnp_driver);
}
module_init(ns558_init);
......
......@@ -53,28 +53,27 @@ MODULE_LICENSE("GPL");
#define VORTEX_DATA_WAIT 20 /* 20 ms */
struct vortex {
struct gameport gameport;
struct gameport *gameport;
struct pci_dev *dev;
unsigned char __iomem *base;
unsigned char __iomem *io;
char phys[32];
unsigned char __iomem *base;
unsigned char __iomem *io;
};
static unsigned char vortex_read(struct gameport *gameport)
{
struct vortex *vortex = gameport->driver;
struct vortex *vortex = gameport->port_data;
return readb(vortex->io + VORTEX_LEG);
}
static void vortex_trigger(struct gameport *gameport)
{
struct vortex *vortex = gameport->driver;
struct vortex *vortex = gameport->port_data;
writeb(0xff, vortex->io + VORTEX_LEG);
}
static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{
struct vortex *vortex = gameport->driver;
struct vortex *vortex = gameport->port_data;
int i;
*buttons = (~readb(vortex->base + VORTEX_LEG) >> 4) & 0xf;
......@@ -89,7 +88,7 @@ static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons
static int vortex_open(struct gameport *gameport, int mode)
{
struct vortex *vortex = gameport->driver;
struct vortex *vortex = gameport->port_data;
switch (mode) {
case GAMEPORT_MODE_COOKED:
......@@ -109,30 +108,17 @@ static int vortex_open(struct gameport *gameport, int mode)
static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
struct vortex *vortex;
struct gameport *port;
int i;
if (!(vortex = kmalloc(sizeof(struct vortex), GFP_KERNEL)))
return -1;
memset(vortex, 0, sizeof(struct vortex));
vortex->dev = dev;
sprintf(vortex->phys, "pci%s/gameport0", pci_name(dev));
pci_set_drvdata(dev, vortex);
vortex->gameport.driver = vortex;
vortex->gameport.fuzz = 64;
vortex->gameport.read = vortex_read;
vortex->gameport.trigger = vortex_trigger;
vortex->gameport.cooked_read = vortex_cooked_read;
vortex->gameport.open = vortex_open;
vortex->gameport.name = pci_name(dev);
vortex->gameport.phys = vortex->phys;
vortex->gameport.id.bustype = BUS_PCI;
vortex->gameport.id.vendor = dev->vendor;
vortex->gameport.id.product = dev->device;
vortex = kcalloc(1, sizeof(struct vortex), GFP_KERNEL);
port = gameport_allocate_port();
if (!vortex || !port) {
printk(KERN_ERR "vortex: Memory allocation failed.\n");
kfree(vortex);
gameport_free_port(port);
return -ENOMEM;
}
for (i = 0; i < 6; i++)
if (~pci_resource_flags(dev, i) & IORESOURCE_IO)
......@@ -140,14 +126,26 @@ static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_i
pci_enable_device(dev);
vortex->dev = dev;
vortex->gameport = port;
vortex->base = ioremap(pci_resource_start(vortex->dev, i),
pci_resource_len(vortex->dev, i));
vortex->io = vortex->base + id->driver_data;
gameport_register_port(&vortex->gameport);
pci_set_drvdata(dev, vortex);
port->port_data = vortex;
port->fuzz = 64;
printk(KERN_INFO "gameport at pci%s speed %d kHz\n",
pci_name(dev), vortex->gameport.speed);
gameport_set_name(port, "AU88x0");
gameport_set_phys(port, "pci%s/gameport0", pci_name(dev));
port->dev.parent = &dev->dev;
port->read = vortex_read;
port->trigger = vortex_trigger;
port->cooked_read = vortex_cooked_read;
port->open = vortex_open;
gameport_register_port(port);
return 0;
}
......@@ -155,15 +153,17 @@ static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_i
static void __devexit vortex_remove(struct pci_dev *dev)
{
struct vortex *vortex = pci_get_drvdata(dev);
gameport_unregister_port(&vortex->gameport);
gameport_unregister_port(vortex->gameport);
iounmap(vortex->base);
kfree(vortex);
}
static struct pci_device_id vortex_id_table[] =
{{ 0x12eb, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x11000 },
{ 0x12eb, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x28800 },
{ 0 }};
static struct pci_device_id vortex_id_table[] = {
{ 0x12eb, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x11000 },
{ 0x12eb, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x28800 },
{ 0 }
};
static struct pci_driver vortex_driver = {
.name = "vortex_gameport",
......@@ -172,12 +172,12 @@ static struct pci_driver vortex_driver = {
.remove = __devexit_p(vortex_remove),
};
int __init vortex_init(void)
static int __init vortex_init(void)
{
return pci_module_init(&vortex_driver);
return pci_register_driver(&vortex_driver);
}
void __exit vortex_exit(void)
static void __exit vortex_exit(void)
{
pci_unregister_driver(&vortex_driver);
}
......
......@@ -50,18 +50,10 @@ static struct input_handler *input_table[8];
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_bus_input_dir;
DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
static int input_devices_state;
#endif
static inline unsigned int ms_to_jiffies(unsigned int ms)
{
unsigned int j;
j = (ms * HZ + 500) / 1000;
return (j > 0) ? j : 1;
}
void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
struct input_handle *handle;
......@@ -96,9 +88,9 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
change_bit(code, dev->key);
if (test_bit(EV_REP, dev->evbit) && dev->rep[REP_PERIOD] && dev->timer.data && value) {
if (test_bit(EV_REP, dev->evbit) && dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] && dev->timer.data && value) {
dev->repeat_key = code;
mod_timer(&dev->timer, jiffies + ms_to_jiffies(dev->rep[REP_DELAY]));
mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
}
break;
......@@ -198,7 +190,8 @@ static void input_repeat_key(unsigned long data)
input_event(dev, EV_KEY, dev->repeat_key, 2);
input_sync(dev);
mod_timer(&dev->timer, jiffies + ms_to_jiffies(dev->rep[REP_PERIOD]));
if (dev->rep[REP_PERIOD])
mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD]));
}
int input_accept_process(struct input_handle *handle, struct file *file)
......
......@@ -47,15 +47,15 @@ struct joydev {
struct input_handle handle;
wait_queue_head_t wait;
struct list_head list;
struct js_corr corr[ABS_MAX];
struct js_corr corr[ABS_MAX + 1];
struct JS_DATA_SAVE_TYPE glue;
int nabs;
int nkey;
__u16 keymap[KEY_MAX - BTN_MISC];
__u16 keypam[KEY_MAX - BTN_MISC];
__u8 absmap[ABS_MAX];
__u8 abspam[ABS_MAX];
__s16 abs[ABS_MAX];
__u16 keymap[KEY_MAX - BTN_MISC + 1];
__u16 keypam[KEY_MAX - BTN_MISC + 1];
__u8 absmap[ABS_MAX + 1];
__u8 abspam[ABS_MAX + 1];
__s16 abs[ABS_MAX + 1];
};
struct joydev_list {
......@@ -281,9 +281,8 @@ static unsigned int joydev_poll(struct file *file, poll_table *wait)
{
struct joydev_list *list = file->private_data;
poll_wait(file, &list->joydev->wait, wait);
if (list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey)
return POLLIN | POLLRDNORM;
return 0;
return ((list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey) ?
(POLLIN | POLLRDNORM) : 0) | (list->joydev->exist ? 0 : (POLLHUP | POLLERR));
}
static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
......@@ -338,7 +337,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return copy_to_user(argp, joydev->corr,
sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0;
case JSIOCSAXMAP:
if (copy_from_user(joydev->abspam, argp, sizeof(__u8) * ABS_MAX))
if (copy_from_user(joydev->abspam, argp, sizeof(__u8) * (ABS_MAX + 1)))
return -EFAULT;
for (i = 0; i < joydev->nabs; i++) {
if (joydev->abspam[i] > ABS_MAX) return -EINVAL;
......@@ -347,9 +346,9 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0;
case JSIOCGAXMAP:
return copy_to_user(argp, joydev->abspam,
sizeof(__u8) * ABS_MAX) ? -EFAULT : 0;
sizeof(__u8) * (ABS_MAX + 1)) ? -EFAULT : 0;
case JSIOCSBTNMAP:
if (copy_from_user(joydev->keypam, argp, sizeof(__u16) * (KEY_MAX - BTN_MISC)))
if (copy_from_user(joydev->keypam, argp, sizeof(__u16) * (KEY_MAX - BTN_MISC + 1)))
return -EFAULT;
for (i = 0; i < joydev->nkey; i++) {
if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL;
......@@ -358,7 +357,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0;
case JSIOCGBTNMAP:
return copy_to_user(argp, joydev->keypam,
sizeof(__u16) * (KEY_MAX - BTN_MISC)) ? -EFAULT : 0;
sizeof(__u16) * (KEY_MAX - BTN_MISC + 1)) ? -EFAULT : 0;
default:
if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) {
int len;
......@@ -409,21 +408,21 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
joydev->handle.private = joydev;
sprintf(joydev->name, "js%d", minor);
for (i = 0; i < ABS_MAX; i++)
for (i = 0; i < ABS_MAX + 1; i++)
if (test_bit(i, dev->absbit)) {
joydev->absmap[i] = joydev->nabs;
joydev->abspam[joydev->nabs] = i;
joydev->nabs++;
}
for (i = BTN_JOYSTICK - BTN_MISC; i < KEY_MAX - BTN_MISC; i++)
for (i = BTN_JOYSTICK - BTN_MISC; i < KEY_MAX - BTN_MISC + 1; i++)
if (test_bit(i + BTN_MISC, dev->keybit)) {
joydev->keymap[i] = joydev->nkey;
joydev->keypam[joydev->nkey] = i + BTN_MISC;
joydev->nkey++;
}
for (i = 0; i < BTN_JOYSTICK - BTN_MISC; i++)
for (i = 0; i < BTN_JOYSTICK - BTN_MISC + 1; i++)
if (test_bit(i + BTN_MISC, dev->keybit)) {
joydev->keymap[i] = joydev->nkey;
joydev->keypam[joydev->nkey] = i + BTN_MISC;
......@@ -463,14 +462,18 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
static void joydev_disconnect(struct input_handle *handle)
{
struct joydev *joydev = handle->private;
struct joydev_list *list;
class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
devfs_remove("input/js%d", joydev->minor);
joydev->exist = 0;
if (joydev->open)
if (joydev->open) {
input_close_device(handle);
else
wake_up_interruptible(&joydev->wait);
list_for_each_entry(list, &joydev->list, node)
kill_fasync(&list->fasync, SIGIO, POLL_HUP);
} else
joydev_free(joydev);
}
......
#
# Joystick driver configuration
#
config INPUT_JOYSTICK
menuconfig INPUT_JOYSTICK
bool "Joysticks"
depends on INPUT
help
If you have a joystick, 6dof controller, gamepad, steering wheel,
weapon control system or something like that you can say Y here
......@@ -13,9 +12,11 @@ config INPUT_JOYSTICK
Please read the file <file:Documentation/input/joystick.txt> which
contains more information.
if INPUT_JOYSTICK
config JOYSTICK_ANALOG
tristate "Classic PC analog joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
---help---
Say Y here if you have a joystick that connects to the PC
gameport. In addition to the usual PC analog joystick, this driver
......@@ -32,7 +33,7 @@ config JOYSTICK_ANALOG
config JOYSTICK_A3D
tristate "Assasin 3D and MadCatz Panther devices"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have an FPGaming or MadCatz controller using the
A3D protocol over the PC gameport.
......@@ -42,7 +43,7 @@ config JOYSTICK_A3D
config JOYSTICK_ADI
tristate "Logitech ADI digital joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a Logitech controller using the ADI
protocol over the PC gameport.
......@@ -52,7 +53,7 @@ config JOYSTICK_ADI
config JOYSTICK_COBRA
tristate "Creative Labs Blaster Cobra gamepad"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a Creative Labs Blaster Cobra gamepad.
......@@ -61,7 +62,7 @@ config JOYSTICK_COBRA
config JOYSTICK_GF2K
tristate "Genius Flight2000 Digital joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a Genius Flight2000 or MaxFighter digitally
communicating joystick or gamepad.
......@@ -71,7 +72,7 @@ config JOYSTICK_GF2K
config JOYSTICK_GRIP
tristate "Gravis GrIP joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a Gravis controller using the GrIP protocol
over the PC gameport.
......@@ -81,7 +82,7 @@ config JOYSTICK_GRIP
config JOYSTICK_GRIP_MP
tristate "Gravis GrIP MultiPort"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have the original Gravis GrIP MultiPort, a hub
that connects to the gameport and you connect gamepads to it.
......@@ -91,7 +92,7 @@ config JOYSTICK_GRIP_MP
config JOYSTICK_GUILLEMOT
tristate "Guillemot joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a Guillemot joystick using a digital
protocol over the PC gameport.
......@@ -101,7 +102,7 @@ config JOYSTICK_GUILLEMOT
config JOYSTICK_INTERACT
tristate "InterAct digital joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have an InterAct gameport or joystick
communicating digitally over the gameport.
......@@ -111,7 +112,7 @@ config JOYSTICK_INTERACT
config JOYSTICK_SIDEWINDER
tristate "Microsoft SideWinder digital joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a Microsoft controller using the Digital
Overdrive protocol over PC gameport.
......@@ -121,7 +122,7 @@ config JOYSTICK_SIDEWINDER
config JOYSTICK_TMDC
tristate "ThrustMaster DirectConnect joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you have a ThrustMaster controller using the
DirectConnect (BSP) protocol over the PC gameport.
......@@ -133,7 +134,6 @@ source "drivers/input/joystick/iforce/Kconfig"
config JOYSTICK_WARRIOR
tristate "Logitech WingMan Warrior joystick"
depends on INPUT && INPUT_JOYSTICK
select SERIO
help
Say Y here if you have a Logitech WingMan Warrior joystick connected
......@@ -144,7 +144,6 @@ config JOYSTICK_WARRIOR
config JOYSTICK_MAGELLAN
tristate "LogiCad3d Magellan/SpaceMouse 6dof controllers"
depends on INPUT && INPUT_JOYSTICK
select SERIO
help
Say Y here if you have a Magellan or Space Mouse 6DOF controller
......@@ -155,7 +154,6 @@ config JOYSTICK_MAGELLAN
config JOYSTICK_SPACEORB
tristate "SpaceTec SpaceOrb/Avenger 6dof controllers"
depends on INPUT && INPUT_JOYSTICK
select SERIO
help
Say Y here if you have a SpaceOrb 360 or SpaceBall Avenger 6DOF
......@@ -166,7 +164,6 @@ config JOYSTICK_SPACEORB
config JOYSTICK_SPACEBALL
tristate "SpaceTec SpaceBall 6dof controllers"
depends on INPUT && INPUT_JOYSTICK
select SERIO
help
Say Y here if you have a SpaceTec SpaceBall 2003/3003/4000 FLX
......@@ -178,7 +175,6 @@ config JOYSTICK_SPACEBALL
config JOYSTICK_STINGER
tristate "Gravis Stinger gamepad"
depends on INPUT && INPUT_JOYSTICK
select SERIO
help
Say Y here if you have a Gravis Stinger connected to one of your
......@@ -187,9 +183,8 @@ config JOYSTICK_STINGER
To compile this driver as a module, choose M here: the
module will be called stinger.
config JOYSTICK_TWIDDLER
config JOYSTICK_TWIDJOY
tristate "Twiddler as a joystick"
depends on INPUT && INPUT_JOYSTICK
select SERIO
help
Say Y here if you have a Handykey Twiddler connected to your
......@@ -200,7 +195,7 @@ config JOYSTICK_TWIDDLER
config JOYSTICK_DB9
tristate "Multisystem, Sega Genesis, Saturn joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && PARPORT
depends on PARPORT
---help---
Say Y here if you have a Sega Master System gamepad, Sega Genesis
gamepad, Sega Saturn gamepad, or a Multisystem -- Atari, Amiga,
......@@ -213,7 +208,7 @@ config JOYSTICK_DB9
config JOYSTICK_GAMECON
tristate "Multisystem, NES, SNES, N64, PSX joysticks and gamepads"
depends on INPUT && INPUT_JOYSTICK && PARPORT
depends on PARPORT
---help---
Say Y here if you have a Nintendo Entertainment System gamepad,
Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad,
......@@ -227,7 +222,7 @@ config JOYSTICK_GAMECON
config JOYSTICK_TURBOGRAFX
tristate "Multisystem joysticks via TurboGraFX device"
depends on INPUT && INPUT_JOYSTICK && PARPORT
depends on PARPORT
help
Say Y here if you have the TurboGraFX interface by Steffen Schwenke,
and want to use it with Multisystem -- Atari, Amiga, Commodore,
......@@ -239,7 +234,7 @@ config JOYSTICK_TURBOGRAFX
config JOYSTICK_AMIGA
tristate "Amiga joysticks"
depends on AMIGA && INPUT && INPUT_JOYSTICK
depends on AMIGA
help
Say Y here if you have an Amiga with a digital joystick connected
to it.
......@@ -249,7 +244,7 @@ config JOYSTICK_AMIGA
config JOYSTICK_JOYDUMP
tristate "Gameport data dumper"
depends on INPUT && INPUT_JOYSTICK && GAMEPORT
select GAMEPORT
help
Say Y here if you want to dump data from your joystick into the system
log for debugging purposes. Say N if you are making a production
......@@ -258,3 +253,4 @@ config JOYSTICK_JOYDUMP
To compile this driver as a module, choose M here: the
module will be called joydump.
endif
......@@ -35,38 +35,35 @@
#include <linux/gameport.h>
#include <linux/input.h>
#define DRIVER_DESC "FP-Gaming Assasin 3D joystick driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("FP-Gaming Assasin 3D joystick driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define A3D_MAX_START 400 /* 400 us */
#define A3D_MAX_STROBE 60 /* 40 us */
#define A3D_DELAY_READ 3 /* 3 ms */
#define A3D_MAX_START 600 /* 600 us */
#define A3D_MAX_STROBE 80 /* 80 us */
#define A3D_MAX_LENGTH 40 /* 40*3 bits */
#define A3D_REFRESH_TIME HZ/50 /* 20 ms */
#define A3D_MODE_A3D 1 /* Assassin 3D */
#define A3D_MODE_PAN 2 /* Panther */
#define A3D_MODE_OEM 3 /* Panther OEM version */
#define A3D_MODE_PXL 4 /* Panther XL */
char *a3d_names[] = { NULL, "FP-Gaming Assassin 3D", "MadCatz Panther", "OEM Panther",
static char *a3d_names[] = { NULL, "FP-Gaming Assassin 3D", "MadCatz Panther", "OEM Panther",
"MadCatz Panther XL", "MadCatz Panther XL w/ rudder" };
struct a3d {
struct gameport *gameport;
struct gameport adc;
struct gameport *adc;
struct input_dev dev;
struct timer_list timer;
int axes[4];
int buttons;
int mode;
int length;
int used;
int reads;
int bads;
char phys[32];
char adcphys[32];
};
/*
......@@ -109,7 +106,9 @@ static int a3d_read_packet(struct gameport *gameport, int length, char *data)
static int a3d_csum(char *data, int count)
{
int i, csum = 0;
for (i = 0; i < count - 2; i++) csum += data[i];
for (i = 0; i < count - 2; i++)
csum += data[i];
return (csum & 0x3f) != ((data[count - 2] << 3) | data[count - 1]);
}
......@@ -139,7 +138,7 @@ static void a3d_read(struct a3d *a3d, unsigned char *data)
a3d->buttons = ((data[3] << 3) | data[4]) & 0xf;
return;
break;
case A3D_MODE_PXL:
......@@ -169,24 +168,26 @@ static void a3d_read(struct a3d *a3d, unsigned char *data)
input_sync(dev);
return;
break;
}
}
/*
* a3d_timer() reads and analyzes A3D joystick data.
* a3d_poll() reads and analyzes A3D joystick data.
*/
static void a3d_timer(unsigned long private)
static void a3d_poll(struct gameport *gameport)
{
struct a3d *a3d = (void *) private;
struct a3d *a3d = gameport_get_drvdata(gameport);
unsigned char data[A3D_MAX_LENGTH];
a3d->reads++;
if (a3d_read_packet(a3d->gameport, a3d->length, data) != a3d->length
|| data[0] != a3d->mode || a3d_csum(data, a3d->length))
a3d->bads++; else a3d_read(a3d, data);
mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);
if (a3d_read_packet(a3d->gameport, a3d->length, data) != a3d->length ||
data[0] != a3d->mode || a3d_csum(data, a3d->length))
a3d->bads++;
else
a3d_read(a3d, data);
}
/*
......@@ -195,10 +196,11 @@ static void a3d_timer(unsigned long private)
* call this more than 50 times a second, which would use too much CPU.
*/
int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons)
static int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{
struct a3d *a3d = gameport->driver;
struct a3d *a3d = gameport->port_data;
int i;
for (i = 0; i < 4; i++)
axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1;
*buttons = a3d->buttons;
......@@ -210,13 +212,14 @@ int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons)
* any but cooked data.
*/
int a3d_adc_open(struct gameport *gameport, int mode)
static int a3d_adc_open(struct gameport *gameport, int mode)
{
struct a3d *a3d = gameport->driver;
struct a3d *a3d = gameport->port_data;
if (mode != GAMEPORT_MODE_COOKED)
return -1;
if (!a3d->used++)
mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);
gameport_start_polling(a3d->gameport);
return 0;
}
......@@ -226,9 +229,9 @@ int a3d_adc_open(struct gameport *gameport, int mode)
static void a3d_adc_close(struct gameport *gameport)
{
struct a3d *a3d = gameport->driver;
if (!--a3d->used)
del_timer(&a3d->timer);
struct a3d *a3d = gameport->port_data;
gameport_stop_polling(a3d->gameport);
}
/*
......@@ -238,8 +241,8 @@ static void a3d_adc_close(struct gameport *gameport)
static int a3d_open(struct input_dev *dev)
{
struct a3d *a3d = dev->private;
if (!a3d->used++)
mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);
gameport_start_polling(a3d->gameport);
return 0;
}
......@@ -250,49 +253,53 @@ static int a3d_open(struct input_dev *dev)
static void a3d_close(struct input_dev *dev)
{
struct a3d *a3d = dev->private;
if (!--a3d->used)
del_timer(&a3d->timer);
gameport_stop_polling(a3d->gameport);
}
/*
* a3d_connect() probes for A3D joysticks.
*/
static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct a3d *a3d;
struct gameport *adc;
unsigned char data[A3D_MAX_LENGTH];
int i;
int err;
if (!(a3d = kmalloc(sizeof(struct a3d), GFP_KERNEL)))
return;
memset(a3d, 0, sizeof(struct a3d));
gameport->private = a3d;
if (!(a3d = kcalloc(1, sizeof(struct a3d), GFP_KERNEL)))
return -ENOMEM;
a3d->gameport = gameport;
init_timer(&a3d->timer);
a3d->timer.data = (long) a3d;
a3d->timer.function = a3d_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, a3d);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
i = a3d_read_packet(gameport, A3D_MAX_LENGTH, data);
if (!i || a3d_csum(data, i))
if (!i || a3d_csum(data, i)) {
err = -ENODEV;
goto fail2;
}
a3d->mode = data[0];
if (!a3d->mode || a3d->mode > 5) {
printk(KERN_WARNING "a3d.c: Unknown A3D device detected "
"(%s, id=%d), contact <vojtech@ucw.cz>\n", gameport->phys, a3d->mode);
err = -ENODEV;
goto fail2;
}
gameport_set_poll_handler(gameport, a3d_poll);
gameport_set_poll_interval(gameport, 20);
sprintf(a3d->phys, "%s/input0", gameport->phys);
sprintf(a3d->adcphys, "%s/gameport0", gameport->phys);
if (a3d->mode == A3D_MODE_PXL) {
......@@ -315,16 +322,11 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
a3d_read(a3d, data);
for (i = 0; i < 4; i++) {
if (i < 2) {
a3d->dev.absmin[axes[i]] = 48;
a3d->dev.absmax[axes[i]] = a3d->dev.abs[axes[i]] * 2 - 48;
a3d->dev.absflat[axes[i]] = 8;
} else {
a3d->dev.absmin[axes[i]] = 2;
a3d->dev.absmax[axes[i]] = 253;
}
a3d->dev.absmin[ABS_HAT0X + i] = -1;
a3d->dev.absmax[ABS_HAT0X + i] = 1;
if (i < 2)
input_set_abs_params(&a3d->dev, axes[i], 48, a3d->dev.abs[axes[i]] * 2 - 48, 0, 8);
else
input_set_abs_params(&a3d->dev, axes[i], 2, 253, 0, 0);
input_set_abs_params(&a3d->dev, ABS_HAT0X + i, -1, 1, 0, 0);
}
} else {
......@@ -336,23 +338,23 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y);
a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE);
a3d->adc.driver = a3d;
a3d->adc.open = a3d_adc_open;
a3d->adc.close = a3d_adc_close;
a3d->adc.cooked_read = a3d_adc_cooked_read;
a3d->adc.fuzz = 1;
a3d_read(a3d, data);
a3d->adc.name = a3d_names[a3d->mode];
a3d->adc.phys = a3d->adcphys;
a3d->adc.id.bustype = BUS_GAMEPORT;
a3d->adc.id.vendor = GAMEPORT_ID_VENDOR_MADCATZ;
a3d->adc.id.product = a3d->mode;
a3d->adc.id.version = 0x0100;
if (!(a3d->adc = adc = gameport_allocate_port()))
printk(KERN_ERR "a3d: Not enough memory for ADC port\n");
else {
adc->port_data = a3d;
adc->open = a3d_adc_open;
adc->close = a3d_adc_close;
adc->cooked_read = a3d_adc_cooked_read;
adc->fuzz = 1;
a3d_read(a3d, data);
gameport_set_name(adc, a3d_names[a3d->mode]);
gameport_set_phys(adc, "%s/gameport0", gameport->phys);
adc->dev.parent = &gameport->dev;
gameport_register_port(&a3d->adc);
printk(KERN_INFO "gameport: %s on %s\n", a3d_names[a3d->mode], gameport->phys);
gameport_register_port(adc);
}
}
a3d->dev.private = a3d;
......@@ -369,36 +371,46 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
input_register_device(&a3d->dev);
printk(KERN_INFO "input: %s on %s\n", a3d_names[a3d->mode], a3d->phys);
return;
return 0;
fail2: gameport_close(gameport);
fail1: kfree(a3d);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(a3d);
return err;
}
static void a3d_disconnect(struct gameport *gameport)
{
struct a3d *a3d = gameport_get_drvdata(gameport);
struct a3d *a3d = gameport->private;
input_unregister_device(&a3d->dev);
if (a3d->mode < A3D_MODE_PXL)
gameport_unregister_port(&a3d->adc);
if (a3d->adc) {
gameport_unregister_port(a3d->adc);
a3d->adc = NULL;
}
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(a3d);
}
static struct gameport_dev a3d_dev = {
.connect = a3d_connect,
.disconnect = a3d_disconnect,
static struct gameport_driver a3d_drv = {
.driver = {
.name = "adc",
},
.description = DRIVER_DESC,
.connect = a3d_connect,
.disconnect = a3d_disconnect,
};
int __init a3d_init(void)
static int __init a3d_init(void)
{
gameport_register_device(&a3d_dev);
gameport_register_driver(&a3d_drv);
return 0;
}
void __exit a3d_exit(void)
static void __exit a3d_exit(void)
{
gameport_unregister_device(&a3d_dev);
gameport_unregister_driver(&a3d_drv);
}
module_init(a3d_init);
......
/*
* $Id: adi.c,v 1.23 2002/01/22 20:26:17 vojtech Exp $
*
* Copyright (c) 1998-2001 Vojtech Pavlik
* Copyright (c) 1998-2005 Vojtech Pavlik
*/
/*
......@@ -37,8 +35,10 @@
#include <linux/gameport.h>
#include <linux/init.h>
#define DRIVER_DESC "Logitech ADI joystick family driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Logitech ADI joystick family driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
/*
......@@ -47,7 +47,6 @@ MODULE_LICENSE("GPL");
#define ADI_MAX_START 200 /* Trigger to packet timeout [200us] */
#define ADI_MAX_STROBE 40 /* Single bit timeout [40us] */
#define ADI_REFRESH_TIME HZ/50 /* How often to poll the joystick [20 ms] */
#define ADI_INIT_DELAY 10 /* Delay after init packet [10ms] */
#define ADI_DATA_DELAY 4 /* Delay after data packet [4ms] */
......@@ -57,7 +56,7 @@ MODULE_LICENSE("GPL");
#define ADI_MIN_ID_LENGTH 66
#define ADI_MAX_NAME_LENGTH 48
#define ADI_MAX_CNAME_LENGTH 16
#define ADI_MAX_PHYS_LENGTH 32
#define ADI_MAX_PHYS_LENGTH 64
#define ADI_FLAG_HAT 0x04
#define ADI_FLAG_10BIT 0x08
......@@ -127,11 +126,9 @@ struct adi {
struct adi_port {
struct gameport *gameport;
struct timer_list timer;
struct adi adi[2];
int bad;
int reads;
int used;
};
/*
......@@ -275,15 +272,15 @@ static int adi_read(struct adi_port *port)
}
/*
* adi_timer() repeatedly polls the Logitech joysticks.
* adi_poll() repeatedly polls the Logitech joysticks.
*/
static void adi_timer(unsigned long data)
static void adi_poll(struct gameport *gameport)
{
struct adi_port *port = (void *) data;
struct adi_port *port = gameport_get_drvdata(gameport);
port->bad -= adi_read(port);
port->reads++;
mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME);
}
/*
......@@ -293,8 +290,8 @@ static void adi_timer(unsigned long data)
static int adi_open(struct input_dev *dev)
{
struct adi_port *port = dev->private;
if (!port->used++)
mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME);
gameport_start_polling(port->gameport);
return 0;
}
......@@ -305,8 +302,8 @@ static int adi_open(struct input_dev *dev)
static void adi_close(struct input_dev *dev)
{
struct adi_port *port = dev->private;
if (!--port->used)
del_timer(&port->timer);
gameport_stop_polling(port->gameport);
}
/*
......@@ -316,13 +313,16 @@ static void adi_close(struct input_dev *dev)
static void adi_init_digital(struct gameport *gameport)
{
int seq[] = { 3, -2, -3, 10, -6, -11, -7, -9, 11, 0 };
int seq[] = { 4, -2, -3, 10, -6, -11, -7, -9, 11, 0 };
int i;
for (i = 0; seq[i]; i++) {
gameport_trigger(gameport);
if (seq[i] > 0) msleep(seq[i]);
if (seq[i] < 0) mdelay(-seq[i]);
if (seq[i] < 0) {
mdelay(-seq[i]);
udelay(-seq[i]*14); /* It looks like mdelay() is off by approx 1.4% */
}
}
}
......@@ -408,9 +408,9 @@ static void adi_init_input(struct adi *adi, struct adi_port *port, int half)
t = adi->id < ADI_ID_MAX ? adi->id : ADI_ID_MAX;
sprintf(buf, adi_names[t], adi->id);
sprintf(adi->name, "Logitech %s", buf);
sprintf(adi->phys, "%s/input%d", port->gameport->phys, half);
snprintf(buf, ADI_MAX_PHYS_LENGTH, adi_names[t], adi->id);
snprintf(adi->name, ADI_MAX_NAME_LENGTH, "Logitech %s", buf);
snprintf(adi->phys, ADI_MAX_PHYS_LENGTH, "%s/input%d", port->gameport->phys, half);
adi->abs = adi_abs[t];
adi->key = adi_key[t];
......@@ -439,35 +439,23 @@ static void adi_init_center(struct adi *adi)
{
int i, t, x;
if (!adi->length) return;
if (!adi->length)
return;
for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++) {
t = adi->abs[i];
x = adi->dev.abs[t];
if (t == ABS_THROTTLE || t == ABS_RUDDER || adi->id == ADI_ID_WGPE) {
if (i < adi->axes10) x = 512; else x = 128;
}
if (i < adi->axes10) {
adi->dev.absmax[t] = x * 2 - 64;
adi->dev.absmin[t] = 64;
adi->dev.absfuzz[t] = 2;
adi->dev.absflat[t] = 16;
continue;
}
if (t == ABS_THROTTLE || t == ABS_RUDDER || adi->id == ADI_ID_WGPE)
x = i < adi->axes10 ? 512 : 128;
if (i < adi->axes10 + adi->axes8) {
adi->dev.absmax[t] = x * 2 - 48;
adi->dev.absmin[t] = 48;
adi->dev.absfuzz[t] = 1;
adi->dev.absflat[t] = 16;
continue;
}
adi->dev.absmax[t] = 1;
adi->dev.absmin[t] = -1;
if (i < adi->axes10)
input_set_abs_params(&adi->dev, t, 64, x * 2 - 64, 2, 16);
else if (i < adi->axes10 + adi->axes8)
input_set_abs_params(&adi->dev, t, 48, x * 2 - 48, 1, 16);
else
input_set_abs_params(&adi->dev, t, -1, 1, 0, 0);
}
}
......@@ -475,25 +463,23 @@ static void adi_init_center(struct adi *adi)
* adi_connect() probes for Logitech ADI joysticks.
*/
static void adi_connect(struct gameport *gameport, struct gameport_dev *dev)
static int adi_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct adi_port *port;
int i;
int err;
if (!(port = kmalloc(sizeof(struct adi_port), GFP_KERNEL)))
return;
memset(port, 0, sizeof(struct adi_port));
gameport->private = port;
if (!(port = kcalloc(1, sizeof(struct adi_port), GFP_KERNEL)))
return -ENOMEM;
port->gameport = gameport;
init_timer(&port->timer);
port->timer.data = (long) port;
port->timer.function = adi_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW)) {
gameport_set_drvdata(gameport, port);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err) {
kfree(port);
return;
return err;
}
adi_init_digital(gameport);
......@@ -510,9 +496,12 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev)
if (!port->adi[0].length && !port->adi[1].length) {
gameport_close(gameport);
kfree(port);
return;
return -ENODEV;
}
gameport_set_poll_handler(gameport, adi_poll);
gameport_set_poll_interval(gameport, 20);
msleep(ADI_INIT_DELAY);
if (adi_read(port)) {
msleep(ADI_DATA_DELAY);
......@@ -526,17 +515,20 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev)
printk(KERN_INFO "input: %s [%s] on %s\n",
port->adi[i].name, port->adi[i].cname, gameport->phys);
}
return 0;
}
static void adi_disconnect(struct gameport *gameport)
{
int i;
struct adi_port *port = gameport_get_drvdata(gameport);
struct adi_port *port = gameport->private;
for (i = 0; i < 2; i++)
if (port->adi[i].length > 0)
input_unregister_device(&port->adi[i].dev);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(port);
}
......@@ -544,20 +536,24 @@ static void adi_disconnect(struct gameport *gameport)
* The gameport device structure.
*/
static struct gameport_dev adi_dev = {
.connect = adi_connect,
.disconnect = adi_disconnect,
static struct gameport_driver adi_drv = {
.driver = {
.name = "adi",
},
.description = DRIVER_DESC,
.connect = adi_connect,
.disconnect = adi_disconnect,
};
int __init adi_init(void)
static int __init adi_init(void)
{
gameport_register_device(&adi_dev);
gameport_register_driver(&adi_drv);
return 0;
}
void __exit adi_exit(void)
static void __exit adi_exit(void)
{
gameport_unregister_device(&adi_dev);
gameport_unregister_driver(&adi_drv);
}
module_init(adi_init);
......
......@@ -40,8 +40,10 @@
#include <linux/gameport.h>
#include <asm/timex.h>
#define DRIVER_DESC "Analog joystick and gamepad driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Analog joystick and gamepad driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
/*
......@@ -88,7 +90,6 @@ __obsolete_setup("js=");
#define ANALOG_MAX_TIME 3 /* 3 ms */
#define ANALOG_LOOP_TIME 2000 /* 2 * loop */
#define ANALOG_REFRESH_TIME HZ/100 /* 10 ms */
#define ANALOG_SAITEK_DELAY 200 /* 200 us */
#define ANALOG_SAITEK_TIME 2000 /* 2000 us */
#define ANALOG_AXIS_TIME 2 /* 2 * refresh */
......@@ -119,7 +120,6 @@ struct analog {
struct analog_port {
struct gameport *gameport;
struct timer_list timer;
struct analog analog[2];
unsigned char mask;
char saitek;
......@@ -132,7 +132,6 @@ struct analog_port {
int axes[4];
int buttons;
int initial[4];
int used;
int axtime;
};
......@@ -305,12 +304,12 @@ static int analog_button_read(struct analog_port *port, char saitek, char chf)
}
/*
* analog_timer() repeatedly polls the Analog joysticks.
* analog_poll() repeatedly polls the Analog joysticks.
*/
static void analog_timer(unsigned long data)
static void analog_poll(struct gameport *gameport)
{
struct analog_port *port = (void *) data;
struct analog_port *port = gameport_get_drvdata(gameport);
int i;
char saitek = !!(port->analog[0].mask & ANALOG_SAITEK);
......@@ -336,8 +335,6 @@ static void analog_timer(unsigned long data)
for (i = 0; i < 2; i++)
if (port->analog[i].mask)
analog_decode(port->analog + i, port->axes, port->initial, port->buttons);
mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME);
}
/*
......@@ -347,8 +344,8 @@ static void analog_timer(unsigned long data)
static int analog_open(struct input_dev *dev)
{
struct analog_port *port = dev->private;
if (!port->used++)
mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME);
gameport_start_polling(port->gameport);
return 0;
}
......@@ -359,8 +356,8 @@ static int analog_open(struct input_dev *dev)
static void analog_close(struct input_dev *dev)
{
struct analog_port *port = dev->private;
if (!--port->used)
del_timer(&port->timer);
gameport_stop_polling(port->gameport);
}
/*
......@@ -379,7 +376,7 @@ static void analog_calibrate_timer(struct analog_port *port)
#ifdef FAKE_TIME
analog_faketime += 830;
#endif
udelay(1000);
mdelay(1);
GET_TIME(t2);
GET_TIME(t3);
local_irq_restore(flags);
......@@ -587,17 +584,15 @@ static int analog_init_masks(struct analog_port *port)
return -!(analog[0].mask || analog[1].mask);
}
static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, struct analog_port *port)
static int analog_init_port(struct gameport *gameport, struct gameport_driver *drv, struct analog_port *port)
{
int i, t, u, v;
gameport->private = port;
port->gameport = gameport;
init_timer(&port->timer);
port->timer.data = (long) port;
port->timer.function = analog_timer;
if (!gameport_open(gameport, dev, GAMEPORT_MODE_RAW)) {
gameport_set_drvdata(gameport, port);
if (!gameport_open(gameport, drv, GAMEPORT_MODE_RAW)) {
analog_calibrate_timer(port);
......@@ -608,7 +603,8 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev,
port->fuzz = (port->speed * ANALOG_FUZZ_MAGIC) / port->loop / 1000 + ANALOG_FUZZ_BITS;
for (i = 0; i < ANALOG_INIT_RETRIES; i++) {
if (!analog_cooked_read(port)) break;
if (!analog_cooked_read(port))
break;
msleep(ANALOG_MAX_TIME);
}
......@@ -617,11 +613,13 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev,
msleep(ANALOG_MAX_TIME);
t = gameport_time(gameport, ANALOG_MAX_TIME * 1000);
gameport_trigger(gameport);
while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++;
while ((gameport_read(port->gameport) & port->mask) && (u < t))
u++;
udelay(ANALOG_SAITEK_DELAY);
t = gameport_time(gameport, ANALOG_SAITEK_TIME);
gameport_trigger(gameport);
while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++;
while ((gameport_read(port->gameport) & port->mask) && (v < t))
v++;
if (v < (u >> 1)) { /* FIXME - more than one port */
analog_options[0] |= /* FIXME - more than one port */
......@@ -632,59 +630,66 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev,
gameport_close(gameport);
}
if (!gameport_open(gameport, dev, GAMEPORT_MODE_COOKED)) {
if (!gameport_open(gameport, drv, GAMEPORT_MODE_COOKED)) {
for (i = 0; i < ANALOG_INIT_RETRIES; i++)
if (!gameport_cooked_read(gameport, port->axes, &port->buttons))
break;
for (i = 0; i < 4; i++)
if (port->axes[i] != -1) port->mask |= 1 << i;
if (port->axes[i] != -1)
port->mask |= 1 << i;
port->fuzz = gameport->fuzz;
port->cooked = 1;
return 0;
}
if (!gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
return 0;
return -1;
return gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
}
static void analog_connect(struct gameport *gameport, struct gameport_dev *dev)
static int analog_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct analog_port *port;
int i;
int err;
if (!(port = kmalloc(sizeof(struct analog_port), GFP_KERNEL)))
return;
memset(port, 0, sizeof(struct analog_port));
if (!(port = kcalloc(1, sizeof(struct analog_port), GFP_KERNEL)))
return - ENOMEM;
if (analog_init_port(gameport, dev, port)) {
err = analog_init_port(gameport, drv, port);
if (err) {
kfree(port);
return;
return err;
}
if (analog_init_masks(port)) {
err = analog_init_masks(port);
if (err) {
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(port);
return;
return err;
}
gameport_set_poll_handler(gameport, analog_poll);
gameport_set_poll_interval(gameport, 10);
for (i = 0; i < 2; i++)
if (port->analog[i].mask)
analog_init_device(port, port->analog + i, i);
return 0;
}
static void analog_disconnect(struct gameport *gameport)
{
int i;
struct analog_port *port = gameport_get_drvdata(gameport);
struct analog_port *port = gameport->private;
for (i = 0; i < 2; i++)
if (port->analog[i].mask)
input_unregister_device(&port->analog[i].dev);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
printk(KERN_INFO "analog.c: %d out of %d reads (%d%%) on %s failed\n",
port->bads, port->reads, port->reads ? (port->bads * 100 / port->reads) : 0,
port->gameport->phys);
......@@ -696,7 +701,7 @@ struct analog_types {
int value;
};
struct analog_types analog_types[] = {
static struct analog_types analog_types[] = {
{ "none", 0x00000000 },
{ "auto", 0x000000ff },
{ "2btn", 0x0000003f },
......@@ -741,21 +746,26 @@ static void analog_parse_options(void)
* The gameport device structure.
*/
static struct gameport_dev analog_dev = {
.connect = analog_connect,
.disconnect = analog_disconnect,
static struct gameport_driver analog_drv = {
.driver = {
.name = "analog",
},
.description = DRIVER_DESC,
.connect = analog_connect,
.disconnect = analog_disconnect,
};
int __init analog_init(void)
static int __init analog_init(void)
{
analog_parse_options();
gameport_register_device(&analog_dev);
gameport_register_driver(&analog_drv);
return 0;
}
void __exit analog_exit(void)
static void __exit analog_exit(void)
{
gameport_unregister_device(&analog_dev);
gameport_unregister_driver(&analog_drv);
}
module_init(analog_init);
......
......@@ -35,12 +35,13 @@
#include <linux/gameport.h>
#include <linux/input.h>
#define DRIVER_DESC "Creative Labs Blaster GamePad Cobra driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Creative Labs Blaster GamePad Cobra driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define COBRA_MAX_STROBE 45 /* 45 us max wait for first strobe */
#define COBRA_REFRESH_TIME HZ/50 /* 20 ms between reads */
#define COBRA_LENGTH 36
static char* cobra_name = "Creative Labs Blaster GamePad Cobra";
......@@ -49,9 +50,7 @@ static int cobra_btn[] = { BTN_START, BTN_SELECT, BTN_TL, BTN_TR, BTN_X, BTN_Y,
struct cobra {
struct gameport *gameport;
struct timer_list timer;
struct input_dev dev[2];
int used;
int reads;
int bads;
unsigned char exists;
......@@ -112,18 +111,19 @@ static unsigned char cobra_read_packet(struct gameport *gameport, unsigned int *
return ret;
}
static void cobra_timer(unsigned long private)
static void cobra_poll(struct gameport *gameport)
{
struct cobra *cobra = (void *) private;
struct cobra *cobra = gameport_get_drvdata(gameport);
struct input_dev *dev;
unsigned int data[2];
int i, j, r;
cobra->reads++;
if ((r = cobra_read_packet(cobra->gameport, data)) != cobra->exists)
if ((r = cobra_read_packet(gameport, data)) != cobra->exists) {
cobra->bads++;
else
return;
}
for (i = 0; i < 2; i++)
if (cobra->exists & r & (1 << i)) {
......@@ -139,43 +139,39 @@ static void cobra_timer(unsigned long private)
input_sync(dev);
}
mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME);
}
static int cobra_open(struct input_dev *dev)
{
struct cobra *cobra = dev->private;
if (!cobra->used++)
mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME);
gameport_start_polling(cobra->gameport);
return 0;
}
static void cobra_close(struct input_dev *dev)
{
struct cobra *cobra = dev->private;
if (!--cobra->used)
del_timer(&cobra->timer);
gameport_stop_polling(cobra->gameport);
}
static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev)
static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct cobra *cobra;
unsigned int data[2];
int i, j;
int err;
if (!(cobra = kmalloc(sizeof(struct cobra), GFP_KERNEL)))
return;
memset(cobra, 0, sizeof(struct cobra));
gameport->private = cobra;
if (!(cobra = kcalloc(1, sizeof(struct cobra), GFP_KERNEL)))
return -ENOMEM;
cobra->gameport = gameport;
init_timer(&cobra->timer);
cobra->timer.data = (long) cobra;
cobra->timer.function = cobra_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, cobra);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
cobra->exists = cobra_read_packet(gameport, data);
......@@ -187,8 +183,13 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev)
cobra->exists &= ~(1 << i);
}
if (!cobra->exists)
if (!cobra->exists) {
err = -ENODEV;
goto fail2;
}
gameport_set_poll_handler(gameport, cobra_poll);
gameport_set_poll_interval(gameport, 20);
for (i = 0; i < 2; i++)
if ((cobra->exists >> i) & 1) {
......@@ -207,49 +208,56 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev)
cobra->dev[i].id.version = 0x0100;
cobra->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
cobra->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
input_set_abs_params(&cobra->dev[i], ABS_X, -1, 1, 0, 0);
input_set_abs_params(&cobra->dev[i], ABS_Y, -1, 1, 0, 0);
for (j = 0; cobra_btn[j]; j++)
set_bit(cobra_btn[j], cobra->dev[i].keybit);
cobra->dev[i].absmin[ABS_X] = -1; cobra->dev[i].absmax[ABS_X] = 1;
cobra->dev[i].absmin[ABS_Y] = -1; cobra->dev[i].absmax[ABS_Y] = 1;
input_register_device(cobra->dev + i);
input_register_device(&cobra->dev[i]);
printk(KERN_INFO "input: %s on %s\n", cobra_name, gameport->phys);
}
return;
return 0;
fail2: gameport_close(gameport);
fail1: kfree(cobra);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(cobra);
return err;
}
static void cobra_disconnect(struct gameport *gameport)
{
struct cobra *cobra = gameport_get_drvdata(gameport);
int i;
struct cobra *cobra = gameport->private;
for (i = 0; i < 2; i++)
if ((cobra->exists >> i) & 1)
input_unregister_device(cobra->dev + i);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(cobra);
}
static struct gameport_dev cobra_dev = {
.connect = cobra_connect,
.disconnect = cobra_disconnect,
static struct gameport_driver cobra_drv = {
.driver = {
.name = "cobra",
},
.description = DRIVER_DESC,
.connect = cobra_connect,
.disconnect = cobra_disconnect,
};
int __init cobra_init(void)
static int __init cobra_init(void)
{
gameport_register_device(&cobra_dev);
gameport_register_driver(&cobra_drv);
return 0;
}
void __exit cobra_exit(void)
static void __exit cobra_exit(void)
{
gameport_unregister_device(&cobra_dev);
gameport_unregister_driver(&cobra_drv);
}
module_init(cobra_init);
......
......@@ -619,7 +619,7 @@ static struct db9 __init *db9_probe(int *config, int nargs)
return db9;
}
int __init db9_init(void)
static int __init db9_init(void)
{
db9_base[0] = db9_probe(db9, db9_nargs);
db9_base[1] = db9_probe(db9_2, db9_nargs_2);
......@@ -631,7 +631,7 @@ int __init db9_init(void)
return -ENODEV;
}
void __exit db9_exit(void)
static void __exit db9_exit(void)
{
int i, j;
......
......@@ -227,7 +227,8 @@ static void gc_multi_read_packet(struct gc *gc, int length, unsigned char *data)
*/
#define GC_PSX_DELAY 25 /* 25 usec */
#define GC_PSX_LENGTH 8 /* talk to the controller in bytes */
#define GC_PSX_LENGTH 8 /* talk to the controller in bits */
#define GC_PSX_BYTES 6 /* the maximum number of bytes to read off the controller */
#define GC_PSX_MOUSE 1 /* Mouse */
#define GC_PSX_NEGCON 2 /* NegCon */
......@@ -241,7 +242,7 @@ static void gc_multi_read_packet(struct gc *gc, int length, unsigned char *data)
#define GC_PSX_SELECT 0x02 /* Pin 3 */
#define GC_PSX_ID(x) ((x) >> 4) /* High nibble is device type */
#define GC_PSX_LEN(x) ((x) & 0xf) /* Low nibble is length in words */
#define GC_PSX_LEN(x) (((x) & 0xf) << 1) /* Low nibble is length in bytes/2 */
static int gc_psx_delay = GC_PSX_DELAY;
module_param_named(psx_delay, gc_psx_delay, uint, 0);
......@@ -259,13 +260,13 @@ static short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 };
* the psx pad.
*/
static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_PSX_LENGTH])
static void gc_psx_command(struct gc *gc, int b, unsigned char data[5])
{
int i, j, cmd, read;
for (i = 0; i < 5; i++)
data[i] = 0;
for (i = 0; i < 8; i++, b >>= 1) {
for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) {
cmd = (b & 1) ? GC_PSX_COMMAND : 0;
parport_write_data(gc->pd->port, cmd | GC_PSX_POWER);
udelay(gc_psx_delay);
......@@ -282,7 +283,7 @@ static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_PSX_LENGT
* device identifier code.
*/
static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_LENGTH], unsigned char id[5])
static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_BYTES], unsigned char id[5])
{
int i, j, max_len = 0;
unsigned long flags;
......@@ -300,10 +301,12 @@ static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_LENGT
gc_psx_command(gc, 0, data2); /* Dump status */
for (i =0; i < 5; i++) /* Find the longest pad */
if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) && (GC_PSX_LEN(id[i]) > max_len))
if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR]))
&& (GC_PSX_LEN(id[i]) > max_len)
&& (GC_PSX_LEN(id[i]) <= GC_PSX_BYTES))
max_len = GC_PSX_LEN(id[i]);
for (i = 0; i < max_len * 2; i++) { /* Read in all the data */
for (i = 0; i < max_len; i++) { /* Read in all the data */
gc_psx_command(gc, 0, data2);
for (j = 0; j < 5; j++)
data[j][i] = data2[j];
......@@ -328,7 +331,7 @@ static void gc_timer(unsigned long private)
struct gc *gc = (void *) private;
struct input_dev *dev = gc->dev;
unsigned char data[GC_MAX_LENGTH];
unsigned char data_psx[5][GC_PSX_LENGTH];
unsigned char data_psx[5][GC_PSX_BYTES];
int i, j, s;
/*
......@@ -665,7 +668,7 @@ static struct gc __init *gc_probe(int *config, int nargs)
return gc;
}
int __init gc_init(void)
static int __init gc_init(void)
{
gc_base[0] = gc_probe(gc, gc_nargs);
gc_base[1] = gc_probe(gc_2, gc_nargs_2);
......@@ -677,7 +680,7 @@ int __init gc_init(void)
return -ENODEV;
}
void __exit gc_exit(void)
static void __exit gc_exit(void)
{
int i, j;
......
......@@ -36,15 +36,16 @@
#include <linux/input.h>
#include <linux/gameport.h>
#define DRIVER_DESC "Genius Flight 2000 joystick driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Genius Flight 2000 joystick driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define GF2K_START 400 /* The time we wait for the first bit [400 us] */
#define GF2K_STROBE 40 /* The time we wait for the first bit [40 us] */
#define GF2K_TIMEOUT 4 /* Wait for everything to settle [4 ms] */
#define GF2K_LENGTH 80 /* Max number of triplets in a packet */
#define GF2K_REFRESH HZ/50 /* Time between joystick polls [20 ms] */
/*
* Genius joystick ids ...
......@@ -80,11 +81,9 @@ static short gf2k_seq_digital[] = { 590, 320, 860, 0 };
struct gf2k {
struct gameport *gameport;
struct timer_list timer;
struct input_dev dev;
int reads;
int bads;
int used;
unsigned char id;
unsigned char length;
char phys[32];
......@@ -202,60 +201,56 @@ static void gf2k_read(struct gf2k *gf2k, unsigned char *data)
}
/*
* gf2k_timer() reads and analyzes Genius joystick data.
* gf2k_poll() reads and analyzes Genius joystick data.
*/
static void gf2k_timer(unsigned long private)
static void gf2k_poll(struct gameport *gameport)
{
struct gf2k *gf2k = (void *) private;
struct gf2k *gf2k = gameport_get_drvdata(gameport);
unsigned char data[GF2K_LENGTH];
gf2k->reads++;
if (gf2k_read_packet(gf2k->gameport, gf2k_length[gf2k->id], data) < gf2k_length[gf2k->id]) {
if (gf2k_read_packet(gf2k->gameport, gf2k_length[gf2k->id], data) < gf2k_length[gf2k->id])
gf2k->bads++;
} else gf2k_read(gf2k, data);
mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH);
else
gf2k_read(gf2k, data);
}
static int gf2k_open(struct input_dev *dev)
{
struct gf2k *gf2k = dev->private;
if (!gf2k->used++)
mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH);
gameport_start_polling(gf2k->gameport);
return 0;
}
static void gf2k_close(struct input_dev *dev)
{
struct gf2k *gf2k = dev->private;
if (!--gf2k->used)
del_timer(&gf2k->timer);
gameport_stop_polling(gf2k->gameport);
}
/*
* gf2k_connect() probes for Genius id joysticks.
*/
static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct gf2k *gf2k;
unsigned char data[GF2K_LENGTH];
int i;
if (!(gf2k = kmalloc(sizeof(struct gf2k), GFP_KERNEL)))
return;
memset(gf2k, 0, sizeof(struct gf2k));
int i, err;
gameport->private = gf2k;
if (!(gf2k = kcalloc(1, sizeof(struct gf2k), GFP_KERNEL)))
return -ENOMEM;
gf2k->gameport = gameport;
init_timer(&gf2k->timer);
gf2k->timer.data = (long) gf2k;
gf2k->timer.function = gf2k_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, gf2k);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
gf2k_trigger_seq(gameport, gf2k_seq_reset);
......@@ -266,16 +261,22 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
msleep(GF2K_TIMEOUT);
if (gf2k_read_packet(gameport, GF2K_LENGTH, data) < 12)
if (gf2k_read_packet(gameport, GF2K_LENGTH, data) < 12) {
err = -ENODEV;
goto fail2;
}
if (!(gf2k->id = GB(7,2,0) | GB(3,3,2) | GB(0,3,5)))
if (!(gf2k->id = GB(7,2,0) | GB(3,3,2) | GB(0,3,5))) {
err = -ENODEV;
goto fail2;
}
#ifdef RESET_WORKS
if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) ||
(gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5))))
(gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) {
err = -ENODEV;
goto fail2;
}
#else
gf2k->id = 6;
#endif
......@@ -283,9 +284,13 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
if (gf2k->id > GF2K_ID_MAX || !gf2k_axes[gf2k->id]) {
printk(KERN_WARNING "gf2k.c: Not yet supported joystick on %s. [id: %d type:%s]\n",
gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]);
err = -ENODEV;
goto fail2;
}
gameport_set_poll_handler(gameport, gf2k_poll);
gameport_set_poll_interval(gameport, 20);
sprintf(gf2k->phys, "%s/input0", gameport->phys);
gf2k->length = gf2k_lens[gf2k->id];
......@@ -333,33 +338,42 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
input_register_device(&gf2k->dev);
printk(KERN_INFO "input: %s on %s\n", gf2k_names[gf2k->id], gameport->phys);
return;
return 0;
fail2: gameport_close(gameport);
fail1: kfree(gf2k);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(gf2k);
return err;
}
static void gf2k_disconnect(struct gameport *gameport)
{
struct gf2k *gf2k = gameport->private;
struct gf2k *gf2k = gameport_get_drvdata(gameport);
input_unregister_device(&gf2k->dev);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(gf2k);
}
static struct gameport_dev gf2k_dev = {
.connect = gf2k_connect,
.disconnect = gf2k_disconnect,
static struct gameport_driver gf2k_drv = {
.driver = {
.name = "gf2k",
},
.description = DRIVER_DESC,
.connect = gf2k_connect,
.disconnect = gf2k_disconnect,
};
int __init gf2k_init(void)
static int __init gf2k_init(void)
{
gameport_register_device(&gf2k_dev);
gameport_register_driver(&gf2k_drv);
return 0;
}
void __exit gf2k_exit(void)
static void __exit gf2k_exit(void)
{
gameport_unregister_device(&gf2k_dev);
gameport_unregister_driver(&gf2k_drv);
}
module_init(gf2k_init);
......
......@@ -35,8 +35,10 @@
#include <linux/gameport.h>
#include <linux/input.h>
#define DRIVER_DESC "Gravis GrIP protocol joystick driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Gravis GrIP protocol joystick driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define GRIP_MODE_GPP 1
......@@ -51,14 +53,10 @@ MODULE_LICENSE("GPL");
#define GRIP_MAX_CHUNKS_XT 10
#define GRIP_MAX_BITS_XT 30
#define GRIP_REFRESH_TIME HZ/50 /* 20 ms */
struct grip {
struct gameport *gameport;
struct timer_list timer;
struct input_dev dev[2];
unsigned char mode[2];
int used;
int reads;
int bads;
char phys[2][32];
......@@ -183,9 +181,9 @@ static int grip_xt_read_packet(struct gameport *gameport, int shift, unsigned in
* grip_timer() repeatedly polls the joysticks and generates events.
*/
static void grip_timer(unsigned long private)
static void grip_poll(struct gameport *gameport)
{
struct grip *grip = (void*) private;
struct grip *grip = gameport_get_drvdata(gameport);
unsigned int data[GRIP_LENGTH_XT];
struct input_dev *dev;
int i, j;
......@@ -279,43 +277,39 @@ static void grip_timer(unsigned long private)
input_sync(dev);
}
mod_timer(&grip->timer, jiffies + GRIP_REFRESH_TIME);
}
static int grip_open(struct input_dev *dev)
{
struct grip *grip = dev->private;
if (!grip->used++)
mod_timer(&grip->timer, jiffies + GRIP_REFRESH_TIME);
gameport_start_polling(grip->gameport);
return 0;
}
static void grip_close(struct input_dev *dev)
{
struct grip *grip = dev->private;
if (!--grip->used)
del_timer(&grip->timer);
gameport_stop_polling(grip->gameport);
}
static void grip_connect(struct gameport *gameport, struct gameport_dev *dev)
static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct grip *grip;
unsigned int data[GRIP_LENGTH_XT];
int i, j, t;
int err;
if (!(grip = kmalloc(sizeof(struct grip), GFP_KERNEL)))
return;
memset(grip, 0, sizeof(struct grip));
gameport->private = grip;
if (!(grip = kcalloc(1, sizeof(struct grip), GFP_KERNEL)))
return -ENOMEM;
grip->gameport = gameport;
init_timer(&grip->timer);
grip->timer.data = (long) grip;
grip->timer.function = grip_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, grip);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
for (i = 0; i < 2; i++) {
......@@ -337,8 +331,13 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev)
}
}
if (!grip->mode[0] && !grip->mode[1])
if (!grip->mode[0] && !grip->mode[1]) {
err = -ENODEV;
goto fail2;
}
gameport_set_poll_handler(gameport, grip_poll);
gameport_set_poll_interval(gameport, 20);
for (i = 0; i < 2; i++)
if (grip->mode[i]) {
......@@ -361,68 +360,62 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev)
for (j = 0; (t = grip_abs[grip->mode[i]][j]) >= 0; j++) {
set_bit(t, grip->dev[i].absbit);
if (j < grip_cen[grip->mode[i]]) {
grip->dev[i].absmin[t] = 14;
grip->dev[i].absmax[t] = 52;
grip->dev[i].absfuzz[t] = 1;
grip->dev[i].absflat[t] = 2;
continue;
}
if (j < grip_anx[grip->mode[i]]) {
grip->dev[i].absmin[t] = 3;
grip->dev[i].absmax[t] = 57;
grip->dev[i].absfuzz[t] = 1;
continue;
}
grip->dev[i].absmin[t] = -1;
grip->dev[i].absmax[t] = 1;
if (j < grip_cen[grip->mode[i]])
input_set_abs_params(&grip->dev[i], t, 14, 52, 1, 2);
else if (j < grip_anx[grip->mode[i]])
input_set_abs_params(&grip->dev[i], t, 3, 57, 1, 0);
else
input_set_abs_params(&grip->dev[i], t, -1, 1, 0, 0);
}
for (j = 0; (t = grip_btn[grip->mode[i]][j]) >= 0; j++)
if (t > 0)
set_bit(t, grip->dev[i].keybit);
input_register_device(grip->dev + i);
printk(KERN_INFO "input: %s on %s\n",
grip_name[grip->mode[i]], gameport->phys);
input_register_device(grip->dev + i);
}
return;
return 0;
fail2: gameport_close(gameport);
fail1: kfree(grip);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(grip);
return err;
}
static void grip_disconnect(struct gameport *gameport)
{
struct grip *grip = gameport_get_drvdata(gameport);
int i;
struct grip *grip = gameport->private;
for (i = 0; i < 2; i++)
if (grip->mode[i])
input_unregister_device(grip->dev + i);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(grip);
}
static struct gameport_dev grip_dev = {
.connect = grip_connect,
.disconnect = grip_disconnect,
static struct gameport_driver grip_drv = {
.driver = {
.name = "grip",
},
.description = DRIVER_DESC,
.connect = grip_connect,
.disconnect = grip_disconnect,
};
int __init grip_init(void)
static int __init grip_init(void)
{
gameport_register_device(&grip_dev);
gameport_register_driver(&grip_drv);
return 0;
}
void __exit grip_exit(void)
static void __exit grip_exit(void)
{
gameport_unregister_device(&grip_dev);
gameport_unregister_driver(&grip_drv);
}
module_init(grip_init);
......
......@@ -20,8 +20,10 @@
#include <linux/delay.h>
#include <linux/proc_fs.h>
#define DRIVER_DESC "Gravis Grip Multiport driver"
MODULE_AUTHOR("Brian Bonnlander");
MODULE_DESCRIPTION("Gravis Grip Multiport driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#ifdef GRIP_DEBUG
......@@ -36,11 +38,9 @@ MODULE_LICENSE("GPL");
struct grip_mp {
struct gameport *gameport;
struct timer_list timer;
struct input_dev dev[4];
int mode[4];
int registered[4];
int used;
int reads;
int bads;
......@@ -79,7 +79,6 @@ struct grip_mp {
*/
#define GRIP_INIT_DELAY 2000 /* 2 ms */
#define GRIP_REFRESH_TIME HZ/50 /* 20 ms */
#define GRIP_MODE_NONE 0
#define GRIP_MODE_RESET 1
......@@ -477,9 +476,9 @@ static int multiport_init(struct grip_mp *grip)
}
if (dig_mode)
dbg("multiport_init(): digital mode achieved.\n");
dbg("multiport_init(): digital mode activated.\n");
else {
dbg("multiport_init(): unable to achieve digital mode.\n");
dbg("multiport_init(): unable to activate digital mode.\n");
return 0;
}
......@@ -524,8 +523,9 @@ static void report_slot(struct grip_mp *grip, int slot)
* Get the multiport state.
*/
static void get_and_report_mp_state(struct grip_mp *grip)
static void grip_poll(struct gameport *gameport)
{
struct grip_mp *grip = gameport_get_drvdata(gameport);
int i, npkts, flags;
for (npkts = 0; npkts < 4; npkts++) {
......@@ -551,8 +551,8 @@ static void get_and_report_mp_state(struct grip_mp *grip)
static int grip_open(struct input_dev *dev)
{
struct grip_mp *grip = dev->private;
if (!grip->used++)
mod_timer(&grip->timer, jiffies + GRIP_REFRESH_TIME);
gameport_start_polling(grip->gameport);
return 0;
}
......@@ -563,8 +563,8 @@ static int grip_open(struct input_dev *dev)
static void grip_close(struct input_dev *dev)
{
struct grip_mp *grip = dev->private;
if (!--grip->used)
del_timer(&grip->timer);
gameport_start_polling(grip->gameport);
}
/*
......@@ -585,11 +585,8 @@ static void register_slot(int slot, struct grip_mp *grip)
grip->dev[slot].id.version = 0x0100;
grip->dev[slot].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (j = 0; (t = grip_abs[grip->mode[slot]][j]) >= 0; j++) {
set_bit(t, grip->dev[slot].absbit);
grip->dev[slot].absmin[t] = -1;
grip->dev[slot].absmax[t] = 1;
}
for (j = 0; (t = grip_abs[grip->mode[slot]][j]) >= 0; j++)
input_set_abs_params(&grip->dev[slot], t, -1, 1, 0, 0);
for (j = 0; (t = grip_btn[grip->mode[slot]][j]) >= 0; j++)
if (t > 0)
......@@ -605,69 +602,75 @@ static void register_slot(int slot, struct grip_mp *grip)
grip_name[grip->mode[slot]], slot);
}
/*
* Repeatedly polls the multiport and generates events.
*/
static void grip_timer(unsigned long private)
{
struct grip_mp *grip = (void*) private;
get_and_report_mp_state(grip);
mod_timer(&grip->timer, jiffies + GRIP_REFRESH_TIME);
}
static void grip_connect(struct gameport *gameport, struct gameport_dev *dev)
static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct grip_mp *grip;
int err;
if (!(grip = kcalloc(1, sizeof(struct grip_mp), GFP_KERNEL)))
return -ENOMEM;
if (!(grip = kmalloc(sizeof(struct grip_mp), GFP_KERNEL)))
return;
memset(grip, 0, sizeof(struct grip_mp));
gameport->private = grip;
grip->gameport = gameport;
init_timer(&grip->timer);
grip->timer.data = (long) grip;
grip->timer.function = grip_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, grip);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
if (!multiport_init(grip))
gameport_set_poll_handler(gameport, grip_poll);
gameport_set_poll_interval(gameport, 20);
if (!multiport_init(grip)) {
err = -ENODEV;
goto fail2;
if (!grip->mode[0] && !grip->mode[1] && /* nothing plugged in */
!grip->mode[2] && !grip->mode[3])
}
if (!grip->mode[0] && !grip->mode[1] && !grip->mode[2] && !grip->mode[3]) {
/* nothing plugged in */
err = -ENODEV;
goto fail2;
return;
}
return 0;
fail2: gameport_close(gameport);
fail1: kfree(grip);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(grip);
return err;
}
static void grip_disconnect(struct gameport *gameport)
{
struct grip_mp *grip = gameport_get_drvdata(gameport);
int i;
struct grip_mp *grip = gameport->private;
for (i = 0; i < 4; i++)
if (grip->registered[i])
input_unregister_device(grip->dev + i);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(grip);
}
static struct gameport_dev grip_dev = {
static struct gameport_driver grip_drv = {
.driver = {
.name = "grip_mp",
},
.description = DRIVER_DESC,
.connect = grip_connect,
.disconnect = grip_disconnect,
};
static int grip_init(void)
static int __init grip_init(void)
{
gameport_register_device(&grip_dev);
gameport_register_driver(&grip_drv);
return 0;
}
static void grip_exit(void)
static void __exit grip_exit(void)
{
gameport_unregister_device(&grip_dev);
gameport_unregister_driver(&grip_drv);
}
module_init(grip_init);
......
......@@ -36,14 +36,15 @@
#include <linux/gameport.h>
#include <linux/input.h>
#define DRIVER_DESC "Guillemot Digital joystick driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Guillemot Digital joystick driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define GUILLEMOT_MAX_START 600 /* 600 us */
#define GUILLEMOT_MAX_STROBE 60 /* 60 us */
#define GUILLEMOT_MAX_LENGTH 17 /* 17 bytes */
#define GUILLEMOT_REFRESH_TIME HZ/50 /* 20 ms */
static short guillemot_abs_pad[] =
{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, -1 };
......@@ -67,8 +68,6 @@ struct guillemot_type {
struct guillemot {
struct gameport *gameport;
struct input_dev dev;
struct timer_list timer;
int used;
int bads;
int reads;
struct guillemot_type *type;
......@@ -118,12 +117,12 @@ static int guillemot_read_packet(struct gameport *gameport, u8 *data)
}
/*
* guillemot_timer() reads and analyzes Guillemot joystick data.
* guillemot_poll() reads and analyzes Guillemot joystick data.
*/
static void guillemot_timer(unsigned long private)
static void guillemot_poll(struct gameport *gameport)
{
struct guillemot *guillemot = (struct guillemot *) private;
struct guillemot *guillemot = gameport_get_drvdata(gameport);
struct input_dev *dev = &guillemot->dev;
u8 data[GUILLEMOT_MAX_LENGTH];
int i;
......@@ -148,8 +147,6 @@ static void guillemot_timer(unsigned long private)
}
input_sync(dev);
mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);
}
/*
......@@ -159,8 +156,8 @@ static void guillemot_timer(unsigned long private)
static int guillemot_open(struct input_dev *dev)
{
struct guillemot *guillemot = dev->private;
if (!guillemot->used++)
mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);
gameport_start_polling(guillemot->gameport);
return 0;
}
......@@ -171,38 +168,38 @@ static int guillemot_open(struct input_dev *dev)
static void guillemot_close(struct input_dev *dev)
{
struct guillemot *guillemot = dev->private;
if (!--guillemot->used)
del_timer(&guillemot->timer);
gameport_stop_polling(guillemot->gameport);
}
/*
* guillemot_connect() probes for Guillemot joysticks.
*/
static void guillemot_connect(struct gameport *gameport, struct gameport_dev *dev)
static int guillemot_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct guillemot *guillemot;
u8 data[GUILLEMOT_MAX_LENGTH];
int i, t;
int err;
if (!(guillemot = kmalloc(sizeof(struct guillemot), GFP_KERNEL)))
return;
memset(guillemot, 0, sizeof(struct guillemot));
gameport->private = guillemot;
if (!(guillemot = kcalloc(1, sizeof(struct guillemot), GFP_KERNEL)))
return -ENOMEM;
guillemot->gameport = gameport;
init_timer(&guillemot->timer);
guillemot->timer.data = (long) guillemot;
guillemot->timer.function = guillemot_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, guillemot);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
i = guillemot_read_packet(gameport, data);
if (i != GUILLEMOT_MAX_LENGTH * 8 || data[0] != 0x55 || data[16] != 0xaa)
if (i != GUILLEMOT_MAX_LENGTH * 8 || data[0] != 0x55 || data[16] != 0xaa) {
err = -ENODEV;
goto fail2;
}
for (i = 0; guillemot_type[i].name; i++)
if (guillemot_type[i].id == data[11])
......@@ -211,9 +208,13 @@ static void guillemot_connect(struct gameport *gameport, struct gameport_dev *de
if (!guillemot_type[i].name) {
printk(KERN_WARNING "guillemot.c: Unknown joystick on %s. [ %02x%02x:%04x, ver %d.%02d ]\n",
gameport->phys, data[12], data[13], data[11], data[14], data[15]);
err = -ENODEV;
goto fail2;
}
gameport_set_poll_handler(gameport, guillemot_poll);
gameport_set_poll_interval(gameport, 20);
sprintf(guillemot->phys, "%s/input0", gameport->phys);
guillemot->type = guillemot_type + i;
......@@ -231,19 +232,13 @@ static void guillemot_connect(struct gameport *gameport, struct gameport_dev *de
guillemot->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; (t = guillemot->type->abs[i]) >= 0; i++) {
set_bit(t, guillemot->dev.absbit);
guillemot->dev.absmin[t] = 0;
guillemot->dev.absmax[t] = 255;
}
for (i = 0; (t = guillemot->type->abs[i]) >= 0; i++)
input_set_abs_params(&guillemot->dev, t, 0, 255, 0, 0);
if (guillemot->type->hat)
for (i = 0; i < 2; i++) {
t = ABS_HAT0X + i;
set_bit(t, guillemot->dev.absbit);
guillemot->dev.absmin[t] = -1;
guillemot->dev.absmax[t] = 1;
}
if (guillemot->type->hat) {
input_set_abs_params(&guillemot->dev, ABS_HAT0X, -1, 1, 0, 0);
input_set_abs_params(&guillemot->dev, ABS_HAT0Y, -1, 1, 0, 0);
}
for (i = 0; (t = guillemot->type->btn[i]) >= 0; i++)
set_bit(t, guillemot->dev.keybit);
......@@ -252,34 +247,42 @@ static void guillemot_connect(struct gameport *gameport, struct gameport_dev *de
printk(KERN_INFO "input: %s ver %d.%02d on %s\n",
guillemot->type->name, data[14], data[15], gameport->phys);
return;
return 0;
fail2: gameport_close(gameport);
fail1: kfree(guillemot);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(guillemot);
return err;
}
static void guillemot_disconnect(struct gameport *gameport)
{
struct guillemot *guillemot = gameport->private;
struct guillemot *guillemot = gameport_get_drvdata(gameport);
printk(KERN_INFO "guillemot.c: Failed %d reads out of %d on %s\n", guillemot->reads, guillemot->bads, guillemot->phys);
input_unregister_device(&guillemot->dev);
gameport_close(gameport);
kfree(guillemot);
}
static struct gameport_dev guillemot_dev = {
.connect = guillemot_connect,
.disconnect = guillemot_disconnect,
static struct gameport_driver guillemot_drv = {
.driver = {
.name = "guillemot",
},
.description = DRIVER_DESC,
.connect = guillemot_connect,
.disconnect = guillemot_disconnect,
};
int __init guillemot_init(void)
static int __init guillemot_init(void)
{
gameport_register_device(&guillemot_dev);
gameport_register_driver(&guillemot_drv);
return 0;
}
void __exit guillemot_exit(void)
static void __exit guillemot_exit(void)
{
gameport_unregister_device(&guillemot_dev);
gameport_unregister_driver(&guillemot_drv);
}
module_init(guillemot_init);
......
......@@ -75,13 +75,15 @@ void iforce_serial_xmit(struct iforce *iforce)
static void iforce_serio_write_wakeup(struct serio *serio)
{
iforce_serial_xmit((struct iforce *)serio->private);
struct iforce *iforce = serio_get_drvdata(serio);
iforce_serial_xmit(iforce);
}
static irqreturn_t iforce_serio_irq(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct iforce* iforce = serio->private;
struct iforce *iforce = serio_get_drvdata(serio);
if (!iforce->pkt) {
if (data == 0x2b)
......@@ -124,45 +126,66 @@ static irqreturn_t iforce_serio_irq(struct serio *serio,
return IRQ_HANDLED;
}
static void iforce_serio_connect(struct serio *serio, struct serio_driver *drv)
static int iforce_serio_connect(struct serio *serio, struct serio_driver *drv)
{
struct iforce *iforce;
if (serio->type != (SERIO_RS232 | SERIO_IFORCE))
return;
int err;
if (!(iforce = kmalloc(sizeof(struct iforce), GFP_KERNEL)))
return -ENOMEM;
if (!(iforce = kmalloc(sizeof(struct iforce), GFP_KERNEL))) return;
memset(iforce, 0, sizeof(struct iforce));
iforce->bus = IFORCE_232;
iforce->serio = serio;
serio->private = iforce;
if (serio_open(serio, drv)) {
serio_set_drvdata(serio, iforce);
err = serio_open(serio, drv);
if (err) {
serio_set_drvdata(serio, NULL);
kfree(iforce);
return;
return err;
}
if (iforce_init_device(iforce)) {
serio_close(serio);
serio_set_drvdata(serio, NULL);
kfree(iforce);
return;
return -ENODEV;
}
return 0;
}
static void iforce_serio_disconnect(struct serio *serio)
{
struct iforce* iforce = serio->private;
struct iforce *iforce = serio_get_drvdata(serio);
input_unregister_device(&iforce->dev);
serio_close(serio);
serio_set_drvdata(serio, NULL);
kfree(iforce);
}
static struct serio_device_id iforce_serio_ids[] = {
{
.type = SERIO_RS232,
.proto = SERIO_IFORCE,
.id = SERIO_ANY,
.extra = SERIO_ANY,
},
{ 0 }
};
MODULE_DEVICE_TABLE(serio, iforce_serio_ids);
struct serio_driver iforce_serio_drv = {
.driver = {
.name = "iforce",
},
.description = "RS232 I-Force joysticks and wheels driver",
.id_table = iforce_serio_ids,
.write_wakeup = iforce_serio_write_wakeup,
.interrupt = iforce_serio_irq,
.connect = iforce_serio_connect,
......
......@@ -39,14 +39,15 @@
#include <linux/gameport.h>
#include <linux/input.h>
#define DRIVER_DESC "InterAct digital joystick driver"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("InterAct digital joystick driver");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define INTERACT_MAX_START 400 /* 400 us */
#define INTERACT_MAX_STROBE 40 /* 40 us */
#define INTERACT_MAX_START 600 /* 400 us */
#define INTERACT_MAX_STROBE 60 /* 40 us */
#define INTERACT_MAX_LENGTH 32 /* 32 bits */
#define INTERACT_REFRESH_TIME HZ/50 /* 20 ms */
#define INTERACT_TYPE_HHFX 0 /* HammerHead/FX */
#define INTERACT_TYPE_PP8D 1 /* ProPad 8 */
......@@ -54,8 +55,6 @@ MODULE_LICENSE("GPL");
struct interact {
struct gameport *gameport;
struct input_dev dev;
struct timer_list timer;
int used;
int bads;
int reads;
unsigned char type;
......@@ -125,12 +124,12 @@ static int interact_read_packet(struct gameport *gameport, int length, u32 *data
}
/*
* interact_timer() reads and analyzes InterAct joystick data.
* interact_poll() reads and analyzes InterAct joystick data.
*/
static void interact_timer(unsigned long private)
static void interact_poll(struct gameport *gameport)
{
struct interact *interact = (struct interact *) private;
struct interact *interact = gameport_get_drvdata(gameport);
struct input_dev *dev = &interact->dev;
u32 data[3];
int i;
......@@ -177,9 +176,6 @@ static void interact_timer(unsigned long private)
}
input_sync(dev);
mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME);
}
/*
......@@ -189,8 +185,8 @@ static void interact_timer(unsigned long private)
static int interact_open(struct input_dev *dev)
{
struct interact *interact = dev->private;
if (!interact->used++)
mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME);
gameport_start_polling(interact->gameport);
return 0;
}
......@@ -201,37 +197,36 @@ static int interact_open(struct input_dev *dev)
static void interact_close(struct input_dev *dev)
{
struct interact *interact = dev->private;
if (!--interact->used)
del_timer(&interact->timer);
gameport_stop_polling(interact->gameport);
}
/*
* interact_connect() probes for InterAct joysticks.
*/
static void interact_connect(struct gameport *gameport, struct gameport_dev *dev)
static int interact_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct interact *interact;
__u32 data[3];
int i, t;
int err;
if (!(interact = kmalloc(sizeof(struct interact), GFP_KERNEL)))
return;
memset(interact, 0, sizeof(struct interact));
gameport->private = interact;
if (!(interact = kcalloc(1, sizeof(struct interact), GFP_KERNEL)))
return -ENOMEM;
interact->gameport = gameport;
init_timer(&interact->timer);
interact->timer.data = (long) interact;
interact->timer.function = interact_timer;
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW))
gameport_set_drvdata(gameport, interact);
err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
if (err)
goto fail1;
i = interact_read_packet(gameport, INTERACT_MAX_LENGTH * 2, data);
if (i != 32 || (data[0] >> 24) != 0x0c || (data[1] >> 24) != 0x02) {
err = -ENODEV;
goto fail2;
}
......@@ -242,9 +237,13 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev
if (!interact_type[i].length) {
printk(KERN_WARNING "interact.c: Unknown joystick on %s. [len %d d0 %08x d1 %08x i2 %08x]\n",
gameport->phys, i, data[0], data[1], data[2]);
err = -ENODEV;
goto fail2;
}
gameport_set_poll_handler(gameport, interact_poll);
gameport_set_poll_interval(gameport, 20);
sprintf(interact->phys, "%s/input0", gameport->phys);
interact->type = i;
......@@ -281,33 +280,42 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev
printk(KERN_INFO "input: %s on %s\n",
interact_type[interact->type].name, gameport->phys);
return;
return 0;
fail2: gameport_close(gameport);
fail1: kfree(interact);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(interact);
return err;
}
static void interact_disconnect(struct gameport *gameport)
{
struct interact *interact = gameport->private;
struct interact *interact = gameport_get_drvdata(gameport);
input_unregister_device(&interact->dev);
gameport_close(gameport);
gameport_set_drvdata(gameport, NULL);
kfree(interact);
}
static struct gameport_dev interact_dev = {
.connect = interact_connect,
.disconnect = interact_disconnect,
static struct gameport_driver interact_drv = {
.driver = {
.name = "interact",
},
.description = DRIVER_DESC,
.connect = interact_connect,
.disconnect = interact_disconnect,
};
int __init interact_init(void)
static int __init interact_init(void)
{
gameport_register_device(&interact_dev);
gameport_register_driver(&interact_drv);
return 0;
}
void __exit interact_exit(void)
static void __exit interact_exit(void)
{
gameport_unregister_device(&interact_dev);
gameport_unregister_driver(&interact_drv);
}
module_init(interact_init);
......
......@@ -35,8 +35,10 @@
#include <linux/delay.h>
#include <linux/init.h>
#define DRIVER_DESC "Gameport data dumper module"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Gameport data dumper module");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
#define BUF_SIZE 256
......@@ -46,38 +48,46 @@ struct joydump {
unsigned char data;
};
static void __devinit joydump_connect(struct gameport *gameport, struct gameport_dev *dev)
static int joydump_connect(struct gameport *gameport, struct gameport_driver *drv)
{
struct joydump buf[BUF_SIZE];
struct joydump *buf; /* all entries */
struct joydump *dump, *prev; /* one entry each */
int axes[4], buttons;
int i, j, t, timeout;
unsigned long flags;
unsigned char u;
printk(KERN_INFO "joydump: ,------------------- START ------------------.\n");
printk(KERN_INFO "joydump: | Dumping gameport%s.\n", gameport->phys);
printk(KERN_INFO "joydump: | Speed: %4d kHz. |\n", gameport->speed);
printk(KERN_INFO "joydump: ,------------------ START ----------------.\n");
printk(KERN_INFO "joydump: | Dumping: %30s |\n", gameport->phys);
printk(KERN_INFO "joydump: | Speed: %28d kHz |\n", gameport->speed);
if (gameport_open(gameport, dev, GAMEPORT_MODE_RAW)) {
if (gameport_open(gameport, drv, GAMEPORT_MODE_RAW)) {
printk(KERN_INFO "joydump: | Raw mode not available - trying cooked. |\n");
if (gameport_open(gameport, dev, GAMEPORT_MODE_COOKED)) {
if (gameport_open(gameport, drv, GAMEPORT_MODE_COOKED)) {
printk(KERN_INFO "joydump: | Cooked not available either. Failing. |\n");
printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
return;
printk(KERN_INFO "joydump: | Cooked not available either. Failing. |\n");
printk(KERN_INFO "joydump: `------------------- END -----------------'\n");
return -ENODEV;
}
gameport_cooked_read(gameport, axes, &buttons);
for (i = 0; i < 4; i++)
printk(KERN_INFO "joydump: | Axis %d: %4d. |\n", i, axes[i]);
printk(KERN_INFO "joydump: | Buttons %02x. |\n", buttons);
printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
printk(KERN_INFO "joydump: | Axis %d: %4d. |\n", i, axes[i]);
printk(KERN_INFO "joydump: | Buttons %02x. |\n", buttons);
printk(KERN_INFO "joydump: `------------------- END -----------------'\n");
}
timeout = gameport_time(gameport, 10000); /* 10 ms */
buf = kmalloc(BUF_SIZE * sizeof(struct joydump), GFP_KERNEL);
if (!buf) {
printk(KERN_INFO "joydump: no memory for testing\n");
goto jd_end;
}
dump = buf;
t = 0;
i = 1;
......@@ -85,19 +95,21 @@ static void __devinit joydump_connect(struct gameport *gameport, struct gameport
u = gameport_read(gameport);
buf[0].data = u;
buf[0].time = t;
dump->data = u;
dump->time = t;
dump++;
gameport_trigger(gameport);
while (i < BUF_SIZE && t < timeout) {
buf[i].data = gameport_read(gameport);
dump->data = gameport_read(gameport);
if (buf[i].data ^ u) {
u = buf[i].data;
buf[i].time = t;
if (dump->data ^ u) {
u = dump->data;
dump->time = t;
i++;
dump++;
}
t++;
}
......@@ -109,42 +121,54 @@ static void __devinit joydump_connect(struct gameport *gameport, struct gameport
*/
t = i;
dump = buf;
prev = dump;
printk(KERN_INFO "joydump: >------------------- DATA -------------------<\n");
printk(KERN_INFO "joydump: | index: %3d delta: %3d.%02d us data: ", 0, 0, 0);
printk(KERN_INFO "joydump: >------------------ DATA -----------------<\n");
printk(KERN_INFO "joydump: | index: %3d delta: %3d us data: ", 0, 0);
for (j = 7; j >= 0; j--)
printk("%d",(buf[0].data >> j) & 1);
printk("%d", (dump->data >> j) & 1);
printk(" |\n");
for (i = 1; i < t; i++) {
dump++;
for (i = 1; i < t; i++, dump++, prev++) {
printk(KERN_INFO "joydump: | index: %3d delta: %3d us data: ",
i, buf[i].time - buf[i-1].time);
i, dump->time - prev->time);
for (j = 7; j >= 0; j--)
printk("%d",(buf[i].data >> j) & 1);
printk(" |\n");
printk("%d", (dump->data >> j) & 1);
printk(" |\n");
}
kfree(buf);
jd_end:
printk(KERN_INFO "joydump: `------------------- END -----------------'\n");
printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
return 0;
}
static void __devexit joydump_disconnect(struct gameport *gameport)
static void joydump_disconnect(struct gameport *gameport)
{
gameport_close(gameport);
}
static struct gameport_dev joydump_dev = {
.connect = joydump_connect,
.disconnect = joydump_disconnect,
static struct gameport_driver joydump_drv = {
.driver = {
.name = "joydump",
},
.description = DRIVER_DESC,
.connect = joydump_connect,
.disconnect = joydump_disconnect,
};
static int __init joydump_init(void)
{
gameport_register_device(&joydump_dev);
gameport_register_driver(&joydump_drv);
return 0;
}
static void __exit joydump_exit(void)
{
gameport_unregister_device(&joydump_dev);
gameport_unregister_driver(&joydump_drv);
}
module_init(joydump_init);
......
......@@ -118,7 +118,7 @@ static void magellan_process_packet(struct magellan* magellan, struct pt_regs *r
static irqreturn_t magellan_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct magellan* magellan = serio->private;
struct magellan* magellan = serio_get_drvdata(serio);
if (data == '\r') {
magellan_process_packet(magellan, regs);
......@@ -136,28 +136,28 @@ static irqreturn_t magellan_interrupt(struct serio *serio,
static void magellan_disconnect(struct serio *serio)
{
struct magellan* magellan = serio->private;
struct magellan* magellan = serio_get_drvdata(serio);
input_unregister_device(&magellan->dev);
serio_close(serio);
serio_set_drvdata(serio, NULL);
kfree(magellan);
}
/*
* magellan_connect() is the routine that is called when someone adds a
* new serio device. It looks for the Magellan, and if found, registers
* it as an input device.
* new serio device that supports Magellan protocol and registers it as
* an input device.
*/
static void magellan_connect(struct serio *serio, struct serio_driver *drv)
static int magellan_connect(struct serio *serio, struct serio_driver *drv)
{
struct magellan *magellan;
int i, t;
if (serio->type != (SERIO_RS232 | SERIO_MAGELLAN))
return;
int err;
if (!(magellan = kmalloc(sizeof(struct magellan), GFP_KERNEL)))
return;
return -ENOMEM;
memset(magellan, 0, sizeof(struct magellan));
......@@ -185,28 +185,44 @@ static void magellan_connect(struct serio *serio, struct serio_driver *drv)
magellan->dev.id.version = 0x0100;
magellan->dev.dev = &serio->dev;
serio->private = magellan;
serio_set_drvdata(serio, magellan);
if (serio_open(serio, drv)) {
err = serio_open(serio, drv);
if (err) {
serio_set_drvdata(serio, NULL);
kfree(magellan);
return;
return err;
}
input_register_device(&magellan->dev);
printk(KERN_INFO "input: %s on %s\n", magellan_name, serio->phys);
return 0;
}
/*
* The serio device structure.
* The serio driver structure.
*/
static struct serio_device_id magellan_serio_ids[] = {
{
.type = SERIO_RS232,
.proto = SERIO_MAGELLAN,
.id = SERIO_ANY,
.extra = SERIO_ANY,
},
{ 0 }
};
MODULE_DEVICE_TABLE(serio, magellan_serio_ids);
static struct serio_driver magellan_drv = {
.driver = {
.name = "magellan",
},
.description = DRIVER_DESC,
.id_table = magellan_serio_ids,
.interrupt = magellan_interrupt,
.connect = magellan_connect,
.disconnect = magellan_disconnect,
......@@ -216,13 +232,13 @@ static struct serio_driver magellan_drv = {
* The functions for inserting/removing us as a module.
*/
int __init magellan_init(void)
static int __init magellan_init(void)
{
serio_register_driver(&magellan_drv);
return 0;
}
void __exit magellan_exit(void)
static void __exit magellan_exit(void)
{
serio_unregister_driver(&magellan_drv);
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -77,7 +77,7 @@ __obsolete_setup("tgfx_3=");
static int tgfx_buttons[] = { BTN_TRIGGER, BTN_THUMB, BTN_THUMB2, BTN_TOP, BTN_TOP2 };
static char *tgfx_name = "TurboGraFX Multisystem joystick";
struct tgfx {
static struct tgfx {
struct pardevice *pd;
struct timer_list timer;
struct input_dev dev[7];
......@@ -229,7 +229,7 @@ static struct tgfx __init *tgfx_probe(int *config, int nargs)
return tgfx;
}
int __init tgfx_init(void)
static int __init tgfx_init(void)
{
tgfx_base[0] = tgfx_probe(tgfx, tgfx_nargs);
tgfx_base[1] = tgfx_probe(tgfx_2, tgfx_nargs_2);
......@@ -241,7 +241,7 @@ int __init tgfx_init(void)
return -ENODEV;
}
void __exit tgfx_exit(void)
static void __exit tgfx_exit(void)
{
int i, j;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,5 +10,10 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o
obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o
obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o
obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o
obj-$(CONFIG_KEYBOARD_98KBD) += 98kbd.o
obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -14,10 +14,8 @@
*/
/* undefine if you have a RDI PRECISIONBOOK */
#define STANDARD_KEYBOARD
#if defined(STANDARD_KEYBOARD)
/* Is the keyboard an RDI PrecisionBook? */
#ifndef CONFIG_KEYBOARD_ATKBD_RDI_KEYCODES
# define CONFLICT(x,y) x
#else
# define CONFLICT(x,y) y
......@@ -50,10 +48,10 @@
/* 60 */ KEY_DOWN, C_61, KEY_PAUSE, KEY_UP, KEY_DELETE, KEY_END, KEY_BACKSPACE, KEY_INSERT,
/* 68 */ KEY_RESERVED, KEY_KP1, KEY_RIGHT, KEY_KP4, KEY_KP7, KEY_PAGEDOWN, KEY_HOME, KEY_PAGEUP,
/* 70 */ KEY_KP0, KEY_KPDOT, KEY_KP2, KEY_KP5, KEY_KP6, KEY_KP8, KEY_ESC, KEY_NUMLOCK,
/* 78 */ KEY_F11, KEY_KPPLUS, KEY_KP3, KEY_KPMINUS, KEY_KPASTERISK,KEY_KP9, KEY_SCROLLLOCK,KEY_103RD,
/* 78 */ KEY_F11, KEY_KPPLUS, KEY_KP3, KEY_KPMINUS, KEY_KPASTERISK,KEY_KP9, KEY_SCROLLLOCK,KEY_102ND,
/* 80 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
/* 88 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
/* 90 */ KEY_RESERVED, KEY_RIGHTALT, KEY_SYSRQ, KEY_RESERVED, KEY_RIGHTCTRL, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
/* 90 */ KEY_RESERVED, KEY_RIGHTALT, 255, KEY_RESERVED, KEY_RIGHTCTRL, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
/* 98 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_CAPSLOCK, KEY_RESERVED, KEY_LEFTMETA,
/* a0 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RIGHTMETA,
/* a8 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_COMPOSE,
......@@ -103,7 +101,6 @@
/* f0 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
/* f8 */ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED
#undef STANDARD_KEYBOARD
#undef CONFLICT
#undef C_07
#undef C_11
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,3 +9,4 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -12,6 +12,7 @@ obj-$(CONFIG_MOUSE_MAPLE) += maplemouse.o
obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o
obj-$(CONFIG_MOUSE_PS2) += psmouse.o
obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o
obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o
obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o
psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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