Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andres Salomon and committed by
Dmitry Torokhov
55e3d922 cb9def4d

+197 -61
+60 -1
drivers/input/mouse/Kconfig
··· 37 37 To compile this driver as a module, choose M here: the 38 38 module will be called psmouse. 39 39 40 + config MOUSE_PS2_ALPS 41 + bool "ALPS PS/2 mouse protocol extension" if EMBEDDED 42 + default y 43 + depends on MOUSE_PS2 44 + ---help--- 45 + Say Y here if you have an ALPS PS/2 touchpad connected to 46 + your system. 47 + 48 + If unsure, say Y. 49 + 50 + config MOUSE_PS2_LOGIPS2PP 51 + bool "Logictech PS/2++ mouse protocol extension" if EMBEDDED 52 + default y 53 + depends on MOUSE_PS2 54 + ---help--- 55 + Say Y here if you have a Logictech PS/2++ mouse connected to 56 + your system. 57 + 58 + If unsure, say Y. 59 + 60 + config MOUSE_PS2_SYNAPTICS 61 + bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED 62 + default y 63 + depends on MOUSE_PS2 64 + ---help--- 65 + Say Y here if you have a Synaptics PS/2 TouchPad connected to 66 + your system. 67 + 68 + If unsure, say Y. 69 + 70 + config MOUSE_PS2_LIFEBOOK 71 + bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED 72 + default y 73 + depends on MOUSE_PS2 74 + ---help--- 75 + Say Y here if you have a Fujitsu B-series Lifebook PS/2 76 + TouchScreen connected to your system. 77 + 78 + If unsure, say Y. 79 + 80 + config MOUSE_PS2_TRACKPOINT 81 + bool "IBM Trackpoint PS/2 mouse protocol extension" if EMBEDDED 82 + default y 83 + depends on MOUSE_PS2 84 + ---help--- 85 + Say Y here if you have an IBM Trackpoint PS/2 mouse connected 86 + to your system. 87 + 88 + If unsure, say Y. 89 + 90 + config MOUSE_PS2_TOUCHKIT 91 + bool "eGalax TouchKit PS/2 protocol extension" 92 + depends on MOUSE_PS2 93 + ---help--- 94 + Say Y here if you have an eGalax TouchKit PS/2 touchscreen 95 + connected to your system. 96 + 97 + If unsure, say N. 98 + 40 99 config MOUSE_SERIAL 41 100 tristate "Serial mouse" 42 101 select SERIO ··· 177 118 digitizer (VSXXX-AB) DEC produced. 178 119 179 120 config MOUSE_HIL 180 - tristate "HIL pointers (mice etc)." 121 + tristate "HIL pointers (mice etc)." 181 122 depends on GSC || HP300 182 123 select HP_SDC 183 124 select HIL_MLC
+7 -2
drivers/input/mouse/Makefile
··· 14 14 obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o 15 15 obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o 16 16 17 - psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o \ 18 - trackpoint.o touchkit_ps2.o 17 + psmouse-objs := psmouse-base.o synaptics.o 18 + 19 + psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o 20 + psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o 21 + psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o 22 + psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o 23 + psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o
+14 -3
drivers/input/mouse/alps.h
··· 12 12 #ifndef _ALPS_H 13 13 #define _ALPS_H 14 14 15 - int alps_detect(struct psmouse *psmouse, int set_properties); 16 - int alps_init(struct psmouse *psmouse); 17 - 18 15 struct alps_model_info { 19 16 unsigned char signature[3]; 20 17 unsigned char byte0, mask0; ··· 25 28 const struct alps_model_info *i;/* Info */ 26 29 int prev_fin; /* Finger bit from previous packet */ 27 30 }; 31 + 32 + #ifdef CONFIG_MOUSE_PS2_ALPS 33 + int alps_detect(struct psmouse *psmouse, int set_properties); 34 + int alps_init(struct psmouse *psmouse); 35 + #else 36 + inline int alps_detect(struct psmouse *psmouse, int set_properties) 37 + { 38 + return -ENOSYS; 39 + } 40 + inline int alps_init(struct psmouse *psmouse) 41 + { 42 + return -ENOSYS; 43 + } 44 + #endif /* CONFIG_MOUSE_PS2_ALPS */ 28 45 29 46 #endif
+11
drivers/input/mouse/lifebook.h
··· 11 11 #ifndef _LIFEBOOK_H 12 12 #define _LIFEBOOK_H 13 13 14 + #ifdef CONFIG_MOUSE_PS2_LIFEBOOK 14 15 int lifebook_detect(struct psmouse *psmouse, int set_properties); 15 16 int lifebook_init(struct psmouse *psmouse); 17 + #else 18 + inline int lifebook_detect(struct psmouse *psmouse, int set_properties) 19 + { 20 + return -ENOSYS; 21 + } 22 + inline int lifebook_init(struct psmouse *psmouse) 23 + { 24 + return -ENOSYS; 25 + } 26 + #endif 16 27 17 28 #endif
+7
drivers/input/mouse/logips2pp.h
··· 11 11 #ifndef _LOGIPS2PP_H 12 12 #define _LOGIPS2PP_H 13 13 14 + #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP 14 15 int ps2pp_init(struct psmouse *psmouse, int set_properties); 16 + #else 17 + inline int ps2pp_init(struct psmouse *psmouse, int set_properties) 18 + { 19 + return -ENOSYS; 20 + } 21 + #endif /* CONFIG_MOUSE_PS2_LOGIPS2PP */ 15 22 16 23 #endif
+15 -1
drivers/input/mouse/psmouse-base.c
··· 570 570 return PSMOUSE_THINKPS; 571 571 572 572 /* 573 - * Try Synaptics TouchPad 573 + * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol 574 + * support is disabled in config - we need to know if it is synaptics so we 575 + * can reset it properly after probing for intellimouse. 574 576 */ 575 577 if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { 576 578 synaptics_hardware = 1; ··· 663 661 .maxproto = 1, 664 662 .detect = ps2bare_detect, 665 663 }, 664 + #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP 666 665 { 667 666 .type = PSMOUSE_PS2PP, 668 667 .name = "PS2++", 669 668 .alias = "logitech", 670 669 .detect = ps2pp_init, 671 670 }, 671 + #endif 672 672 { 673 673 .type = PSMOUSE_THINKPS, 674 674 .name = "ThinkPS/2", ··· 697 693 .maxproto = 1, 698 694 .detect = im_explorer_detect, 699 695 }, 696 + #ifdef CONFIG_MOUSE_PS2_SYNAPTICS 700 697 { 701 698 .type = PSMOUSE_SYNAPTICS, 702 699 .name = "SynPS/2", ··· 705 700 .detect = synaptics_detect, 706 701 .init = synaptics_init, 707 702 }, 703 + #endif 704 + #ifdef CONFIG_MOUSE_PS2_ALPS 708 705 { 709 706 .type = PSMOUSE_ALPS, 710 707 .name = "AlpsPS/2", ··· 714 707 .detect = alps_detect, 715 708 .init = alps_init, 716 709 }, 710 + #endif 711 + #ifdef CONFIG_MOUSE_PS2_LIFEBOOK 717 712 { 718 713 .type = PSMOUSE_LIFEBOOK, 719 714 .name = "LBPS/2", 720 715 .alias = "lifebook", 721 716 .init = lifebook_init, 722 717 }, 718 + #endif 719 + #ifdef CONFIG_MOUSE_PS2_TRACKPOINT 723 720 { 724 721 .type = PSMOUSE_TRACKPOINT, 725 722 .name = "TPPS/2", 726 723 .alias = "trackpoint", 727 724 .detect = trackpoint_detect, 728 725 }, 726 + #endif 727 + #ifdef CONFIG_MOUSE_PS2_TOUCHKIT 729 728 { 730 729 .type = PSMOUSE_TOUCHKIT_PS2, 731 730 .name = "touchkitPS/2", 732 731 .alias = "touchkit", 733 732 .detect = touchkit_ps2_detect, 734 733 }, 734 + #endif 735 735 { 736 736 .type = PSMOUSE_AUTO, 737 737 .name = "auto",
+59 -44
drivers/input/mouse/synaptics.c
··· 40 40 #define YMIN_NOMINAL 1408 41 41 #define YMAX_NOMINAL 4448 42 42 43 - /***************************************************************************** 44 - * Synaptics communications functions 45 - ****************************************************************************/ 46 43 47 - /* 48 - * Send a command to the synpatics touchpad by special commands 49 - */ 50 - static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) 51 - { 52 - if (psmouse_sliced_command(psmouse, c)) 53 - return -1; 54 - if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) 55 - return -1; 56 - return 0; 57 - } 44 + /***************************************************************************** 45 + * Stuff we need even when we do not want native Synaptics support 46 + ****************************************************************************/ 58 47 59 48 /* 60 49 * Set the synaptics touchpad mode byte by special commands ··· 56 67 return -1; 57 68 param[0] = SYN_PS_SET_MODE2; 58 69 if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE)) 70 + return -1; 71 + return 0; 72 + } 73 + 74 + int synaptics_detect(struct psmouse *psmouse, int set_properties) 75 + { 76 + struct ps2dev *ps2dev = &psmouse->ps2dev; 77 + unsigned char param[4]; 78 + 79 + param[0] = 0; 80 + 81 + ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 82 + ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 83 + ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 84 + ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 85 + ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); 86 + 87 + if (param[1] != 0x47) 88 + return -ENODEV; 89 + 90 + if (set_properties) { 91 + psmouse->vendor = "Synaptics"; 92 + psmouse->name = "TouchPad"; 93 + } 94 + 95 + return 0; 96 + } 97 + 98 + void synaptics_reset(struct psmouse *psmouse) 99 + { 100 + /* reset touchpad back to relative mode, gestures enabled */ 101 + synaptics_mode_cmd(psmouse, 0); 102 + } 103 + 104 + #ifdef CONFIG_MOUSE_PS2_SYNAPTICS 105 + 106 + /***************************************************************************** 107 + * Synaptics communications functions 108 + ****************************************************************************/ 109 + 110 + /* 111 + * Send a command to the synpatics touchpad by special commands 112 + */ 113 + static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) 114 + { 115 + if (psmouse_sliced_command(psmouse, c)) 116 + return -1; 117 + if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) 59 118 return -1; 60 119 return 0; 61 120 } ··· 566 529 clear_bit(REL_Y, dev->relbit); 567 530 } 568 531 569 - void synaptics_reset(struct psmouse *psmouse) 570 - { 571 - /* reset touchpad back to relative mode, gestures enabled */ 572 - synaptics_mode_cmd(psmouse, 0); 573 - } 574 - 575 532 static void synaptics_disconnect(struct psmouse *psmouse) 576 533 { 577 534 synaptics_reset(psmouse); ··· 595 564 if (synaptics_set_absolute_mode(psmouse)) { 596 565 printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); 597 566 return -1; 598 - } 599 - 600 - return 0; 601 - } 602 - 603 - int synaptics_detect(struct psmouse *psmouse, int set_properties) 604 - { 605 - struct ps2dev *ps2dev = &psmouse->ps2dev; 606 - unsigned char param[4]; 607 - 608 - param[0] = 0; 609 - 610 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 611 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 612 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 613 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 614 - ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); 615 - 616 - if (param[1] != 0x47) 617 - return -1; 618 - 619 - if (set_properties) { 620 - psmouse->vendor = "Synaptics"; 621 - psmouse->name = "TouchPad"; 622 567 } 623 568 624 569 return 0; ··· 687 680 return -1; 688 681 } 689 682 683 + #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ 684 + 685 + int synaptics_init(struct psmouse *psmouse) 686 + { 687 + return -ENOSYS; 688 + } 689 + 690 + #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ 690 691
+9 -9
drivers/input/mouse/synaptics.h
··· 9 9 #ifndef _SYNAPTICS_H 10 10 #define _SYNAPTICS_H 11 11 12 - extern int synaptics_detect(struct psmouse *psmouse, int set_properties); 13 - extern int synaptics_init(struct psmouse *psmouse); 14 - extern void synaptics_reset(struct psmouse *psmouse); 15 - 16 12 /* synaptics queries */ 17 13 #define SYN_QUE_IDENTIFY 0x00 18 14 #define SYN_QUE_MODES 0x01 ··· 58 62 #define SYN_MODE_WMODE(m) ((m) & (1 << 0)) 59 63 60 64 /* synaptics identify query bits */ 61 - #define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f) 62 - #define SYN_ID_MAJOR(i) ((i) & 0x0f) 63 - #define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) 65 + #define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f) 66 + #define SYN_ID_MAJOR(i) ((i) & 0x0f) 67 + #define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) 64 68 #define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) 65 69 66 70 /* synaptics special commands */ ··· 94 98 struct synaptics_data { 95 99 /* Data read from the touchpad */ 96 100 unsigned long int model_id; /* Model-ID */ 97 - unsigned long int capabilities; /* Capabilities */ 98 - unsigned long int ext_cap; /* Extended Capabilities */ 101 + unsigned long int capabilities; /* Capabilities */ 102 + unsigned long int ext_cap; /* Extended Capabilities */ 99 103 unsigned long int identity; /* Identification */ 100 104 101 105 unsigned char pkt_type; /* packet type - old, new, etc */ 102 106 unsigned char mode; /* current mode byte */ 103 107 int scroll; 104 108 }; 109 + 110 + int synaptics_detect(struct psmouse *psmouse, int set_properties); 111 + int synaptics_init(struct psmouse *psmouse); 112 + void synaptics_reset(struct psmouse *psmouse); 105 113 106 114 #endif /* _SYNAPTICS_H */
+7
drivers/input/mouse/touchkit_ps2.h
··· 12 12 #ifndef _TOUCHKIT_PS2_H 13 13 #define _TOUCHKIT_PS2_H 14 14 15 + #ifdef CONFIG_MOUSE_PS2_TOUCHKIT 15 16 int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties); 17 + #else 18 + inline int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties) 19 + { 20 + return -ENOSYS; 21 + } 22 + #endif /* CONFIG_MOUSE_PS2_TOUCHKIT */ 16 23 17 24 #endif
+8 -1
drivers/input/mouse/trackpoint.h
··· 142 142 unsigned char ext_dev; 143 143 }; 144 144 145 - extern int trackpoint_detect(struct psmouse *psmouse, int set_properties); 145 + #ifdef CONFIG_MOUSE_PS2_TRACKPOINT 146 + int trackpoint_detect(struct psmouse *psmouse, int set_properties); 147 + #else 148 + inline int trackpoint_detect(struct psmouse *psmouse, int set_properties) 149 + { 150 + return -ENOSYS; 151 + } 152 + #endif /* CONFIG_MOUSE_PS2_TRACKPOINT */ 146 153 147 154 #endif /* _TRACKPOINT_H */