Input: psmouse - add support for detecting FocalTech PS/2 touchpads
[firefly-linux-kernel-4.4.55.git] / drivers / input / mouse / psmouse-base.c
index bc1bc2653f15635bca18d10abb8412594eb492b8..3ab941d425ae8837927baf81455aee792b170256 100644 (file)
@@ -35,6 +35,7 @@
 #include "elantech.h"
 #include "sentelic.h"
 #include "cypress_ps2.h"
+#include "focaltech.h"
 
 #define DRIVER_DESC    "PS/2 mouse driver"
 
@@ -720,6 +721,21 @@ static int psmouse_extensions(struct psmouse *psmouse,
 {
        bool synaptics_hardware = false;
 
+/* Always check for focaltech, this is safe as it uses pnp-id matching */
+       if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
+               if (!set_properties || focaltech_init(psmouse) == 0) {
+                       /*
+                        * Not supported yet, use bare protocol.
+                        * Note that we need to also restrict
+                        * psmouse_max_proto so that psmouse_initialize()
+                        * does not try to reset rate and resolution,
+                        * because even that upsets the device.
+                        */
+                       psmouse_max_proto = PSMOUSE_PS2;
+                       return PSMOUSE_PS2;
+               }
+       }
+
 /*
  * We always check for lifebook because it does not disturb mouse
  * (it only checks DMI information).