aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/synaptics.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@debian.org>2007-03-10 01:39:54 -0500
committerDmitry Torokhov <dtor@insightbb.com>2007-03-10 01:39:54 -0500
commit55e3d9224b60df0fd2dc36bff9b538ce40fd9586 (patch)
tree7a8df6e8996bc1c4e73705750df3b0854e998897 /drivers/input/mouse/synaptics.c
parentcb9def4dff9fe7e3d3114eba4e2d89f52265e22c (diff)
Input: psmouse - allow disabing certain protocol extensions
Allow ALPS, LOGIPS2PP, LIFEBOOK, TRACKPOINT and TOUCHKIT protocol extensions of psmouse to be disabled during compilation. This will allow users save some memory when they are sure that they will only use a certain type of mice. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/synaptics.c')
-rw-r--r--drivers/input/mouse/synaptics.c99
1 files changed, 57 insertions, 42 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f0f9413d762c..e42a0a4345ac 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -40,33 +40,70 @@
40#define YMIN_NOMINAL 1408 40#define YMIN_NOMINAL 1408
41#define YMAX_NOMINAL 4448 41#define YMAX_NOMINAL 4448
42 42
43
43/***************************************************************************** 44/*****************************************************************************
44 * Synaptics communications functions 45 * Stuff we need even when we do not want native Synaptics support
45 ****************************************************************************/ 46 ****************************************************************************/
46 47
47/* 48/*
48 * Send a command to the synpatics touchpad by special commands 49 * Set the synaptics touchpad mode byte by special commands
49 */ 50 */
50static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) 51static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
51{ 52{
52 if (psmouse_sliced_command(psmouse, c)) 53 unsigned char param[1];
54
55 if (psmouse_sliced_command(psmouse, mode))
53 return -1; 56 return -1;
54 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) 57 param[0] = SYN_PS_SET_MODE2;
58 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE))
55 return -1; 59 return -1;
56 return 0; 60 return 0;
57} 61}
58 62
63int synaptics_detect(struct psmouse *psmouse, int set_properties)
64{
65 struct ps2dev *ps2dev = &psmouse->ps2dev;
66 unsigned char param[4];
67
68 param[0] = 0;
69
70 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
71 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
72 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
73 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
74 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
75
76 if (param[1] != 0x47)
77 return -ENODEV;
78
79 if (set_properties) {
80 psmouse->vendor = "Synaptics";
81 psmouse->name = "TouchPad";
82 }
83
84 return 0;
85}
86
87void synaptics_reset(struct psmouse *psmouse)
88{
89 /* reset touchpad back to relative mode, gestures enabled */
90 synaptics_mode_cmd(psmouse, 0);
91}
92
93#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
94
95/*****************************************************************************
96 * Synaptics communications functions
97 ****************************************************************************/
98
59/* 99/*
60 * Set the synaptics touchpad mode byte by special commands 100 * Send a command to the synpatics touchpad by special commands
61 */ 101 */
62static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) 102static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param)
63{ 103{
64 unsigned char param[1]; 104 if (psmouse_sliced_command(psmouse, c))
65
66 if (psmouse_sliced_command(psmouse, mode))
67 return -1; 105 return -1;
68 param[0] = SYN_PS_SET_MODE2; 106 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO))
69 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE))
70 return -1; 107 return -1;
71 return 0; 108 return 0;
72} 109}
@@ -529,12 +566,6 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
529 clear_bit(REL_Y, dev->relbit); 566 clear_bit(REL_Y, dev->relbit);
530} 567}
531 568
532void synaptics_reset(struct psmouse *psmouse)
533{
534 /* reset touchpad back to relative mode, gestures enabled */
535 synaptics_mode_cmd(psmouse, 0);
536}
537
538static void synaptics_disconnect(struct psmouse *psmouse) 569static void synaptics_disconnect(struct psmouse *psmouse)
539{ 570{
540 synaptics_reset(psmouse); 571 synaptics_reset(psmouse);
@@ -569,30 +600,6 @@ static int synaptics_reconnect(struct psmouse *psmouse)
569 return 0; 600 return 0;
570} 601}
571 602
572int synaptics_detect(struct psmouse *psmouse, int set_properties)
573{
574 struct ps2dev *ps2dev = &psmouse->ps2dev;
575 unsigned char param[4];
576
577 param[0] = 0;
578
579 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
580 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
581 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
582 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
583 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
584
585 if (param[1] != 0x47)
586 return -1;
587
588 if (set_properties) {
589 psmouse->vendor = "Synaptics";
590 psmouse->name = "TouchPad";
591 }
592
593 return 0;
594}
595
596#if defined(__i386__) 603#if defined(__i386__)
597#include <linux/dmi.h> 604#include <linux/dmi.h>
598static struct dmi_system_id toshiba_dmi_table[] = { 605static struct dmi_system_id toshiba_dmi_table[] = {
@@ -680,4 +687,12 @@ int synaptics_init(struct psmouse *psmouse)
680 return -1; 687 return -1;
681} 688}
682 689
690#else /* CONFIG_MOUSE_PS2_SYNAPTICS */
691
692int synaptics_init(struct psmouse *psmouse)
693{
694 return -ENOSYS;
695}
696
697#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
683 698