GIT 666bab0e6c753634b0e81a5244867560844b541d git+ssh://master.kernel.org/pub/scm/linux/kernel/git/dtor/input.git commit Author: Stefan Lucke Date: Fri Feb 16 00:09:43 2007 -0500 Input: psmouse - add support for eGalax PS/2 touchscreen controller Based on the touchkit USB and lifebook PS/2 touchscreen driver. The egalax touchsreen controller (PS/2 or USB version) is used in this 7" device: http://www.cartft.com/catalog/il/449 Signed-off-by: Michal Piotrowski Signed-off-by: Andrew Morton Signed-off-by: Dmitry Torokhov commit f01cd13f6fcce8813a2711b3f11f075cb7a8008e Author: Valentin Zagura Date: Fri Feb 16 00:09:11 2007 -0500 Input: HID - add support for Logitech Formula Force EX Signed-off-by: Johann Deneux Signed-off-by: Dmitry Torokhov commit 8dabc98cd4dd5ca61b8daedb844265a3a863ee42 Author: Cyrill V. Gorcunov Date: Fri Feb 16 00:08:45 2007 -0500 Input: HIL - fix improper call to release_region() Do not call release_region() if the code has been compiled without CONFIG_HP300 support. Signed-off-by: Cyrill V. Gorcunov Acked-by: Helge Deller Signed-off-by: Dmitry Torokhov commit 6d7078c2847bd130879539a9c78588653f3dba9b Author: Dmitry Torokhov Date: Fri Feb 16 00:07:48 2007 -0500 Input: do not lock device when showing name, phys and uniq Now that sysfs attributes return -ENODEV once driver requests their removal we do not need to handle scenario when data is deleted from under our feet and can simplify the code. Signed-off-by: Dmitry Torokhov commit bee2c46d10af4185925e3a7fd887e5eb08ebac42 Author: Dmitry Torokhov Date: Fri Feb 16 00:07:16 2007 -0500 Input: i8042 - let serio bus suspend ports Let serio subsystem take care of suspending the ports; concentrate on suspending/resuming the controller itself. Also make sure that we suspending the controller only when we really going to suspend, not when we about to take memory snapshot. Signed-off-by: Dmitry Torokhov commit 40c68736f0164ef9ffe9ad6a4db8b7a49a1ea534 Author: Dmitry Torokhov Date: Fri Feb 16 00:05:00 2007 -0500 Input: psmouse - properly reset mouse on shutdown/suspend Some people report that they need psmouse module unloaded for suspend to ram/disk to work properly. Let's make port cleanup behave the same way as driver unload. This fixes "bad state" roblem on various HP laptops, such as nx7400. Signed-off-by: Dmitry Torokhov commit 57cb43e00b3e512169a99564b9d5e0ffc9962ce7 Author: Stephen Hemminger Date: Sat Feb 10 01:30:55 2007 -0500 Input: add apanel driver for Fujitsu Lifebook laptops This driver supports the applications buttons on the Fujitsu Lifebook laptops. These buttons are read via the SMBus; for more details see: http://apanel.sourceforge.net/tech.php The buttons are routed as normal special keys to the input system. It is based on the earlier apanel driver done by Jochen Eisinger, but with many changes. The original driver used ioctl's and a separate user space program, this version hooks into the input subsystem so that the normal Gnome/KDE shortcuts work without any userspace changes. Other Fujitsu laptops have similar keys and can be added later. Signed-off-by: Stephen Hemminger Acked-by: Jean Delvare Signed-off-by: Dmitry Torokhov drivers/input/input.c | 17 - drivers/input/keyboard/hilkbd.c | 2 drivers/input/misc/Kconfig | 13 + drivers/input/misc/Makefile | 1 drivers/input/misc/apanel.c | 456 ++++++++++++++++++++++++++++++++++++ drivers/input/mouse/Makefile | 3 drivers/input/mouse/psmouse-base.c | 53 ++++ drivers/input/mouse/psmouse.h | 2 drivers/input/mouse/synaptics.c | 1 drivers/input/mouse/touchkit_ps2.c | 102 ++++++++ drivers/input/mouse/touchkit_ps2.h | 17 + drivers/input/serio/i8042.c | 39 +-- drivers/input/serio/serio.c | 28 ++ drivers/usb/input/Kconfig | 6 drivers/usb/input/hid-ff.c | 3 drivers/usb/input/hid-lgff.c | 2 include/linux/serio.h | 6 17 files changed, 696 insertions(+), 55 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index efa1b1f..a9a706f 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -588,18 +588,9 @@ #define INPUT_DEV_STRING_ATTR_SHOW(name) static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ - int retval; \ \ - retval = mutex_lock_interruptible(&input_dev->mutex); \ - if (retval) \ - return retval; \ - \ - retval = scnprintf(buf, PAGE_SIZE, \ - "%s\n", input_dev->name ? input_dev->name : ""); \ - \ - mutex_unlock(&input_dev->mutex); \ - \ - return retval; \ + return scnprintf(buf, PAGE_SIZE, "%s\n", \ + input_dev->name ? input_dev->name : ""); \ } \ static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL); @@ -1049,10 +1040,6 @@ void input_unregister_device(struct inpu sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); - mutex_lock(&dev->mutex); - dev->name = dev->phys = dev->uniq = NULL; - mutex_unlock(&dev->mutex); - class_device_unregister(&dev->cdev); input_wakeup_procfs_readers(); diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 255a6ec..4de4dc2 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c @@ -294,8 +294,10 @@ err3: disable_irq(HIL_IRQ); free_irq(HIL_IRQ, hil_dev.dev_id); err2: +#if defined(CONFIG_HP300) release_region(HILBASE + HIL_DATA, 2); err1: +#endif input_free_device(hil_dev.dev); hil_dev.dev = NULL; return err; diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 41b4258..e69cb35 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -60,6 +60,19 @@ config INPUT_ATLAS_BTNS To compile this driver as a module, choose M here: the module will be called atlas_btns. +config INPUT_APANEL + tristate "Fujitsu Lifebook Application Panel buttons" + depends on X86 && !X86_64 + select I2C + select I2C_I801 + help + Say Y here for support of the Application Panel buttons, used on + Fujitsu Lifebook. These are attached to the mainboard through + an SMBus interface managed by the I2C Intel ICH (i801) driver. + + To compile this driver as a module, choose M here: the module will + be called apanel. + config INPUT_IXP4XX_BEEPER tristate "IXP4XX Beeper support" depends on ARCH_IXP4XX diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index e0a8d58..7d435ec 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -10,5 +10,6 @@ obj-$(CONFIG_INPUT_M68K_BEEP) += m68ksp obj-$(CONFIG_INPUT_UINPUT) += uinput.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o +obj-$(CONFIG_INPUT_APANEL) += apanel.o obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c new file mode 100644 index 0000000..84c33de --- /dev/null +++ b/drivers/input/misc/apanel.c @@ -0,0 +1,456 @@ +/* + * SMBus client for the Fujitsu Lifebook Application Panel + * + * Copyright (C) 2007 Stephen Hemminger + * Copyright (C) 2001-2003 Jochen Eisinger + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_AUTHOR("Stephen Hemminger "); +MODULE_DESCRIPTION("Fujitsu Lifebook Application Panel driver"); +MODULE_LICENSE("GPL"); +MODULE_VERSION("0.2"); + +static int force; +module_param(force, bool, 0); +MODULE_PARM_DESC(force, "Load even if computer is not in database"); + +struct keymap { + u32 mask; + u8 keycode; +}; + +static struct keymap app_media_keys[] = { + { 0x1, KEY_MAIL }, + { 0x2, KEY_WWW }, + { 0x4, KEY_PROG2 }, + { 0x8, KEY_PROG1 }, + { 0x100, KEY_FORWARD }, + { 0x200, KEY_REWIND }, + { 0x400, KEY_STOPCD }, + { 0x800, KEY_PLAYPAUSE }, + { 0 } +}; + +static struct keymap four_keys[] = { + { 0x1, KEY_PROG4 }, + { 0x2, KEY_PROG3 }, + { 0x4, KEY_PROG2 }, + { 0x8, KEY_PROG1 }, + { 0 } +}; + +static const struct keymap *keymap; + +static int __init dmi_matched(struct dmi_system_id *dmi) +{ + keymap = dmi->driver_data; + return 1; +} + +/* List of systems known to work */ +static struct dmi_system_id apanel_dmi_table[] __initdata = { + { + .callback = dmi_matched, + .ident = "Lifebook S", + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"), + }, + .driver_data = app_media_keys, + }, + { + .callback = dmi_matched, + .ident = "Lifebook B6210", + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "Lifebook B6210"), + }, + .driver_data = four_keys, + }, + { } +}; + +enum apanel_devid { + APANEL_DEV_NONE = 0, + APANEL_DEV_APPBTN= 1, + APANEL_DEV_CDBTN = 2, + APANEL_DEV_LCD = 3, + APANEL_DEV_LED = 4, + + APANEL_DEV_MAX, +}; + +enum apanel_chip { + CHIP_NONE = 0, + CHIP_OZ992C = 1, + CHIP_OZ163T = 2, + CHIP_OZ711M3= 4, +}; +static enum apanel_chip device_chip[APANEL_DEV_MAX]; + +static const char *device_names[APANEL_DEV_MAX] = { + [APANEL_DEV_APPBTN] = "Application Buttons", + [APANEL_DEV_LCD] = "LCD", + [APANEL_DEV_LED] = "LED", + [APANEL_DEV_CDBTN] = "CD Buttons", +}; + +struct apanel { + struct input_dev *input; + struct i2c_client client; + struct delayed_work poll_timer; + struct work_struct led_work; +}; + +#define POLL_FREQUENCY 10 /* Number of polls per second */ + +#if POLL_FREQUENCY > HZ +#error "POLL_FREQUENCY too high" +#endif + +/* definitions for i2c (smbus) interface */ +static int apanel_probe(struct i2c_adapter *, int, int); + +/* for now, we only support one address */ +static unsigned short normal_i2c[] = {0, I2C_CLIENT_END}; +static unsigned short ignore = I2C_CLIENT_END; +static struct i2c_client_address_data addr_data = { + .normal_i2c = normal_i2c, + .probe = &ignore, + .ignore = &ignore, +}; + +/* + * Poll for key changes every 100ms + * + * Read Application keys via SMI + * A (0x4), B (0x8), Internet (0x2), Email (0x1). + */ +static void report_key(struct input_dev *input,unsigned keycode) +{ + input_report_key(input, keycode, 1); + input_sync(input); + input_report_key(input, keycode, 0); + input_sync(input); +} + +static void apanel_poll(struct work_struct *work) +{ + struct apanel *ap = container_of(work, struct apanel, poll_timer.work); + u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; + const struct keymap *key; + s32 data; + static int read_errors; + + data = i2c_smbus_read_word_data(&ap->client, cmd); + if (data < 0) { + /* too many errors stop polling */ + if (++read_errors < 2 * HZ / POLL_FREQUENCY) + goto reschedule; + dev_err(&ap->client.dev, "SMBus read error\n"); + return; + } + read_errors = 0; + + i2c_smbus_write_word_data(&ap->client, cmd, 0); + if (data) + dev_dbg(&ap->client.dev, "poll data=%#x\n", data); + + for (key = keymap; key->mask; ++key) + if (data & key->mask) + report_key(ap->input, key->keycode); +reschedule: + schedule_delayed_work(&ap->poll_timer, POLL_FREQUENCY); +} + +/* + * Track state changes of LED + * There are actually four LED's (A, B, Internet, E-Mail), + * unsure about how to access others and what LED_xxx value would be useful. + */ +static void apanel_led(struct work_struct *work) +{ + struct apanel *ap = container_of(work, struct apanel, led_work); + + i2c_smbus_write_word_data(&ap->client, 0x10, + test_bit(LED_MAIL, ap->input->led) + ? 0x8000 : 0); +} + +/* + * Callback from input layer when state change happens. + * Used to handle LED control. + */ +static int apanel_event(struct input_dev *dev, unsigned int type, + unsigned int code, int value) +{ + struct apanel *ap = dev->private; + + pr_debug("apanel event type %d\n", type); + if (device_chip[APANEL_DEV_LED] == CHIP_NONE || type != EV_LED) + return -1; + + schedule_work(&ap->led_work); + + return 0; +} + +static int apanel_input_open(struct input_dev *dev) +{ + struct apanel *ap = dev->private; + + schedule_delayed_work(&ap->poll_timer, POLL_FREQUENCY); + + return 0; +} + +static void apanel_input_close(struct input_dev *dev) +{ + struct apanel *ap = dev->private; + + cancel_rearming_delayed_work(&ap->poll_timer); +} + +#ifdef CONFIG_PM +/* Stop polling */ +static int apanel_suspend(struct device *dev, pm_message_t state) +{ + struct apanel *ap = i2c_get_clientdata(to_i2c_client(dev)); + + cancel_rearming_delayed_work(&ap->poll_timer); + + return 0; +} + +/* If input device was opened, then resume polling */ +static int apanel_resume(struct device *dev) +{ + struct apanel *ap = i2c_get_clientdata(to_i2c_client(dev)); + struct input_dev *input = ap->input; + + mutex_lock(&input->mutex); + if (input->users) + schedule_delayed_work(&ap->poll_timer, POLL_FREQUENCY); + mutex_unlock(&input->mutex); + + return 0; +} +#else +#define apanel_suspend NULL +#define apanel_resume NULL +#endif + +static int apanel_detach_client(struct i2c_client *client) +{ + struct apanel *ap = i2c_get_clientdata(client); + + input_unregister_device(ap->input); + i2c_detach_client(&ap->client); + + return 0; +} + +/* Function is invoked for every i2c adapter. */ +static int apanel_attach_adapter(struct i2c_adapter *adap) +{ + /* Our device is connected only to i801 on laptop */ + if (adap->id != I2C_HW_SMBUS_I801) + return -ENODEV; + + return i2c_probe(adap, &addr_data, apanel_probe); +} + +static struct i2c_driver apanel_driver = { + .driver = { + .name = "apanel", + .suspend = apanel_suspend, + .resume = apanel_resume, + }, + .attach_adapter = &apanel_attach_adapter, + .detach_client = &apanel_detach_client, +}; + +/* + * basically this function should probe the i2c client, but we know that + * it has to be the one we're looking for - and I have no idea how I should + * probe for it, so we just register... + */ +static int apanel_probe(struct i2c_adapter *adap, int addr, int kind) +{ + struct apanel *ap; + const struct keymap *key; + struct input_dev *input; + u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; + int err = -ENOMEM; + static struct apanel apanel = { + .client = { + .name = "apanel", + .driver = &apanel_driver, + } + }; + + ap = &apanel; + dev_dbg(&ap->client.dev, "probe adapter %p addr %d kind %d\n", + adap, addr, kind); + + input = input_allocate_device(); + if (!input) + goto out1; + + ap->input = input; + ap->client.adapter = adap; + ap->client.addr = addr; + INIT_DELAYED_WORK(&ap->poll_timer, apanel_poll); + INIT_WORK(&ap->led_work, apanel_led); + i2c_set_clientdata(&ap->client, ap); + + i2c_smbus_write_word_data(&ap->client, cmd, 0); + + input->name = "Lifebook Panel buttons"; + input->phys = "apanel/input0"; + input->id.bustype = BUS_HOST; + input->cdev.dev = &ap->client.dev; + input->private = ap; + input->open = apanel_input_open; + input->close = apanel_input_close; + input->evbit[LONG(EV_KEY)] = BIT(EV_KEY); + + for (key = keymap; key->mask; ++key) + set_bit(key->keycode, input->keybit); + + if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { + input->event = apanel_event; + input->evbit[0] |= BIT(EV_LED); + set_bit(LED_MAIL, input->ledbit); + } + + err = i2c_attach_client(&ap->client); + if (err) + goto out2; + + err = input_register_device(input); + if (err) + goto out3; + + return 0; +out3: + i2c_detach_client(&ap->client); +out2: + input_free_device(input); +out1: + return err; +} + +/* Scan the system ROM for the signature "FJKEYINF" */ +static __init void __iomem *bios_signature(void) +{ + void __iomem *bios; + ssize_t offset; + const unsigned char signature[] = "FJKEYINF"; + + bios = ioremap(0xF0000, 0x10000); /* Can't fail */ + + for (offset = 0; offset < 0x10000; offset += 0x10) { + if (check_signature(bios + offset, signature, + sizeof(signature)-1)) + return bios + offset; + } + + printk(KERN_ERR "apanel: Fujitsu BIOS signature '%s' not found...\n", + signature); + iounmap(bios); + return NULL; +} + +static int __init apanel_init(void) +{ + void __iomem *bios; + u8 devno; + int found = 0; + + if (!dmi_check_system(apanel_dmi_table)) { + printk(KERN_WARNING "apanel: DMI information does not match\n"); + if (!force) + return -ENODEV; + } + BUG_ON(!keymap); + + bios = bios_signature(); + if (!bios) + return -ENODEV; + + bios += 8; + + /* just use the first address */ + normal_i2c[0] = readb(bios+3) >> 1; + + for ( ; (devno = readb(bios)) & 0x7f; bios += 4) { + unsigned char method, slave, chip; + + method = readb(bios + 1); + chip = readb(bios + 2); + slave = readb(bios + 3) >> 1; + + if (slave != normal_i2c[0]) { + printk(KERN_ERR "apanel: only one SMBus slave " + "address supported, skiping device...\n"); + continue; + } + + /* translate alternative device numbers */ + switch (devno) { + case 6: + devno = APANEL_DEV_APPBTN; + break; + case 7: + devno = APANEL_DEV_LED; + break; + } + + if (devno >= APANEL_DEV_MAX) + printk(KERN_WARNING "apanel: unknown device %d found\n", + devno); + else if (device_chip[devno] != CHIP_NONE) + printk(KERN_ERR "apanel: duplicate entry for %s\n", + device_names[devno]); + + else if (method != 1 && method != 2 && method != 4) { + printk(KERN_ERR "apanel: unknown method %u for %s\n", + method, device_names[devno]); + } else { + pr_debug("apanel: %s found, chip=%d\n", + device_names[devno], chip); + + device_chip[devno] = (enum apanel_chip) chip; + ++found; + } + } + + iounmap(bios); + + if (!found) { + printk(KERN_ERR "apanel: no input devices reported by BIOS\n"); + return -EIO; + } + + return i2c_add_driver(&apanel_driver); +} +module_init(apanel_init); + +static void __exit apanel_cleanup(void) +{ + i2c_del_driver(&apanel_driver); +} +module_exit(apanel_cleanup); diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 21a1de6..6751179 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile @@ -14,4 +14,5 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o -psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o +psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o \ + trackpoint.o touchkit_ps2.o diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index a0e4a03..827a0f9 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -28,6 +28,7 @@ #include "logips2pp.h" #include "alps.h" #include "lifebook.h" #include "trackpoint.h" +#include "touchkit_ps2.h" #define DRIVER_DESC "PS/2 mouse driver" @@ -611,14 +612,20 @@ static int psmouse_extensions(struct psm } } - if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse, set_properties) == 0) - return PSMOUSE_GENPS; + if (max_proto > PSMOUSE_IMEX) { + + if (genius_detect(psmouse, set_properties) == 0) + return PSMOUSE_GENPS; - if (max_proto > PSMOUSE_IMEX && ps2pp_init(psmouse, set_properties) == 0) - return PSMOUSE_PS2PP; + if (ps2pp_init(psmouse, set_properties) == 0) + return PSMOUSE_PS2PP; - if (max_proto > PSMOUSE_IMEX && trackpoint_detect(psmouse, set_properties) == 0) - return PSMOUSE_TRACKPOINT; + if (trackpoint_detect(psmouse, set_properties) == 0) + return PSMOUSE_TRACKPOINT; + + if (touchkit_ps2_detect(psmouse, set_properties) == 0) + return PSMOUSE_TOUCHKIT_PS2; + } /* * Reset to defaults in case the device got confused by extended @@ -719,6 +726,12 @@ static const struct psmouse_protocol psm .detect = trackpoint_detect, }, { + .type = PSMOUSE_TOUCHKIT_PS2, + .name = "touchkitPS/2", + .alias = "touchkit", + .detect = touchkit_ps2_detect, + }, + { .type = PSMOUSE_AUTO, .name = "auto", .alias = "any", @@ -987,8 +1000,36 @@ static void psmouse_resync(struct work_s static void psmouse_cleanup(struct serio *serio) { struct psmouse *psmouse = serio_get_drvdata(serio); + struct psmouse *parent = NULL; + + mutex_lock(&psmouse_mutex); + + if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { + parent = serio_get_drvdata(serio->parent); + psmouse_deactivate(parent); + } + + psmouse_deactivate(psmouse); + + if (psmouse->cleanup) + psmouse->cleanup(psmouse); psmouse_reset(psmouse); + +/* + * Some boxes, such as HP nx7400, get terribly confused if mouse + * is not fully enabled before suspending/shutting down. + */ + ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE); + + if (parent) { + if (parent->pt_deactivate) + parent->pt_deactivate(parent); + + psmouse_activate(parent); + } + + mutex_unlock(&psmouse_mutex); } /* diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 1b74cae..3964e8a 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -68,6 +68,7 @@ struct psmouse { int (*reconnect)(struct psmouse *psmouse); void (*disconnect)(struct psmouse *psmouse); + void (*cleanup)(struct psmouse *psmouse); int (*poll)(struct psmouse *psmouse); void (*pt_activate)(struct psmouse *psmouse); @@ -86,6 +87,7 @@ enum psmouse_type { PSMOUSE_ALPS, PSMOUSE_LIFEBOOK, PSMOUSE_TRACKPOINT, + PSMOUSE_TOUCHKIT_PS2, PSMOUSE_AUTO /* This one should always be last */ }; diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 49ac696..f0f9413 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -652,6 +652,7 @@ int synaptics_init(struct psmouse *psmou psmouse->set_rate = synaptics_set_rate; psmouse->disconnect = synaptics_disconnect; psmouse->reconnect = synaptics_reconnect; + psmouse->cleanup = synaptics_reset; psmouse->pktsize = 6; /* Synaptics can usually stay in sync without extra help */ psmouse->resync_time = 0; diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c new file mode 100644 index 0000000..9f02600 --- /dev/null +++ b/drivers/input/mouse/touchkit_ps2.c @@ -0,0 +1,102 @@ +/* ---------------------------------------------------------------------------- + * touchkit_ps2.c -- Driver for eGalax TouchKit PS/2 Touchscreens + * + * Copyright (C) 2005 by Stefan Lucke + * Copyright (C) 2004 by Daniel Ritz + * Copyright (C) by Todd E. Johnson (mtouchusb.c) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based upon touchkitusb.c + * + * Vendor documentation is available in support section of: + * http://www.egalax.com.tw/ + */ + +#include +#include + +#include +#include +#include + +#include "psmouse.h" +#include "touchkit_ps2.h" + +#define TOUCHKIT_MAX_XC 0x07ff +#define TOUCHKIT_MAX_YC 0x07ff + +#define TOUCHKIT_CMD 0x0a +#define TOUCHKIT_CMD_LENGTH 1 + +#define TOUCHKIT_CMD_ACTIVE 'A' +#define TOUCHKIT_CMD_FIRMWARE_VERSION 'D' +#define TOUCHKIT_CMD_CONTROLLER_TYPE 'E' + +#define TOUCHKIT_SEND_PARMS(s, r, c) ((s) << 12 | (r) << 8 | (c)) + +#define TOUCHKIT_GET_TOUCHED(packet) (((packet)[0]) & 0x01) +#define TOUCHKIT_GET_X(packet) (((packet)[1] << 7) | (packet)[2]) +#define TOUCHKIT_GET_Y(packet) (((packet)[3] << 7) | (packet)[4]) + +static psmouse_ret_t touchkit_ps2_process_byte(struct psmouse *psmouse) +{ + unsigned char *packet = psmouse->packet; + struct input_dev *dev = psmouse->dev; + + if (psmouse->pktcnt != 5) + return PSMOUSE_GOOD_DATA; + + input_report_abs(dev, ABS_X, TOUCHKIT_GET_X(packet)); + input_report_abs(dev, ABS_Y, TOUCHKIT_GET_Y(packet)); + input_report_key(dev, BTN_TOUCH, TOUCHKIT_GET_TOUCHED(packet)); + input_report_key(dev, BTN_TOOL_FINGER, 1); + input_sync(dev); + + return PSMOUSE_FULL_PACKET; +} + +int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties) +{ + struct input_dev *dev = psmouse->dev; + unsigned char param[3]; + int command; + + param[0] = TOUCHKIT_CMD_LENGTH; + param[1] = TOUCHKIT_CMD_ACTIVE; + command = TOUCHKIT_SEND_PARMS(2, 3, TOUCHKIT_CMD); + + if (ps2_command(&psmouse->ps2dev, param, command)) + return -ENODEV; + + if (param[0] != TOUCHKIT_CMD || param[1] != 0x01 || + param[2] != TOUCHKIT_CMD_ACTIVE) + return -ENODEV; + + if (set_properties) { + dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + set_bit(BTN_TOUCH, dev->keybit); + set_bit(BTN_TOOL_FINGER, dev->keybit); + input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); + input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); + + psmouse->vendor = "eGalax"; + psmouse->name = "Touchscreen"; + psmouse->protocol_handler = touchkit_ps2_process_byte; + psmouse->pktsize = 5; + } + + return 0; +} diff --git a/drivers/input/mouse/touchkit_ps2.h b/drivers/input/mouse/touchkit_ps2.h new file mode 100644 index 0000000..3f03fbc --- /dev/null +++ b/drivers/input/mouse/touchkit_ps2.h @@ -0,0 +1,17 @@ +/* ---------------------------------------------------------------------------- + * touchkit_ps2.h -- Driver for eGalax TouchKit PS/2 Touchscreens + * + * Copyright (C) 2005 by Stefan Lucke + * Copyright (c) 2005 Vojtech Pavlik + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#ifndef _TOUCHKIT_PS2_H +#define _TOUCHKIT_PS2_H + +int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties); + +#endif diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index c3fdfc1..0c316d9 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -791,27 +791,6 @@ static void i8042_controller_reset(void) /* - * Here we try to reset everything back to a state in which the BIOS will be - * able to talk to the hardware when rebooting. - */ - -static void i8042_controller_cleanup(void) -{ - int i; - -/* - * Reset anything that is connected to the ports. - */ - - for (i = 0; i < I8042_NUM_PORTS; i++) - if (i8042_ports[i].serio) - serio_cleanup(i8042_ports[i].serio); - - i8042_controller_reset(); -} - - -/* * i8042_panic_blink() will flash the keyboard LEDs and is called when * kernel panics. Flashing LEDs is useful for users running X who may * not see the console and will help distingushing panics from "real" @@ -858,12 +837,15 @@ static long i8042_panic_blink(long count #undef DELAY /* - * Here we try to restore the original BIOS settings + * Here we try to restore the original BIOS settings. We only want to + * do that once, when we really suspend, not when we need to take a + * snapshot. */ static int i8042_suspend(struct platform_device *dev, pm_message_t state) { - i8042_controller_cleanup(); + if (state.event == PM_EVENT_SUSPEND) + i8042_controller_reset(); return 0; } @@ -877,6 +859,12 @@ static int i8042_resume(struct platform_ { int error; +/* + * Do not bother with restoring state if we haven't really suspened yet + */ + if (dev->dev.power.power_state.event != PM_EVENT_SUSPEND) + return 0; + error = i8042_controller_check(); if (error) return error; @@ -889,6 +877,9 @@ static int i8042_resume(struct platform_ * Restore pre-resume CTR value and disable all ports */ + i8042_ctr = i8042_initial_ctr; + if (i8042_direct) + i8042_ctr &= ~I8042_CTR_XLATE; i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS; i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT); if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { @@ -919,7 +910,7 @@ static int i8042_resume(struct platform_ static void i8042_shutdown(struct platform_device *dev) { - i8042_controller_cleanup(); + i8042_controller_reset(); } static int __devinit i8042_create_kbd_port(void) diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 17c8c63..48bd489 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -778,6 +778,19 @@ static int serio_driver_remove(struct de return 0; } +static void serio_cleanup(struct serio *serio) +{ + if (serio->drv && serio->drv->cleanup) + serio->drv->cleanup(serio); +} + +static void serio_shutdown(struct device *dev) +{ + struct serio *serio = to_serio_port(dev); + + serio_cleanup(serio); +} + static void serio_attach_driver(struct serio_driver *drv) { int error; @@ -910,11 +923,22 @@ static int serio_uevent(struct device *d #endif /* CONFIG_HOTPLUG */ +static int serio_suspend(struct device *dev, pm_message_t state) +{ + struct serio *serio = to_serio_port(dev); + + if (state.event == PM_EVENT_SUSPEND) + serio_cleanup(serio); + + return 0; +} + static int serio_resume(struct device *dev) { struct serio *serio = to_serio_port(dev); - if (serio_reconnect_driver(serio)) { + if (dev->power.power_state.event == PM_EVENT_SUSPEND && + serio_reconnect_driver(serio)) { /* * Driver re-probing can take a while, so better let kseriod * deal with it. @@ -974,6 +998,8 @@ static struct bus_type serio_bus = { .uevent = serio_uevent, .probe = serio_driver_probe, .remove = serio_driver_remove, + .shutdown = serio_shutdown, + .suspend = serio_suspend, .resume = serio_resume, }; diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 2e71d3c..69a9f3b 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig @@ -58,13 +58,17 @@ config HID_PID devices. config LOGITECH_FF - bool "Logitech WingMan *3D support" + bool "Logitech devices support" depends on HID_FF select INPUT_FF_MEMLESS if USB_HID help Say Y here if you have one of these devices: - Logitech WingMan Cordless RumblePad + - Logitech WingMan Cordless RumblePad 2 - Logitech WingMan Force 3D + - Logitech Formula Force EX + - Logitech MOMO Force wheel + and if you want to enable force feedback for them. Note: if you say N here, this device will still be supported, but without force feedback. diff --git a/drivers/usb/input/hid-ff.c b/drivers/usb/input/hid-ff.c index bc7f8e6..e431faa 100644 --- a/drivers/usb/input/hid-ff.c +++ b/drivers/usb/input/hid-ff.c @@ -54,9 +54,10 @@ struct hid_ff_initializer { static struct hid_ff_initializer inits[] = { #ifdef CONFIG_LOGITECH_FF { 0x46d, 0xc211, hid_lgff_init }, /* Logitech Cordless rumble pad */ + { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */ { 0x46d, 0xc283, hid_lgff_init }, /* Logitech Wingman Force 3d */ + { 0x46d, 0xc294, hid_lgff_init }, /* Logitech Formula Force EX */ { 0x46d, 0xc295, hid_lgff_init }, /* Logitech MOMO force wheel */ - { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */ { 0x46d, 0xca03, hid_lgff_init }, /* Logitech MOMO force wheel */ #endif #ifdef CONFIG_PANTHERLORD_FF diff --git a/drivers/usb/input/hid-lgff.c b/drivers/usb/input/hid-lgff.c index 4df0968..d1a4dff 100644 --- a/drivers/usb/input/hid-lgff.c +++ b/drivers/usb/input/hid-lgff.c @@ -52,6 +52,8 @@ static const struct dev_type devices[] = { 0x046d, 0xc211, ff_rumble }, { 0x046d, 0xc219, ff_rumble }, { 0x046d, 0xc283, ff_joystick }, + { 0x046d, 0xc294, ff_joystick }, + { 0x046d, 0xc295, ff_joystick }, { 0x046d, 0xca03, ff_joystick }, { 0x0000, 0x0000, ff_joystick } }; diff --git a/include/linux/serio.h b/include/linux/serio.h index ac2c70e..1ebf045 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h @@ -108,12 +108,6 @@ static inline void serio_drv_write_wakeu serio->drv->write_wakeup(serio); } -static inline void serio_cleanup(struct serio *serio) -{ - if (serio->drv && serio->drv->cleanup) - serio->drv->cleanup(serio); -} - /* * Use the following functions to manipulate serio's per-port * driver-specific data.