diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-09-13 21:16:56 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-09-13 21:16:56 -0700 |
commit | fc8e1ead9314cf0e0f1922e661428b93d3a50d88 (patch) | |
tree | f3cb97c4769b74f6627a59769f1ed5c92a13c58a /drivers/input/mouse/psmouse-base.c | |
parent | 2bcaa6a4238094c5695d5b1943078388d82d3004 (diff) | |
parent | 9de48cc300fb10f7d9faa978670becf5e352462a (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 113 |
1 files changed, 71 insertions, 42 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index b407b355dce..690aed90543 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -30,6 +30,7 @@ #include "trackpoint.h" #include "touchkit_ps2.h" #include "elantech.h" +#include "sentelic.h" #define DRIVER_DESC "PS/2 mouse driver" @@ -108,10 +109,10 @@ static struct workqueue_struct *kpsmoused_wq; struct psmouse_protocol { enum psmouse_type type; + bool maxproto; const char *name; const char *alias; - int maxproto; - int (*detect)(struct psmouse *, int); + int (*detect)(struct psmouse *, bool); int (*init)(struct psmouse *); }; @@ -216,7 +217,7 @@ void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work, static inline void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) { psmouse->state = new_state; - psmouse->pktcnt = psmouse->out_of_sync = 0; + psmouse->pktcnt = psmouse->out_of_sync_cnt = 0; psmouse->ps2dev.flags = 0; psmouse->last = jiffies; } @@ -249,7 +250,7 @@ static int psmouse_handle_byte(struct psmouse *psmouse) if (psmouse->state == PSMOUSE_ACTIVATED) { printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n", psmouse->name, psmouse->phys, psmouse->pktcnt); - if (++psmouse->out_of_sync == psmouse->resetafter) { + if (++psmouse->out_of_sync_cnt == psmouse->resetafter) { __psmouse_set_state(psmouse, PSMOUSE_IGNORE); printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n"); serio_reconnect(psmouse->ps2dev.serio); @@ -261,8 +262,8 @@ static int psmouse_handle_byte(struct psmouse *psmouse) case PSMOUSE_FULL_PACKET: psmouse->pktcnt = 0; - if (psmouse->out_of_sync) { - psmouse->out_of_sync = 0; + if (psmouse->out_of_sync_cnt) { + psmouse->out_of_sync_cnt = 0; printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n", psmouse->name, psmouse->phys); } @@ -408,7 +409,7 @@ int psmouse_reset(struct psmouse *psmouse) /* * Genius NetMouse magic init. */ -static int genius_detect(struct psmouse *psmouse, int set_properties) +static int genius_detect(struct psmouse *psmouse, bool set_properties) { struct ps2dev *ps2dev = &psmouse->ps2dev; unsigned char param[4]; @@ -424,9 +425,9 @@ static int genius_detect(struct psmouse *psmouse, int set_properties) return -1; if (set_properties) { - set_bit(BTN_EXTRA, psmouse->dev->keybit); - set_bit(BTN_SIDE, psmouse->dev->keybit); - set_bit(REL_WHEEL, psmouse->dev->relbit); + __set_bit(BTN_EXTRA, psmouse->dev->keybit); + __set_bit(BTN_SIDE, psmouse->dev->keybit); + __set_bit(REL_WHEEL, psmouse->dev->relbit); psmouse->vendor = "Genius"; psmouse->name = "Mouse"; @@ -439,7 +440,7 @@ static int genius_detect(struct psmouse *psmouse, int set_properties) /* * IntelliMouse magic init. */ -static int intellimouse_detect(struct psmouse *psmouse, int set_properties) +static int intellimouse_detect(struct psmouse *psmouse, bool set_properties) { struct ps2dev *ps2dev = &psmouse->ps2dev; unsigned char param[2]; @@ -456,8 +457,8 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties) return -1; if (set_properties) { - set_bit(BTN_MIDDLE, psmouse->dev->keybit); - set_bit(REL_WHEEL, psmouse->dev->relbit); + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); + __set_bit(REL_WHEEL, psmouse->dev->relbit); if (!psmouse->vendor) psmouse->vendor = "Generic"; if (!psmouse->name) psmouse->name = "Wheel Mouse"; @@ -470,7 +471,7 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties) /* * Try IntelliMouse/Explorer magic init. */ -static int im_explorer_detect(struct psmouse *psmouse, int set_properties) +static int im_explorer_detect(struct psmouse *psmouse, bool set_properties) { struct ps2dev *ps2dev = &psmouse->ps2dev; unsigned char param[2]; @@ -497,11 +498,11 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties) ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); if (set_properties) { - set_bit(BTN_MIDDLE, psmouse->dev->keybit); - set_bit(REL_WHEEL, psmouse->dev->relbit); - set_bit(REL_HWHEEL, psmouse->dev->relbit); - set_bit(BTN_SIDE, psmouse->dev->keybit); - set_bit(BTN_EXTRA, psmouse->dev->keybit); + __set_bit(BTN_MIDDLE, psmouse->dev->keybit); + __set_bit(REL_WHEEL, psmouse->dev->relbit); + __set_bit(REL_HWHEEL, psmouse->dev->relbit); + __set_bit(BTN_SIDE, psmouse->dev->keybit); + __set_bit(BTN_EXTRA, psmouse->dev->keybit); if (!psmouse->vendor) psmouse->vendor = "Generic"; if (!psmouse->name) psmouse->name = "Explorer Mouse"; @@ -514,7 +515,7 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties) /* * Kensington ThinkingMouse / ExpertMouse magic init. */ -static int thinking_detect(struct psmouse *psmouse, int set_properties) +static int thinking_detect(struct psmouse *psmouse, bool set_properties) { struct ps2dev *ps2dev = &psmouse->ps2dev; unsigned char param[2]; @@ -535,7 +536,7 @@ static int thinking_detect(struct psmouse *psmouse, int set_properties) return -1; if (set_properties) { - set_bit(BTN_EXTRA, psmouse->dev->keybit); + __set_bit(BTN_EXTRA, psmouse->dev->keybit); psmouse->vendor = "Kensington"; psmouse->name = "ThinkingMouse"; @@ -547,7 +548,7 @@ static int thinking_detect(struct psmouse *psmouse, int set_properties) /* * Bare PS/2 protocol "detection". Always succeeds. */ -static int ps2bare_detect(struct psmouse *psmouse, int set_properties) +static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) { if (set_properties) { if (!psmouse->vendor) psmouse->vendor = "Generic"; @@ -561,12 +562,12 @@ static int ps2bare_detect(struct psmouse *psmouse, int set_properties) * Cortron PS/2 protocol detection. There's no special way to detect it, so it * must be forced by sysfs protocol writing. */ -static int cortron_detect(struct psmouse *psmouse, int set_properties) +static int cortron_detect(struct psmouse *psmouse, bool set_properties) { if (set_properties) { psmouse->vendor = "Cortron"; psmouse->name = "PS/2 Trackball"; - set_bit(BTN_SIDE, psmouse->dev->keybit); + __set_bit(BTN_SIDE, psmouse->dev->keybit); } return 0; @@ -578,9 +579,9 @@ static int cortron_detect(struct psmouse *psmouse, int set_properties) */ static int psmouse_extensions(struct psmouse *psmouse, - unsigned int max_proto, int set_properties) + unsigned int max_proto, bool set_properties) { - int synaptics_hardware = 0; + bool synaptics_hardware = true; /* * We always check for lifebook because it does not disturb mouse @@ -607,7 +608,7 @@ static int psmouse_extensions(struct psmouse *psmouse, * can reset it properly after probing for intellimouse. */ if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { - synaptics_hardware = 1; + synaptics_hardware = true; if (max_proto > PSMOUSE_IMEX) { if (!set_properties || synaptics_init(psmouse) == 0) @@ -666,6 +667,20 @@ static int psmouse_extensions(struct psmouse *psmouse, max_proto = PSMOUSE_IMEX; } +/* + * Try Finger Sensing Pad + */ + if (max_proto > PSMOUSE_IMEX) { + if (fsp_detect(psmouse, set_properties) == 0) { + if (!set_properties || fsp_init(psmouse) == 0) + return PSMOUSE_FSP; +/* + * Init failed, try basic relative protocols + */ + max_proto = PSMOUSE_IMEX; + } + } + if (max_proto > PSMOUSE_IMEX) { if (genius_detect(psmouse, set_properties) == 0) return PSMOUSE_GENPS; @@ -718,7 +733,7 @@ static const struct psmouse_protocol psmouse_protocols[] = { .type = PSMOUSE_PS2, .name = "PS/2", .alias = "bare", - .maxproto = 1, + .maxproto = true, .detect = ps2bare_detect, }, #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP @@ -745,14 +760,14 @@ static const struct psmouse_protocol psmouse_protocols[] = { .type = PSMOUSE_IMPS, .name = "ImPS/2", .alias = "imps", - .maxproto = 1, + .maxproto = true, .detect = intellimouse_detect, }, { .type = PSMOUSE_IMEX, .name = "ImExPS/2", .alias = "exps", - .maxproto = 1, + .maxproto = true, .detect = im_explorer_detect, }, #ifdef CONFIG_MOUSE_PS2_SYNAPTICS @@ -813,7 +828,16 @@ static const struct psmouse_protocol psmouse_protocols[] = { .detect = elantech_detect, .init = elantech_init, }, - #endif +#endif +#ifdef CONFIG_MOUSE_PS2_SENTELIC + { + .type = PSMOUSE_FSP, + .name = "FSPPS/2", + .alias = "fsp", + .detect = fsp_detect, + .init = fsp_init, + }, +#endif { .type = PSMOUSE_CORTRON, .name = "CortronPS/2", @@ -824,7 +848,7 @@ static const struct psmouse_protocol psmouse_protocols[] = { .type = PSMOUSE_AUTO, .name = "auto", .alias = "any", - .maxproto = 1, + .maxproto = true, }, }; @@ -990,7 +1014,7 @@ static void psmouse_resync(struct work_struct *work) container_of(work, struct psmouse, resync_work.work); struct serio *serio = psmouse->ps2dev.serio; psmouse_ret_t rc = PSMOUSE_GOOD_DATA; - int failed = 0, enabled = 0; + bool failed = false, enabled = false; int i; mutex_lock(&psmouse_mutex); @@ -1017,9 +1041,9 @@ static void psmouse_resync(struct work_struct *work) if (ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_DISABLE, 20)) { if (psmouse->num_resyncs < 3 || psmouse->acks_disable_command) - failed = 1; + failed = true; } else - psmouse->acks_disable_command = 1; + psmouse->acks_disable_command = true; /* * Poll the mouse. If it was reset the packet will be shorter than @@ -1030,7 +1054,7 @@ static void psmouse_resync(struct work_struct *work) */ if (!failed) { if (psmouse->poll(psmouse)) - failed = 1; + failed = true; else { psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); for (i = 0; i < psmouse->pktsize; i++) { @@ -1040,7 +1064,7 @@ static void psmouse_resync(struct work_struct *work) break; } if (rc != PSMOUSE_FULL_PACKET) - failed = 1; + failed = true; psmouse_set_state(psmouse, PSMOUSE_RESYNCING); } } @@ -1051,7 +1075,7 @@ static void psmouse_resync(struct work_struct *work) */ for (i = 0; i < 5; i++) { if (!ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { - enabled = 1; + enabled = true; break; } msleep(200); @@ -1060,7 +1084,7 @@ static void psmouse_resync(struct work_struct *work) if (!enabled) { printk(KERN_WARNING "psmouse.c: failed to re-enable mouse on %s\n", psmouse->ps2dev.serio->phys); - failed = 1; + failed = true; } if (failed) { @@ -1187,7 +1211,8 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse psmouse->type = proto->type; } else - psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1); + psmouse->type = psmouse_extensions(psmouse, + psmouse_max_proto, true); /* * If mouse's packet size is 3 there is no point in polling the @@ -1342,8 +1367,10 @@ static int psmouse_reconnect(struct serio *serio) if (psmouse->reconnect(psmouse)) goto out; } else if (psmouse_probe(psmouse) < 0 || - psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0)) + psmouse->type != psmouse_extensions(psmouse, + psmouse_max_proto, false)) { goto out; + } /* ok, the device type (and capabilities) match the old one, * we can continue using it, complete intialization @@ -1528,7 +1555,9 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co while (serio->child) { if (++retry > 3) { - printk(KERN_WARNING "psmouse: failed to destroy child port, protocol change aborted.\n"); + printk(KERN_WARNING + "psmouse: failed to destroy child port, " + "protocol change aborted.\n"); input_free_device(new_dev); return -EIO; } |