]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/hid/usbhid/usbhid.h
HID: Add quirk for Xin-Mo Dual Controller
[mirror_ubuntu-bionic-kernel.git] / drivers / hid / usbhid / usbhid.h
CommitLineData
4916b3a5
JK
1#ifndef __USBHID_H
2#define __USBHID_H
3
4/*
5 * Copyright (c) 1999 Andreas Gal
6 * Copyright (c) 2000-2001 Vojtech Pavlik
7 * Copyright (c) 2006 Jiri Kosina
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <linux/types.h>
28#include <linux/slab.h>
29#include <linux/list.h>
3d5afd32 30#include <linux/mutex.h>
4916b3a5 31#include <linux/timer.h>
1d1bdd20 32#include <linux/wait.h>
4916b3a5
JK
33#include <linux/workqueue.h>
34#include <linux/input.h>
35
36/* API provided by hid-core.c for USB HID drivers */
4916b3a5 37void usbhid_init_reports(struct hid_device *hid);
8fe294ca 38struct usb_interface *usbhid_find_interface(int minor);
4916b3a5 39
0ed94b33
JS
40/* iofl flags */
41#define HID_CTRL_RUNNING 1
42#define HID_OUT_RUNNING 2
43#define HID_IN_RUNNING 3
44#define HID_RESET_PENDING 4
45#define HID_SUSPENDED 5
46#define HID_CLEAR_HALT 6
47#define HID_DISCONNECTED 7
48#define HID_STARTED 8
0361a28d 49#define HID_KEYS_PRESSED 10
a8c52b66 50#define HID_NO_BANDWIDTH 11
b905811a 51#define HID_RESUME_RUNNING 12
28cbc863
DT
52/*
53 * The device is opened, meaning there is a client that is interested
54 * in data coming from the device.
55 */
56#define HID_OPENED 13
57/*
58 * We are polling input endpoint by [re]submitting IN URB, because
59 * either HID device is opened or ALWAYS POLL quirk is set for the
60 * device.
61 */
62#define HID_IN_POLLING 14
0ed94b33 63
4916b3a5
JK
64/*
65 * USB-specific HID struct, to be pointed to
66 * from struct hid_device->driver_data
67 */
68
69struct usbhid_device {
70 struct hid_device *hid; /* pointer to corresponding HID dev */
71
72 struct usb_interface *intf; /* USB interface */
73 int ifnum; /* USB interface number */
74
75 unsigned int bufsize; /* URB buffer size */
76
77 struct urb *urbin; /* Input URB */
78 char *inbuf; /* Input buffer */
79 dma_addr_t inbuf_dma; /* Input buffer dma */
4916b3a5
JK
80
81 struct urb *urbctrl; /* Control URB */
82 struct usb_ctrlrequest *cr; /* Control request struct */
4916b3a5
JK
83 struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE]; /* Control fifo */
84 unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */
85 char *ctrlbuf; /* Control buffer */
86 dma_addr_t ctrlbuf_dma; /* Control buffer dma */
858155fb 87 unsigned long last_ctrl; /* record of last output for timeouts */
4916b3a5
JK
88
89 struct urb *urbout; /* Output URB */
f129ea6d 90 struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */
4916b3a5
JK
91 unsigned char outhead, outtail; /* Output pipe fifo head & tail */
92 char *outbuf; /* Output buffer */
93 dma_addr_t outbuf_dma; /* Output buffer dma */
858155fb 94 unsigned long last_out; /* record of last output for timeouts */
4916b3a5 95
0361a28d 96 spinlock_t lock; /* fifo spinlock */
4916b3a5
JK
97 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
98 struct timer_list io_retry; /* Retry timer */
99 unsigned long stop_retry; /* Time to give up, in jiffies */
100 unsigned int retry_delay; /* Delay length in ms */
101 struct work_struct reset_work; /* Task context for resets */
1d1bdd20 102 wait_queue_head_t wait; /* For sleeping */
4916b3a5
JK
103};
104
be820975 105#define hid_to_usb_dev(hid_dev) \
7775fb92 106 to_usb_device(hid_dev->dev.parent->parent)
be820975 107
4916b3a5
JK
108#endif
109