gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / hid / hid-jabra.c
blob41dc30fe2d16b82d886d58f301e6e08c7558d5da
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Jabra USB HID Driver
5 * Copyright (c) 2017 Niels Skou Olsen <nolsen@jabra.com>
6 */
8 /*
9 */
11 #include <linux/hid.h>
12 #include <linux/module.h>
14 #include "hid-ids.h"
16 #define HID_UP_VENDOR_DEFINED_MIN 0xff000000
17 #define HID_UP_VENDOR_DEFINED_MAX 0xffff0000
19 static int jabra_input_mapping(struct hid_device *hdev,
20 struct hid_input *hi,
21 struct hid_field *field,
22 struct hid_usage *usage,
23 unsigned long **bit, int *max)
25 int is_vendor_defined =
26 ((usage->hid & HID_USAGE_PAGE) >= HID_UP_VENDOR_DEFINED_MIN &&
27 (usage->hid & HID_USAGE_PAGE) <= HID_UP_VENDOR_DEFINED_MAX);
29 dbg_hid("hid=0x%08x appl=0x%08x coll_idx=0x%02x usage_idx=0x%02x: %s\n",
30 usage->hid,
31 field->application,
32 usage->collection_index,
33 usage->usage_index,
34 is_vendor_defined ? "ignored" : "defaulted");
36 /* Ignore vendor defined usages, default map standard usages */
37 return is_vendor_defined ? -1 : 0;
40 static const struct hid_device_id jabra_devices[] = {
41 { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, HID_ANY_ID) },
42 { }
44 MODULE_DEVICE_TABLE(hid, jabra_devices);
46 static struct hid_driver jabra_driver = {
47 .name = "jabra",
48 .id_table = jabra_devices,
49 .input_mapping = jabra_input_mapping,
51 module_hid_driver(jabra_driver);
53 MODULE_AUTHOR("Niels Skou Olsen <nolsen@jabra.com>");
54 MODULE_DESCRIPTION("Jabra USB HID Driver");
55 MODULE_LICENSE("GPL");