From patchwork Wed Apr 15 23:53:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 6223441 X-Patchwork-Delegate: jikos@jikos.cz 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9D242BF4A6 for ; Wed, 15 Apr 2015 23:54:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A360A2034B for ; Wed, 15 Apr 2015 23:54:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB8FE202FF for ; Wed, 15 Apr 2015 23:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933508AbbDOXyA (ORCPT ); Wed, 15 Apr 2015 19:54:00 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:35911 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755719AbbDOXyA (ORCPT ); Wed, 15 Apr 2015 19:54:00 -0400 Received: by pdea3 with SMTP id a3so69980691pde.3 for ; Wed, 15 Apr 2015 16:53:59 -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; bh=GWZL6G5GCg/1k1KHzAlLE7UNv7DE6w3ih75EAXCWZ3M=; b=sd3tm4bA37jJUpLt7lTxWHIxlPH57OUqes8EYrSIEddz/RGUqhi2VA5Z0NBKhrHQRJ SfsW2dZlVEkrvPepz1CihdhFUm8BPU724T/9N+vTomikjCh2yvPEjV8uuYIbYbBpx0FX lJ+HbzO/oyUIzDJHPwZ30Di+0MlcsGeX7iG8/IBL432OWN9q7YM+YdubQuOiqOh6s3Sy o55w9rE03N6pNJJkbuWfc15cMsn0VSL49dS3YF7ANNZB15DOucmaCChQZ1Zz5FPFLo1U S2RQ2LHF1H9K3txaNlvyKMkFBhK0jLhQ5GrDFto0uCE7Q99aOpLnIsanhYpL8LzeE40c 6uyg== X-Received: by 10.70.134.198 with SMTP id pm6mr51472435pdb.17.1429142039887; Wed, 15 Apr 2015 16:53:59 -0700 (PDT) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id nl16sm5189984pdb.56.2015.04.15.16.53.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Apr 2015 16:53:59 -0700 (PDT) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, Ping Cheng Subject: [PATCH 2/4] HID: wacom: move all quirks to wacom_setup_device_quirks Date: Wed, 15 Apr 2015 16:53:54 -0700 Message-Id: <1429142034-16832-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 It makes probe routine easy to follow. Signed-off-by: Ping Cheng --- drivers/hid/wacom.h | 2 +- drivers/hid/wacom_sys.c | 39 +-------------------------------------- drivers/hid/wacom_wac.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 40 deletions(-) diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h index ad7318d..0f189c2 100644 --- a/drivers/hid/wacom.h +++ b/drivers/hid/wacom.h @@ -132,7 +132,7 @@ static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) extern const struct hid_device_id wacom_ids[]; void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); -void wacom_setup_device_quirks(struct wacom_features *features); +void wacom_setup_device_quirks(struct wacom *wacom); int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, struct wacom_wac *wacom_wac); int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 4c5d924..ca30eab 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1504,44 +1504,7 @@ static int wacom_probe(struct hid_device *hdev, /* Retrieve the physical and logical size for touch devices */ wacom_retrieve_hid_descriptor(hdev, features); - /* - * Intuos5 has no useful data about its touch interface in its - * HID descriptor. If this is the touch interface (PacketSize - * of WACOM_PKGLEN_BBTOUCH3), override the table values. - */ - if (features->type >= INTUOS5S && features->type <= INTUOSHT) { - if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { - features->device_type = BTN_TOOL_FINGER; - - features->x_max = 4096; - features->y_max = 4096; - } else { - features->device_type = BTN_TOOL_PEN; - } - } - - /* - * Same thing for Bamboo 3rd gen. - */ - if ((features->type == BAMBOO_PT) && - (features->pktlen == WACOM_PKGLEN_BBTOUCH3) && - (features->device_type == BTN_TOOL_PEN)) { - features->device_type = BTN_TOOL_FINGER; - - features->x_max = 4096; - features->y_max = 4096; - } - - /* - * Same thing for Bamboo PAD - */ - if (features->type == BAMBOO_PAD) - features->device_type = BTN_TOOL_FINGER; - - if (hdev->bus == BUS_BLUETOOTH) - features->quirks |= WACOM_QUIRK_BATTERY; - - wacom_setup_device_quirks(features); + wacom_setup_device_quirks(wacom); /* set unit to "100th of a mm" for devices not reported by HID */ if (!features->unit) { diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 69c7df7..952ed4c 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2164,8 +2164,9 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac) input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); } -void wacom_setup_device_quirks(struct wacom_features *features) +void wacom_setup_device_quirks(struct wacom *wacom) { + struct wacom_features *features = &wacom->wacom_wac.features; /* touch device found but size is not defined. use default */ if (features->device_type == BTN_TOOL_FINGER && !features->x_max) { @@ -2173,6 +2174,33 @@ void wacom_setup_device_quirks(struct wacom_features *features) features->y_max = 1023; } + /* + * Intuos5/Pro and Bamboo 3rd gen have no useful data about its + * touch interface in its HID descriptor. If this is the touch + * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the + * tablet values. + */ + if ((features->type >= INTUOS5S && features->type <= INTUOSHT) || + (features->type == BAMBOO_PT)) { + if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { + features->device_type = BTN_TOOL_FINGER; + + features->x_max = 4096; + features->y_max = 4096; + } else { + features->device_type = BTN_TOOL_PEN; + } + } + + /* + * Same thing for Bamboo PAD + */ + if (features->type == BAMBOO_PAD) + features->device_type = BTN_TOOL_FINGER; + + if (wacom->hdev->bus == BUS_BLUETOOTH) + features->quirks |= WACOM_QUIRK_BATTERY; + /* quirk for bamboo touch with 2 low res touches */ if (features->type == BAMBOO_PT && features->pktlen == WACOM_PKGLEN_BBTOUCH) {