diff options
| author | Vojtech Pavlik <vojtech@twilight.ucw.cz> | 2002-07-25 03:53:19 +0200 |
|---|---|---|
| committer | Vojtech Pavlik <vojtech@twilight.ucw.cz> | 2002-07-25 03:53:19 +0200 |
| commit | a2ea21bb4b327510007eeeacabb3292aa0ff841d (patch) | |
| tree | 1eee8049ab6a91f37039909497ce643521f2fa65 /drivers | |
| parent | 040a02c82fc313731f111ac6d228836086aac43f (diff) | |
| parent | 268c978300c2a850da4a99bbb9a44ce3579da6b6 (diff) | |
Merge http://linus.bkbits.net:8080/linux-2.5
into twilight.ucw.cz:/home/vojtech/bk/linus
Diffstat (limited to 'drivers')
64 files changed, 887 insertions, 461 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 0a2f930cf585..af7abcf21c53 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -233,6 +233,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, struct evdev_list *list = file->private_data; struct evdev *evdev = list->evdev; struct input_dev *dev = evdev->handle.dev; + struct input_devinfo id; int retval, t, u; if (!evdev->exist) return -ENODEV; @@ -243,11 +244,12 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return put_user(EV_VERSION, (int *) arg); case EVIOCGID: - if ((retval = put_user(dev->idbus, ((short *) arg) + 0))) return retval; - if ((retval = put_user(dev->idvendor, ((short *) arg) + 1))) return retval; - if ((retval = put_user(dev->idproduct, ((short *) arg) + 2))) return retval; - if ((retval = put_user(dev->idversion, ((short *) arg) + 3))) return retval; - return 0; + id.bustype = dev->id.bustype; + id.vendor = dev->id.vendor; + id.product = dev->id.product; + id.version = dev->id.version; + return copy_to_user((void *) arg, &id, sizeof(struct input_devinfo)); + case EVIOCGREP: if ((retval = put_user(dev->rep[0], ((int *) arg) + 0))) return retval; diff --git a/drivers/input/gameport/cs461x.c b/drivers/input/gameport/cs461x.c index 4d14aaffc374..3712c51a2273 100644 --- a/drivers/input/gameport/cs461x.c +++ b/drivers/input/gameport/cs461x.c @@ -291,9 +291,9 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev port->name = name; port->phys = phys; - port->idbus = BUS_PCI; - port->idvendor = pdev->vendor; - port->idproduct = pdev->device; + port->id.bustype = BUS_PCI; + port->id.vendor = pdev->vendor; + port->id.product = pdev->device; cs461x_pokeBA0(BA0_JSIO, 0xFF); // ? cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW); diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c index ff5f5cf09dc9..00b9036e3de9 100644 --- a/drivers/input/gameport/emu10k1-gp.c +++ b/drivers/input/gameport/emu10k1-gp.c @@ -87,9 +87,9 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id emu->gameport.io = ioport; emu->gameport.name = pdev->name; emu->gameport.phys = emu->phys; - emu->gameport.idbus = BUS_PCI; - emu->gameport.idvendor = pdev->vendor; - emu->gameport.idproduct = pdev->device; + emu->gameport.id.bustype = BUS_PCI; + emu->gameport.id.vendor = pdev->vendor; + emu->gameport.id.product = pdev->device; pci_set_drvdata(pdev, emu); diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 7cd454338f83..e3b3e9172920 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c @@ -105,9 +105,9 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device gp->gameport.phys = gp->phys; gp->gameport.name = gp->name; - gp->gameport.idbus = BUS_PCI; - gp->gameport.idvendor = pci->vendor; - gp->gameport.idproduct = pci->device; + gp->gameport.id.bustype = BUS_PCI; + gp->gameport.id.vendor = pci->vendor; + gp->gameport.id.product = pci->device; pci_set_drvdata(pci, gp); diff --git a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c index 946e9826392a..cf3fc18d2a9d 100644 --- a/drivers/input/gameport/lightning.c +++ b/drivers/input/gameport/lightning.c @@ -259,7 +259,7 @@ int __init l4_init(void) gameport->name = l4_name; gameport->phys = l4->phys; - gameport->idbus = BUS_ISA; + gameport->id.bustype = BUS_ISA; if (!i && !j) gameport->io = L4_PORT; diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c index 3bdeda42395e..dee7970bc2dd 100644 --- a/drivers/input/gameport/ns558.c +++ b/drivers/input/gameport/ns558.c @@ -144,7 +144,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next) port->gameport.io = io & (-1 << i); port->gameport.phys = port->phys; port->gameport.name = port->name; - port->gameport.idbus = BUS_ISA; + port->gameport.id.bustype = BUS_ISA; sprintf(port->phys, "isa%04x/gameport0", io & (-1 << i)); sprintf(port->name, "NS558 ISA"); @@ -232,10 +232,10 @@ static struct ns558* ns558_pnp_probe(struct pci_dev *dev, struct ns558 *next) port->gameport.io = ioport; port->gameport.phys = port->phys; port->gameport.name = port->name; - port->gameport.idbus = BUS_ISAPNP; - port->gameport.idvendor = dev->vendor; - port->gameport.idproduct = dev->device; - port->gameport.idversion = 0x100; + port->gameport.id.bustype = BUS_ISAPNP; + port->gameport.id.vendor = dev->vendor; + port->gameport.id.product = dev->device; + port->gameport.id.version = 0x100; sprintf(port->phys, "isapnp%d.%d/gameport0", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); sprintf(port->name, "%s", dev->name[0] ? dev->name : "NS558 PnP Gameport"); diff --git a/drivers/input/gameport/vortex.c b/drivers/input/gameport/vortex.c index c2c12e7d4a5b..6c84e1a41883 100644 --- a/drivers/input/gameport/vortex.c +++ b/drivers/input/gameport/vortex.c @@ -129,9 +129,9 @@ static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_i vortex->gameport.name = dev->name; vortex->gameport.phys = vortex->phys; - vortex->gameport.idbus = BUS_PCI; - vortex->gameport.idvendor = dev->vendor; - vortex->gameport.idproduct = dev->device; + vortex->gameport.id.bustype = BUS_PCI; + vortex->gameport.id.vendor = dev->vendor; + vortex->gameport.id.product = dev->device; for (i = 0; i < 6; i++) if (~pci_resource_flags(dev, i) & IORESOURCE_IO) diff --git a/drivers/input/input.c b/drivers/input/input.c index 93241c7d577e..3b4c82f91bb2 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -290,19 +290,19 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st for (; id->flags || id->driver_info; id++) { if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) - if (id->idbus != dev->idbus) + if (id->id.bustype != dev->id.bustype) continue; if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) - if (id->idvendor != dev->idvendor) + if (id->id.vendor != dev->id.vendor) continue; if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) - if (id->idproduct != dev->idproduct) + if (id->id.product != dev->id.product) continue; if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) - if (id->idversion != dev->idversion) + if (id->id.version != dev->id.version) continue; MATCH_BIT(evbit, EV_MAX); @@ -395,7 +395,7 @@ static void input_call_hotplug(char *verb, struct input_dev *dev) envp[i++] = scratch; scratch += sprintf(scratch, "PRODUCT=%x/%x/%x/%x", - dev->idbus, dev->idvendor, dev->idproduct, dev->idversion) + 1; + dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1; if (dev->name) { envp[i++] = scratch; @@ -710,7 +710,7 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int while (dev) { len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", - dev->idbus, dev->idvendor, dev->idproduct, dev->idversion); + dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : ""); len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : ""); diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c index b5e0f8911cc2..194a32a297c3 100644 --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c @@ -336,10 +336,10 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev) a3d->adc.name = a3d_names[a3d->mode]; a3d->adc.phys = a3d->adcphys; - a3d->adc.idbus = BUS_GAMEPORT; - a3d->adc.idvendor = GAMEPORT_ID_VENDOR_MADCATZ; - a3d->adc.idproduct = a3d->mode; - a3d->adc.idversion = 0x0100; + 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; a3d_read(a3d, data); @@ -353,10 +353,10 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev) a3d->dev.name = a3d_names[a3d->mode]; a3d->dev.phys = a3d->phys; - a3d->dev.idbus = BUS_GAMEPORT; - a3d->dev.idvendor = GAMEPORT_ID_VENDOR_MADCATZ; - a3d->dev.idproduct = a3d->mode; - a3d->dev.idversion = 0x0100; + a3d->dev.id.bustype = BUS_GAMEPORT; + a3d->dev.id.vendor = GAMEPORT_ID_VENDOR_MADCATZ; + a3d->dev.id.product = a3d->mode; + a3d->dev.id.version = 0x0100; input_register_device(&a3d->dev); printk(KERN_INFO "input: %s on %s\n", a3d_names[a3d->mode], a3d->phys); diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c index e0f070343acd..81a6cbac5209 100644 --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -416,10 +416,10 @@ static void adi_init_input(struct adi *adi, struct adi_port *port, int half) adi->dev.name = adi->name; adi->dev.phys = adi->phys; - adi->dev.idbus = BUS_GAMEPORT; - adi->dev.idvendor = GAMEPORT_ID_VENDOR_LOGITECH; - adi->dev.idproduct = adi->id; - adi->dev.idversion = 0x0100; + adi->dev.id.bustype = BUS_GAMEPORT; + adi->dev.id.vendor = GAMEPORT_ID_VENDOR_LOGITECH; + adi->dev.id.product = adi->id; + adi->dev.id.version = 0x0100; adi->dev.private = port; adi->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c index ced41af02981..40ae670e8a5e 100644 --- a/drivers/input/joystick/amijoy.c +++ b/drivers/input/joystick/amijoy.c @@ -134,10 +134,10 @@ static int __init amijoy_init(void) amijoy->dev[i].name = amijoy_name; amijoy->dev[i].phys = amijoy_phys[i]; - amijoy->dev[i].idbus = BUS_AMIGA; - amijoy->dev[i].idvendor = 0x0001; - amijoy->dev[i].idproduct = 0x0003; - amijoy->dev[i].version = 0x0100; + amijoy->dev[i].id.bustype = BUS_AMIGA; + amijoy->dev[i].id.vendor = 0x0001; + amijoy->dev[i].id.product = 0x0003; + amijoy->dev[i].id.version = 0x0100; amijoy_dev[i].private = amijoy_used + i; diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 88521c7e0cb3..865ddd450fc2 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -436,10 +436,10 @@ static void analog_init_device(struct analog_port *port, struct analog *analog, analog->dev.name = analog->name; analog->dev.phys = analog->phys; - analog->dev.idbus = BUS_GAMEPORT; - analog->dev.idvendor = GAMEPORT_ID_VENDOR_ANALOG; - analog->dev.idproduct = analog->mask >> 4; - analog->dev.idversion = 0x0100; + analog->dev.id.bustype = BUS_GAMEPORT; + analog->dev.id.vendor = GAMEPORT_ID_VENDOR_ANALOG; + analog->dev.id.product = analog->mask >> 4; + analog->dev.id.version = 0x0100; analog->dev.open = analog_open; analog->dev.close = analog_close; diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c index 85312ccfdeb0..b67d451c7d93 100644 --- a/drivers/input/joystick/cobra.c +++ b/drivers/input/joystick/cobra.c @@ -199,10 +199,10 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev) cobra->dev[i].name = cobra_name; cobra->dev[i].phys = cobra->phys[i]; - cobra->dev[i].idbus = BUS_GAMEPORT; - cobra->dev[i].idvendor = GAMEPORT_ID_VENDOR_CREATIVE; - cobra->dev[i].idproduct = 0x0008; - cobra->dev[i].idversion = 0x0100; + cobra->dev[i].id.bustype = BUS_GAMEPORT; + cobra->dev[i].id.vendor = GAMEPORT_ID_VENDOR_CREATIVE; + cobra->dev[i].id.product = 0x0008; + 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); diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index 24d75e44d904..bc8ac5240df2 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c @@ -351,10 +351,10 @@ static struct db9 __init *db9_probe(int *config) db9->dev[i].name = db9_name[db9->mode]; db9->dev[i].phys = db9->phys[i]; - db9->dev[i].idbus = BUS_PARPORT; - db9->dev[i].idvendor = 0x0002; - db9->dev[i].idproduct = config[1]; - db9->dev[i].idversion = 0x0100; + db9->dev[i].id.bustype = BUS_PARPORT; + db9->dev[i].id.vendor = 0x0002; + db9->dev[i].id.product = config[1]; + db9->dev[i].id.version = 0x0100; db9->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); db9->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); @@ -373,21 +373,21 @@ static struct db9 __init *db9_probe(int *config) } #ifndef MODULE -int __init db9_setup(char *str) +static int __init db9_setup(char *str) { int i, ints[3]; get_options(str, ARRAY_SIZE(ints), ints); for (i = 0; i <= ints[0] && i < 2; i++) db9[i] = ints[i + 1]; return 1; } -int __init db9_setup_2(char *str) +static int __init db9_setup_2(char *str) { int i, ints[3]; get_options(str, ARRAY_SIZE(ints), ints); for (i = 0; i <= ints[0] && i < 2; i++) db9_2[i] = ints[i + 1]; return 1; } -int __init db9_setup_3(char *str) +static int __init db9_setup_3(char *str) { int i, ints[3]; get_options(str, ARRAY_SIZE(ints), ints); diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 17e743db6cbe..039bb0c8ce9d 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c @@ -593,10 +593,10 @@ static struct gc __init *gc_probe(int *config) gc->dev[i].name = gc_names[config[i + 1]]; gc->dev[i].phys = gc->phys[i]; - gc->dev[i].idbus = BUS_PARPORT; - gc->dev[i].idvendor = 0x0001; - gc->dev[i].idproduct = config[i + 1]; - gc->dev[i].idversion = 0x0100; + gc->dev[i].id.bustype = BUS_PARPORT; + gc->dev[i].id.vendor = 0x0001; + gc->dev[i].id.product = config[i + 1]; + gc->dev[i].id.version = 0x0100; } parport_release(gc->pd); @@ -617,21 +617,21 @@ static struct gc __init *gc_probe(int *config) } #ifndef MODULE -int __init gc_setup(char *str) +static int __init gc_setup(char *str) { int i, ints[7]; get_options(str, ARRAY_SIZE(ints), ints); for (i = 0; i <= ints[0] && i < 6; i++) gc[i] = ints[i + 1]; return 1; } -int __init gc_setup_2(char *str) +static int __init gc_setup_2(char *str) { int i, ints[7]; get_options(str, ARRAY_SIZE(ints), ints); for (i = 0; i <= ints[0] && i < 6; i++) gc_2[i] = ints[i + 1]; return 1; } -int __init gc_setup_3(char *str) +static int __init gc_setup_3(char *str) { int i, ints[7]; get_options(str, ARRAY_SIZE(ints), ints); diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c index b303fa7a20e8..63e534f7784c 100644 --- a/drivers/input/joystick/gf2k.c +++ b/drivers/input/joystick/gf2k.c @@ -295,10 +295,10 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev) gf2k->dev.name = gf2k_names[gf2k->id]; gf2k->dev.phys = gf2k->phys; - gf2k->dev.idbus = BUS_GAMEPORT; - gf2k->dev.idvendor = GAMEPORT_ID_VENDOR_GENIUS; - gf2k->dev.idproduct = gf2k->id; - gf2k->dev.idversion = 0x0100; + gf2k->dev.id.bustype = BUS_GAMEPORT; + gf2k->dev.id.vendor = GAMEPORT_ID_VENDOR_GENIUS; + gf2k->dev.id.product = gf2k->id; + gf2k->dev.id.version = 0x0100; for (i = 0; i < gf2k_axes[gf2k->id]; i++) set_bit(gf2k_abs[i], gf2k->dev.absbit); diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c index d16a81032548..0519581c9e34 100644 --- a/drivers/input/joystick/grip.c +++ b/drivers/input/joystick/grip.c @@ -350,10 +350,10 @@ static void grip_connect(struct gameport *gameport, struct gameport_dev *dev) grip->dev[i].name = grip_name[grip->mode[i]]; grip->dev[i].phys = grip->phys[i]; - grip->dev[i].idbus = BUS_GAMEPORT; - grip->dev[i].idvendor = GAMEPORT_ID_VENDOR_GRAVIS; - grip->dev[i].idproduct = grip->mode[i]; - grip->dev[i].idversion = 0x0100; + grip->dev[i].id.bustype = BUS_GAMEPORT; + grip->dev[i].id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; + grip->dev[i].id.product = grip->mode[i]; + grip->dev[i].id.version = 0x0100; grip->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c index b287829b0e1e..bceb8402c14a 100644 --- a/drivers/input/joystick/guillemot.c +++ b/drivers/input/joystick/guillemot.c @@ -222,10 +222,10 @@ static void guillemot_connect(struct gameport *gameport, struct gameport_dev *de guillemot->dev.name = guillemot_type[i].name; guillemot->dev.phys = guillemot->phys; - guillemot->dev.idbus = BUS_GAMEPORT; - guillemot->dev.idvendor = GAMEPORT_ID_VENDOR_GUILLEMOT; - guillemot->dev.idproduct = guillemot_type[i].id; - guillemot->dev.idversion = (int)data[14] << 8 | data[15]; + guillemot->dev.id.bustype = BUS_GAMEPORT; + guillemot->dev.id.vendor = GAMEPORT_ID_VENDOR_GUILLEMOT; + guillemot->dev.id.product = guillemot_type[i].id; + guillemot->dev.id.version = (int)data[14] << 8 | data[15]; guillemot->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 61a1fff6ad75..c53e61acb9bc 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -352,7 +352,7 @@ int iforce_init_device(struct iforce *iforce) * Input device fields. */ - iforce->dev.idbus = BUS_USB; + iforce->dev.id.bustype = BUS_USB; iforce->dev.private = iforce; iforce->dev.name = "Unknown I-Force device"; iforce->dev.open = iforce_open; @@ -392,12 +392,12 @@ int iforce_init_device(struct iforce *iforce) */ if (!iforce_get_id_packet(iforce, "M")) - iforce->dev.idvendor = (iforce->edata[2] << 8) | iforce->edata[1]; + iforce->dev.id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; else printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); if (!iforce_get_id_packet(iforce, "P")) - iforce->dev.idproduct = (iforce->edata[2] << 8) | iforce->edata[1]; + iforce->dev.id.product = (iforce->edata[2] << 8) | iforce->edata[1]; else printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); @@ -438,8 +438,8 @@ int iforce_init_device(struct iforce *iforce) */ for (i = 0; iforce_device[i].idvendor; i++) - if (iforce_device[i].idvendor == iforce->dev.idvendor && - iforce_device[i].idproduct == iforce->dev.idproduct) + if (iforce_device[i].idvendor == iforce->dev.id.vendor && + iforce_device[i].idproduct == iforce->dev.id.product) break; iforce->type = iforce_device + i; diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c index 039bf72e7ba3..307cf12789af 100644 --- a/drivers/input/joystick/interact.c +++ b/drivers/input/joystick/interact.c @@ -254,10 +254,10 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev interact->dev.name = interact_type[i].name; interact->dev.phys = interact->phys; - interact->dev.idbus = BUS_GAMEPORT; - interact->dev.idvendor = GAMEPORT_ID_VENDOR_INTERACT; - interact->dev.idproduct = interact_type[i].id; - interact->dev.idversion = 0x0100; + interact->dev.id.bustype = BUS_GAMEPORT; + interact->dev.id.vendor = GAMEPORT_ID_VENDOR_INTERACT; + interact->dev.id.product = interact_type[i].id; + interact->dev.id.version = 0x0100; interact->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c index 2930248b443a..ed7cd36e64c7 100644 --- a/drivers/input/joystick/magellan.c +++ b/drivers/input/joystick/magellan.c @@ -170,10 +170,10 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev) magellan->dev.private = magellan; magellan->dev.name = magellan_name; magellan->dev.phys = magellan->phys; - magellan->dev.idbus = BUS_RS232; - magellan->dev.idvendor = SERIO_MAGELLAN; - magellan->dev.idproduct = 0x0001; - magellan->dev.idversion = 0x0100; + magellan->dev.id.bustype = BUS_RS232; + magellan->dev.id.vendor = SERIO_MAGELLAN; + magellan->dev.id.product = 0x0001; + magellan->dev.id.version = 0x0100; serio->private = magellan; diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c index 519592724890..d53b852ae5aa 100644 --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c @@ -701,10 +701,10 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) sw->dev[i].name = sw->name; sw->dev[i].phys = sw->phys[i]; - sw->dev[i].idbus = BUS_GAMEPORT; - sw->dev[i].idvendor = GAMEPORT_ID_VENDOR_MICROSOFT; - sw->dev[i].idproduct = sw->type; - sw->dev[i].idversion = 0x0100; + sw->dev[i].id.bustype = BUS_GAMEPORT; + sw->dev[i].id.vendor = GAMEPORT_ID_VENDOR_MICROSOFT; + sw->dev[i].id.product = sw->type; + sw->dev[i].id.version = 0x0100; sw->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c index f2cac90ce151..8732f85975be 100644 --- a/drivers/input/joystick/spaceball.c +++ b/drivers/input/joystick/spaceball.c @@ -240,10 +240,10 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) spaceball->dev.name = spaceball_names[id]; spaceball->dev.phys = spaceball->phys; - spaceball->dev.idbus = BUS_RS232; - spaceball->dev.idvendor = SERIO_SPACEBALL; - spaceball->dev.idproduct = id; - spaceball->dev.idversion = 0x0100; + spaceball->dev.id.bustype = BUS_RS232; + spaceball->dev.id.vendor = SERIO_SPACEBALL; + spaceball->dev.id.product = id; + spaceball->dev.id.version = 0x0100; serio->private = spaceball; diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c index 2f406f1f7a65..eae1bdca9590 100644 --- a/drivers/input/joystick/spaceorb.c +++ b/drivers/input/joystick/spaceorb.c @@ -187,10 +187,10 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) spaceorb->dev.name = spaceorb_name; spaceorb->dev.phys = spaceorb->phys; - spaceorb->dev.idbus = BUS_RS232; - spaceorb->dev.idvendor = SERIO_SPACEORB; - spaceorb->dev.idproduct = 0x0001; - spaceorb->dev.idversion = 0x0100; + spaceorb->dev.id.bustype = BUS_RS232; + spaceorb->dev.id.vendor = SERIO_SPACEORB; + spaceorb->dev.id.product = 0x0001; + spaceorb->dev.id.version = 0x0100; serio->private = spaceorb; diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c index 71267b7cda37..cd8541983c57 100644 --- a/drivers/input/joystick/stinger.c +++ b/drivers/input/joystick/stinger.c @@ -152,10 +152,10 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev) stinger->dev.name = stinger_name; stinger->dev.phys = stinger->phys; - stinger->dev.idbus = BUS_RS232; - stinger->dev.idvendor = SERIO_STINGER; - stinger->dev.idproduct = 0x0001; - stinger->dev.idversion = 0x0100; + stinger->dev.id.bustype = BUS_RS232; + stinger->dev.id.vendor = SERIO_STINGER; + stinger->dev.id.product = 0x0001; + stinger->dev.id.version = 0x0100; for (i = 0; i < 2; i++) { stinger->dev.absmax[ABS_X+i] = 64; diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c index 11eb335e5362..4c7665cf5d8d 100644 --- a/drivers/input/joystick/tmdc.c +++ b/drivers/input/joystick/tmdc.c @@ -312,10 +312,10 @@ static void tmdc_connect(struct gameport *gameport, struct gameport_dev *dev) tmdc->dev[j].name = tmdc->name[j]; tmdc->dev[j].phys = tmdc->phys[j]; - tmdc->dev[j].idbus = BUS_GAMEPORT; - tmdc->dev[j].idvendor = GAMEPORT_ID_VENDOR_THRUSTMASTER; - tmdc->dev[j].idproduct = models[m].id; - tmdc->dev[j].idversion = 0x0100; + tmdc->dev[j].id.bustype = BUS_GAMEPORT; + tmdc->dev[j].id.vendor = GAMEPORT_ID_VENDOR_THRUSTMASTER; + tmdc->dev[j].id.product = models[m].id; + tmdc->dev[j].id.version = 0x0100; tmdc->dev[j].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index 5f99a37663ec..f579cdd31389 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c @@ -179,10 +179,10 @@ static struct tgfx __init *tgfx_probe(int *config) tgfx->dev[i].name = tgfx_name; tgfx->dev[i].phys = tgfx->phys[i]; - tgfx->dev[i].idbus = BUS_PARPORT; - tgfx->dev[i].idvendor = 0x0003; - tgfx->dev[i].idproduct = config[i+1]; - tgfx->dev[i].idversion = 0x0100; + tgfx->dev[i].id.bustype = BUS_PARPORT; + tgfx->dev[i].id.vendor = 0x0003; + tgfx->dev[i].id.product = config[i+1]; + tgfx->dev[i].id.version = 0x0100; tgfx->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); tgfx->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); @@ -208,21 +208,21 @@ static struct tgfx __init *tgfx_probe(int *config) } #ifndef MODULE -int __init tgfx_setup(char *str) +static int __init tgfx_setup(char *str) { int i, ints[9]; get_options(str, ARRAY_SIZE(ints), ints); for (i = 0; i <= ints[0] && i < 8; i++) tgfx[i] = ints[i + 1]; return 1; } -int __init tgfx_setup_2(char *str) +static int __init tgfx_setup_2(char *str) { int i, ints[9]; get_options(str, ARRAY_SIZE(ints), ints); for (i = 0; i <= ints[0] && i < 8; i++) tgfx_2[i] = ints[i + 1]; return 1; } -int __init tgfx_setup_3(char *str) +static int __init tgfx_setup_3(char *str) { int i, ints[9]; get_options(str, ARRAY_SIZE(ints), ints); diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c index 70da80e89404..958dca35e95f 100644 --- a/drivers/input/joystick/twidjoy.c +++ b/drivers/input/joystick/twidjoy.c @@ -198,10 +198,10 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev) twidjoy->dev.name = twidjoy_name; twidjoy->dev.phys = twidjoy->phys; - twidjoy->dev.idbus = BUS_RS232; - twidjoy->dev.idvendor = SERIO_TWIDJOY; - twidjoy->dev.idproduct = 0x0001; - twidjoy->dev.idversion = 0x0100; + twidjoy->dev.id.bustype = BUS_RS232; + twidjoy->dev.id.vendor = SERIO_TWIDJOY; + twidjoy->dev.id.product = 0x0001; + twidjoy->dev.id.version = 0x0100; twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c index 56933ea6fd67..acc4b16e5f7a 100644 --- a/drivers/input/joystick/warrior.c +++ b/drivers/input/joystick/warrior.c @@ -156,10 +156,10 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev) warrior->dev.name = warrior_name; warrior->dev.phys = warrior->phys; - warrior->dev.idbus = BUS_RS232; - warrior->dev.idvendor = SERIO_WARRIOR; - warrior->dev.idproduct = 0x0001; - warrior->dev.idversion = 0x0100; + warrior->dev.id.bustype = BUS_RS232; + warrior->dev.id.vendor = SERIO_WARRIOR; + warrior->dev.id.product = 0x0001; + warrior->dev.id.version = 0x0100; for (i = 0; i < 2; i++) { warrior->dev.absmax[ABS_X+i] = -64; diff --git a/drivers/input/keybdev.c b/drivers/input/keybdev.c index 8a5a93b57f7a..c96751914084 100644 --- a/drivers/input/keybdev.c +++ b/drivers/input/keybdev.c @@ -72,26 +72,6 @@ static unsigned short x86_keycodes[256] = #ifdef CONFIG_MAC_EMUMOUSEBTN extern int mac_hid_mouse_emulate_buttons(int, int, int); #endif /* CONFIG_MAC_EMUMOUSEBTN */ -#ifdef CONFIG_MAC_ADBKEYCODES -extern int mac_hid_keyboard_sends_linux_keycodes(void); -#else -#define mac_hid_keyboard_sends_linux_keycodes() 0 -#endif /* CONFIG_MAC_ADBKEYCODES */ -#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD) -static unsigned char mac_keycodes[256] = { - 0, 53, 18, 19, 20, 21, 23, 22, 26, 28, 25, 29, 27, 24, 51, 48, - 12, 13, 14, 15, 17, 16, 32, 34, 31, 35, 33, 30, 36, 54,128, 1, - 2, 3, 5, 4, 38, 40, 37, 41, 39, 50, 56, 42, 6, 7, 8, 9, - 11, 45, 46, 43, 47, 44,123, 67, 58, 49, 57,122,120, 99,118, 96, - 97, 98,100,101,109, 71,107, 89, 91, 92, 78, 86, 87, 88, 69, 83, - 84, 85, 82, 65, 42, 0, 10,103,111, 0, 0, 0, 0, 0, 0, 0, - 76,125, 75,105,124,110,115, 62,116, 59, 60,119, 61,121,114,117, - 0, 0, 0, 0,127, 81, 0,113, 0, 0, 0, 0, 95, 55, 55, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 94, 0, 93, 0, 0, 0, 0, 0, 0,104,102 }; -#endif /* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */ static int emulate_raw(unsigned int keycode, int down) { @@ -99,15 +79,6 @@ static int emulate_raw(unsigned int keycode, int down) if (mac_hid_mouse_emulate_buttons(1, keycode, down)) return 0; #endif /* CONFIG_MAC_EMUMOUSEBTN */ -#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD) - if (!mac_hid_keyboard_sends_linux_keycodes()) { - if (keycode > 255 || !mac_keycodes[keycode]) - return -1; - - handle_scancode((mac_keycodes[keycode] & 0x7f), down); - return 0; - } -#endif /* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */ if (keycode > 255 || !x86_keycodes[keycode]) return -1; diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c index 330b33615165..474289eb27e1 100644 --- a/drivers/input/keyboard/amikbd.c +++ b/drivers/input/keyboard/amikbd.c @@ -121,10 +121,10 @@ static int __init amikbd_init(void) amikbd_dev.name = amikbd_name; amikbd_dev.phys = amikbd_phys; - amikbd_dev.idbus = BUS_AMIGA; - amikbd_dev.idvendor = 0x0001; - amikbd_dev.idproduct = 0x0001; - amikbd_dev.idversion = 0x0100; + amikbd_dev.id.bustype = BUS_AMIGA; + amikbd_dev.id.vendor = 0x0001; + amikbd_dev.id.product = 0x0001; + amikbd_dev.id.version = 0x0100; input_register_device(&amikbd_dev); diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 7e5d516b46d7..c64b1934dc7a 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -98,6 +98,7 @@ static unsigned char atkbd_set3_keycode[512] = { #define ATKBD_CMD_ENABLE 0x00f4 #define ATKBD_CMD_RESET_DIS 0x00f5 #define ATKBD_CMD_SETALL_MB 0x00f8 +#define ATKBD_CMD_RESEND 0x00fe #define ATKBD_CMD_EX_ENABLE 0x10ea #define ATKBD_CMD_EX_SETLEDS 0x20eb @@ -141,9 +142,16 @@ static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned in int code = data; #ifdef ATKBD_DEBUG - printk(KERN_DEBUG "atkbd.c: Received %02x\n", data); + printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); #endif + /* Interface error. Request that the keyboard resend. */ + if (flags & (SERIO_FRAME | SERIO_PARITY)) { + printk("atkbd.c: frame/parity error: %02x\n", flags); + serio_write(serio, ATKBD_CMD_RESEND); + return; + } + switch (code) { case ATKBD_RET_ACK: atkbd->ack = 1; @@ -496,10 +504,10 @@ static void atkbd_connect(struct serio *serio, struct serio_dev *dev) atkbd->dev.name = atkbd->name; atkbd->dev.phys = atkbd->phys; - atkbd->dev.idbus = BUS_I8042; - atkbd->dev.idvendor = 0x0001; - atkbd->dev.idproduct = atkbd->set; - atkbd->dev.idversion = atkbd->id; + atkbd->dev.id.bustype = BUS_I8042; + atkbd->dev.id.vendor = 0x0001; + atkbd->dev.id.product = atkbd->set; + atkbd->dev.id.version = atkbd->id; for (i = 0; i < 512; i++) if (atkbd->keycode[i] && atkbd->keycode[i] <= 250) @@ -520,14 +528,16 @@ static struct serio_dev atkbd_dev = { disconnect: atkbd_disconnect }; -/* - * Module init and exit. - */ - -void __init atkbd_setup(char *str, int *ints) +#ifndef MODULE +static int __init atkbd_setup(char *str) { - if (!ints[0]) atkbd_set = ints[1]; + int ints[4]; + str = get_options(str, ARRAY_SIZE(ints), ints); + if (ints[0] > 0) atkbd_set = ints[1]; + return 1; } +__setup("atkbd_set=", atkbd_setup); +#endif int __init atkbd_init(void) { diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index feaea91dc8b4..bccafd21e02c 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c @@ -132,7 +132,7 @@ static int dc_kbd_connect(struct maple_device *dev) kbd->dev.event = NULL; kbd->dev.name = dev->product_name; - kbd->dev.idbus = BUS_MAPLE; + kbd->dev.id.bustype = BUS_MAPLE; input_register_device(&kbd->dev); diff --git a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c index 2df81137d0f6..92cd88bc3208 100644 --- a/drivers/input/keyboard/newtonkbd.c +++ b/drivers/input/keyboard/newtonkbd.c @@ -110,10 +110,10 @@ void nkbd_connect(struct serio *serio, struct serio_dev *dev) nkbd->dev.name = nkbd_name; nkbd->dev.phys = nkbd->phys; - nkbd->dev.idbus = BUS_RS232; - nkbd->dev.idvendor = SERIO_NEWTON; - nkbd->dev.idproduct = 0x0001; - nkbd->dev.idversion = 0x0100; + nkbd->dev.id.bustype = BUS_RS232; + nkbd->dev.id.vendor = SERIO_NEWTON; + nkbd->dev.id.product = 0x0001; + nkbd->dev.id.version = 0x0100; input_register_device(&nkbd->dev); diff --git a/drivers/input/keyboard/ps2serkbd.c b/drivers/input/keyboard/ps2serkbd.c index afa4c107ff4e..63cda43669f6 100644 --- a/drivers/input/keyboard/ps2serkbd.c +++ b/drivers/input/keyboard/ps2serkbd.c @@ -246,10 +246,10 @@ static void ps2serkbd_connect(struct serio *serio, struct serio_dev *dev) ps2serkbd->dev.name = ps2serkbd->name; ps2serkbd->dev.phys = ps2serkbd->phys; - ps2serkbd->dev.idbus = BUS_RS232; - ps2serkbd->dev.idvendor = SERIO_PS2SER; - ps2serkbd->dev.idproduct = ps2serkbd->set; - ps2serkbd->dev.idversion = ps2serkbd->id; + ps2serkbd->dev.id.bustype = BUS_RS232; + ps2serkbd->dev.id.vendor = SERIO_PS2SER; + ps2serkbd->dev.id.product = ps2serkbd->set; + ps2serkbd->dev.id.version = ps2serkbd->id; for (i = 0; i < 512; i++) if (ps2serkbd->keycode[i] && ps2serkbd->keycode[i] <= 250) diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c index 901567c2b355..2469cd06be30 100644 --- a/drivers/input/keyboard/sunkbd.c +++ b/drivers/input/keyboard/sunkbd.c @@ -271,10 +271,10 @@ static void sunkbd_connect(struct serio *serio, struct serio_dev *dev) sunkbd->dev.name = sunkbd->name; sunkbd->dev.phys = sunkbd->phys; - sunkbd->dev.idbus = BUS_RS232; - sunkbd->dev.idvendor = SERIO_SUNKBD; - sunkbd->dev.idproduct = sunkbd->type; - sunkbd->dev.idversion = 0x0100; + sunkbd->dev.id.bustype = BUS_RS232; + sunkbd->dev.id.vendor = SERIO_SUNKBD; + sunkbd->dev.id.product = sunkbd->type; + sunkbd->dev.id.version = 0x0100; input_register_device(&sunkbd->dev); diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c index 6f0b2410788a..8c2b483e3723 100644 --- a/drivers/input/keyboard/xtkbd.c +++ b/drivers/input/keyboard/xtkbd.c @@ -118,10 +118,10 @@ void xtkbd_connect(struct serio *serio, struct serio_dev *dev) xtkbd->dev.name = xtkbd_name; xtkbd->dev.phys = xtkbd->phys; - xtkbd->dev.idbus = BUS_XTKBD; - xtkbd->dev.idvendor = 0x0001; - xtkbd->dev.idproduct = 0x0001; - xtkbd->dev.idversion = 0x0100; + xtkbd->dev.id.bustype = BUS_XTKBD; + xtkbd->dev.id.vendor = 0x0001; + xtkbd->dev.id.product = 0x0001; + xtkbd->dev.id.version = 0x0100; input_register_device(&xtkbd->dev); diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c index 60acbca5332b..6b6a92c9ede7 100644 --- a/drivers/input/mouse/amimouse.c +++ b/drivers/input/mouse/amimouse.c @@ -110,10 +110,10 @@ static int __init amimouse_init(void) amimouse_dev.name = amimouse_name; amimouse_dev.phys = amimouse_phys; - amimouse_dev.idbus = BUS_AMIGA; - amimouse_dev.idvendor = 0x0001; - amimouse_dev.idproduct = 0x0002; - amimouse_dev.idversion = 0x0100; + amimouse_dev.id.bustype = BUS_AMIGA; + amimouse_dev.id.vendor = 0x0001; + amimouse_dev.id.product = 0x0002; + amimouse_dev.id.version = 0x0100; input_register_device(&amimouse_dev); diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c index 9931ff92835e..bb179d901ff3 100644 --- a/drivers/input/mouse/inport.c +++ b/drivers/input/mouse/inport.c @@ -115,10 +115,6 @@ static struct input_dev inport_dev = { close: inport_close, name: INPORT_NAME, phys: "isa023c/input0", - idbus: BUS_ISA, - idvendor: INPORT_VENDOR, - idproduct: 0x0001, - idversion: 0x0100, }; static void inport_interrupt(int irq, void *dev_id, struct pt_regs *regs) @@ -176,6 +172,11 @@ static int __init inport_init(void) request_region(INPORT_BASE, INPORT_EXTENT, "inport"); input_register_device(&inport_dev); + inport_dev.id.bustype =BUS_ISA; + inport_dev.id.vendor =INPORT_VENDOR; + inport_dev.id.product =0x0001; + inport_dev.id.version =0x0100; + printk(KERN_INFO "input: " INPORT_NAME " at %#x irq %d\n", INPORT_BASE, inport_irq); diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c index f1b34343de90..4fab9667ea96 100644 --- a/drivers/input/mouse/logibm.c +++ b/drivers/input/mouse/logibm.c @@ -105,10 +105,6 @@ static struct input_dev logibm_dev = { close: logibm_close, name: "Logitech bus mouse", phys: "isa023c/input0", - idbus: BUS_ISA, - idvendor: 0x0003, - idproduct: 0x0001, - idversion: 0x0100, }; static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs) @@ -125,13 +121,14 @@ static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs) outb(LOGIBM_READ_Y_HIGH, LOGIBM_CONTROL_PORT); buttons = inb(LOGIBM_DATA_PORT); dy |= (buttons & 0xf) << 4; - buttons = ~buttons; + buttons = ~buttons >> 5; input_report_rel(&logibm_dev, REL_X, dx); - input_report_rel(&logibm_dev, REL_Y, 255 - dy); - input_report_key(&logibm_dev, BTN_MIDDLE, buttons & 1); - input_report_key(&logibm_dev, BTN_LEFT, buttons & 2); - input_report_key(&logibm_dev, BTN_RIGHT, buttons & 4); + input_report_rel(&logibm_dev, REL_Y, dy); + input_report_key(&logibm_dev, BTN_RIGHT, buttons & 1); + input_report_key(&logibm_dev, BTN_MIDDLE, buttons & 2); + input_report_key(&logibm_dev, BTN_LEFT, buttons & 4); + outb(LOGIBM_ENABLE_IRQ, LOGIBM_CONTROL_PORT); } #ifndef MODULE @@ -147,7 +144,7 @@ __setup("logibm_irq=", logibm_setup); static int __init logibm_init(void) { - if (request_region(LOGIBM_BASE, LOGIBM_EXTENT, "logibm")) { + if (!request_region(LOGIBM_BASE, LOGIBM_EXTENT, "logibm")) { printk(KERN_ERR "logibm.c: Can't allocate ports at %#x\n", LOGIBM_BASE); return -EBUSY; } @@ -166,6 +163,10 @@ static int __init logibm_init(void) outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT); input_register_device(&logibm_dev); + logibm_dev.id.bustype = BUS_ISA; + logibm_dev.id.vendor = 0x0003; + logibm_dev.id.product = 0x0001; + logibm_dev.id.version = 0x0100; printk(KERN_INFO "input: Logitech bus mouse at %#x irq %d\n", LOGIBM_BASE, logibm_irq); diff --git a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c index 61ee96685dcf..275e3bb6033c 100644 --- a/drivers/input/mouse/pc110pad.c +++ b/drivers/input/mouse/pc110pad.c @@ -95,14 +95,14 @@ static int pc110pad_open(struct input_dev *dev) if (pc110pad_used++) return 0; - save_flags(flags); - cli(); + __save_flags(flags); + __cli(); pc110pad_interrupt(0,0,0); pc110pad_interrupt(0,0,0); pc110pad_interrupt(0,0,0); outb(PC110PAD_ON, pc110pad_io + 2); pc110pad_count = 0; - restore_flags(flags); + __restore_flags(flags); return 0; } @@ -136,10 +136,10 @@ static int __init pc110pad_init(void) pc110pad_dev.name = pc110pad_name; pc110pad_dev.phys = pc110pad_phys; - pc110pad_dev.idbus = BUS_ISA; - pc110pad_dev.idvendor = 0x0003; - pc110pad_dev.idproduct = 0x0001; - pc110pad_dev.idversion = 0x0100; + pc110pad_dev.id.bustype = BUS_ISA; + pc110pad_dev.id.vendor = 0x0003; + pc110pad_dev.id.product = 0x0001; + pc110pad_dev.id.version = 0x0100; input_register_device(&pc110pad_dev); diff --git a/drivers/input/mouse/psmouse.c b/drivers/input/mouse/psmouse.c index d4ec312e019a..716eb9616c6c 100644 --- a/drivers/input/mouse/psmouse.c +++ b/drivers/input/mouse/psmouse.c @@ -142,7 +142,7 @@ static void psmouse_process_packet(struct psmouse *psmouse) */ if (psmouse->type == PSMOUSE_IMEX) { - input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 7) - (int) (packet[2] & 8)); + input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 7) - (int) (packet[3] & 8)); input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1); input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1); } @@ -600,10 +600,10 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev) psmouse->dev.name = psmouse->devname; psmouse->dev.phys = psmouse->phys; - psmouse->dev.idbus = BUS_I8042; - psmouse->dev.idvendor = psmouse->type; - psmouse->dev.idproduct = 0x0002; - psmouse->dev.idversion = 0x0100; + psmouse->dev.id.bustype = BUS_I8042; + psmouse->dev.id.vendor = psmouse->type; + psmouse->dev.id.product = 0x0002; + psmouse->dev.id.version = 0x0100; input_register_device(&psmouse->dev); diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c index 1a2fda738df5..ba0fb7cd81a3 100644 --- a/drivers/input/mouse/rpcmouse.c +++ b/drivers/input/mouse/rpcmouse.c @@ -22,6 +22,7 @@ #include <linux/ptrace.h> #include <linux/interrupt.h> #include <linux/init.h> +#include <linux/input.h> #include <asm/hardware.h> #include <asm/irq.h> @@ -40,10 +41,6 @@ static struct input_dev rpcmouse_dev = { relbit: { BIT(REL_X) | BIT(REL_Y) }, name: "Acorn RiscPC Mouse", phys: "rpcmouse/input0", - idbus: BUS_HOST, - idvendor: 0x0005, - idproduct: 0x0001, - idversion: 0x0100, }; static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs) @@ -63,9 +60,9 @@ static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs) input_report_rel(&rpcmouse_dev, REL_X, dx); input_report_rel(&rpcmouse_dev, REL_Y, dy); - input_report_key(&rpcmouse_dev, BTN_LEFT, buttons & 0x10); - input_report_key(&rpcmouse_dev, BTN_MIDDLE, buttons & 0x20); - input_report_key(&rpcmouse_dev, BTN_RIGHT, buttons & 0x40); + input_report_key(&rpcmouse_dev, BTN_LEFT, b & 0x10); + input_report_key(&rpcmouse_dev, BTN_MIDDLE, b & 0x20); + input_report_key(&rpcmouse_dev, BTN_RIGHT, b & 0x40); } static int __init rpcmouse_init(void) @@ -79,6 +76,11 @@ static int __init rpcmouse_init(void) } input_register_device(&rpcmouse_dev); + rpcmouse.id.bustype =BUS_HOST, + rpcmouse.id.vendor =0x0005, + rpcmouse.id.product =0x0001, + rpcmouse.id.version =0x0100, + printk(KERN_INFO "input: Acorn RiscPC mouse irq %d", IRQ_VSYNCPULSE); return 0; diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 4dd1a4e9033c..6069ea2235d3 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c @@ -263,10 +263,10 @@ static void sermouse_connect(struct serio *serio, struct serio_dev *dev) sermouse->dev.name = sermouse_protocols[sermouse->type]; sermouse->dev.phys = sermouse->phys; - sermouse->dev.idbus = BUS_RS232; - sermouse->dev.idvendor = sermouse->type; - sermouse->dev.idproduct = c; - sermouse->dev.idversion = 0x0100; + sermouse->dev.id.bustype = BUS_RS232; + sermouse->dev.id.vendor = sermouse->type; + sermouse->dev.id.product = c; + sermouse->dev.id.version = 0x0100; if (serio_open(serio, dev)) { kfree(sermouse); diff --git a/drivers/input/serio/Config.in b/drivers/input/serio/Config.in index 253da87ea530..cedd53e2d415 100644 --- a/drivers/input/serio/Config.in +++ b/drivers/input/serio/Config.in @@ -12,9 +12,17 @@ if [ "$CONFIG_SERIO_I8042" != "n" ]; then fi dep_tristate ' Serial port line discipline' CONFIG_SERIO_SERPORT $CONFIG_SERIO dep_tristate ' ct82c710 Aux port controller' CONFIG_SERIO_CT82C710 $CONFIG_SERIO -dep_tristate ' Q40 keyboard controller' CONFIG_SERIO_Q40KBD $CONFIG_SERIO +if [ "$CONFIG_Q40" = "y" ]; then + dep_tristate ' Q40 keyboard controller' CONFIG_SERIO_Q40KBD $CONFIG_SERIO +fi dep_tristate ' Parallel port keyboard adapter' CONFIG_SERIO_PARKBD $CONFIG_SERIO $CONFIG_PARPORT if [ "$CONFIG_ARCH_ACORN" = "y" ]; then dep_tristate ' Acorn RiscPC keyboard controller' CONFIG_SERIO_ACORN $CONFIG_SERIO fi +if [ "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then + dep_tristate ' AMBA KMI keyboard controller' CONFIG_SERIO_AMBAKMI $CONFIG_SERIO +fi +if [ "$CONFIG_SA1111" = "y" ]; then + dep_tristate ' Intel SA1111 keyboard controller' CONFIG_SERIO_SA1111 $CONFIG_SERIO +fi diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile index 4a12ab84e374..dd67a77e6f08 100644 --- a/drivers/input/serio/Makefile +++ b/drivers/input/serio/Makefile @@ -14,6 +14,8 @@ obj-$(CONFIG_SERIO_PARKBD) += parkbd.o obj-$(CONFIG_SERIO_SERPORT) += serport.o obj-$(CONFIG_SERIO_CT82C710) += ct82c710.o obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o +obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o +obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o # The global Rules.make. diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c new file mode 100644 index 000000000000..0c19157baa4a --- /dev/null +++ b/drivers/input/serio/ambakmi.c @@ -0,0 +1,158 @@ +/* + * linux/drivers/input/serio/amba_kmi.c + * + * Copyright (C) 2000 Deep Blue Solutions Ltd. + * Copyright (C) 2002 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include <linux/module.h> +#include <linux/init.h> +#include <linux/serio.h> +#include <linux/errno.h> +#include <linux/interrupt.h> +#include <linux/ioport.h> +#include <linux/device.h> +#include <linux/delay.h> +#include <linux/slab.h> + +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/hardware/amba_kmi.h> +#include <asm/mach/amba_kmi.h> + +extern struct pt_regs *kbd_pt_regs; + +#define KMI_BASE (kmi->base) + +struct amba_kmi_port { + struct serio io; + struct amba_kmi_port *next; + unsigned long base; + unsigned int irq; + unsigned int divisor; + char name[32]; + char phys[16]; +}; + +static void amba_kmi_int(int irq, void *dev_id, struct pt_regs *regs) +{ + struct amba_kmi_port *kmi = dev_id; + unsigned int status = __raw_readb(KMIIR); + + kbd_pt_regs = regs; + + while (status & KMIIR_RXINTR) { + serio_interrupt(&kmi->io, __raw_readb(KMIDATA), 0); + status = __raw_readb(KMIIR); + } +} + +static int amba_kmi_write(struct serio *io, unsigned char val) +{ + struct amba_kmi_port *kmi = io->driver; + unsigned int timeleft = 10000; /* timeout in 100ms */ + + while ((__raw_readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && timeleft--) + udelay(10); + + if (timeleft) + __raw_writeb(val, KMIDATA); + + return timeleft ? 0 : SERIO_TIMEOUT; +} + +static int amba_kmi_open(struct serio *io) +{ + struct amba_kmi_port *kmi = io->driver; + int ret; + + __raw_writeb(kmi->divisor, KMICLKDIV); + __raw_writeb(KMICR_EN, KMICR); + + ret = request_irq(kmi->irq, amba_kmi_int, 0, kmi->phys, kmi); + if (ret) { + printk(KERN_ERR "kmi: failed to claim IRQ%d\n", kmi->irq); + __raw_writeb(0, KMICR); + return ret; + } + + __raw_writeb(KMICR_EN | KMICR_RXINTREN, KMICR); + + return 0; +} + +static void amba_kmi_close(struct serio *io) +{ + struct amba_kmi_port *kmi = io->driver; + + free_irq(kmi->irq, kmi); + + __raw_writeb(0, KMICR); +} + +static struct amba_kmi_port *list; + +static int __init amba_kmi_init_one(char *type, unsigned long base, int irq, int nr) +{ + struct amba_kmi_port *kmi; + + kmi = kmalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); + if (!kmi) + return -ENOMEM; + + memset(kmi, 0, sizeof(struct amba_kmi_port)); + + kmi->io.type = SERIO_8042; + kmi->io.write = amba_kmi_write; + kmi->io.open = amba_kmi_open; + kmi->io.close = amba_kmi_close; + kmi->io.name = kmi->name; + kmi->io.phys = kmi->phys; + kmi->io.driver = kmi; + + kmi->base = base; + kmi->irq = irq; + kmi->divisor = 24 / 8 - 1; + + kmi->next = list; + list = kmi; + + snprintf(kmi->name, sizeof(kmi->name), "AMBA KMI PS/2 %s port", type); + snprintf(kmi->phys, sizeof(kmi->phys), "amba/serio%d", nr); + + serio_register_port(&kmi->io); + return 0; +} + +static int __init amba_kmi_init(void) +{ + amba_kmi_init_one("keyboard", IO_ADDRESS(KMI0_BASE), IRQ_KMIINT0, 0); + amba_kmi_init_one("mouse", IO_ADDRESS(KMI1_BASE), IRQ_KMIINT1, 1); + return 0; +} + +static void __exit amba_kmi_exit(void) +{ + struct amba_kmi_port *kmi, *next; + + kmi = list; + while (kmi) { + next = kmi->next; + + serio_unregister_port(&kmi->io); + kfree(kmi); + + kmi = next; + } +} + +module_init(amba_kmi_init); +module_exit(amba_kmi_exit); + +MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); +MODULE_DESCRIPTION("AMBA KMI controller driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/input/serio/i8042-ppcio.h b/drivers/input/serio/i8042-ppcio.h index 4b89fa3cc99e..c385b473c688 100644 --- a/drivers/input/serio/i8042-ppcio.h +++ b/drivers/input/serio/i8042-ppcio.h @@ -18,6 +18,9 @@ extern void *kb_cs; extern void *kb_data; +#define I8042_COMMAND_REG (*(int *)kb_cs) +#define I8042_DATA_REG (*(int *)kb_data) + static inline int i8042_read_data(void) { return readb(kb_data); @@ -57,6 +60,9 @@ static inline void i8042_platform_exit(void) #define I8042_KBD_PHYS_DESC "spruceps2/serio0" #define I8042_AUX_PHYS_DESC "spruceps2/serio1" +#define I8042_COMMAND_REG 0xff810000 +#define I8042_DATA_REG 0xff810001 + static inline int i8042_read_data(void) { unsigned long kbd_data; diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 4251d91e38b0..7aeb872f9e4d 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -31,11 +31,13 @@ MODULE_PARM(i8042_noaux, "1i"); MODULE_PARM(i8042_unlock, "1i"); MODULE_PARM(i8042_reset, "1i"); MODULE_PARM(i8042_direct, "1i"); +MODULE_PARM(i8042_restore_ctr, "1i"); static int i8042_noaux; static int i8042_unlock; static int i8042_reset; static int i8042_direct; +static int i8042_restore_ctr; spinlock_t i8042_lock = SPIN_LOCK_UNLOCKED; @@ -111,8 +113,9 @@ static int i8042_flush(void) while ((i8042_read_status() & I8042_STR_OBF) && (i++ < I8042_BUFFER_SIZE)) #ifdef I8042_DEBUG_IO - printk(KERN_DEBUG "i8042.c: %02x <- i8042 (flush) [%d]\n", - i8042_read_data(), (int) (jiffies - i8042_start)); + printk(KERN_DEBUG "i8042.c: %02x <- i8042 (flush, %s) [%d]\n", + i8042_read_data(), i8042_read_status() & I8042_STR_AUXDATA ? "aux" : "kbd", + (int) (jiffies - i8042_start)); #else i8042_read_data(); #endif @@ -123,11 +126,11 @@ static int i8042_flush(void) } /* - * i8042_command() executes a command on the i8042. It also sends the input parameter(s) - * of the commands to it, and receives the output value(s). The parameters are to be - * stored in the param array, and the output is placed into the same array. The number - * of the parameters and output values is encoded in bits 8-11 of the command - * number. + * i8042_command() executes a command on the i8042. It also sends the input + * parameter(s) of the commands to it, and receives the output value(s). The + * parameters are to be stored in the param array, and the output is placed + * into the same array. The number of the parameters and output values is + * encoded in bits 8-11 of the command number. */ static int i8042_command(unsigned char *param, int command) @@ -182,9 +185,6 @@ static int i8042_command(unsigned char *param, int command) /* * i8042_kbd_write() sends a byte out through the keyboard interface. - * It also automatically refreshes the CTR value, since some i8042's - * trash their CTR after attempting to send data to an nonexistent - * device. */ static int i8042_kbd_write(struct serio *port, unsigned char c) @@ -222,11 +222,12 @@ static int i8042_aux_write(struct serio *port, unsigned char c) retval = i8042_command(&c, I8042_CMD_AUX_SEND); /* - * Here we restore the CTR value. I don't know why, but i8042's in half-AT - * mode tend to trash their CTR when doing the AUX_SEND command. + * Here we restore the CTR value if requested. I don't know why, but i8042's in + * half-AT mode tend to trash their CTR when doing the AUX_SEND command. */ - retval |= i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR); + if (i8042_restore_ctr) + retval |= i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR); /* * Make sure the interrupt happens and the character is received even @@ -240,16 +241,14 @@ static int i8042_aux_write(struct serio *port, unsigned char c) /* * i8042_open() is called when a port is open by the higher layer. - * It allocates an interrupt and enables the port. + * It allocates the interrupt and enables in in the chip. */ static int i8042_open(struct serio *port) { struct i8042_values *values = port->driver; -/* - * Allocate the interrupt - */ + i8042_flush(); if (request_irq(values->irq, i8042_interrupt, 0, "i8042", NULL)) { printk(KERN_ERR "i8042.c: Can't get irq %d for %s, unregistering the port.\n", values->irq, values->name); @@ -258,10 +257,6 @@ static int i8042_open(struct serio *port) return -1; } -/* - * Enable the interrupt. - */ - i8042_ctr |= values->irqen; if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { @@ -269,22 +264,21 @@ static int i8042_open(struct serio *port) return -1; } + i8042_interrupt(0, NULL, NULL); + return 0; } /* - * i8042_close() frees the interrupt, and disables the interface when the - * upper layer doesn't need it anymore. + * i8042_close() frees the interrupt, so that it can possibly be used + * by another driver. We never know - if the user doesn't have a mouse, + * the BIOS could have used the AUX interupt for PCI. */ static void i8042_close(struct serio *port) { struct i8042_values *values = port->driver; -/* - * Disable the interrupt. - */ - i8042_ctr &= ~values->irqen; if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { @@ -292,11 +286,9 @@ static void i8042_close(struct serio *port) return; } -/* - * Free the interrupt - */ - free_irq(values->irq, NULL); + + i8042_flush(); } /* @@ -362,7 +354,7 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs) ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); #ifdef I8042_DEBUG_IO - printk(KERN_DEBUG "i8042.c: %02x <- i8042 (interrupt-%s, %d) [%d]\n", + printk(KERN_DEBUG "i8042.c: %02x <- i8042 (interrupt, %s, %d) [%d]\n", data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, (int) (jiffies - i8042_start)); #endif @@ -391,23 +383,14 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* * i8042_controller init initializes the i8042 controller, and, - * most importantly, sets it into non-xlated mode. + * most importantly, sets it into non-xlated mode if that's + * desired. */ static int __init i8042_controller_init(void) { /* - * Check the i/o region before we touch it. - */ -#if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) - if (check_region(I8042_DATA_REG, 16)) { - printk(KERN_ERR "i8042.c: %#x port already in use!\n", I8042_DATA_REG); - return -1; - } -#endif - -/* * Test the i8042. We need to know if it thinks it's working correctly * before doing anything else. */ @@ -431,7 +414,7 @@ static int __init i8042_controller_init(void) } /* - * Read the CTR. + * Save the CTR for restoral on unload / reboot. */ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) { @@ -439,14 +422,10 @@ static int __init i8042_controller_init(void) return -1; } -/* - * Save the CTR for restoral on unload / reboot. - */ - i8042_initial_ctr = i8042_ctr; /* - * Disable both interfaces and their interrupts. + * Disable the keyboard interface and interrupt. */ i8042_ctr |= I8042_CTR_KBDDIS; @@ -625,7 +604,16 @@ static int __init i8042_check_aux(struct i8042_values *values, struct serio *por static int __init i8042_port_register(struct i8042_values *values, struct serio *port) { values->exists = 1; + + i8042_ctr &= ~values->disable; + + if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { + printk(KERN_WARNING "i8042.c: Can't write CTR while registering.\n"); + return -1; + } + serio_register_port(port); + printk(KERN_INFO "serio: i8042 %s port at %#x,%#x irq %d\n", values->name, I8042_DATA_REG, I8042_COMMAND_REG, values->irq); @@ -638,45 +626,45 @@ static void i8042_timer_func(unsigned long data) mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); } -static void __init i8042_start_polling(void) +#ifndef MODULE +static int __init i8042_setup_reset(char *str) { - i8042_ctr &= ~I8042_CTR_KBDDIS; - if (i8042_aux_values.exists) - i8042_ctr &= ~I8042_CTR_AUXDIS; - - if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { - printk(KERN_WARNING "i8042.c: Can't write CTR while starting polling.\n"); - return; - } - - i8042_timer.function = i8042_timer_func; - mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); + i8042_reset = 1; + return 1; } - -static void __exit i8042_stop_polling(void) +static int __init i8042_setup_noaux(char *str) { - del_timer(&i8042_timer); + i8042_noaux = 1; + return 1; } - -/* - * Module init and cleanup functions. - */ - -void __init i8042_setup(char *str, int *ints) +static int __init i8042_setup_unlock(char *str) { - if (!strcmp(str, "i8042_reset=1")) - i8042_reset = 1; - if (!strcmp(str, "i8042_noaux=1")) - i8042_noaux = 1; - if (!strcmp(str, "i8042_unlock=1")) - i8042_unlock = 1; - if (!strcmp(str, "i8042_direct=1")) - i8042_direct = 1; + i8042_unlock = 1; + return 1; +} +static int __init i8042_setup_direct(char *str) +{ + i8042_direct = 1; + return 1; } +static int __init i8042_setup_restore_ctr(char *str) +{ + i8042_restore_ctr = 1; + return 1; +} + +__setup("i8042_reset", i8042_setup_reset); +__setup("i8042_noaux", i8042_setup_noaux); +__setup("i8042_unlock", i8042_setup_unlock); +__setup("i8042_direct", i8042_setup_direct); +__setup("i8042_restore_ctr", i8042_setup_restore_ctr); +#endif /* - * Reset the 8042 back to original mode. + * We need to reset the 8042 back to original mode on system shutdown, + * because otherwise BIOSes will be confused. */ + static int i8042_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { @@ -698,18 +686,23 @@ int __init i8042_init(void) i8042_start = jiffies; #endif +#if !defined(__i386__) && !defined(__x86_64__) + i8042_reset = 1; +#endif + if (!i8042_platform_init()) return -EBUSY; if (i8042_controller_init()) return -ENODEV; - - i8042_port_register(&i8042_kbd_values, &i8042_kbd_port); if (!i8042_noaux && !i8042_check_aux(&i8042_aux_values, &i8042_aux_port)) i8042_port_register(&i8042_aux_values, &i8042_aux_port); - i8042_start_polling(); + i8042_port_register(&i8042_kbd_values, &i8042_kbd_port); + + i8042_timer.function = i8042_timer_func; + mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); register_reboot_notifier(&i8042_notifier); @@ -720,7 +713,7 @@ void __exit i8042_exit(void) { unregister_reboot_notifier(&i8042_notifier); - i8042_stop_polling(); + del_timer(&i8042_timer); if (i8042_kbd_values.exists) serio_unregister_port(&i8042_kbd_port); @@ -735,3 +728,5 @@ void __exit i8042_exit(void) module_init(i8042_init); module_exit(i8042_exit); + + diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index c5a3dc1fc3d4..744098811cf6 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c @@ -47,8 +47,10 @@ MODULE_LICENSE("GPL"); static inline void rpckbd_write(unsigned char val) { - while(!(inb(IOMD_KCTRL) & (1 << 7))); - outb(val, IOMD_KARTTX); + while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) + cpu_relax(); + + iomd_writeb(val, IOMD_KARTTX); } static struct serio rpckbd_port = @@ -61,11 +63,14 @@ static struct serio rpckbd_port = static void rpckbd_rx(int irq, void *dev_id, struct pt_regs *regs) { + unsigned int byte; kbd_pt_regs = regs; - while (inb(IOMD_KCTRL) & (1 << 5)) - serio_interrupt(&rpckbd_port, inb(IOMD_KARTRX), 0); + while (iomd_readb(IOMD_KCTRL) & (1 << 5)) { + byte = iomd_readb(IOMD_KARTRX); + serio_interrupt(&rpckbd_port, byte, 0); + } } static void rpckbd_tx(int irq, void *dev_id, struct pt_regs *regs) @@ -74,13 +79,10 @@ static void rpckbd_tx(int irq, void *dev_id, struct pt_regs *regs) static int __init rpckbd_init(void) { - unsigned long flags; - /* Reset the keyboard state machine. */ - outb(0, IOMD_KCTRL); - outb(8, IOMD_KCTRL); - - save_flags_cli(flags); + iomd_writeb(0, IOMD_KCTRL); + iomd_writeb(8, IOMD_KCTRL); + iomd_readb(IOMD_KARTRX); if (request_irq(IRQ_KEYBOARDRX, rpckbd_rx, 0, "rpckbd", NULL) != 0) { printk(KERN_ERR "rpckbd.c: Could not allocate keyboard receive IRQ!\n") @@ -93,14 +95,7 @@ static int __init rpckbd_init(void) return -EBUSY; } - disable_irq(IRQ_KEYBOARDTX); - (void)IOMD_KARTRX; - - restore_flags(flags); - register_serio_port(&rpckbd_port); - printk(KERN_INFO "serio: RiscPC PS/2 kbd port irq %d %d\n", IRQ_KEYBOARDRX, IRQ_KEYBOARDTX); - return 0; } diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c new file mode 100644 index 000000000000..da5688105128 --- /dev/null +++ b/drivers/input/serio/sa1111ps2.c @@ -0,0 +1,286 @@ +/* + * linux/drivers/input/serio/sa1111ps2.c + * + * Copyright (C) 2002 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License. + */ +#include <linux/module.h> +#include <linux/init.h> +#include <linux/serio.h> +#include <linux/errno.h> +#include <linux/interrupt.h> +#include <linux/ioport.h> +#include <linux/delay.h> +#include <linux/device.h> + +#include <asm/hardware/sa1111.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/system.h> + +extern struct pt_regs *kbd_pt_regs; + +struct ps2if { + struct serio io; + struct resource *res; + unsigned long base; + unsigned int irq; + unsigned int skpcr_mask; +}; + +/* + * Read all bytes waiting in the PS2 port. There should be + * at the most one, but we loop for safety. If there was a + * framing error, we have to manually clear the status. + */ +static void ps2_int(int irq, void *dev_id, struct pt_regs *regs) +{ + struct ps2if *sa = dev_id; + unsigned int scancode, flag, status; + + kbd_pt_regs = regs; + + status = sa1111_readl(sa->base + SA1111_PS2STAT); + while (status & PS2STAT_RXF) { + if (status & PS2STAT_STP) + sa1111_writel(PS2STAT_STP, sa->base + SA1111_PS2STAT); + + flag = (status & PS2STAT_STP ? SERIO_FRAME : 0) | + (status & PS2STAT_RXP ? 0 : SERIO_PARITY); + + scancode = sa1111_readl(sa->base + SA1111_PS2DATA) & 0xff; + + if (hweight8(scancode) & 1) + flag ^= SERIO_PARITY; + + serio_interrupt(&sa->io, scancode, flag); + + status = sa1111_readl(sa->base + SA1111_PS2STAT); + } +} + +/* + * Write a byte to the PS2 port. We have to wait for the + * port to indicate that the transmitter is empty. + */ +static int ps2_write(struct serio *io, unsigned char val) +{ + struct ps2if *sa = io->driver; + unsigned int timeleft = 10000; /* timeout in 100ms */ + + while ((sa1111_readl(sa->base + SA1111_PS2STAT) & PS2STAT_TXE) == 0 && + timeleft--) + udelay(10); + + if (timeleft) + sa1111_writel(val, sa->base + SA1111_PS2DATA); + + return timeleft ? 0 : SERIO_TIMEOUT; +} + +static int ps2_open(struct serio *io) +{ + struct ps2if *sa = io->driver; + int ret; + + sa1111_enable_device(sa->skpcr_mask); + + ret = request_irq(sa->irq, ps2_int, 0, "ps2", sa); + if (ret) { + printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", + sa->irq, ret); + return ret; + } + + sa1111_writel(PS2CR_ENA, sa->base + SA1111_PS2CR); + + return 0; +} + +static void ps2_close(struct serio *io) +{ + struct ps2if *sa = io->driver; + + sa1111_writel(0, sa->base + SA1111_PS2CR); + + free_irq(sa->irq, sa); + + sa1111_disable_device(sa->skpcr_mask); +} + +/* + * Clear the input buffer. + */ +static void __init ps2_clear_input(struct ps2if *sa) +{ + int maxread = 100; + + while (maxread--) { + if ((sa1111_readl(sa->base + SA1111_PS2DATA) & 0xff) == 0xff) + break; + } +} + +static inline unsigned int +ps2_test_one(struct ps2if *sa, unsigned int mask) +{ + unsigned int val; + + sa1111_writel(PS2CR_ENA | mask, sa->base + SA1111_PS2CR); + + udelay(2); + + val = sa1111_readl(sa->base + SA1111_PS2STAT); + return val & (PS2STAT_KBC | PS2STAT_KBD); +} + +/* + * Test the keyboard interface. We basically check to make sure that + * we can drive each line to the keyboard independently of each other. + */ +static int __init ps2_test(struct ps2if *sa) +{ + unsigned int stat; + int ret = 0; + + stat = ps2_test_one(sa, PS2CR_FKC); + if (stat != PS2STAT_KBD) { + printk("Keyboard interface test failed[1]: %02x\n", stat); + ret = -ENODEV; + } + + stat = ps2_test_one(sa, 0); + if (stat != (PS2STAT_KBC | PS2STAT_KBD)) { + printk("Keyboard interface test failed[2]: %02x\n", stat); + ret = -ENODEV; + } + + stat = ps2_test_one(sa, PS2CR_FKD); + if (stat != PS2STAT_KBC) { + printk("Keyboard interface test failed[3]: %02x\n", stat); + ret = -ENODEV; + } + + sa1111_writel(0, sa->base + SA1111_PS2CR); + + return ret; +} + +/* + * Initialise one PS/2 port. + */ +static int __init ps2_init_one(struct sa1111_device *dev, struct ps2if *sa) +{ + int ret; + + /* + * Request the physical region for this PS2 port. + */ + sa->res = request_mem_region(_SA1111(sa->base), 512, "ps2"); + if (!sa->res) + return -EBUSY; + + /* + * Convert the chip offset to virtual address. + */ + sa->base += (unsigned long)dev->base; + + sa1111_enable_device(sa->skpcr_mask); + + /* Incoming clock is 8MHz */ + sa1111_writel(0, sa->base + SA1111_PS2CLKDIV); + sa1111_writel(127, sa->base + SA1111_PS2PRECNT); + + /* + * Flush any pending input. + */ + ps2_clear_input(sa); + + /* + * Test the keyboard interface. + */ + ret = ps2_test(sa); + if (ret) + goto out; + + /* + * Flush any pending input. + */ + ps2_clear_input(sa); + sa1111_disable_device(sa->skpcr_mask); + + serio_register_port(&sa->io); + return 0; + + out: + sa1111_disable_device(sa->skpcr_mask); + release_resource(sa->res); + return ret; +} + +/* + * Remove one PS/2 port. + */ +static void __exit ps2_remove_one(struct ps2if *sa) +{ + serio_unregister_port(&sa->io); + release_resource(sa->res); +} + +static struct ps2if ps2_kbd_port = +{ + io: { + type: SERIO_8042, + write: ps2_write, + open: ps2_open, + close: ps2_close, + name: "SA1111 PS/2 kbd port", + phys: "sa1111/serio0", + driver: &ps2_kbd_port, + }, + base: SA1111_KBD, + irq: IRQ_TPRXINT, + skpcr_mask: SKPCR_PTCLKEN, +}; + +static struct ps2if ps2_mse_port = +{ + io: { + type: SERIO_8042, + write: ps2_write, + open: ps2_open, + close: ps2_close, + name: "SA1111 PS/2 mouse port", + phys: "sa1111/serio1", + driver: &ps2_mse_port, + }, + base: SA1111_MSE, + irq: IRQ_MSRXINT, + skpcr_mask: SKPCR_PMCLKEN, +}; + +static int __init ps2_init(void) +{ + int ret = -ENODEV; + + if (sa1111) { + ret = ps2_init_one(sa1111, &ps2_kbd_port); + } + + return ret; +} + +static void __exit ps2_exit(void) +{ + ps2_remove_one(&ps2_kbd_port); +} + +module_init(ps2_init); +module_exit(ps2_exit); + +MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); +MODULE_DESCRIPTION("SA1111 PS2 controller driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 415adb665568..b6e6c0f71384 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -42,6 +42,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); MODULE_DESCRIPTION("Serio abstraction core"); MODULE_LICENSE("GPL"); +EXPORT_SYMBOL(serio_interrupt); EXPORT_SYMBOL(serio_register_port); EXPORT_SYMBOL(serio_unregister_port); EXPORT_SYMBOL(serio_register_device); diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c index 8ea3050692e9..71fbce1b7250 100644 --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c @@ -134,10 +134,10 @@ static void gunze_connect(struct serio *serio, struct serio_dev *dev) gunze->dev.private = gunze; gunze->dev.name = gunze_name; gunze->dev.phys = gunze->phys; - gunze->dev.idbus = BUS_RS232; - gunze->dev.idvendor = SERIO_GUNZE; - gunze->dev.idproduct = 0x0051; - gunze->dev.idversion = 0x0100; + gunze->dev.id.bustype = BUS_RS232; + gunze->dev.id.vendor = SERIO_GUNZE; + gunze->dev.id.product = 0x0051; + gunze->dev.id.version = 0x0100; if (serio_open(serio, dev)) { kfree(gunze); diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index 2cb7309eae32..7995b5c1b99a 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c @@ -418,10 +418,10 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) ts->dev.private = ts; ts->dev.name = h3600_name; ts->dev.phys = ts->phys; - ts->dev.idbus = BUS_RS232; - ts->dev.idvendor = SERIO_H3600; - ts->dev.idproduct = 0x0666; /* FIXME !!! We can ask the hardware */ - ts->dev.idversion = 0x0100; + ts->dev.id.bustype = BUS_RS232; + ts->dev.id.vendor = SERIO_H3600; + ts->dev.id.product = 0x0666; /* FIXME !!! We can ask the hardware */ + ts->dev.id.version = 0x0100; if (serio_open(serio, dev)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); diff --git a/drivers/input/uinput.c b/drivers/input/uinput.c index 6b6dc611d835..29a8ce48f130 100644 --- a/drivers/input/uinput.c +++ b/drivers/input/uinput.c @@ -162,10 +162,10 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou strncpy(dev->name, user_dev.name, size); dev->name[size] = '\0'; - dev->idbus = user_dev.idbus; - dev->idvendor = user_dev.idvendor; - dev->idproduct = user_dev.idproduct; - dev->idversion = user_dev.idversion; + dev->id.bustype = user_dev.id.bustype; + dev->id.vendor = user_dev.id.vendor; + dev->id.product = user_dev.id.product; + dev->id.version = user_dev.id.version; dev->ff_effects_max = user_dev.ff_effects_max; size = sizeof(unsigned long) * NBITS(ABS_MAX + 1); diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c index 8bd4be08e65d..85670d5c6d38 100644 --- a/drivers/macintosh/adbhid.c +++ b/drivers/macintosh/adbhid.c @@ -479,10 +479,10 @@ adbhid_input_register(int id, int default_id, int original_handler_id, adbhid[id]->input.private = adbhid[id]; adbhid[id]->input.name = adbhid[id]->name; adbhid[id]->input.phys = adbhid[id]->phys; - adbhid[id]->input.idbus = BUS_ADB; - adbhid[id]->input.idvendor = 0x0001; - adbhid[id]->input.idproduct = (id << 12) | (default_id << 8) | original_handler_id; - adbhid[id]->input.idversion = 0x0100; + adbhid[id]->input.id.bustype = BUS_ADB; + adbhid[id]->input.id.vendor = 0x0001; + adbhid[id]->input.id.product = (id << 12) | (default_id << 8) | original_handler_id; + adbhid[id]->input.id.version = 0x0100; switch (default_id) { case ADB_KEYBOARD: @@ -607,7 +607,7 @@ adbhid_input_reregister(int id, int default_id, int org_handler_id, int cur_handler_id, int mk) { if (adbhid[id]) { - if (adbhid[id]->input.idproduct != + if (adbhid[id]->input.id.product != ((id << 12)|(default_id << 8)|org_handler_id)) { adbhid_input_unregister(id); adbhid_input_register(id, default_id, org_handler_id, diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 80872c799b1b..41e4dbb5ce85 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c @@ -181,10 +181,10 @@ static void emumousebtn_input_register(void) emumousebtn.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); emumousebtn.relbit[0] = BIT(REL_X) | BIT(REL_Y); - emumousebtn.idbus = BUS_ADB; - emumousebtn.idvendor = 0x0001; - emumousebtn.idproduct = 0x0001; - emumousebtn.idversion = 0x0100; + emumousebtn.id.bustype = BUS_ADB; + emumousebtn.id.vendor = 0x0001; + emumousebtn.id.product = 0x0001; + emumousebtn.id.version = 0x0100; input_register_device(&emumousebtn); diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index 764f52074649..f869b223116d 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c @@ -277,10 +277,10 @@ aiptek_probe(struct usb_device *dev, unsigned int ifnum, aiptek->dev.close = aiptek_close; aiptek->dev.name = aiptek->features->name; - aiptek->dev.idbus = BUS_USB; - aiptek->dev.idvendor = dev->descriptor.idVendor; - aiptek->dev.idproduct = dev->descriptor.idProduct; - aiptek->dev.idversion = dev->descriptor.bcdDevice; + aiptek->dev.id.bustype = BUS_USB; + aiptek->dev.id.vendor = dev->descriptor.idVendor; + aiptek->dev.id.product = dev->descriptor.idProduct; + aiptek->dev.id.version = dev->descriptor.bcdDevice; aiptek->usbdev = dev; endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0; diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index a036b23f6fa6..4ffdec218fd5 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -490,10 +490,10 @@ int hidinput_connect(struct hid_device *hid) hid->input.name = hid->name; hid->input.phys = hid->phys; hid->input.uniq = hid->uniq; - hid->input.idbus = BUS_USB; - hid->input.idvendor = dev->descriptor.idVendor; - hid->input.idproduct = dev->descriptor.idProduct; - hid->input.idversion = dev->descriptor.bcdDevice; + hid->input.id.bustype = BUS_USB; + hid->input.id.vendor = dev->descriptor.idVendor; + hid->input.id.product = dev->descriptor.idProduct; + hid->input.id.version = dev->descriptor.bcdDevice; for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { report_enum = hid->report_enum + k; diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c index 9dd719300002..79dcc55c7717 100644 --- a/drivers/usb/input/powermate.c +++ b/drivers/usb/input/powermate.c @@ -293,10 +293,10 @@ static void *powermate_probe(struct usb_device *udev, unsigned int ifnum, const pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); - pm->input.idbus = BUS_USB; - pm->input.idvendor = udev->descriptor.idVendor; - pm->input.idproduct = udev->descriptor.idProduct; - pm->input.idversion = udev->descriptor.bcdDevice; + pm->input.id.bustype = BUS_USB; + pm->input.id.vendor = udev->descriptor.idVendor; + pm->input.id.product = udev->descriptor.idProduct; + pm->input.id.version = udev->descriptor.bcdDevice; pm->input.event = powermate_input_event; input_register_device(&pm->input); diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c index b9b3e0923cb5..bf42555c0d18 100644 --- a/drivers/usb/input/usbkbd.c +++ b/drivers/usb/input/usbkbd.c @@ -236,10 +236,10 @@ static void *usb_kbd_probe(struct usb_device *dev, unsigned int ifnum, kbd->dev.name = kbd->name; kbd->dev.phys = kbd->phys; - kbd->dev.idbus = BUS_USB; - kbd->dev.idvendor = dev->descriptor.idVendor; - kbd->dev.idproduct = dev->descriptor.idProduct; - kbd->dev.idversion = dev->descriptor.bcdDevice; + kbd->dev.id.bus = BUS_USB; + kbd->dev.id.vendor = dev->descriptor.idVendor; + kbd->dev.id.product = dev->descriptor.idProduct; + kbd->dev.id.version = dev->descriptor.bcdDevice; if (!(buf = kmalloc(63, GFP_KERNEL))) { kfree(kbd); @@ -255,7 +255,7 @@ static void *usb_kbd_probe(struct usb_device *dev, unsigned int ifnum, if (!strlen(kbd->name)) sprintf(kbd->name, "USB HIDBP Keyboard %04x:%04x", - kbd->dev.idvendor, kbd->dev.idproduct); + kbd->dev.id.vendor, kbd->dev.id.product); kfree(buf); diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c index cfec38752242..37da58d9ad65 100644 --- a/drivers/usb/input/usbmouse.c +++ b/drivers/usb/input/usbmouse.c @@ -145,10 +145,10 @@ static void *usb_mouse_probe(struct usb_device *dev, unsigned int ifnum, mouse->dev.name = mouse->name; mouse->dev.phys = mouse->phys; - mouse->dev.idbus = BUS_USB; - mouse->dev.idvendor = dev->descriptor.idVendor; - mouse->dev.idproduct = dev->descriptor.idProduct; - mouse->dev.idversion = dev->descriptor.bcdDevice; + mouse->dev.id.bus = BUS_USB; + mouse->dev.id.vendor = dev->descriptor.idVendor; + mouse->dev.id.product = dev->descriptor.idProduct; + mouse->dev.id.version = dev->descriptor.bcdDevice; if (!(buf = kmalloc(63, GFP_KERNEL))) { kfree(mouse); @@ -164,7 +164,7 @@ static void *usb_mouse_probe(struct usb_device *dev, unsigned int ifnum, if (!strlen(mouse->name)) sprintf(mouse->name, "USB HIDBP Mouse %04x:%04x", - mouse->dev.idvendor, mouse->dev.idproduct); + mouse->dev.id.vendor, mouse->dev.id.product); kfree(buf); diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index 2d1c8f4ec2d7..2fdac6221282 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c @@ -400,10 +400,10 @@ static void *wacom_probe(struct usb_device *dev, unsigned int ifnum, const struc wacom->dev.name = wacom->features->name; wacom->dev.phys = wacom->phys; - wacom->dev.idbus = BUS_USB; - wacom->dev.idvendor = dev->descriptor.idVendor; - wacom->dev.idproduct = dev->descriptor.idProduct; - wacom->dev.idversion = dev->descriptor.bcdDevice; + wacom->dev.id.bustype = BUS_USB; + wacom->dev.id.vendor = dev->descriptor.idVendor; + wacom->dev.id.product = dev->descriptor.idProduct; + wacom->dev.id.version = dev->descriptor.bcdDevice; wacom->usbdev = dev; endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0; diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index ace599597455..b7651315df08 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c @@ -1,68 +1,70 @@ /* - * USB XBOX HID Gamecontroller - v0.0.3 + * X-Box gamepad - v0.0.5 * * Copyright (c) 2002 Marko Friedemann <mfr@bmx-chemnitz.de> * * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * This driver is based on: - * - information from http://euc.jp/periphs/xbox-controller.ja.html - * - the iForce driver drivers/char/joystick/iforce.c - * - the skeleton-driver drivers/usb/usb-skeleton.c + * - information from http://euc.jp/periphs/xbox-controller.ja.html + * - the iForce driver drivers/char/joystick/iforce.c + * - the skeleton-driver drivers/usb/usb-skeleton.c * * Thanks to: - * - ITO Takayuki for providing xpad information on his website - * - Vojtech Pavlik - iforce driver / input subsystem - * - Greg Kroah-Hartman - usb-skeleton driver + * - ITO Takayuki for providing essential xpad information on his website + * - Vojtech Pavlik - iforce driver / input subsystem + * - Greg Kroah-Hartman - usb-skeleton driver * * TODO: - * - get the black button to work - * - fine tune axes - * - fix "analog" buttons - * - get rumble working + * - fine tune axes + * - fix "analog" buttons (reported as digital now) + * - get rumble working * * History: * - * 2002-06-27 - 0.0.1 - first version, just said "XBOX HID controller" + * 2002-06-27 - 0.0.1 : first version, just said "XBOX HID controller" * - * 2002-07-02 - 0.0.2 - basic working version - * all axes and 9 of the 10 buttons work (german InterAct device) - * the black button does not work + * 2002-07-02 - 0.0.2 : basic working version + * - all axes and 9 of the 10 buttons work (german InterAct device) + * - the black button does not work * + * 2002-07-14 - 0.0.3 : rework by Vojtech Pavlik + * - indentation fixes + * - usb + input init sequence fixes + * + * 2002-07-16 - 0.0.4 : minor changes, merge with Vojtech's v0.0.3 + * - verified the lack of HID and report descriptors + * - verified that ALL buttons WORK + * - fixed d-pad to axes mapping + * + * 2002-07-17 - 0.0.5 : simplified d-pad handling */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/input.h> -#include <linux/sched.h> -#include <linux/signal.h> -#include <linux/errno.h> -#include <linux/poll.h> #include <linux/init.h> #include <linux/slab.h> -#include <linux/fcntl.h> #include <linux/module.h> -#include <linux/spinlock.h> -#include <linux/list.h> #include <linux/smp_lock.h> #include <linux/devfs_fs_kernel.h> #include <linux/usb.h> -#define DRIVER_VERSION "v0.0.3" +#define DRIVER_VERSION "v0.0.5" #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" #define DRIVER_DESC "X-Box pad driver" @@ -75,29 +77,24 @@ static struct xpad_device { } xpad_device[] = { { 0x045e, 0x0202, "Microsoft X-Box pad (US)" }, { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)" }, - { 0x05fd, 0x107a, "InterAct X-Box pad (Germany)" }, + { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)" }, { 0x0000, 0x0000, "X-Box pad" } }; static signed short xpad_btn[] = { - BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* 6 "analog" buttons */ - BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back + stick press */ - -1 /* terminating entry */ + BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* "analog" buttons */ + BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */ + -1 /* terminating entry */ }; static signed short xpad_abs[] = { ABS_X, ABS_Y, /* left stick */ ABS_RX, ABS_RY, /* right stick */ ABS_Z, ABS_RZ, /* triggers left/right */ - ABS_HAT0X, ABS_HAT0Y, /* dpad */ - -1 /* terminating entry */ + ABS_HAT0X, ABS_HAT0Y, /* digital pad */ + -1 /* terminating entry */ }; -static struct { - __s32 x; - __s32 y; -} xpad_hat_to_axis[] = { {0, 0}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1} }; - static struct usb_device_id xpad_table [] = { { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ { } @@ -113,28 +110,17 @@ struct usb_xpad { unsigned char idata[XPAD_PKT_LEN]; /* input data */ char phys[65]; /* physical device path */ - int open_count; /* how many times has this been opened */ + int open_count; /* reference count */ }; /* - * xpad_process_packet - * - * Completes a request by converting the data into events for the input subsystem. - * - * The used report descriptor given below was taken from ITO Takayukis website: - * http://euc.jp/periphs/xbox-controller.ja.html + * xpad_process_packet * - * ---------------------------------------------------------------------------------------------------------------- - * | padding | byte-cnt | dpad sb12 | reserved | bt A | bt B | bt X | bt Y | bt black | bt white | - * | 01234567 | 01234567 | 0123 4567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | - * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | - * ---------------------------------------------------------------------------------------------------------------- + * Completes a request by converting the data into events for the + * input subsystem. * - * --------------------------------------------------------------------------------------------------------------- - * | trig L | trig R | left stick X | left stick Y | right stick X | right stick Y | - * | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | 01234567 | - * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | - * --------------------------------------------------------------------------------------------------------------- + * The used report descriptor was taken from ITO Takayukis website: + * http://euc.jp/periphs/xbox-controller.ja.html */ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) @@ -154,8 +140,8 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d input_report_abs(dev, ABS_RZ, data[11]); /* digital pad */ - input_report_abs(dev, ABS_HAT0X, xpad_hat_to_axis[data[2] & 0x0f].x); - input_report_abs(dev, ABS_HAT0Y, xpad_hat_to_axis[data[2] & 0x0f].y); + input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); + input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); /* start/back buttons and stick press left/right */ input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); @@ -224,7 +210,7 @@ static void * xpad_probe(struct usb_device *udev, unsigned int ifnum, const stru return NULL; } memset(xpad, 0, sizeof(struct usb_xpad)); - + xpad->irq_in = usb_alloc_urb(0, GFP_KERNEL); if (!xpad->irq_in) { err("cannot allocate memory for new pad irq urb"); @@ -234,52 +220,54 @@ static void * xpad_probe(struct usb_device *udev, unsigned int ifnum, const stru ep_irq_in = udev->actconfig->interface[ifnum].altsetting[0].endpoint + 0; - FILL_INT_URB(xpad->irq_in, udev, usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), - xpad->idata, XPAD_PKT_LEN, xpad_irq_in, xpad, ep_irq_in->bInterval); + FILL_INT_URB(xpad->irq_in, udev, + usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), + xpad->idata, XPAD_PKT_LEN, xpad_irq_in, xpad, + ep_irq_in->bInterval); xpad->udev = udev; - - xpad->dev.idbus = BUS_USB; - xpad->dev.idvendor = udev->descriptor.idVendor; - xpad->dev.idproduct = udev->descriptor.idProduct; - xpad->dev.idversion = udev->descriptor.bcdDevice; + + xpad->dev.id.bustype = BUS_USB; + xpad->dev.id.vendor = udev->descriptor.idVendor; + xpad->dev.id.product = udev->descriptor.idProduct; + xpad->dev.id.version = udev->descriptor.bcdDevice; xpad->dev.private = xpad; xpad->dev.name = xpad_device[i].name; xpad->dev.phys = xpad->phys; xpad->dev.open = xpad_open; xpad->dev.close = xpad_close; - + usb_make_path(udev, path, 64); snprintf(xpad->phys, 64, "%s/input0", path); xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - + for (i = 0; xpad_btn[i] >= 0; i++) - set_bit(xpad_btn[i], xpad->dev.keybit); + set_bit(xpad_btn[i], xpad->dev.keybit); for (i = 0; xpad_abs[i] >= 0; i++) { - + signed short t = xpad_abs[i]; - + set_bit(t, xpad->dev.absbit); switch (t) { case ABS_X: case ABS_Y: case ABS_RX: - case ABS_RY: + case ABS_RY: /* the two sticks */ xpad->dev.absmax[t] = 32767; xpad->dev.absmin[t] = -32768; xpad->dev.absflat[t] = 128; xpad->dev.absfuzz[t] = 16; break; case ABS_Z: - case ABS_RZ: + case ABS_RZ: /* the triggers */ xpad->dev.absmax[t] = 255; xpad->dev.absmin[t] = 0; break; case ABS_HAT0X: - case ABS_HAT0Y: + case ABS_HAT0Y: /* the d-pad */ xpad->dev.absmax[t] = 1; xpad->dev.absmin[t] = -1; break; @@ -304,10 +292,10 @@ static void xpad_disconnect(struct usb_device *udev, void *ptr) } static struct usb_driver xpad_driver = { - .name = "xpad", - .probe = xpad_probe, - .disconnect = xpad_disconnect, - .id_table = xpad_table, + .name = "xpad", + .probe = xpad_probe, + .disconnect = xpad_disconnect, + .id_table = xpad_table, }; static int __init usb_xpad_init(void) |
