diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2014-07-15 07:09:46 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-07-16 13:50:36 -0400 |
commit | 00a2430ff07d4e0e0e7e24e02fd8adede333b797 (patch) | |
tree | fd6680b6a8941ac1a3149ae4b77f159701bb1a61 /drivers/usb/gadget/function/u_serial.h | |
parent | 90fccb529d241b55829701cfb9eb3086570f38b8 (diff) |
usb: gadget: Gadget directory cleanup - group usb functions
The drivers/usb/gadget directory contains many files.
Files which are related can be distributed into separate directories.
This patch moves the USB functions implementations into a separate directory.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function/u_serial.h')
-rw-r--r-- | drivers/usb/gadget/function/u_serial.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/u_serial.h b/drivers/usb/gadget/function/u_serial.h new file mode 100644 index 000000000000..c20210c0babd --- /dev/null +++ b/drivers/usb/gadget/function/u_serial.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * u_serial.h - interface to USB gadget "serial port"/TTY utilities | ||
3 | * | ||
4 | * Copyright (C) 2008 David Brownell | ||
5 | * Copyright (C) 2008 by Nokia Corporation | ||
6 | * | ||
7 | * This software is distributed under the terms of the GNU General | ||
8 | * Public License ("GPL") as published by the Free Software Foundation, | ||
9 | * either version 2 of that License or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __U_SERIAL_H | ||
13 | #define __U_SERIAL_H | ||
14 | |||
15 | #include <linux/usb/composite.h> | ||
16 | #include <linux/usb/cdc.h> | ||
17 | |||
18 | #define MAX_U_SERIAL_PORTS 4 | ||
19 | |||
20 | struct f_serial_opts { | ||
21 | struct usb_function_instance func_inst; | ||
22 | u8 port_num; | ||
23 | }; | ||
24 | |||
25 | /* | ||
26 | * One non-multiplexed "serial" I/O port ... there can be several of these | ||
27 | * on any given USB peripheral device, if it provides enough endpoints. | ||
28 | * | ||
29 | * The "u_serial" utility component exists to do one thing: manage TTY | ||
30 | * style I/O using the USB peripheral endpoints listed here, including | ||
31 | * hookups to sysfs and /dev for each logical "tty" device. | ||
32 | * | ||
33 | * REVISIT at least ACM could support tiocmget() if needed. | ||
34 | * | ||
35 | * REVISIT someday, allow multiplexing several TTYs over these endpoints. | ||
36 | */ | ||
37 | struct gserial { | ||
38 | struct usb_function func; | ||
39 | |||
40 | /* port is managed by gserial_{connect,disconnect} */ | ||
41 | struct gs_port *ioport; | ||
42 | |||
43 | struct usb_ep *in; | ||
44 | struct usb_ep *out; | ||
45 | |||
46 | /* REVISIT avoid this CDC-ACM support harder ... */ | ||
47 | struct usb_cdc_line_coding port_line_coding; /* 9600-8-N-1 etc */ | ||
48 | |||
49 | /* notification callbacks */ | ||
50 | void (*connect)(struct gserial *p); | ||
51 | void (*disconnect)(struct gserial *p); | ||
52 | int (*send_break)(struct gserial *p, int duration); | ||
53 | }; | ||
54 | |||
55 | /* utilities to allocate/free request and buffer */ | ||
56 | struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned len, gfp_t flags); | ||
57 | void gs_free_req(struct usb_ep *, struct usb_request *req); | ||
58 | |||
59 | /* management of individual TTY ports */ | ||
60 | int gserial_alloc_line(unsigned char *port_line); | ||
61 | void gserial_free_line(unsigned char port_line); | ||
62 | |||
63 | /* connect/disconnect is handled by individual functions */ | ||
64 | int gserial_connect(struct gserial *, u8 port_num); | ||
65 | void gserial_disconnect(struct gserial *); | ||
66 | |||
67 | /* functions are bound to configurations by a config or gadget driver */ | ||
68 | int gser_bind_config(struct usb_configuration *c, u8 port_num); | ||
69 | int obex_bind_config(struct usb_configuration *c, u8 port_num); | ||
70 | |||
71 | #endif /* __U_SERIAL_H */ | ||