Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 2 | /* |
| 3 | * This header declares the utility functions used by "Gadget Zero", plus |
| 4 | * interfaces to its two single-configuration function drivers. |
| 5 | */ |
| 6 | |
| 7 | #ifndef __G_ZERO_H |
| 8 | #define __G_ZERO_H |
| 9 | |
Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 10 | #define GZERO_BULK_BUFLEN 4096 |
| 11 | #define GZERO_QLEN 32 |
Andrzej Pietrasiewicz | 25d8015 | 2013-11-07 08:41:28 +0100 | [diff] [blame] | 12 | #define GZERO_ISOC_INTERVAL 4 |
| 13 | #define GZERO_ISOC_MAXPACKET 1024 |
Peter Chen | 0d6c3d9 | 2015-11-19 15:02:16 +0800 | [diff] [blame] | 14 | #define GZERO_SS_BULK_QLEN 1 |
| 15 | #define GZERO_SS_ISO_QLEN 8 |
Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 16 | |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 17 | struct usb_zero_options { |
| 18 | unsigned pattern; |
| 19 | unsigned isoc_interval; |
| 20 | unsigned isoc_maxpacket; |
| 21 | unsigned isoc_mult; |
| 22 | unsigned isoc_maxburst; |
| 23 | unsigned bulk_buflen; |
| 24 | unsigned qlen; |
Peter Chen | 0d6c3d9 | 2015-11-19 15:02:16 +0800 | [diff] [blame] | 25 | unsigned ss_bulk_qlen; |
| 26 | unsigned ss_iso_qlen; |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 27 | }; |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 28 | |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 29 | struct f_ss_opts { |
| 30 | struct usb_function_instance func_inst; |
| 31 | unsigned pattern; |
| 32 | unsigned isoc_interval; |
| 33 | unsigned isoc_maxpacket; |
| 34 | unsigned isoc_mult; |
| 35 | unsigned isoc_maxburst; |
| 36 | unsigned bulk_buflen; |
Peter Chen | 0d6c3d9 | 2015-11-19 15:02:16 +0800 | [diff] [blame] | 37 | unsigned bulk_qlen; |
| 38 | unsigned iso_qlen; |
Andrzej Pietrasiewicz | 25d8015 | 2013-11-07 08:41:28 +0100 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * Read/write access to configfs attributes is handled by configfs. |
| 42 | * |
| 43 | * This is to protect the data from concurrent access by read/write |
| 44 | * and create symlink/remove symlink. |
| 45 | */ |
| 46 | struct mutex lock; |
| 47 | int refcnt; |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | struct f_lb_opts { |
| 51 | struct usb_function_instance func_inst; |
| 52 | unsigned bulk_buflen; |
| 53 | unsigned qlen; |
Andrzej Pietrasiewicz | c0501f4 | 2013-11-07 08:41:27 +0100 | [diff] [blame] | 54 | |
| 55 | /* |
| 56 | * Read/write access to configfs attributes is handled by configfs. |
| 57 | * |
| 58 | * This is to protect the data from concurrent access by read/write |
| 59 | * and create symlink/remove symlink. |
| 60 | */ |
| 61 | struct mutex lock; |
| 62 | int refcnt; |
Sebastian Andrzej Siewior | cf9a08a | 2012-12-23 21:10:01 +0100 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | void lb_modexit(void); |
| 66 | int lb_modinit(void); |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 67 | |
| 68 | /* common utilities */ |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 69 | void disable_endpoints(struct usb_composite_dev *cdev, |
Paul Zimmerman | b4036cc | 2012-04-16 14:19:06 -0700 | [diff] [blame] | 70 | struct usb_ep *in, struct usb_ep *out, |
Felipe Balbi | 2c24780 | 2015-03-11 10:00:05 -0500 | [diff] [blame] | 71 | struct usb_ep *iso_in, struct usb_ep *iso_out); |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 72 | |
David Brownell | a400cad | 2008-06-19 17:55:23 -0700 | [diff] [blame] | 73 | #endif /* __G_ZERO_H */ |