From patchwork Fri Jan 7 18:42:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 464901 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p07IheZj009803 for ; Fri, 7 Jan 2011 18:43:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755008Ab1AGSmE (ORCPT ); Fri, 7 Jan 2011 13:42:04 -0500 Received: from 89-230.252-81.static-ip.oleane.fr ([81.252.230.89]:54648 "EHLO smtp.lii-enac.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754711Ab1AGSmB (ORCPT ); Fri, 7 Jan 2011 13:42:01 -0500 Received: from gloupti.lii-enac.fr (unknown [10.0.0.110]) by smtp.lii-enac.fr (DoorWays) with ESMTP id 8B0279523E; Fri, 7 Jan 2011 19:41:59 +0100 (CET) From: Benjamin Tissoires To: Stephane Chatty , Henrik Rydberg , Dmitry Torokhov , Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Benjamin Tissoires Subject: [RFC v3 4/5] hid-multitouch: added support for Cypress TrueTouch panels Date: Fri, 7 Jan 2011 19:42:41 +0100 Message-Id: <1294425762-29730-5-git-send-email-benjamin.tissoires@enac.fr> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1294425762-29730-1-git-send-email-benjamin.tissoires@enac.fr> References: <1294425762-29730-1-git-send-email-benjamin.tissoires@enac.fr> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 07 Jan 2011 18:43:40 +0000 (UTC) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 511554d..de31d75 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -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" diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 2b4d9b9..e6a86bf 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -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) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 17b444b..c258c42 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -180,6 +180,7 @@ #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 diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 3b05dfe..7af9f71 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -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,