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 | |
| 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')
46 files changed, 28686 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile new file mode 100644 index 000000000000..6d91f21b52a6 --- /dev/null +++ b/drivers/usb/gadget/function/Makefile | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | # | ||
| 2 | # USB peripheral controller drivers | ||
| 3 | # | ||
| 4 | |||
| 5 | ccflags-y := -I$(PWD)/drivers/usb/gadget/ | ||
| 6 | ccflags-y += -I$(PWD)/drivers/usb/gadget/udc/ | ||
| 7 | |||
| 8 | # USB Functions | ||
| 9 | usb_f_acm-y := f_acm.o | ||
| 10 | obj-$(CONFIG_USB_F_ACM) += usb_f_acm.o | ||
| 11 | usb_f_ss_lb-y := f_loopback.o f_sourcesink.o | ||
| 12 | obj-$(CONFIG_USB_F_SS_LB) += usb_f_ss_lb.o | ||
| 13 | obj-$(CONFIG_USB_U_SERIAL) += u_serial.o | ||
| 14 | usb_f_serial-y := f_serial.o | ||
| 15 | obj-$(CONFIG_USB_F_SERIAL) += usb_f_serial.o | ||
| 16 | usb_f_obex-y := f_obex.o | ||
| 17 | obj-$(CONFIG_USB_F_OBEX) += usb_f_obex.o | ||
| 18 | obj-$(CONFIG_USB_U_ETHER) += u_ether.o | ||
| 19 | usb_f_ncm-y := f_ncm.o | ||
| 20 | obj-$(CONFIG_USB_F_NCM) += usb_f_ncm.o | ||
| 21 | usb_f_ecm-y := f_ecm.o | ||
| 22 | obj-$(CONFIG_USB_F_ECM) += usb_f_ecm.o | ||
| 23 | usb_f_phonet-y := f_phonet.o | ||
| 24 | obj-$(CONFIG_USB_F_PHONET) += usb_f_phonet.o | ||
| 25 | usb_f_eem-y := f_eem.o | ||
| 26 | obj-$(CONFIG_USB_F_EEM) += usb_f_eem.o | ||
| 27 | usb_f_ecm_subset-y := f_subset.o | ||
| 28 | obj-$(CONFIG_USB_F_SUBSET) += usb_f_ecm_subset.o | ||
| 29 | usb_f_rndis-y := f_rndis.o rndis.o | ||
| 30 | obj-$(CONFIG_USB_F_RNDIS) += usb_f_rndis.o | ||
| 31 | usb_f_mass_storage-y := f_mass_storage.o storage_common.o | ||
| 32 | obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o | ||
| 33 | usb_f_fs-y := f_fs.o | ||
| 34 | obj-$(CONFIG_USB_F_FS) += usb_f_fs.o | ||
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c new file mode 100644 index 000000000000..ab1065afbbd0 --- /dev/null +++ b/drivers/usb/gadget/function/f_acm.c | |||
| @@ -0,0 +1,848 @@ | |||
| 1 | /* | ||
| 2 | * f_acm.c -- USB CDC serial (ACM) function driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2003 Al Borchers (alborchers@steinerpoint.com) | ||
| 5 | * Copyright (C) 2008 by David Brownell | ||
| 6 | * Copyright (C) 2008 by Nokia Corporation | ||
| 7 | * Copyright (C) 2009 by Samsung Electronics | ||
| 8 | * Author: Michal Nazarewicz (mina86@mina86.com) | ||
| 9 | * | ||
| 10 | * This software is distributed under the terms of the GNU General | ||
| 11 | * Public License ("GPL") as published by the Free Software Foundation, | ||
| 12 | * either version 2 of that License or (at your option) any later version. | ||
| 13 | */ | ||
| 14 | |||
| 15 | /* #define VERBOSE_DEBUG */ | ||
| 16 | |||
| 17 | #include <linux/slab.h> | ||
| 18 | #include <linux/kernel.h> | ||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/device.h> | ||
| 21 | #include <linux/err.h> | ||
| 22 | |||
| 23 | #include "u_serial.h" | ||
| 24 | #include "gadget_chips.h" | ||
| 25 | |||
| 26 | |||
| 27 | /* | ||
| 28 | * This CDC ACM function support just wraps control functions and | ||
| 29 | * notifications around the generic serial-over-usb code. | ||
| 30 | * | ||
| 31 | * Because CDC ACM is standardized by the USB-IF, many host operating | ||
| 32 | * systems have drivers for it. Accordingly, ACM is the preferred | ||
| 33 | * interop solution for serial-port type connections. The control | ||
| 34 | * models are often not necessary, and in any case don't do much in | ||
| 35 | * this bare-bones implementation. | ||
| 36 | * | ||
| 37 | * Note that even MS-Windows has some support for ACM. However, that | ||
| 38 | * support is somewhat broken because when you use ACM in a composite | ||
| 39 | * device, having multiple interfaces confuses the poor OS. It doesn't | ||
| 40 | * seem to understand CDC Union descriptors. The new "association" | ||
| 41 | * descriptors (roughly equivalent to CDC Unions) may sometimes help. | ||
| 42 | */ | ||
| 43 | |||
| 44 | struct f_acm { | ||
| 45 | struct gserial port; | ||
| 46 | u8 ctrl_id, data_id; | ||
| 47 | u8 port_num; | ||
| 48 | |||
| 49 | u8 pending; | ||
| 50 | |||
| 51 | /* lock is mostly for pending and notify_req ... they get accessed | ||
| 52 | * by callbacks both from tty (open/close/break) under its spinlock, | ||
| 53 | * and notify_req.complete() which can't use that lock. | ||
| 54 | */ | ||
| 55 | spinlock_t lock; | ||
| 56 | |||
| 57 | struct usb_ep *notify; | ||
| 58 | struct usb_request *notify_req; | ||
| 59 | |||
| 60 | struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */ | ||
| 61 | |||
| 62 | /* SetControlLineState request -- CDC 1.1 section 6.2.14 (INPUT) */ | ||
| 63 | u16 port_handshake_bits; | ||
| 64 | #define ACM_CTRL_RTS (1 << 1) /* unused with full duplex */ | ||
| 65 | #define ACM_CTRL_DTR (1 << 0) /* host is ready for data r/w */ | ||
| 66 | |||
| 67 | /* SerialState notification -- CDC 1.1 section 6.3.5 (OUTPUT) */ | ||
| 68 | u16 serial_state; | ||
| 69 | #define ACM_CTRL_OVERRUN (1 << 6) | ||
| 70 | #define ACM_CTRL_PARITY (1 << 5) | ||
| 71 | #define ACM_CTRL_FRAMING (1 << 4) | ||
| 72 | #define ACM_CTRL_RI (1 << 3) | ||
| 73 | #define ACM_CTRL_BRK (1 << 2) | ||
| 74 | #define ACM_CTRL_DSR (1 << 1) | ||
| 75 | #define ACM_CTRL_DCD (1 << 0) | ||
| 76 | }; | ||
| 77 | |||
| 78 | static inline struct f_acm *func_to_acm(struct usb_function *f) | ||
| 79 | { | ||
| 80 | return container_of(f, struct f_acm, port.func); | ||
| 81 | } | ||
| 82 | |||
| 83 | static inline struct f_acm *port_to_acm(struct gserial *p) | ||
| 84 | { | ||
| 85 | return container_of(p, struct f_acm, port); | ||
| 86 | } | ||
| 87 | |||
| 88 | /*-------------------------------------------------------------------------*/ | ||
| 89 | |||
