From patchwork Thu Oct 6 21:22:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 9365345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1CB7F6077E for ; Thu, 6 Oct 2016 21:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 067EF29259 for ; Thu, 6 Oct 2016 21:23:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF4AA2925D; Thu, 6 Oct 2016 21:23:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B8D62926C for ; Thu, 6 Oct 2016 21:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935249AbcJFVXB (ORCPT ); Thu, 6 Oct 2016 17:23:01 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:36438 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935088AbcJFVXB (ORCPT ); Thu, 6 Oct 2016 17:23:01 -0400 Received: by mail-qt0-f195.google.com with SMTP id y38so833218qta.3 for ; Thu, 06 Oct 2016 14:23:00 -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=ChsMgwQqbXJEyCYhGHzb88L2pc9dPsPxFKl5zaXp8jI=; b=GjAYhraoOekzpsb+GbrM/a9/BssLT7yLL3d6fPiPlhR9IDmrpGSBlWcwcETojWhV7K kHexoMF9u285/S26/9Tszan4cICiLYyIs4Adn1smw4oB1I73Ag8ZH8MoqPRNRPz05jRJ Io1GGN30l2dukFaM8ShFoqVi6dMBWyTzs19p/TMv0azL/lsRInezj9RIzMSo2HSloueU XFJ3wKtewen6DJWwcwM/4o6bIZzDLSBBTOSOkEyfh8aTBGWGEhwvzCYM5XJp2A7gLMT+ wyhIbKZjpZODnsS0fwoS53bpb8QlBnByF4i76BQnrHFgAb1MHpuLRgdaKlGreU7kTwRW Fu/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ChsMgwQqbXJEyCYhGHzb88L2pc9dPsPxFKl5zaXp8jI=; b=R6b17jDbclj0ZS+RtAIgxh313qe6OXO7RCRt6Gi+ejaWDLkoiVoWtqRAOSw+MTrgsJ 8knrTrNguufaJ8v+pfhWP1GWZZ/73NN9yFgT+gndlYIN9aqxliw9l/Z/V4sjfLPlhdsN 2TXFAvSccoYeZ4rCqCwx5+45LSFt5/E0kNyLY308CFrhIKiQWTJ/cLs5R20eTbjS88BD JbKjHMHXMCYtZpkOVHIWqtxTc6gn5l1vPPN+HZ9Wifs88lwfC6EPVZcFrYEOHuUQ9YFs 7CNDtke2ccCy27gmx2VQOzMVHm4AN0OHsSYLdJLNN3I2Hkf2sKnVrPKs7qhAWCEDOulF NshQ== X-Gm-Message-State: AA6/9Rk+EqyXRScKgeaG83zXROtNQMC6OHzvJxfKButGiAjEYXuyV1uvXZoeWjQA2/nHcg== X-Received: by 10.200.40.176 with SMTP id i45mr16782475qti.70.1475788980246; Thu, 06 Oct 2016 14:23:00 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id m4sm5773714qkf.29.2016.10.06.14.22.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Oct 2016 14:22:59 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org, Jiri Kosina Cc: Benjamin Tissoires , Ping Cheng , Ping Cheng , Aaron Skomra , Jason Gerecke , Jason Gerecke Subject: [PATCH 13/19] HID: wacom: generic: Pass 'hdev' to 'wacom_map_usage' Date: Thu, 6 Oct 2016 14:22:25 -0700 Message-Id: <20161006212231.31440-14-killertofu@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006212231.31440-1-killertofu@gmail.com> References: <20161006212231.31440-1-killertofu@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the following "Add support for sensor offsets" patch we'll need access to the 'features' struct within 'wacom_map_usage', so update the function signature and calls to include a reference to the HID device so this can be done. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 53 ++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index f2aadc4..8f493cc 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1465,9 +1465,12 @@ static int wacom_equivalent_usage(int usage) return usage; } -static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage, - struct hid_field *field, __u8 type, __u16 code, int fuzz) +static void wacom_map_usage(struct input_dev *input, struct hid_device *hdev, + struct hid_usage *usage, struct hid_field *field, __u8 type, + __u16 code, int fuzz) { + struct wacom *wacom = hid_get_drvdata(hdev); + struct wacom_wac *wacom_wac = &wacom->wacom_wac; int fmin = field->logical_minimum; int fmax = field->logical_maximum; unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); @@ -1508,53 +1511,53 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, switch (equivalent_usage) { case HID_GD_X: - wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_X, 4); break; case HID_GD_Y: - wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_Y, 4); break; case WACOM_HID_WD_DISTANCE: case HID_GD_Z: - wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_DISTANCE, 0); break; case HID_DG_TIPPRESSURE: - wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_PRESSURE, 0); break; case HID_DG_INRANGE: - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOOL_PEN, 0); break; case HID_DG_INVERT: - wacom_map_usage(input, usage, field, EV_KEY, + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOOL_RUBBER, 0); break; case HID_DG_TILT_X: - wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_TILT_X, 0); break; case HID_DG_TILT_Y: - wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_TILT_Y, 0); break; case HID_DG_TWIST: - wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_Z, 0); break; case HID_DG_ERASER: case HID_DG_TIPSWITCH: - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOUCH, 0); break; case HID_DG_BARRELSWITCH: - wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_STYLUS, 0); break; case HID_DG_BARRELSWITCH2: - wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_STYLUS2, 0); break; case HID_DG_TOOLSERIALNUMBER: - wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); + wacom_map_usage(input, hdev, usage, field, EV_MSC, MSC_SERIAL, 0); break; case WACOM_HID_WD_SENSE: features->quirks |= WACOM_QUIRK_SENSE; - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOOL_PEN, 0); break; case WACOM_HID_WD_SERIALHI: - wacom_map_usage(input, usage, field, EV_ABS, ABS_MISC, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MISC, 0); set_bit(EV_KEY, input->evbit); input_set_capability(input, EV_KEY, BTN_TOOL_PEN); input_set_capability(input, EV_KEY, BTN_TOOL_RUBBER); @@ -1565,7 +1568,7 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, input_set_capability(input, EV_KEY, BTN_TOOL_LENS); break; case WACOM_HID_WD_FINGERWHEEL: - wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_WHEEL, 0); break; } } @@ -1722,24 +1725,24 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, case HID_GD_X: features->last_slot_field = usage->hid; if (touch_max == 1) - wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_X, 4); else - wacom_map_usage(input, usage, field, EV_ABS, + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MT_POSITION_X, 4); break; case HID_GD_Y: features->last_slot_field = usage->hid; if (touch_max == 1) - wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_Y, 4); else - wacom_map_usage(input, usage, field, EV_ABS, + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MT_POSITION_Y, 4); break; case HID_DG_WIDTH: case HID_DG_HEIGHT: features->last_slot_field = usage->hid; - wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); - wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); + wacom_map_usage(input, hdev, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); break; case HID_DG_CONTACTID: @@ -1753,7 +1756,7 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, break; case HID_DG_TIPSWITCH: features->last_slot_field = usage->hid; - wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); + wacom_map_usage(input, hdev, usage, field, EV_KEY, BTN_TOUCH, 0); break; case HID_DG_CONTACTCOUNT: wacom_wac->hid_data.cc_report = field->report->id;