Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / usb / gadget / function / g_zero.h
1 /*
2  * This header declares the utility functions used by "Gadget Zero", plus
3  * interfaces to its two single-configuration function drivers.
4  */
5
6 #ifndef __G_ZERO_H
7 #define __G_ZERO_H
8
9 #define GZERO_BULK_BUFLEN       4096
10 #define GZERO_QLEN              32
11 #define GZERO_ISOC_INTERVAL     4
12 #define GZERO_ISOC_MAXPACKET    1024
13 #define GZERO_INT_INTERVAL      1 /* Default interrupt interval = 1 ms */
14 #define GZERO_INT_MAXPACKET     1024
15
16 struct usb_zero_options {
17         unsigned pattern;
18         unsigned isoc_interval;
19         unsigned isoc_maxpacket;
20         unsigned isoc_mult;
21         unsigned isoc_maxburst;
22         unsigned int_interval; /* In ms */
23         unsigned int_maxpacket;
24         unsigned int_mult;
25         unsigned int_maxburst;
26         unsigned bulk_buflen;
27         unsigned qlen;
28 };
29
30 struct f_ss_opts {
31         struct usb_function_instance func_inst;
32         unsigned pattern;
33         unsigned isoc_interval;
34         unsigned isoc_maxpacket;
35         unsigned isoc_mult;
36         unsigned isoc_maxburst;
37         unsigned int_interval; /* In ms */
38         unsigned int_maxpacket;
39         unsigned int_mult;
40         unsigned int_maxburst;
41         unsigned bulk_buflen;
42
43         /*
44          * Read/write access to configfs attributes is handled by configfs.
45          *
46          * This is to protect the data from concurrent access by read/write
47          * and create symlink/remove symlink.
48          */
49         struct mutex                    lock;
50         int                             refcnt;
51 };
52
53 struct f_lb_opts {
54         struct usb_function_instance func_inst;
55         unsigned bulk_buflen;
56         unsigned qlen;
57
58         /*
59          * Read/write access to configfs attributes is handled by configfs.
60          *
61          * This is to protect the data from concurrent access by read/write
62          * and create symlink/remove symlink.
63          */
64         struct mutex                    lock;
65         int                             refcnt;
66 };
67
68 void lb_modexit(void);
69 int lb_modinit(void);
70
71 /* common utilities */
72 void free_ep_req(struct usb_ep *ep, struct usb_request *req);
73 void disable_endpoints(struct usb_composite_dev *cdev,
74                 struct usb_ep *in, struct usb_ep *out,
75                 struct usb_ep *iso_in, struct usb_ep *iso_out,
76                 struct usb_ep *int_in, struct usb_ep *int_out);
77
78 #endif /* __G_ZERO_H */