Input: elantech - add more IC body types to the list
[pandora-kernel.git] / drivers / input / mouse / elantech.c
index 00a7889..537692d 100644 (file)
@@ -692,18 +692,18 @@ static int elantech_packet_check_v3(struct psmouse *psmouse)
 static int elantech_packet_check_v4(struct psmouse *psmouse)
 {
        unsigned char *packet = psmouse->packet;
+       unsigned char packet_type = packet[3] & 0x03;
 
-       if ((packet[0] & 0x0c) == 0x04 &&
-           (packet[3] & 0x1f) == 0x11)
+       switch (packet_type) {
+       case 0:
+               return PACKET_V4_STATUS;
+
+       case 1:
                return PACKET_V4_HEAD;
 
-       if ((packet[0] & 0x0c) == 0x04 &&
-           (packet[3] & 0x1f) == 0x12)
+       case 2:
                return PACKET_V4_MOTION;
-
-       if ((packet[0] & 0x0c) == 0x04 &&
-           (packet[3] & 0x1f) == 0x10)
-               return PACKET_V4_STATUS;
+       }
 
        return PACKET_UNKNOWN;
 }
@@ -1146,10 +1146,11 @@ static bool elantech_is_signature_valid(const unsigned char *param)
                return true;
 
        /*
-        * Some models have a revision higher then 20. Meaning param[2] may
-        * be 10 or 20, skip the rates check for these.
+        * Some hw_version >= 4 models have a revision higher then 20. Meaning
+        * that param[2] may be 10 or 20, skip the rates check for these.
         */
-       if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40)
+       if ((param[0] & 0x0f) >= 0x06 && (param[1] & 0xaf) == 0x0f &&
+           param[2] < 40)
                return true;
 
        for (i = 0; i < ARRAY_SIZE(rates); i++)
@@ -1283,7 +1284,7 @@ static int elantech_set_properties(struct elantech_data *etd)
                case 5:
                        etd->hw_version = 3;
                        break;
-               case 6:
+               case 6 ... 14:
                        etd->hw_version = 4;
                        break;
                default: