Release 4.11 drivers/input/mouse/amimouse.c
/*
* Amiga mouse driver for Linux/m68k
*
* Copyright (c) 2000-2002 Vojtech Pavlik
*
* Based on the work of:
* Michael Rausch James Banks
* Matther Dillon David Giller
* Nathan Laredo Linus Torvalds
* Johan Myreen Jes Sorensen
* Russell King
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <linux/uaccess.h>
#include <asm/amigahw.h>
#include <asm/amigaints.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Amiga mouse driver");
MODULE_LICENSE("GPL");
static int amimouse_lastx, amimouse_lasty;
static irqreturn_t amimouse_interrupt(int irq, void *data)
{
struct input_dev *dev = data;
unsigned short joy0dat, potgor;
int nx, ny, dx, dy;
joy0dat = amiga_custom.joy0dat;
nx = joy0dat & 0xff;
ny = joy0dat >> 8;
dx = nx - amimouse_lastx;
dy = ny - amimouse_lasty;
if (dx < -127) dx = (256 + nx) - amimouse_lastx;
if (dx > 127) dx = (nx - 256) - amimouse_lastx;
if (dy < -127) dy = (256 + ny) - amimouse_lasty;
if (dy > 127) dy = (ny - 256) - amimouse_lasty;
amimouse_lastx = nx;
amimouse_lasty = ny;
potgor = amiga_custom.potgor;
input_report_rel(dev, REL_X, dx);
input_report_rel(dev, REL_Y, dy);
input_report_key(dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(dev, BTN_RIGHT, potgor & 0x0400);
input_sync(dev);
return IRQ_HANDLED;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vojtech Pavlik | 186 | 90.29% | 3 | 50.00% |
Geert Uytterhoeven | 18 | 8.74% | 2 | 33.33% |
Al Viro | 2 | 0.97% | 1 | 16.67% |
Total | 206 | 100.00% | 6 | 100.00% |
static int amimouse_open(struct input_dev *dev)
{
unsigned short joy0dat;
int error;
joy0dat = amiga_custom.joy0dat;
amimouse_lastx = joy0dat & 0xff;
amimouse_lasty = joy0dat >> 8;
error = request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse",
dev);
if (error)
dev_err(&dev->dev, "Can't allocate irq %d\n", IRQ_AMIGA_VERTB);
return error;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vojtech Pavlik | 50 | 71.43% | 1 | 25.00% |
Geert Uytterhoeven | 19 | 27.14% | 2 | 50.00% |
Al Viro | 1 | 1.43% | 1 | 25.00% |
Total | 70 | 100.00% | 4 | 100.00% |
static void amimouse_close(struct input_dev *dev)
{
free_irq(IRQ_AMIGA_VERTB, dev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vojtech Pavlik | 17 | 94.44% | 1 | 50.00% |
Geert Uytterhoeven | 1 | 5.56% | 1 | 50.00% |
Total | 18 | 100.00% | 2 | 100.00% |
static int __init amimouse_probe(struct platform_device *pdev)
{
int err;
struct input_dev *dev;
dev = input_allocate_device();
if (!dev)
return -ENOMEM;
dev->name = pdev->name;
dev->phys = "amimouse/input0";
dev->id.bustype = BUS_AMIGA;
dev->id.vendor = 0x0001;
dev->id.product = 0x0002;
dev->id.version = 0x0100;
dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
dev->open = amimouse_open;
dev->close = amimouse_close;
dev->dev.parent = &pdev->dev;
err = input_register_device(dev);
if (err) {
input_free_device(dev);
return err;
}
platform_set_drvdata(pdev, dev);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Dmitry Torokhov | 71 | 36.79% | 2 | 33.33% |
Vojtech Pavlik | 65 | 33.68% | 1 | 16.67% |
Geert Uytterhoeven | 49 | 25.39% | 2 | 33.33% |
Jiri Slaby | 8 | 4.15% | 1 | 16.67% |
Total | 193 | 100.00% | 6 | 100.00% |
static int __exit amimouse_remove(struct platform_device *pdev)
{
struct input_dev *dev = platform_get_drvdata(pdev);
input_unregister_device(dev);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Geert Uytterhoeven | 21 | 70.00% | 1 | 50.00% |
Vojtech Pavlik | 9 | 30.00% | 1 | 50.00% |
Total | 30 | 100.00% | 2 | 100.00% |
static struct platform_driver amimouse_driver = {
.remove = __exit_p(amimouse_remove),
.driver = {
.name = "amiga-mouse",
},
};
module_platform_driver_probe(amimouse_driver, amimouse_probe);
MODULE_ALIAS("platform:amiga-mouse");
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vojtech Pavlik | 373 | 61.45% | 3 | 21.43% |
Geert Uytterhoeven | 144 | 23.72% | 4 | 28.57% |
Dmitry Torokhov | 77 | 12.69% | 3 | 21.43% |
Jiri Slaby | 8 | 1.32% | 1 | 7.14% |
Al Viro | 3 | 0.49% | 1 | 7.14% |
Linus Torvalds | 1 | 0.16% | 1 | 7.14% |
Sachin Kamat | 1 | 0.16% | 1 | 7.14% |
Total | 607 | 100.00% | 14 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.