summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-a4tech.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-08-21 13:12:29 -0400
committerJason Gunthorpe <jgg@mellanox.com>2019-08-21 19:58:18 -0400
commitdaa138a58c802e7b4c2fb73f9b85bb082616ef43 (patch)
treebe913e8e3745bb367d2ba371598f447649102cfc /drivers/hid/hid-a4tech.c
parent6869b7b206595ae0e326f59719090351eb8f4f5d (diff)
parentfba0e448a2c5b297a4ddc1ec4e48f4aa6600a1c9 (diff)
Merge branch 'odp_fixes' into hmm.git
From rdma.git Jason Gunthorpe says: ==================== This is a collection of general cleanups for ODP to clarify some of the flows around umem creation and use of the interval tree. ==================== The branch is based on v5.3-rc5 due to dependencies, and is being taken into hmm.git due to dependencies in the next patches. * odp_fixes: RDMA/mlx5: Use odp instead of mr->umem in pagefault_mr RDMA/mlx5: Use ib_umem_start instead of umem.address RDMA/core: Make invalidate_range a device operation RDMA/odp: Use kvcalloc for the dma_list and page_list RDMA/odp: Check for overflow when computing the umem_odp end RDMA/odp: Provide ib_umem_odp_release() to undo the allocs RDMA/odp: Split creating a umem_odp from ib_umem_get RDMA/odp: Make the three ways to create a umem_odp clear RMDA/odp: Consolidate umem_odp initialization RDMA/odp: Make it clearer when a umem is an implicit ODP umem RDMA/odp: Iterate over the whole rbtree directly RDMA/odp: Use the common interval tree library instead of generic RDMA/mlx5: Fix MR npages calculation for IB_ACCESS_HUGETLB Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/hid/hid-a4tech.c')
-rw-r--r--drivers/hid/hid-a4tech.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c
index 98bf694626f7..3a8c4a5971f7 100644
--- a/drivers/hid/hid-a4tech.c
+++ b/drivers/hid/hid-a4tech.c
@@ -23,12 +23,36 @@
23#define A4_2WHEEL_MOUSE_HACK_7 0x01 23#define A4_2WHEEL_MOUSE_HACK_7 0x01
24#define A4_2WHEEL_MOUSE_HACK_B8 0x02 24#define A4_2WHEEL_MOUSE_HACK_B8 0x02
25 25
26#define A4_WHEEL_ORIENTATION (HID_UP_GENDESK | 0x000000b8)
27
26struct a4tech_sc { 28struct a4tech_sc {
27 unsigned long quirks; 29 unsigned long quirks;
28 unsigned int hw_wheel; 30 unsigned int hw_wheel;
29 __s32 delayed_value; 31 __s32 delayed_value;
30}; 32};
31 33
34static int a4_input_mapping(struct hid_device *hdev, struct hid_input *hi,
35 struct hid_field *field, struct hid_usage *usage,
36 unsigned long **bit, int *max)
37{
38 struct a4tech_sc *a4 = hid_get_drvdata(hdev);
39
40 if (a4->quirks & A4_2WHEEL_MOUSE_HACK_B8 &&
41 usage->hid == A4_WHEEL_ORIENTATION) {
42 /*
43 * We do not want to have this usage mapped to anything as it's
44 * nonstandard and doesn't really behave like an HID report.
45 * It's only selecting the orientation (vertical/horizontal) of
46 * the previous mouse wheel report. The input_events will be
47 * generated once both reports are recorded in a4_event().
48 */
49 return -1;
50 }
51
52 return 0;
53
54}
55
32static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, 56static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi,
33 struct hid_field *field, struct hid_usage *usage, 57 struct hid_field *field, struct hid_usage *usage,
34 unsigned long **bit, int *max) 58 unsigned long **bit, int *max)
@@ -52,8 +76,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,
52 struct a4tech_sc *a4 = hid_get_drvdata(hdev); 76 struct a4tech_sc *a4 = hid_get_drvdata(hdev);
53 struct input_dev *input; 77 struct input_dev *input;
54 78
55 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || 79 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput)
56 !usage->type)
57 return 0; 80 return 0;
58 81
59 input = field->hidinput->input; 82 input = field->hidinput->input;
@@ -64,7 +87,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field,
64 return 1; 87 return 1;
65 } 88 }
66 89
67 if (usage->hid == 0x000100b8) { 90 if (usage->hid == A4_WHEEL_ORIENTATION) {
68 input_event(input, EV_REL, value ? REL_HWHEEL : 91 input_event(input, EV_REL, value ? REL_HWHEEL :
69 REL_WHEEL, a4->delayed_value); 92 REL_WHEEL, a4->delayed_value);
70 input_event(input, EV_REL, value ? REL_HWHEEL_HI_RES : 93 input_event(input, EV_REL, value ? REL_HWHEEL_HI_RES :
@@ -131,6 +154,7 @@ MODULE_DEVICE_TABLE(hid, a4_devices);
131static struct hid_driver a4_driver = { 154static struct hid_driver a4_driver = {
132 .name = "a4tech", 155 .name = "a4tech",
133 .id_table = a4_devices, 156 .id_table = a4_devices,
157 .input_mapping = a4_input_mapping,
134 .input_mapped = a4_input_mapped, 158 .input_mapped = a4_input_mapped,
135 .event = a4_event, 159 .event = a4_event,
136 .probe = a4_probe, 160 .probe = a4_probe,