diff options
Diffstat (limited to 'drivers/input/mouse/synaptics.c')
-rw-r--r-- | drivers/input/mouse/synaptics.c | 99 |
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 | */ |
50 | static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) | 51 | static 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 | ||
63 | int 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 | |||
87 | void 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 | */ |
62 | static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) | 102 | static 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 | ||
532 | void synaptics_reset(struct psmouse *psmouse) | ||
533 | { | ||
534 | /* reset touchpad back to relative mode, gestures enabled */ | ||
535 | synaptics_mode_cmd(psmouse, 0); | ||
536 | } | ||
537 | |||
538 | static void synaptics_disconnect(struct psmouse *psmouse) | 569 | static 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 | ||
572 | int 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> |
598 | static struct dmi_system_id toshiba_dmi_table[] = { | 605 | static 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 | |||
692 | int synaptics_init(struct psmouse *psmouse) | ||
693 | { | ||
694 | return -ENOSYS; | ||
695 | } | ||
696 | |||
697 | #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ | ||
683 | 698 | ||