aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2014-07-15 07:09:46 -0400
committerFelipe Balbi <balbi@ti.com>2014-07-16 13:50:36 -0400
commit00a2430ff07d4e0e0e7e24e02fd8adede333b797 (patch)
treefd6680b6a8941ac1a3149ae4b77f159701bb1a61 /drivers/usb/gadget/function
parent90fccb529d241b55829701cfb9eb3086570f38b8 (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')
-rw-r--r--drivers/usb/gadget/function/Makefile34
-rw-r--r--drivers/usb/gadget/function/f_acm.c848
-rw-r--r--drivers/usb/gadget/function/f_ecm.c973
-rw-r--r--drivers/usb/gadget/function/f_eem.c660
-rw-r--r--drivers/usb/gadget/function/f_fs.c3347
-rw-r--r--drivers/usb/gadget/function/f_hid.c763
-rw-r--r--drivers/usb/gadget/function/f_loopback.c571
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c3668
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.h166
-rw-r--r--drivers/usb/gadget/function/f_midi.c986
-rw-r--r--drivers/usb/gadget/function/f_ncm.c1622
-rw-r--r--drivers/usb/gadget/function/f_obex.c533
-rw-r--r--drivers/usb/gadget/function/f_phonet.c758
-rw-r--r--drivers/usb/gadget/function/f_rndis.c1029
-rw-r--r--drivers/usb/gadget/function/f_serial.c385
-rw-r--r--drivers/usb/gadget/function/f_sourcesink.c1247
-rw-r--r--drivers/usb/gadget/function/f_subset.c519
-rw-r--r--drivers/usb/gadget/function/f_uac1.c768
-rw-r--r--drivers/usb/gadget/function/f_uac2.c1354
-rw-r--r--drivers/usb/gadget/function/f_uvc.c836
-rw-r--r--drivers/usb/gadget/function/f_uvc.h27
-rw-r--r--drivers/usb/gadget/function/g_zero.h67
-rw-r--r--drivers/usb/gadget/function/ndis.h47
-rw-r--r--drivers/usb/gadget/function/rndis.c1190
-rw-r--r--drivers/usb/gadget/function/rndis.h220
-rw-r--r--drivers/usb/gadget/function/storage_common.c504
-rw-r--r--drivers/usb/gadget/function/storage_common.h225
-rw-r--r--drivers/usb/gadget/function/u_ecm.h36
-rw-r--r--drivers/usb/gadget/function/u_eem.h36
-rw-r--r--drivers/usb/gadget/function/u_ether.c1179
-rw-r--r--drivers/usb/gadget/function/u_ether.h272
-rw-r--r--drivers/usb/gadget/function/u_ether_configfs.h164
-rw-r--r--drivers/usb/gadget/function/u_fs.h270
-rw-r--r--drivers/usb/gadget/function/u_gether.h36
-rw-r--r--drivers/usb/gadget/function/u_ncm.h36
-rw-r--r--drivers/usb/gadget/function/u_phonet.h29
-rw-r--r--drivers/usb/gadget/function/u_rndis.h46
-rw-r--r--drivers/usb/gadget/function/u_serial.c1347
-rw-r--r--drivers/usb/gadget/function/u_serial.h71
-rw-r--r--drivers/usb/gadget/function/u_uac1.c330
-rw-r--r--drivers/usb/gadget/function/u_uac1.h56
-rw-r--r--drivers/usb/gadget/function/uvc.h202
-rw-r--r--drivers/usb/gadget/function/uvc_queue.c407
-rw-r--r--drivers/usb/gadget/function/uvc_queue.h63
-rw-r--r--drivers/usb/gadget/function/uvc_v4l2.c365
-rw-r--r--drivers/usb/gadget/function/uvc_video.c394
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
5ccflags-y := -I$(PWD)/drivers/usb/gadget/
6ccflags-y += -I$(PWD)/drivers/usb/gadget/udc/
7
8# USB Functions
9usb_f_acm-y := f_acm.o
10obj-$(CONFIG_USB_F_ACM) += usb_f_acm.o
11usb_f_ss_lb-y := f_loopback.o f_sourcesink.o
12obj-$(CONFIG_USB_F_SS_LB) += usb_f_ss_lb.o
13obj-$(CONFIG_USB_U_SERIAL) += u_serial.o
14usb_f_serial-y := f_serial.o
15obj-$(CONFIG_USB_F_SERIAL) += usb_f_serial.o
16usb_f_obex-y := f_obex.o
17obj-$(CONFIG_USB_F_OBEX) += usb_f_obex.o
18obj-$(CONFIG_USB_U_ETHER) += u_ether.o
19usb_f_ncm-y := f_ncm.o
20obj-$(CONFIG_USB_F_NCM) += usb_f_ncm.o
21usb_f_ecm-y := f_ecm.o
22obj-$(CONFIG_USB_F_ECM) += usb_f_ecm.o
23usb_f_phonet-y := f_phonet.o
24obj-$(CONFIG_USB_F_PHONET) += usb_f_phonet.o
25usb_f_eem-y := f_eem.o
26obj-$(CONFIG_USB_F_EEM) += usb_f_eem.o
27usb_f_ecm_subset-y := f_subset.o
28obj-$(CONFIG_USB_F_SUBSET) += usb_f_ecm_subset.o
29usb_f_rndis-y := f_rndis.o rndis.o
30obj-$(CONFIG_USB_F_RNDIS) += usb_f_rndis.o
31usb_f_mass_storage-y := f_mass_storage.o storage_common.o
32obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o
33usb_f_fs-y := f_fs.o
34obj-$(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
44struct 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
78static inline struct f_acm *func_to_acm(struct usb_function *f)
79{
80 return container_of(f, struct f_acm, port.func);
81}
82
83static inline struct f_acm *port_to_acm(struct gserial *p)
84{
85 return container_of(p, struct f_acm, port);
86}
87
88/*-------------------------------------------------------------------------*/
89