From patchwork Tue Sep 3 21:52:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 2853428 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41D56C0AB5 for ; Tue, 3 Sep 2013 21:52:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44BEC20399 for ; Tue, 3 Sep 2013 21:52:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DA5E20397 for ; Tue, 3 Sep 2013 21:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933071Ab3ICVwQ (ORCPT ); Tue, 3 Sep 2013 17:52:16 -0400 Received: from mail-pb0-f42.google.com ([209.85.160.42]:47368 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933068Ab3ICVwN (ORCPT ); Tue, 3 Sep 2013 17:52:13 -0400 Received: by mail-pb0-f42.google.com with SMTP id un15so6571214pbc.29 for ; Tue, 03 Sep 2013 14:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qVyURSvkIgmZGq62IzfrLwxiE7chtRGuMaH6UoZxdls=; b=pHclK2UK5TB2ZR4VUtQVU3Z6gOCuNmNfHepwNmwzwJ/IVhffLbrwsJkBPwkAwVG9wb UaZYMCOyZ9yfU3C9z5h3wrsl2TjcJJV2TrJPI1/1PhLsgBARKPo3itQ37jLFz/hNmJR7 3af2SMYJ+7za94Pv5vVzro9xnAolJQfibMN7eZDwCns437WsvREcjjPKES4fKoCMrtMh p6M12emhYJIlrhyKH4FY86Ff9gm1qAJpEDaHNsuh5ZHy6ttHPgoAkfLSO3IzO4t468o9 dKYrIxLb+bX2gLpSyh5pEmerV4qKlkEJXiTGROgbWqK4GaTEjHzs7YnjG1xerR3BhtiC JD9A== X-Received: by 10.67.4.227 with SMTP id ch3mr34787829pad.74.1378245132343; Tue, 03 Sep 2013 14:52:12 -0700 (PDT) Received: from wacom-arch.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id ib9sm24618259pbc.43.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Sep 2013 14:52:11 -0700 (PDT) From: Jason Gerecke To: linuxwacom-devel@lists.sourceforge.net, linux-input@vger.kernel.org, pinglinux@gmail.com, peter.hutterer@who-t.net Cc: Jason Gerecke Subject: [PATCH 1/3 v3] Input: wacom - Support EMR and MFT sensors of Cintiq Companion Hybrid Date: Tue, 3 Sep 2013 14:52:06 -0700 Message-Id: <1378245126-1329-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1377220537-1474-1-git-send-email-killertofu@gmail.com> References: <1377220537-1474-1-git-send-email-killertofu@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adds support for the sensors integrated in to the Cintiq Companion Hybrid. These sensors use by-and-large the same protocol as the Cintiq 24HD touch. NOTE: The ExpressKeys on the Cintiq Companion Hybrid are wired to both the EMR controller and CPU GPIO pins. It may be necessary to disable their functionality in this driver if building a custom Android kernel for this device (lest two events be sent to userspace for every button press). Signed-off-by: Jason Gerecke --- Changes in v3: * Change type name from 'ASTERIX' to 'CINTIQ_HYBRID' Changes in v2: * Remove "#if 1" block surrounding conditional ExpressKey reporting * Change to C-style comments drivers/input/tablet/wacom_sys.c | 2 +- drivers/input/tablet/wacom_wac.c | 46 +++++++++++++++++++++++++++++++++++++++- drivers/input/tablet/wacom_wac.h | 1 + 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 1ad3e07..0750d2a 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -548,7 +548,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat /* MT Tablet PC touch */ return wacom_set_device_mode(intf, 3, 4, 4); } - else if (features->type == WACOM_24HDT) { + else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) { return wacom_set_device_mode(intf, 18, 3, 2); } } else if (features->device_type == BTN_TOOL_PEN) { diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 541197b..d68bf73 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -475,7 +475,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom) /* general pen packet */ if ((data[1] & 0xb8) == 0xa0) { t = (data[6] << 2) | ((data[7] >> 6) & 3); - if (features->type >= INTUOS4S && features->type <= WACOM_24HD) { + if (features->type >= INTUOS4S && features->type <= CINTIQ_HYBRID) { t = (t << 1) | (data[1] & 1); } input_report_abs(input, ABS_PRESSURE, t); @@ -619,6 +619,22 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) } else { input_report_abs(input, ABS_MISC, 0); } + } else if (features->type == CINTIQ_HYBRID) { + /* + * Do not send hardware buttons under Android. They + * are already sent to the system through GPIO (and + * have different meaning). + */ + input_report_key(input, BTN_1, (data[4] & 0x01)); + input_report_key(input, BTN_2, (data[4] & 0x02)); + input_report_key(input, BTN_3, (data[4] & 0x04)); + input_report_key(input, BTN_4, (data[4] & 0x08)); + + input_report_key(input, BTN_5, (data[4] & 0x10)); /* Right */ + input_report_key(input, BTN_6, (data[4] & 0x20)); /* Up */ + input_report_key(input, BTN_7, (data[4] & 0x40)); /* Left */ + input_report_key(input, BTN_8, (data[4] & 0x80)); /* Down */ + input_report_key(input, BTN_0, (data[3] & 0x01)); /* Center */ } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { int i; @@ -1325,6 +1341,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) case WACOM_22HD: case WACOM_24HD: case DTK: + case CINTIQ_HYBRID: sync = wacom_intuos_irq(wacom_wac); break; @@ -1763,6 +1780,24 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, 0, 0); } break; + + case CINTIQ_HYBRID: + __set_bit(BTN_1, input_dev->keybit); + __set_bit(BTN_2, input_dev->keybit); + __set_bit(BTN_3, input_dev->keybit); + __set_bit(BTN_4, input_dev->keybit); + + __set_bit(BTN_5, input_dev->keybit); + __set_bit(BTN_6, input_dev->keybit); + __set_bit(BTN_7, input_dev->keybit); + __set_bit(BTN_8, input_dev->keybit); + __set_bit(BTN_0, input_dev->keybit); + + input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); + + wacom_setup_cintiq(wacom_wac); + break; } return 0; } @@ -2117,6 +2152,13 @@ static const struct wacom_features wacom_features_0xDF = static const struct wacom_features wacom_features_0x6004 = { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0x0307 = + { "Wacom ISDv5 307", WACOM_PKGLEN_INTUOS, 59552, 33848, 2047, + 63, CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, + .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; +static const struct wacom_features wacom_features_0x0309 = + { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ + .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10 }; #define USB_DEVICE_WACOM(prod) \ USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ @@ -2247,6 +2289,8 @@ const struct usb_device_id wacom_ids[] = { { USB_DEVICE_WACOM(0xF8) }, { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) }, { USB_DEVICE_WACOM(0xFA) }, + { USB_DEVICE_WACOM(0x0307) }, + { USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) }, { USB_DEVICE_LENOVO(0x6004) }, { } }; diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index dfc9e08..90ce10d 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h @@ -80,6 +80,7 @@ enum { WACOM_22HD, DTK, WACOM_24HD, + CINTIQ_HYBRID, CINTIQ, WACOM_BEE, WACOM_13HD,