diff options
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/ambakmi.c | 15 | ||||
-rw-r--r-- | drivers/input/serio/ct82c710.c | 89 | ||||
-rw-r--r-- | drivers/input/serio/i8042-x86ia64io.h | 22 | ||||
-rw-r--r-- | drivers/input/serio/i8042.c | 116 | ||||
-rw-r--r-- | drivers/input/serio/maceps2.c | 68 | ||||
-rw-r--r-- | drivers/input/serio/q40kbd.c | 89 | ||||
-rw-r--r-- | drivers/input/serio/sa1111ps2.c | 1 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 12 | ||||
-rw-r--r-- | drivers/input/serio/serport.c | 13 |
9 files changed, 273 insertions, 152 deletions
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index 9b1ab5e7a98d..3df5eedf8f31 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c @@ -19,12 +19,12 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/err.h> +#include <linux/amba/bus.h> +#include <linux/amba/kmi.h> +#include <linux/clk.h> #include <asm/io.h> #include <asm/irq.h> -#include <asm/hardware/amba.h> -#include <asm/hardware/amba_kmi.h> -#include <asm/hardware/clock.h> #define KMI_BASE (kmi->base) @@ -72,13 +72,9 @@ static int amba_kmi_open(struct serio *io) unsigned int divisor; int ret; - ret = clk_use(kmi->clk); - if (ret) - goto out; - ret = clk_enable(kmi->clk); if (ret) - goto clk_unuse; + goto out; divisor = clk_get_rate(kmi->clk) / 8000000 - 1; writeb(divisor, KMICLKDIV); @@ -97,8 +93,6 @@ static int amba_kmi_open(struct serio *io) clk_disable: clk_disable(kmi->clk); - clk_unuse: - clk_unuse(kmi->clk); out: return ret; } @@ -111,7 +105,6 @@ static void amba_kmi_close(struct serio *io) free_irq(kmi->irq, kmi); clk_disable(kmi->clk); - clk_unuse(kmi->clk); } static int amba_kmi_probe(struct amba_device *dev, void *id) diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 4da6c86b5d76..096b6a0b5cca 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c @@ -154,7 +154,7 @@ static int ct82c710_write(struct serio *port, unsigned char c) * See if we can find a 82C710 device. Read mouse address. */ -static int __init ct82c710_probe(void) +static int __init ct82c710_detect(void) { outb_p(0x55, 0x2fa); /* Any value except 9, ff or 36 */ outb_p(0xaa, 0x3fa); /* Inverse of 55 */ @@ -163,7 +163,7 @@ static int __init ct82c710_probe(void) outb_p(0x1b, 0x2fa); /* Inverse of e4 */ outb_p(0x0f, 0x390); /* Write index */ if (inb_p(0x391) != 0xe4) /* Config address found? */ - return -1; /* No: no 82C710 here */ + return -ENODEV; /* No: no 82C710 here */ outb_p(0x0d, 0x390); /* Write index */ ct82c710_iores.start = inb_p(0x391) << 2; /* Get mouse I/O address */ @@ -175,51 +175,88 @@ static int __init ct82c710_probe(void) return 0; } -static struct serio * __init ct82c710_allocate_port(void) +static int __devinit ct82c710_probe(struct platform_device *dev) { - struct serio *serio; - - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); - if (serio) { - memset(serio, 0, sizeof(struct serio)); - serio->id.type = SERIO_8042; - serio->open = ct82c710_open; - serio->close = ct82c710_close; - serio->write = ct82c710_write; - serio->dev.parent = &ct82c710_device->dev; - strlcpy(serio->name, "C&T 82c710 mouse port", sizeof(serio->name)); - snprintf(serio->phys, sizeof(serio->phys), "isa%04lx/serio0", CT82C710_DATA); - } + ct82c710_port = kzalloc(sizeof(struct serio), GFP_KERNEL); + if (!ct82c710_port) + return -ENOMEM; + + ct82c710_port->id.type = SERIO_8042; + ct82c710_port->dev.parent = &dev->dev; + ct82c710_port->open = ct82c710_open; + ct82c710_port->close = ct82c710_close; + ct82c710_port->write = ct82c710_write; + strlcpy(ct82c710_port->name, "C&T 82c710 mouse port", + sizeof(ct82c710_port->name)); + snprintf(ct82c710_port->phys, sizeof(ct82c710_port->phys), + "isa%04lx/serio0", CT82C710_DATA); + + serio_register_port(ct82c710_port); + + return 0; +} + +static int __devexit ct82c710_remove(struct platform_device *dev) +{ + serio_unregister_port(ct82c710_port); - return serio; + return 0; } +static struct platform_driver ct82c710_driver = { + .driver = { + .name = "ct82c710", + .owner = THIS_MODULE, + }, + .probe = ct82c710_probe, + .remove = __devexit_p(ct82c710_remove), +}; + + static int __init ct82c710_init(void) { - if (ct82c710_probe()) - return -ENODEV; + int error; - ct82c710_device = platform_device_register_simple("ct82c710", -1, &ct82c710_iores, 1); - if (IS_ERR(ct82c710_device)) - return PTR_ERR(ct82c710_device); + error = ct82c710_detect(); + if (error) + return error; - if (!(ct82c710_port = ct82c710_allocate_port())) { - platform_device_unregister(ct82c710_device); - return -ENOMEM; + error = platform_driver_register(&ct82c710_driver); + if (error) + return error; + + ct82c710_device = platform_device_alloc("ct82c710", -1); + if (!ct82c710_device) { + error = -ENOMEM; + goto err_unregister_driver; } + error = platform_device_add_resources(ct82c710_device, &ct82c710_iores, 1); + if (error) + goto err_free_device; + + error = platform_device_add(ct82c710_device); + if (error) + goto err_free_device; + serio_register_port(ct82c710_port); printk(KERN_INFO "serio: C&T 82c710 mouse port at %#lx irq %d\n", CT82C710_DATA, CT82C710_IRQ); return 0; + + err_free_device: + platform_device_put(ct82c710_device); + err_unregister_driver: + platform_driver_unregister(&ct82c710_driver); + return error; } static void __exit ct82c710_exit(void) { - serio_unregister_port(ct82c710_port); platform_device_unregister(ct82c710_device); + platform_driver_unregister(&ct82c710_driver); } module_init(ct82c710_init); diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 273bb3b08cfa..a4c6f3522723 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -84,6 +84,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"), }, }, + { + .ident = "OQO Model 01", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "OQO"), + DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "00"), + }, + }, { } }; @@ -158,6 +166,20 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), }, }, + { + .ident = "Sharp Actius MM20", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SHARP"), + DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"), + }, + }, + { + .ident = "Sony Vaio FS-115b", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"), + }, + }, { } }; diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index ac86c1d1d83e..a7d91d5356a5 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -572,7 +572,7 @@ static int i8042_enable_mux_ports(void) * LCS/Telegraphics. */ -static int __init i8042_check_mux(void) +static int __devinit i8042_check_mux(void) { unsigned char mux_version; @@ -600,7 +600,7 @@ static int __init i8042_check_mux(void) * the presence of an AUX interface. */ -static int __init i8042_check_aux(void) +static int __devinit i8042_check_aux(void) { unsigned char param; static int i8042_check_aux_cookie; @@ -678,7 +678,7 @@ static int __init i8042_check_aux(void) * registers it, and reports to the user. */ -static int __init i8042_port_register(struct i8042_port *port) +static int __devinit i8042_port_register(struct i8042_port *port) { i8042_ctr &= ~port->disable; @@ -956,7 +956,6 @@ static int i8042_resume(struct platform_device *dev) panic_blink = i8042_panic_blink; return 0; - } /* @@ -969,16 +968,7 @@ static void i8042_shutdown(struct platform_device *dev) i8042_controller_cleanup(); } -static struct platform_driver i8042_driver = { - .suspend = i8042_suspend, - .resume = i8042_resume, - .shutdown = i8042_shutdown, - .driver = { - .name = "i8042", - }, -}; - -static int __init i8042_create_kbd_port(void) +static int __devinit i8042_create_kbd_port(void) { struct serio *serio; struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; @@ -1003,7 +993,7 @@ static int __init i8042_create_kbd_port(void) return i8042_port_register(port); } -static int __init i8042_create_aux_port(void) +static int __devinit i8042_create_aux_port(void) { struct serio *serio; struct i8042_port *port = &i8042_ports[I8042_AUX_PORT_NO]; @@ -1028,7 +1018,7 @@ static int __init i8042_create_aux_port(void) return i8042_port_register(port); } -static int __init i8042_create_mux_port(int index) +static int __devinit i8042_create_mux_port(int index) { struct serio *serio; struct i8042_port *port = &i8042_ports[I8042_MUX_PORT_NO + index]; @@ -1057,37 +1047,16 @@ static int __init i8042_create_mux_port(int index) return i8042_port_register(port); } -static int __init i8042_init(void) +static int __devinit i8042_probe(struct platform_device *dev) { int i, have_ports = 0; int err; - dbg_init(); - init_timer(&i8042_timer); i8042_timer.function = i8042_timer_func; - err = i8042_platform_init(); - if (err) - return err; - - i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ; - i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ; - - if (i8042_controller_init()) { - err = -ENODEV; - goto err_platform_exit; - } - - err = platform_driver_register(&i8042_driver); - if (err) - goto err_controller_cleanup; - - i8042_platform_device = platform_device_register_simple("i8042", -1, NULL, 0); - if (IS_ERR(i8042_platform_device)) { - err = PTR_ERR(i8042_platform_device); - goto err_unregister_driver; - } + if (i8042_controller_init()) + return -ENODEV; if (!i8042_noaux && !i8042_check_aux()) { if (!i8042_nomux && !i8042_check_mux()) { @@ -1113,30 +1082,23 @@ static int __init i8042_init(void) if (!have_ports) { err = -ENODEV; - goto err_unregister_device; + goto err_controller_cleanup; } mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); - return 0; err_unregister_ports: for (i = 0; i < I8042_NUM_PORTS; i++) if (i8042_ports[i].serio) serio_unregister_port(i8042_ports[i].serio); - err_unregister_device: - platform_device_unregister(i8042_platform_device); - err_unregister_driver: - platform_driver_unregister(&i8042_driver); err_controller_cleanup: i8042_controller_cleanup(); - err_platform_exit: - i8042_platform_exit(); return err; } -static void __exit i8042_exit(void) +static int __devexit i8042_remove(struct platform_device *dev) { int i; @@ -1148,6 +1110,62 @@ static void __exit i8042_exit(void) del_timer_sync(&i8042_timer); + return 0; +} + +static struct platform_driver i8042_driver = { + .driver = { + .name = "i8042", + .owner = THIS_MODULE, + }, + .probe = i8042_probe, + .remove = __devexit_p(i8042_remove), + .suspend = i8042_suspend, + .resume = i8042_resume, + .shutdown = i8042_shutdown, +}; + +static int __init i8042_init(void) +{ + int err; + + dbg_init(); + + err = i8042_platform_init(); + if (err) + return err; + + i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ; + i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ; + + err = platform_driver_register(&i8042_driver); + if (err) + goto err_platform_exit; + + i8042_platform_device = platform_device_alloc("i8042", -1); + if (!i8042_platform_device) { + err = -ENOMEM; + goto err_unregister_driver; + } + + err = platform_device_add(i8042_platform_device); + if (err) + goto err_free_device; + + return 0; + + err_free_device: + platform_device_put(i8042_platform_device); + err_unregister_driver: + platform_driver_unregister(&i8042_driver); + err_platform_exit: + i8042_platform_exit(); + + return err; +} + +static void __exit i8042_exit(void) +{ platform_device_unregister(i8042_platform_device); platform_driver_unregister(&i8042_driver); diff --git a/drivers/input/serio/maceps2.c b/drivers/input/serio/maceps2.c index d857f7081adb..f08a5d0cd5fa 100644 --- a/drivers/input/serio/maceps2.c +++ b/drivers/input/serio/maceps2.c @@ -118,13 +118,12 @@ static void maceps2_close(struct serio *dev) } -static struct serio * __init maceps2_allocate_port(int idx) +static struct serio * __devinit maceps2_allocate_port(int idx) { struct serio *serio; - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); if (serio) { - memset(serio, 0, sizeof(struct serio)); serio->id.type = SERIO_8042; serio->write = maceps2_write; serio->open = maceps2_open; @@ -138,24 +137,13 @@ static struct serio * __init maceps2_allocate_port(int idx) return serio; } - -static int __init maceps2_init(void) +static int __devinit maceps2_probe(struct platform_device *dev) { - maceps2_device = platform_device_register_simple("maceps2", -1, NULL, 0); - if (IS_ERR(maceps2_device)) - return PTR_ERR(maceps2_device); - - port_data[0].port = &mace->perif.ps2.keyb; - port_data[0].irq = MACEISA_KEYB_IRQ; - port_data[1].port = &mace->perif.ps2.mouse; - port_data[1].irq = MACEISA_MOUSE_IRQ; - maceps2_port[0] = maceps2_allocate_port(0); maceps2_port[1] = maceps2_allocate_port(1); if (!maceps2_port[0] || !maceps2_port[1]) { kfree(maceps2_port[0]); kfree(maceps2_port[1]); - platform_device_unregister(maceps2_device); return -ENOMEM; } @@ -165,11 +153,59 @@ static int __init maceps2_init(void) return 0; } -static void __exit maceps2_exit(void) +static int __devexit maceps2_remove(struct platform_device *dev) { serio_unregister_port(maceps2_port[0]); serio_unregister_port(maceps2_port[1]); + + return 0; +} + +static struct platform_driver maceps2_driver = { + .driver = { + .name = "maceps2", + .owner = THIS_MODULE, + }, + .probe = maceps2_probe, + .remove = __devexit_p(maceps2_remove), +}; + +static int __init maceps2_init(void) +{ + int error; + + error = platform_driver_register(&maceps2_driver); + if (error) + return error; + + maceps2_device = platform_device_alloc("maceps2", -1); + if (!maceps2_device) { + error = -ENOMEM; + goto err_unregister_driver; + } + + port_data[0].port = &mace->perif.ps2.keyb; + port_data[0].irq = MACEISA_KEYB_IRQ; + port_data[1].port = &mace->perif.ps2.mouse; + port_data[1].irq = MACEISA_MOUSE_IRQ; + + error = platform_device_add(maceps2_device); + if (error) + goto err_free_device; + + return 0; + + err_free_device: + platform_device_put(maceps2_device); + err_unregister_driver: + platform_driver_unregister(&maceps2_driver); + return error; +} + +static void __exit maceps2_exit(void) +{ platform_device_unregister(maceps2_device); + platform_driver_unregister(&maceps2_driver); } module_init(maceps2_init); diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c index b44d255596c2..d3827c5fe119 100644 --- a/drivers/input/serio/q40kbd.c +++ b/drivers/input/serio/q40kbd.c @@ -75,13 +75,13 @@ static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) static void q40kbd_flush(void) { - int maxread = 100; + int maxread = 100; unsigned long flags; spin_lock_irqsave(&q40kbd_lock, flags); - while (maxread-- && (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))) - master_inb(KEYCODE_REG); + while (maxread-- && (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))) + master_inb(KEYCODE_REG); spin_unlock_irqrestore(&q40kbd_lock, flags); } @@ -97,14 +97,14 @@ static int q40kbd_open(struct serio *port) if (request_irq(Q40_IRQ_KEYBOARD, q40kbd_interrupt, 0, "q40kbd", NULL)) { printk(KERN_ERR "q40kbd.c: Can't get irq %d.\n", Q40_IRQ_KEYBOARD); - return -1; + return -EBUSY; } - /* off we go */ - master_outb(-1, KEYBOARD_UNLOCK_REG); - master_outb(1, KEY_IRQ_ENABLE_REG); + /* off we go */ + master_outb(-1, KEYBOARD_UNLOCK_REG); + master_outb(1, KEY_IRQ_ENABLE_REG); - return 0; + return 0; } static void q40kbd_close(struct serio *port) @@ -116,48 +116,73 @@ static void q40kbd_close(struct serio *port) q40kbd_flush(); } -static struct serio * __init q40kbd_allocate_port(void) +static int __devinit q40kbd_probe(struct platform_device *dev) { - struct serio *serio; - - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); - if (serio) { - memset(serio, 0, sizeof(struct serio)); - serio->id.type = SERIO_8042; - serio->open = q40kbd_open; - serio->close = q40kbd_close; - serio->dev.parent = &q40kbd_device->dev; - strlcpy(serio->name, "Q40 Kbd Port", sizeof(serio->name)); - strlcpy(serio->phys, "Q40", sizeof(serio->phys)); - } + q40kbd_port = kzalloc(sizeof(struct serio), GFP_KERNEL); + if (!q40kbd_port) + return -ENOMEM; + + q40kbd_port->id.type = SERIO_8042; + q40kbd_port->open = q40kbd_open; + q40kbd_port->close = q40kbd_close; + q40kbd_port->dev.parent = &dev->dev; + strlcpy(q40kbd_port->name, "Q40 Kbd Port", sizeof(q40kbd_port->name)); + strlcpy(q40kbd_port->phys, "Q40", sizeof(q40kbd_port->phys)); + + serio_register_port(q40kbd_port); + printk(KERN_INFO "serio: Q40 kbd registered\n"); - return serio; + return 0; } +static int __devexit q40kbd_remove(struct platform_device *dev) +{ + serio_unregister_port(q40kbd_port); + + return 0; +} + +static struct platform_driver q40kbd_driver = { + .driver = { + .name = "q40kbd", + .owner = THIS_MODULE, + }, + .probe = q40kbd_probe, + .remove = __devexit_p(q40kbd_remove), +}; + static int __init q40kbd_init(void) { + int error; + if (!MACH_IS_Q40) return -EIO; - q40kbd_device = platform_device_register_simple("q40kbd", -1, NULL, 0); - if (IS_ERR(q40kbd_device)) - return PTR_ERR(q40kbd_device); + error = platform_driver_register(&q40kbd_driver); + if (error) + return error; - if (!(q40kbd_port = q40kbd_allocate_port())) { - platform_device_unregister(q40kbd_device); - return -ENOMEM; - } + q40kbd_device = platform_device_alloc("q40kbd", -1); + if (!q40kbd_device) + goto err_unregister_driver; - serio_register_port(q40kbd_port); - printk(KERN_INFO "serio: Q40 kbd registered\n"); + error = platform_device_add(q40kbd_device); + if (error) + goto err_free_device; return 0; + + err_free_device: + platform_device_put(q40kbd_device); + err_unregister_driver: + platform_driver_unregister(&q40kbd_driver); + return error; } static void __exit q40kbd_exit(void) { - serio_unregister_port(q40kbd_port); platform_device_unregister(q40kbd_device); + platform_driver_unregister(&q40kbd_driver); } module_init(q40kbd_init); diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index 3f0df3330fb2..ebd9976fc811 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c @@ -20,7 +20,6 @@ #include <linux/spinlock.h> #include <asm/io.h> -#include <asm/irq.h> #include <asm/system.h> #include <asm/hardware/sa1111.h> diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8e530cc970e1..2f76813c3a64 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -59,9 +59,7 @@ static DECLARE_MUTEX(serio_sem); static LIST_HEAD(serio_list); -static struct bus_type serio_bus = { - .name = "serio", -}; +static struct bus_type serio_bus; static void serio_add_port(struct serio *serio); static void serio_destroy_port(struct serio *serio); @@ -750,11 +748,15 @@ static int serio_driver_remove(struct device *dev) return 0; } +static struct bus_type serio_bus = { + .name = "serio", + .probe = serio_driver_probe, + .remove = serio_driver_remove, +}; + void __serio_register_driver(struct serio_driver *drv, struct module *owner) { drv->driver.bus = &serio_bus; - drv->driver.probe = serio_driver_probe; - drv->driver.remove = serio_driver_remove; serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); } diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 1bd88fca0542..54a680cc704d 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c @@ -96,6 +96,7 @@ static int serport_ldisc_open(struct tty_struct *tty) init_waitqueue_head(&serport->wait); tty->disc_data = serport; + tty->receive_room = 256; set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); return 0; @@ -140,17 +141,6 @@ out: } /* - * serport_ldisc_room() reports how much room we do have for receiving data. - * Although we in fact have infinite room, we need to specify some value - * here, and 256 seems to be reasonable. - */ - -static int serport_ldisc_room(struct tty_struct *tty) -{ - return 256; -} - -/* * serport_ldisc_read() just waits indefinitely if everything goes well. * However, when the serio driver closes the serio port, it finishes, * returning 0 characters. @@ -237,7 +227,6 @@ static struct tty_ldisc serport_ldisc = { .read = serport_ldisc_read, .ioctl = serport_ldisc_ioctl, .receive_buf = serport_ldisc_receive, - .receive_room = serport_ldisc_room, .write_wakeup = serport_ldisc_write_wakeup }; |