Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / usb / gadget / function / u_uvc.h
1 /*
2  * u_uvc.h
3  *
4  * Utility definitions for the uvc function
5  *
6  * Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
7  *              http://www.samsung.com
8  *
9  * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2 as
13  * published by the Free Software Foundation.
14  */
15
16 #ifndef U_UVC_H
17 #define U_UVC_H
18
19 #include <linux/usb/composite.h>
20 #include <linux/usb/video.h>
21
22 #define fi_to_f_uvc_opts(f)     container_of(f, struct f_uvc_opts, func_inst)
23
24 struct f_uvc_opts {
25         struct usb_function_instance                    func_inst;
26         unsigned int                                    uvc_gadget_trace_param;
27         unsigned int                                    streaming_interval;
28         unsigned int                                    streaming_maxpacket;
29         unsigned int                                    streaming_maxburst;
30
31         /*
32          * Control descriptors array pointers for full-/high-speed and
33          * super-speed. They point by default to the uvc_fs_control_cls and
34          * uvc_ss_control_cls arrays respectively. Legacy gadgets must
35          * override them in their gadget bind callback.
36          */
37         const struct uvc_descriptor_header * const      *fs_control;
38         const struct uvc_descriptor_header * const      *ss_control;
39
40         /*
41          * Streaming descriptors array pointers for full-speed, high-speed and
42          * super-speed. They will point to the uvc_[fhs]s_streaming_cls arrays
43          * for configfs-based gadgets. Legacy gadgets must initialize them in
44          * their gadget bind callback.
45          */
46         const struct uvc_descriptor_header * const      *fs_streaming;
47         const struct uvc_descriptor_header * const      *hs_streaming;
48         const struct uvc_descriptor_header * const      *ss_streaming;
49
50         /* Default control descriptors for configfs-based gadgets. */
51         struct uvc_camera_terminal_descriptor           uvc_camera_terminal;
52         struct uvc_processing_unit_descriptor           uvc_processing;
53         struct uvc_output_terminal_descriptor           uvc_output_terminal;
54         struct uvc_color_matching_descriptor            uvc_color_matching;
55
56         /*
57          * Control descriptors pointers arrays for full-/high-speed and
58          * super-speed. The first element is a configurable control header
59          * descriptor, the other elements point to the fixed default control
60          * descriptors. Used by configfs only, must not be touched by legacy
61          * gadgets.
62          */
63         struct uvc_descriptor_header                    *uvc_fs_control_cls[5];
64         struct uvc_descriptor_header                    *uvc_ss_control_cls[5];
65
66         /*
67          * Streaming descriptors for full-speed, high-speed and super-speed.
68          * Used by configfs only, must not be touched by legacy gadgets. The
69          * arrays are allocated at runtime as the number of descriptors isn't
70          * known in advance.
71          */
72         struct uvc_descriptor_header                    **uvc_fs_streaming_cls;
73         struct uvc_descriptor_header                    **uvc_hs_streaming_cls;
74         struct uvc_descriptor_header                    **uvc_ss_streaming_cls;
75
76         /*
77          * Read/write access to configfs attributes is handled by configfs.
78          *
79          * This lock protects the descriptors from concurrent access by
80          * read/write and symlink creation/removal.
81          */
82         struct mutex                    lock;
83         int                             refcnt;
84 };
85
86 void uvc_set_trace_param(unsigned int trace);
87
88 #endif /* U_UVC_H */
89