Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Aug 2013 23:15:52 +0000 (16:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Aug 2013 23:15:52 +0000 (16:15 -0700)
Pull input layer updates from Dmitry Torokhov:
 "Just a couple of new IDs in Wacom and xpad drivers, i8042 is now
  disabled on ARC, and data checks in Elantech driver that were overly
  relaxed by the previous patch are now tightened"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: i8042 - disable the driver on ARC platforms
  Input: xpad - add signature for Razer Onza Classic Edition
  Input: elantech - fix packet check for v3 and v4 hardware
  Input: wacom - add support for 0x300 and 0x301

drivers/input/joystick/xpad.c
drivers/input/mouse/elantech.c
drivers/input/mouse/elantech.h
drivers/input/serio/Kconfig
drivers/input/tablet/wacom_wac.c

index fa061d4..75e3b10 100644 (file)
@@ -167,6 +167,7 @@ static const struct xpad_device {
        { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
        { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
        { 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
+       { 0x1689, 0xfd01, "Razer Onza Classic Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
        { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
        { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
        { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
index 57b2637..8551dca 100644 (file)
@@ -672,6 +672,7 @@ static int elantech_packet_check_v2(struct psmouse *psmouse)
  */
 static int elantech_packet_check_v3(struct psmouse *psmouse)
 {
+       struct elantech_data *etd = psmouse->private;
        const u8 debounce_packet[] = { 0xc4, 0xff, 0xff, 0x02, 0xff, 0xff };
        unsigned char *packet = psmouse->packet;
 
@@ -682,19 +683,48 @@ static int elantech_packet_check_v3(struct psmouse *psmouse)
        if (!memcmp(packet, debounce_packet, sizeof(debounce_packet)))
                return PACKET_DEBOUNCE;
 
-       if ((packet[0] & 0x0c) == 0x04 && (packet[3] & 0xcf) == 0x02)
-               return PACKET_V3_HEAD;
+       /*
+        * If the hardware flag 'crc_enabled' is set the packets have
+        * different signatures.
+        */
+       if (etd->crc_enabled) {
+               if ((packet[3] & 0x09) == 0x08)
+                       return PACKET_V3_HEAD;
+
+               if ((packet[3] & 0x09) == 0x09)
+                       return PACKET_V3_TAIL;
+       } else {
+               if ((packet[0] & 0x0c) == 0x04 && (packet[3] & 0xcf) == 0x02)
+                       return PACKET_V3_HEAD;
 
-       if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c)
-               return PACKET_V3_TAIL;
+               if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c)
+                       return PACKET_V3_TAIL;
+       }
 
        return PACKET_UNKNOWN;
 }
 
 static int elantech_packet_check_v4(struct psmouse *psmouse)
 {
+       struct elantech_data *etd = psmouse->private;
        unsigned char *packet = psmouse->packet;
        unsigned char packet_type = packet[3] & 0x03;
+       bool sanity_check;
+
+       /*
+        * Sanity check based on the constant bits of a packet.
+        * The constant bits change depending on the value of
+        * the hardware flag 'crc_enabled' but are the same for
+        * every packet, regardless of the type.
+        */
+       if (etd->crc_enabled)
+               sanity_check = ((packet[3] & 0x08) == 0x00);
+       else
+               sanity_check = ((packet[0] & 0x0c) == 0x04 &&
+                               (packet[3] & 0x1c) == 0x10);
+
+       if (!sanity_check)
+               return PACKET_UNKNOWN;
 
        switch (packet_type) {
        case 0:
@@ -1313,6 +1343,12 @@ static int elantech_set_properties(struct elantech_data *etd)
                        etd->reports_pressure = true;
        }
 
+       /*
+        * The signatures of v3 and v4 packets change depending on the
+        * value of this hardware flag.
+        */
+       etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000);
+
        return 0;
 }
 
index 46db3be..036a04a 100644 (file)
@@ -129,6 +129,7 @@ struct elantech_data {
        bool paritycheck;
        bool jumpy_cursor;
        bool reports_pressure;
+       bool crc_enabled;
        unsigned char hw_version;
        unsigned int fw_version;
        unsigned int single_finger_reports;
index 94c17c2..1e691a3 100644 (file)
@@ -22,7 +22,8 @@ config SERIO_I8042
        tristate "i8042 PC Keyboard controller" if EXPERT || !X86
        default y
        depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \
-                  (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390
+                  (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \
+                  !ARC
        help
          i8042 is the chip over which the standard AT keyboard and PS/2
          mouse are connected to the computer. If you use these devices,
index 384fbcd..f3e91f0 100644 (file)
@@ -2112,7 +2112,7 @@ static const struct wacom_features wacom_features_0xDA =
        { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN,  14720,  9200, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
          .touch_max = 2 };
-static struct wacom_features wacom_features_0xDB =
+static const struct wacom_features wacom_features_0xDB =
        { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN,  21648, 13700, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
          .touch_max = 2 };
@@ -2127,6 +2127,12 @@ static const struct wacom_features wacom_features_0xDF =
         { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN,    21648, 13700, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
          .touch_max = 16 };
+static const struct wacom_features wacom_features_0x300 =
+       { "Wacom Bamboo One S",    WACOM_PKGLEN_BBPEN,    14720,  9225, 1023,
+         31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x301 =
+       { "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
+         31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 static const struct wacom_features wacom_features_0x6004 =
        { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
          0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2253,6 +2259,8 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x100) },
        { USB_DEVICE_WACOM(0x101) },
        { USB_DEVICE_WACOM(0x10D) },
+       { USB_DEVICE_WACOM(0x300) },
+       { USB_DEVICE_WACOM(0x301) },
        { USB_DEVICE_WACOM(0x304) },
        { USB_DEVICE_WACOM(0x4001) },
        { USB_DEVICE_WACOM(0x47) },