HID: hid-multitouch: add support for Cypress TrueTouch panels
authorBenjamin Tissoires <benjamin.tissoires@enac.fr>
Fri, 7 Jan 2011 22:46:30 +0000 (23:46 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 11 Jan 2011 20:26:54 +0000 (21:26 +0100)
Added support for Cypress TrueTouch panels, which detect up to 10 fingers

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Stéphane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/Kconfig
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-multitouch.c

index 511554de526e57e7e8cddc270e1da4ac80c3e577..de31d75e276f97fdcd8b2066898f80ed7e390871 100644 (file)
@@ -293,6 +293,7 @@ config HID_MULTITOUCH
 
          Say Y here if you have one of the following devices:
          - PixCir touchscreen
+         - Cypress TrueTouch
 
 config HID_NTRIG
        tristate "N-Trig touch screen"
index 9292eb148ce46acf0707059d1fecab576930b5d5..12d4afafc73b31dad5a802807d773b2c422c6498 100644 (file)
@@ -1298,6 +1298,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
        { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
index bd3cd551b4ee655b8f4af5d704fc2fa82dde50fe..f5657a8c757d4011cad8c72948cd5816d87dc231 100644 (file)
 #define USB_DEVICE_ID_CYPRESS_BARCODE_1        0xde61
 #define USB_DEVICE_ID_CYPRESS_BARCODE_2        0xde64
 #define USB_DEVICE_ID_CYPRESS_BARCODE_3        0xbca1
+#define USB_DEVICE_ID_CYPRESS_TRUETOUCH        0xc001
 
 #define USB_VENDOR_ID_DEALEXTREAME     0x10c5
 #define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701        0x819a
index 3b05dfe910bcbe4377360dde15334dec8313d3cb..7af9f7136bd5637c057e54f70240875acfb0eaea 100644 (file)
@@ -32,6 +32,7 @@ MODULE_LICENSE("GPL");
 /* quirks to control the device */
 #define MT_QUIRK_NOT_SEEN_MEANS_UP     (1 << 0)
 #define MT_QUIRK_SLOT_IS_CONTACTID     (1 << 1)
+#define MT_QUIRK_CYPRESS       (1 << 2)
 
 struct mt_slot {
        __s32 x, y, p, w, h;
@@ -62,6 +63,7 @@ struct mt_class {
 /* classes of device behavior */
 #define MT_CLS_DEFAULT 0
 #define MT_CLS_DUAL1 1
+#define MT_CLS_CYPRESS 2
 
 /*
  * these device-dependent functions determine what slot corresponds
@@ -73,6 +75,14 @@ static int slot_is_contactid(struct mt_device *td)
        return td->curdata.contactid;
 }
 
+static int cypress_compute_slot(struct mt_device *td)
+{
+       if (td->curdata.contactid != 0 || td->num_received == 0)
+               return td->curdata.contactid;
+       else
+               return -1;
+}
+
 static int find_slot_from_contactid(struct mt_device *td)
 {
        int i;
@@ -95,6 +105,7 @@ static int find_slot_from_contactid(struct mt_device *td)
 struct mt_class mt_classes[] = {
        { 0, 0, 0, 10 },                             /* MT_CLS_DEFAULT */
        { MT_QUIRK_SLOT_IS_CONTACTID, 0, 0, 2 },     /* MT_CLS_DUAL1 */
+       { MT_QUIRK_CYPRESS | MT_QUIRK_NOT_SEEN_MEANS_UP, 0, 0, 10 }, /* MT_CLS_CYPRESS */
 };
 
 static void mt_feature_mapping(struct hid_device *hdev, struct hid_input *hi,
@@ -223,6 +234,9 @@ static int mt_compute_slot(struct mt_device *td)
        if (cls->quirks & MT_QUIRK_SLOT_IS_CONTACTID)
                return slot_is_contactid(td);
 
+       if (cls->quirks & MT_QUIRK_CYPRESS)
+               return cypress_compute_slot(td);
+
        return find_slot_from_contactid(td);
 }
 
@@ -422,6 +436,11 @@ static void mt_remove(struct hid_device *hdev)
 
 static const struct hid_device_id mt_devices[] = {
 
+       /* Cypress panel */
+       { .driver_data = MT_CLS_CYPRESS,
+               HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
+                       USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
+
        /* PixCir-based panels */
        { .driver_data = MT_CLS_DUAL1,
                HID_USB_DEVICE(USB_VENDOR_ID_HANVON,