aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-10-05 00:46:10 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-10-13 10:49:27 -0400
commita8b3c0f57beaba9035e5339175628b63e551b243 (patch)
tree5ceea4d6288f16f4de22f89ffedd89e6da8d6173 /drivers/input
parent4780c8df3856398020be2928d9e9fa8c457a09a4 (diff)
Input: synaptics - simplify pass-through port handling
There was too much knowledge about internals if serio in the pass-through handling, clean it up. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/synaptics.c36
-rw-r--r--drivers/input/mouse/synaptics.h2
2 files changed, 32 insertions, 6 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index a79bc362dde5..2e300a460556 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -294,7 +294,29 @@ static int synaptics_pt_write(struct serio *serio, unsigned char c)
294 return 0; 294 return 0;
295} 295}
296 296
297static inline int synaptics_is_pt_packet(unsigned char *buf) 297static int synaptics_pt_start(struct serio *serio)
298{
299 struct psmouse *parent = serio_get_drvdata(serio->parent);
300 struct synaptics_data *priv = parent->private;
301
302 serio_pause_rx(parent->ps2dev.serio);
303 priv->pt_port = serio;
304 serio_continue_rx(parent->ps2dev.serio);
305
306 return 0;
307}
308
309static void synaptics_pt_stop(struct serio *serio)
310{
311 struct psmouse *parent = serio_get_drvdata(serio->parent);
312 struct synaptics_data *priv = parent->private;
313
314 serio_pause_rx(parent->ps2dev.serio);
315 priv->pt_port = NULL;
316 serio_continue_rx(parent->ps2dev.serio);
317}
318
319static int synaptics_is_pt_packet(unsigned char *buf)
298{ 320{
299 return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; 321 return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4;
300} 322}
@@ -315,9 +337,8 @@ static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet
315 337
316static void synaptics_pt_activate(struct psmouse *psmouse) 338static void synaptics_pt_activate(struct psmouse *psmouse)
317{ 339{
318 struct serio *ptport = psmouse->ps2dev.serio->child;
319 struct psmouse *child = serio_get_drvdata(ptport);
320 struct synaptics_data *priv = psmouse->private; 340 struct synaptics_data *priv = psmouse->private;
341 struct psmouse *child = serio_get_drvdata(priv->pt_port);
321 342
322 /* adjust the touchpad to child's choice of protocol */ 343 /* adjust the touchpad to child's choice of protocol */
323 if (child) { 344 if (child) {
@@ -345,6 +366,8 @@ static void synaptics_pt_create(struct psmouse *psmouse)
345 strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); 366 strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name));
346 strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); 367 strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name));
347 serio->write = synaptics_pt_write; 368 serio->write = synaptics_pt_write;
369 serio->start = synaptics_pt_start;
370 serio->stop = synaptics_pt_stop;
348 serio->parent = psmouse->ps2dev.serio; 371 serio->parent = psmouse->ps2dev.serio;
349 372
350 psmouse->pt_activate = synaptics_pt_activate; 373 psmouse->pt_activate = synaptics_pt_activate;
@@ -578,9 +601,10 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse)
578 if (unlikely(priv->pkt_type == SYN_NEWABS)) 601 if (unlikely(priv->pkt_type == SYN_NEWABS))
579 priv->pkt_type = synaptics_detect_pkt_type(psmouse); 602 priv->pkt_type = synaptics_detect_pkt_type(psmouse);
580 603
581 if (SYN_CAP_PASS_THROUGH(priv->capabilities) && synaptics_is_pt_packet(psmouse->packet)) { 604 if (SYN_CAP_PASS_THROUGH(priv->capabilities) &&
582 if (psmouse->ps2dev.serio->child) 605 synaptics_is_pt_packet(psmouse->packet)) {
583 synaptics_pass_pt_packet(psmouse->ps2dev.serio->child, psmouse->packet); 606 if (priv->pt_port)
607 synaptics_pass_pt_packet(priv->pt_port, psmouse->packet);
584 } else 608 } else
585 synaptics_process_packet(psmouse); 609 synaptics_process_packet(psmouse);
586 610
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index b6aa7d20d8a3..613a3652f98f 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -110,6 +110,8 @@ struct synaptics_data {
110 unsigned char pkt_type; /* packet type - old, new, etc */ 110 unsigned char pkt_type; /* packet type - old, new, etc */
111 unsigned char mode; /* current mode byte */ 111 unsigned char mode; /* current mode byte */
112 int scroll; 112 int scroll;
113
114 struct serio *pt_port; /* Pass-through serio port */
113}; 115};
114 116
115void synaptics_module_init(void); 117void synaptics_module_init(void);