License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2008-07-01 02:04:50 +08:00
|
|
|
#ifndef _USB_VIDEO_H_
|
|
|
|
#define _USB_VIDEO_H_
|
|
|
|
|
2010-11-22 04:15:44 +08:00
|
|
|
#ifndef __KERNEL__
|
2011-07-31 03:19:49 +08:00
|
|
|
#error "The uvcvideo.h header is deprecated, use linux/uvcvideo.h instead."
|
|
|
|
#endif /* __KERNEL__ */
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2011-07-31 03:19:49 +08:00
|
|
|
#include <linux/kernel.h>
|
2008-07-01 02:04:50 +08:00
|
|
|
#include <linux/poll.h>
|
2010-01-21 16:39:52 +08:00
|
|
|
#include <linux/usb.h>
|
2009-06-26 23:15:38 +08:00
|
|
|
#include <linux/usb/video.h>
|
2010-11-22 04:15:44 +08:00
|
|
|
#include <linux/uvcvideo.h>
|
2011-07-31 03:19:49 +08:00
|
|
|
#include <linux/videodev2.h>
|
2018-07-26 16:17:53 +08:00
|
|
|
#include <linux/workqueue.h>
|
2010-01-21 16:39:47 +08:00
|
|
|
#include <media/media-device.h>
|
|
|
|
#include <media/v4l2-device.h>
|
2012-04-08 23:59:51 +08:00
|
|
|
#include <media/v4l2-event.h>
|
|
|
|
#include <media/v4l2-fh.h>
|
2015-09-22 21:30:29 +08:00
|
|
|
#include <media/videobuf2-v4l2.h>
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
* UVC constants
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define UVC_TERM_INPUT 0x0000
|
|
|
|
#define UVC_TERM_OUTPUT 0x8000
|
2009-11-25 23:00:22 +08:00
|
|
|
#define UVC_TERM_DIRECTION(term) ((term)->type & 0x8000)
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
#define UVC_ENTITY_TYPE(entity) ((entity)->type & 0x7fff)
|
|
|
|
#define UVC_ENTITY_IS_UNIT(entity) (((entity)->type & 0xff00) == 0)
|
|
|
|
#define UVC_ENTITY_IS_TERM(entity) (((entity)->type & 0xff00) != 0)
|
|
|
|
#define UVC_ENTITY_IS_ITERM(entity) \
|
2009-07-02 07:24:47 +08:00
|
|
|
(UVC_ENTITY_IS_TERM(entity) && \
|
|
|
|
((entity)->type & 0x8000) == UVC_TERM_INPUT)
|
2008-07-01 02:04:50 +08:00
|
|
|
#define UVC_ENTITY_IS_OTERM(entity) \
|
2009-07-02 07:24:47 +08:00
|
|
|
(UVC_ENTITY_IS_TERM(entity) && \
|
|
|
|
((entity)->type & 0x8000) == UVC_TERM_OUTPUT)
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------
|
|
|
|
* GUIDs
|
|
|
|
*/
|
|
|
|
#define UVC_GUID_UVC_CAMERA \
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
|
|
|
|
#define UVC_GUID_UVC_OUTPUT \
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
|
|
|
|
#define UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT \
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
|
|
|
|
#define UVC_GUID_UVC_PROCESSING \
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}
|
|
|
|
#define UVC_GUID_UVC_SELECTOR \
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02}
|
|
|
|
|
|
|
|
#define UVC_GUID_FORMAT_MJPEG \
|
|
|
|
{ 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_YUY2 \
|
|
|
|
{ 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2009-12-13 01:57:17 +08:00
|
|
|
#define UVC_GUID_FORMAT_YUY2_ISIGHT \
|
|
|
|
{ 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71}
|
2008-07-01 02:04:50 +08:00
|
|
|
#define UVC_GUID_FORMAT_NV12 \
|
|
|
|
{ 'N', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_YV12 \
|
|
|
|
{ 'Y', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_I420 \
|
|
|
|
{ 'I', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_UYVY \
|
|
|
|
{ 'U', 'Y', 'V', 'Y', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_Y800 \
|
|
|
|
{ 'Y', '8', '0', '0', 0x00, 0x00, 0x10, 0x00, \
|
2012-07-29 06:49:14 +08:00
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_Y8 \
|
|
|
|
{ 'Y', '8', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_Y10 \
|
|
|
|
{ 'Y', '1', '0', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_Y12 \
|
|
|
|
{ 'Y', '1', '2', ' ', 0x00, 0x00, 0x10, 0x00, \
|
2008-07-01 02:04:50 +08:00
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2010-04-12 21:41:22 +08:00
|
|
|
#define UVC_GUID_FORMAT_Y16 \
|
|
|
|
{ 'Y', '1', '6', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2008-07-01 02:04:50 +08:00
|
|
|
#define UVC_GUID_FORMAT_BY8 \
|
|
|
|
{ 'B', 'Y', '8', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2014-02-20 15:12:51 +08:00
|
|
|
#define UVC_GUID_FORMAT_BA81 \
|
|
|
|
{ 'B', 'A', '8', '1', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_GBRG \
|
|
|
|
{ 'G', 'B', 'R', 'G', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_GRBG \
|
|
|
|
{ 'G', 'R', 'B', 'G', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_RGGB \
|
|
|
|
{ 'R', 'G', 'G', 'B', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2016-11-15 13:33:10 +08:00
|
|
|
#define UVC_GUID_FORMAT_BG16 \
|
|
|
|
{ 'B', 'G', '1', '6', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_GB16 \
|
|
|
|
{ 'G', 'B', '1', '6', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_RG16 \
|
|
|
|
{ 'R', 'G', '1', '6', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_GR16 \
|
|
|
|
{ 'G', 'R', '1', '6', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2011-03-06 19:32:04 +08:00
|
|
|
#define UVC_GUID_FORMAT_RGBP \
|
|
|
|
{ 'R', 'G', 'B', 'P', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2014-12-09 02:57:58 +08:00
|
|
|
#define UVC_GUID_FORMAT_BGR3 \
|
|
|
|
{ 0x7d, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
|
|
|
|
0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
|
2011-05-11 20:56:20 +08:00
|
|
|
#define UVC_GUID_FORMAT_M420 \
|
|
|
|
{ 'M', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2011-01-29 03:38:58 +08:00
|
|
|
#define UVC_GUID_FORMAT_H264 \
|
|
|
|
{ 'H', '2', '6', '4', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2016-02-04 01:08:52 +08:00
|
|
|
#define UVC_GUID_FORMAT_Y8I \
|
|
|
|
{ 'Y', '8', 'I', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_Y12I \
|
|
|
|
{ 'Y', '1', '2', 'I', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_Z16 \
|
|
|
|
{ 'Z', '1', '6', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
|
|
|
#define UVC_GUID_FORMAT_RW10 \
|
|
|
|
{ 'R', 'W', '1', '0', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2017-03-03 07:43:20 +08:00
|
|
|
#define UVC_GUID_FORMAT_INVZ \
|
|
|
|
{ 'I', 'N', 'V', 'Z', 0x90, 0x2d, 0x58, 0x4a, \
|
|
|
|
0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
|
|
|
|
#define UVC_GUID_FORMAT_INZI \
|
|
|
|
{ 'I', 'N', 'Z', 'I', 0x66, 0x1a, 0x42, 0xa2, \
|
|
|
|
0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
|
|
|
|
#define UVC_GUID_FORMAT_INVI \
|
|
|
|
{ 'I', 'N', 'V', 'I', 0xdb, 0x57, 0x49, 0x5e, \
|
|
|
|
0x8e, 0x3f, 0xf4, 0x79, 0x53, 0x2b, 0x94, 0x6f}
|
2018-09-12 14:42:07 +08:00
|
|
|
#define UVC_GUID_FORMAT_CNF4 \
|
|
|
|
{ 'C', ' ', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2011-01-29 03:38:58 +08:00
|
|
|
|
2017-11-07 04:13:28 +08:00
|
|
|
#define UVC_GUID_FORMAT_D3DFMT_L8 \
|
|
|
|
{0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2018-03-21 17:16:40 +08:00
|
|
|
#define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
|
|
|
|
{0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
|
|
|
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
2017-11-07 04:13:28 +08:00
|
|
|
|
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
/* ------------------------------------------------------------------------
|
|
|
|
* Driver specific constants.
|
|
|
|
*/
|
|
|
|
|
2011-06-26 00:50:37 +08:00
|
|
|
#define DRIVER_VERSION "1.1.1"
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Number of isochronous URBs. */
|
|
|
|
#define UVC_URBS 5
|
2009-01-19 04:46:30 +08:00
|
|
|
/* Maximum number of packets per URB. */
|
|
|
|
#define UVC_MAX_PACKETS 32
|
2008-09-16 14:32:20 +08:00
|
|
|
/* Maximum status buffer size in bytes of interrupt URB. */
|
|
|
|
#define UVC_MAX_STATUS_SIZE 16
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2017-08-08 20:56:20 +08:00
|
|
|
#define UVC_CTRL_CONTROL_TIMEOUT 500
|
2010-01-19 19:59:21 +08:00
|
|
|
#define UVC_CTRL_STREAMING_TIMEOUT 5000
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2010-09-08 15:15:23 +08:00
|
|
|
/* Maximum allowed number of control mappings per device */
|
|
|
|
#define UVC_MAX_CONTROL_MAPPINGS 1024
|
2011-11-30 05:32:25 +08:00
|
|
|
#define UVC_MAX_CONTROL_MENU_ENTRIES 32
|
2010-09-08 15:15:23 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
/* Devices quirks */
|
|
|
|
#define UVC_QUIRK_STATUS_INTERVAL 0x00000001
|
|
|
|
#define UVC_QUIRK_PROBE_MINMAX 0x00000002
|
|
|
|
#define UVC_QUIRK_PROBE_EXTRAFIELDS 0x00000004
|
|
|
|
#define UVC_QUIRK_BUILTIN_ISIGHT 0x00000008
|
|
|
|
#define UVC_QUIRK_STREAM_NO_FID 0x00000010
|
|
|
|
#define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020
|
2009-02-17 04:41:52 +08:00
|
|
|
#define UVC_QUIRK_FIX_BANDWIDTH 0x00000080
|
2009-07-20 05:39:56 +08:00
|
|
|
#define UVC_QUIRK_PROBE_DEF 0x00000100
|
2010-09-16 23:37:26 +08:00
|
|
|
#define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200
|
2014-03-13 20:38:48 +08:00
|
|
|
#define UVC_QUIRK_RESTORE_CTRLS_ON_INIT 0x00000400
|
2014-08-07 04:50:49 +08:00
|
|
|
#define UVC_QUIRK_FORCE_Y8 0x00000800
|
2019-10-03 17:31:23 +08:00
|
|
|
#define UVC_QUIRK_FORCE_BPP 0x00001000
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Format flags */
|
|
|
|
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
|
|
|
|
#define UVC_FMT_FLAG_STREAM 0x00000002
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------
|
|
|
|
* Structures.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct uvc_device;
|
|
|
|
|
|
|
|
/* TODO: Put the most frequently accessed fields at the beginning of
|
|
|
|
* structures to maximize cache efficiency.
|
|
|
|
*/
|
|
|
|
struct uvc_control_info {
|
|
|
|
struct list_head mappings;
|
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 entity[16];
|
|
|
|
u8 index; /* Bit index in bmControls */
|
|
|
|
u8 selector;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u16 size;
|
|
|
|
u32 flags;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_control_mapping {
|
|
|
|
struct list_head list;
|
2012-04-08 23:59:51 +08:00
|
|
|
struct list_head ev_subs;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 id;
|
|
|
|
u8 name[32];
|
|
|
|
u8 entity[16];
|
|
|
|
u8 selector;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 size;
|
|
|
|
u8 offset;
|
2008-07-01 02:04:50 +08:00
|
|
|
enum v4l2_ctrl_type v4l2_type;
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 data_type;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-08-07 06:25:33 +08:00
|
|
|
const struct uvc_menu_info *menu_info;
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 menu_count;
|
2008-12-16 17:46:32 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 master_id;
|
|
|
|
s32 master_manual;
|
|
|
|
u32 slave_ids[2];
|
2012-04-08 23:59:52 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
s32 (*get)(struct uvc_control_mapping *mapping, u8 query,
|
|
|
|
const u8 *data);
|
|
|
|
void (*set)(struct uvc_control_mapping *mapping, s32 value,
|
|
|
|
u8 *data);
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_control {
|
|
|
|
struct uvc_entity *entity;
|
2010-09-30 03:00:08 +08:00
|
|
|
struct uvc_control_info info;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 index; /* Used to match the uvc_control entry with a
|
2008-07-01 02:04:50 +08:00
|
|
|
uvc_control_info. */
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 dirty:1,
|
|
|
|
loaded:1,
|
|
|
|
modified:1,
|
|
|
|
cached:1,
|
|
|
|
initialized:1;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 *uvc_data;
|
2018-07-26 16:17:53 +08:00
|
|
|
|
|
|
|
struct uvc_fh *handle; /* File handle that last changed the control. */
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_format_desc {
|
|
|
|
char *name;
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 guid[16];
|
|
|
|
u32 fcc;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The term 'entity' refers to both UVC units and UVC terminals.
|
|
|
|
*
|
|
|
|
* The type field is either the terminal type (wTerminalType in the terminal
|
|
|
|
* descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
|
|
|
|
* As the bDescriptorSubtype field is one byte long, the type value will
|
|
|
|
* always have a null MSB for units. All terminal types defined by the UVC
|
|
|
|
* specification have a non-null MSB, so it is safe to use the MSB to
|
|
|
|
* differentiate between units and terminals as long as the descriptor parsing
|
|
|
|
* code makes sure terminal types have a non-null MSB.
|
|
|
|
*
|
|
|
|
* For terminals, the type's most significant bit stores the terminal
|
|
|
|
* direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should
|
|
|
|
* always be accessed with the UVC_ENTITY_* macros and never directly.
|
|
|
|
*/
|
|
|
|
|
2012-08-03 15:35:10 +08:00
|
|
|
#define UVC_ENTITY_FLAG_DEFAULT (1 << 0)
|
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
struct uvc_entity {
|
|
|
|
struct list_head list; /* Entity as part of a UVC device. */
|
|
|
|
struct list_head chain; /* Entity as part of a video device
|
|
|
|
* chain. */
|
2012-08-03 15:35:10 +08:00
|
|
|
unsigned int flags;
|
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 id;
|
|
|
|
u16 type;
|
2008-07-01 02:04:50 +08:00
|
|
|
char name[64];
|
|
|
|
|
2010-01-21 16:39:52 +08:00
|
|
|
/* Media controller-related fields. */
|
2010-01-21 19:56:19 +08:00
|
|
|
struct video_device *vdev;
|
2010-01-21 16:39:52 +08:00
|
|
|
struct v4l2_subdev subdev;
|
|
|
|
unsigned int num_pads;
|
|
|
|
unsigned int num_links;
|
|
|
|
struct media_pad *pads;
|
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
union {
|
|
|
|
struct {
|
2018-01-17 01:45:36 +08:00
|
|
|
u16 wObjectiveFocalLengthMin;
|
|
|
|
u16 wObjectiveFocalLengthMax;
|
|
|
|
u16 wOcularFocalLength;
|
|
|
|
u8 bControlSize;
|
|
|
|
u8 *bmControls;
|
2008-07-01 02:04:50 +08:00
|
|
|
} camera;
|
|
|
|
|
|
|
|
struct {
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 bControlSize;
|
|
|
|
u8 *bmControls;
|
|
|
|
u8 bTransportModeSize;
|
|
|
|
u8 *bmTransportModes;
|
2008-07-01 02:04:50 +08:00
|
|
|
} media;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
} output;
|
|
|
|
|
|
|
|
struct {
|
2018-01-17 01:45:36 +08:00
|
|
|
u16 wMaxMultiplier;
|
|
|
|
u8 bControlSize;
|
|
|
|
u8 *bmControls;
|
|
|
|
u8 bmVideoStandards;
|
2008-07-01 02:04:50 +08:00
|
|
|
} processing;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
} selector;
|
|
|
|
|
|
|
|
struct {
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 guidExtensionCode[16];
|
|
|
|
u8 bNumControls;
|
|
|
|
u8 bControlSize;
|
|
|
|
u8 *bmControls;
|
|
|
|
u8 *bmControlsType;
|
2008-07-01 02:04:50 +08:00
|
|
|
} extension;
|
|
|
|
};
|
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 bNrInPins;
|
|
|
|
u8 *baSourceID;
|
2009-11-25 23:00:30 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
unsigned int ncontrols;
|
|
|
|
struct uvc_control *controls;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_frame {
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 bFrameIndex;
|
|
|
|
u8 bmCapabilities;
|
|
|
|
u16 wWidth;
|
|
|
|
u16 wHeight;
|
|
|
|
u32 dwMinBitRate;
|
|
|
|
u32 dwMaxBitRate;
|
|
|
|
u32 dwMaxVideoFrameBufferSize;
|
|
|
|
u8 bFrameIntervalType;
|
|
|
|
u32 dwDefaultFrameInterval;
|
|
|
|
u32 *dwFrameInterval;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_format {
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 type;
|
|
|
|
u8 index;
|
|
|
|
u8 bpp;
|
|
|
|
u8 colorspace;
|
|
|
|
u32 fcc;
|
|
|
|
u32 flags;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
unsigned int nframes;
|
|
|
|
struct uvc_frame *frame;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_streaming_header {
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 bNumFormats;
|
|
|
|
u8 bEndpointAddress;
|
|
|
|
u8 bTerminalLink;
|
|
|
|
u8 bControlSize;
|
|
|
|
u8 *bmaControls;
|
2008-07-01 02:04:50 +08:00
|
|
|
/* The following fields are used by input headers only. */
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 bmInfo;
|
|
|
|
u8 bStillCaptureMethod;
|
|
|
|
u8 bTriggerSupport;
|
|
|
|
u8 bTriggerUsage;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum uvc_buffer_state {
|
2009-01-04 06:12:40 +08:00
|
|
|
UVC_BUF_STATE_IDLE = 0,
|
|
|
|
UVC_BUF_STATE_QUEUED = 1,
|
|
|
|
UVC_BUF_STATE_ACTIVE = 2,
|
2009-12-17 08:20:45 +08:00
|
|
|
UVC_BUF_STATE_READY = 3,
|
|
|
|
UVC_BUF_STATE_DONE = 4,
|
|
|
|
UVC_BUF_STATE_ERROR = 5,
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_buffer {
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer buf;
|
2008-07-01 02:04:50 +08:00
|
|
|
struct list_head queue;
|
2011-10-24 22:53:59 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
enum uvc_buffer_state state;
|
2010-06-17 17:52:37 +08:00
|
|
|
unsigned int error;
|
2011-10-24 22:49:19 +08:00
|
|
|
|
|
|
|
void *mem;
|
|
|
|
unsigned int length;
|
|
|
|
unsigned int bytesused;
|
2011-09-24 21:46:55 +08:00
|
|
|
|
|
|
|
u32 pts;
|
2017-03-16 21:33:05 +08:00
|
|
|
|
|
|
|
/* Asynchronous buffer handling. */
|
|
|
|
struct kref ref;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
2011-10-24 22:53:59 +08:00
|
|
|
#define UVC_QUEUE_DISCONNECTED (1 << 0)
|
|
|
|
#define UVC_QUEUE_DROP_CORRUPTED (1 << 1)
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
struct uvc_video_queue {
|
2011-10-24 22:53:59 +08:00
|
|
|
struct vb2_queue queue;
|
|
|
|
struct mutex mutex; /* Protects queue */
|
2008-12-29 09:32:29 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
unsigned int flags;
|
2008-12-29 09:32:29 +08:00
|
|
|
unsigned int buf_used;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2011-10-24 22:53:59 +08:00
|
|
|
spinlock_t irqlock; /* Protects irqqueue */
|
2008-07-01 02:04:50 +08:00
|
|
|
struct list_head irqqueue;
|
|
|
|
};
|
|
|
|
|
2009-07-02 07:24:47 +08:00
|
|
|
struct uvc_video_chain {
|
|
|
|
struct uvc_device *dev;
|
|
|
|
struct list_head list;
|
|
|
|
|
2009-11-25 23:00:22 +08:00
|
|
|
struct list_head entities; /* All entities */
|
2009-07-02 07:24:47 +08:00
|
|
|
struct uvc_entity *processing; /* Processing unit */
|
|
|
|
struct uvc_entity *selector; /* Selector unit */
|
|
|
|
|
2010-10-02 20:04:53 +08:00
|
|
|
struct mutex ctrl_mutex; /* Protects ctrl.info */
|
2012-08-29 05:38:58 +08:00
|
|
|
|
2012-08-29 07:29:56 +08:00
|
|
|
struct v4l2_prio_state prio; /* V4L2 priority state */
|
2012-08-29 05:38:58 +08:00
|
|
|
u32 caps; /* V4L2 chain-wide caps */
|
2009-07-02 07:24:47 +08:00
|
|
|
};
|
|
|
|
|
2011-11-03 22:40:08 +08:00
|
|
|
struct uvc_stats_frame {
|
|
|
|
unsigned int size; /* Number of bytes captured */
|
|
|
|
unsigned int first_data; /* Index of the first non-empty packet */
|
|
|
|
|
|
|
|
unsigned int nb_packets; /* Number of packets */
|
|
|
|
unsigned int nb_empty; /* Number of empty packets */
|
|
|
|
unsigned int nb_invalid; /* Number of packets with an invalid header */
|
|
|
|
unsigned int nb_errors; /* Number of packets with the error bit set */
|
2011-11-03 23:30:17 +08:00
|
|
|
|
|
|
|
unsigned int nb_pts; /* Number of packets with a PTS timestamp */
|
|
|
|
unsigned int nb_pts_diffs; /* Number of PTS differences inside a frame */
|
|
|
|
unsigned int last_pts_diff; /* Index of the last PTS difference */
|
|
|
|
bool has_initial_pts; /* Whether the first non-empty packet has a PTS */
|
|
|
|
bool has_early_pts; /* Whether a PTS is present before the first non-empty packet */
|
|
|
|
u32 pts; /* PTS of the last packet */
|
|
|
|
|
|
|
|
unsigned int nb_scr; /* Number of packets with a SCR timestamp */
|
|
|
|
unsigned int nb_scr_diffs; /* Number of SCR.STC differences inside a frame */
|
|
|
|
u16 scr_sof; /* SCR.SOF of the last packet */
|
|
|
|
u32 scr_stc; /* SCR.STC of the last packet */
|
2011-11-03 22:40:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_stats_stream {
|
2017-11-27 21:19:53 +08:00
|
|
|
ktime_t start_ts; /* Stream start timestamp */
|
|
|
|
ktime_t stop_ts; /* Stream stop timestamp */
|
2011-11-03 22:40:08 +08:00
|
|
|
|
|
|
|
unsigned int nb_frames; /* Number of frames */
|
|
|
|
|
|
|
|
unsigned int nb_packets; /* Number of packets */
|
|
|
|
unsigned int nb_empty; /* Number of empty packets */
|
|
|
|
unsigned int nb_invalid; /* Number of packets with an invalid header */
|
|
|
|
unsigned int nb_errors; /* Number of packets with the error bit set */
|
2011-11-03 23:30:17 +08:00
|
|
|
|
|
|
|
unsigned int nb_pts_constant; /* Number of frames with constant PTS */
|
|
|
|
unsigned int nb_pts_early; /* Number of frames with early PTS */
|
|
|
|
unsigned int nb_pts_initial; /* Number of frames with initial PTS */
|
|
|
|
|
|
|
|
unsigned int nb_scr_count_ok; /* Number of frames with at least one SCR per non empty packet */
|
|
|
|
unsigned int nb_scr_diffs_ok; /* Number of frames with varying SCR.STC */
|
|
|
|
unsigned int scr_sof_count; /* STC.SOF counter accumulated since stream start */
|
|
|
|
unsigned int scr_sof; /* STC.SOF of the last packet */
|
|
|
|
unsigned int min_sof; /* Minimum STC.SOF value */
|
|
|
|
unsigned int max_sof; /* Maximum STC.SOF value */
|
2011-11-03 22:40:08 +08:00
|
|
|
};
|
|
|
|
|
2019-07-24 12:56:12 +08:00
|
|
|
#define UVC_METADATA_BUF_SIZE 1024
|
2017-12-06 23:15:40 +08:00
|
|
|
|
2017-03-22 17:42:52 +08:00
|
|
|
/**
|
|
|
|
* struct uvc_copy_op: Context structure to schedule asynchronous memcpy
|
|
|
|
*
|
|
|
|
* @buf: active buf object for this operation
|
|
|
|
* @dst: copy destination address
|
|
|
|
* @src: copy source address
|
|
|
|
* @len: copy length
|
|
|
|
*/
|
|
|
|
struct uvc_copy_op {
|
|
|
|
struct uvc_buffer *buf;
|
|
|
|
void *dst;
|
|
|
|
const __u8 *src;
|
|
|
|
size_t len;
|
|
|
|
};
|
|
|
|
|
2017-03-15 06:03:23 +08:00
|
|
|
/**
|
|
|
|
* struct uvc_urb - URB context management structure
|
|
|
|
*
|
|
|
|
* @urb: the URB described by this context structure
|
2017-03-15 17:39:14 +08:00
|
|
|
* @stream: UVC streaming context
|
2017-03-15 06:03:23 +08:00
|
|
|
* @buffer: memory storage for the URB
|
|
|
|
* @dma: DMA coherent addressing for the urb_buffer
|
2017-03-22 17:42:52 +08:00
|
|
|
* @async_operations: counter to indicate the number of copy operations
|
|
|
|
* @copy_operations: work descriptors for asynchronous copy operations
|
|
|
|
* @work: work queue entry for asynchronous decode
|
2017-03-15 06:03:23 +08:00
|
|
|
*/
|
|
|
|
struct uvc_urb {
|
|
|
|
struct urb *urb;
|
2017-03-15 17:39:14 +08:00
|
|
|
struct uvc_streaming *stream;
|
2017-03-15 06:03:23 +08:00
|
|
|
|
|
|
|
char *buffer;
|
|
|
|
dma_addr_t dma;
|
2017-03-22 17:42:52 +08:00
|
|
|
|
|
|
|
unsigned int async_operations;
|
|
|
|
struct uvc_copy_op copy_operations[UVC_MAX_PACKETS];
|
|
|
|
struct work_struct work;
|
2017-03-15 06:03:23 +08:00
|
|
|
};
|
|
|
|
|
2009-06-28 19:37:50 +08:00
|
|
|
struct uvc_streaming {
|
|
|
|
struct list_head list;
|
2008-07-01 02:04:50 +08:00
|
|
|
struct uvc_device *dev;
|
2015-03-10 00:34:11 +08:00
|
|
|
struct video_device vdev;
|
2009-07-02 07:24:47 +08:00
|
|
|
struct uvc_video_chain *chain;
|
2008-07-01 02:04:50 +08:00
|
|
|
atomic_t active;
|
|
|
|
|
2009-06-28 19:37:50 +08:00
|
|
|
struct usb_interface *intf;
|
|
|
|
int intfnum;
|
2018-01-17 01:45:36 +08:00
|
|
|
u16 maxpsize;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2009-06-28 19:37:50 +08:00
|
|
|
struct uvc_streaming_header header;
|
|
|
|
enum v4l2_buf_type type;
|
|
|
|
|
|
|
|
unsigned int nformats;
|
|
|
|
struct uvc_format *format;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2009-06-28 19:37:50 +08:00
|
|
|
struct uvc_streaming_control ctrl;
|
2012-08-29 05:38:58 +08:00
|
|
|
struct uvc_format *def_format;
|
2009-06-28 19:37:50 +08:00
|
|
|
struct uvc_format *cur_format;
|
|
|
|
struct uvc_frame *cur_frame;
|
2014-09-09 15:42:43 +08:00
|
|
|
|
2010-11-22 00:36:34 +08:00
|
|
|
/* Protect access to ctrl, cur_format, cur_frame and hardware video
|
|
|
|
* probe control.
|
|
|
|
*/
|
2009-06-28 19:37:50 +08:00
|
|
|
struct mutex mutex;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2011-10-24 22:53:59 +08:00
|
|
|
/* Buffers queue. */
|
2009-06-28 19:37:50 +08:00
|
|
|
unsigned int frozen : 1;
|
|
|
|
struct uvc_video_queue queue;
|
2017-03-22 17:42:52 +08:00
|
|
|
struct workqueue_struct *async_wq;
|
2017-03-15 17:39:14 +08:00
|
|
|
void (*decode)(struct uvc_urb *uvc_urb, struct uvc_buffer *buf,
|
|
|
|
struct uvc_buffer *meta_buf);
|
2017-12-06 23:15:40 +08:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct video_device vdev;
|
|
|
|
struct uvc_video_queue queue;
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 format;
|
2017-12-06 23:15:40 +08:00
|
|
|
} meta;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Context data used by the bulk completion handler. */
|
|
|
|
struct {
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 header[256];
|
2008-07-01 02:04:50 +08:00
|
|
|
unsigned int header_size;
|
|
|
|
int skip_payload;
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 payload_size;
|
|
|
|
u32 max_payload_size;
|
2008-07-01 02:04:50 +08:00
|
|
|
} bulk;
|
|
|
|
|
2017-03-15 06:03:23 +08:00
|
|
|
struct uvc_urb uvc_urb[UVC_URBS];
|
2008-07-04 11:36:21 +08:00
|
|
|
unsigned int urb_size;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 sequence;
|
|
|
|
u8 last_fid;
|
2011-11-03 20:39:37 +08:00
|
|
|
|
|
|
|
/* debugfs */
|
|
|
|
struct dentry *debugfs_dir;
|
2011-11-03 22:40:08 +08:00
|
|
|
struct {
|
|
|
|
struct uvc_stats_frame frame;
|
|
|
|
struct uvc_stats_stream stream;
|
|
|
|
} stats;
|
2011-09-24 21:46:55 +08:00
|
|
|
|
|
|
|
/* Timestamps support. */
|
|
|
|
struct uvc_clock {
|
|
|
|
struct uvc_clock_sample {
|
|
|
|
u32 dev_stc;
|
|
|
|
u16 dev_sof;
|
|
|
|
u16 host_sof;
|
2017-11-27 21:19:54 +08:00
|
|
|
ktime_t host_time;
|
2011-09-24 21:46:55 +08:00
|
|
|
} *samples;
|
|
|
|
|
|
|
|
unsigned int head;
|
|
|
|
unsigned int count;
|
|
|
|
unsigned int size;
|
|
|
|
|
|
|
|
u16 last_sof;
|
|
|
|
u16 sof_offset;
|
|
|
|
|
2017-12-06 23:15:40 +08:00
|
|
|
u8 last_scr[6];
|
|
|
|
|
2011-09-24 21:46:55 +08:00
|
|
|
spinlock_t lock;
|
|
|
|
} clock;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
2017-03-22 17:42:52 +08:00
|
|
|
#define for_each_uvc_urb(uvc_urb, uvc_streaming) \
|
|
|
|
for ((uvc_urb) = &(uvc_streaming)->uvc_urb[0]; \
|
|
|
|
(uvc_urb) < &(uvc_streaming)->uvc_urb[UVC_URBS]; \
|
|
|
|
++(uvc_urb))
|
|
|
|
|
2019-02-07 17:13:35 +08:00
|
|
|
static inline u32 uvc_urb_index(const struct uvc_urb *uvc_urb)
|
|
|
|
{
|
|
|
|
return uvc_urb - &uvc_urb->stream->uvc_urb[0];
|
|
|
|
}
|
2018-01-28 07:43:01 +08:00
|
|
|
|
2018-08-17 16:50:02 +08:00
|
|
|
struct uvc_device_info {
|
|
|
|
u32 quirks;
|
|
|
|
u32 meta_format;
|
|
|
|
};
|
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
struct uvc_device {
|
|
|
|
struct usb_device *udev;
|
|
|
|
struct usb_interface *intf;
|
2008-11-09 06:14:50 +08:00
|
|
|
unsigned long warnings;
|
2018-01-17 01:45:36 +08:00
|
|
|
u32 quirks;
|
2008-07-01 02:04:50 +08:00
|
|
|
int intfnum;
|
|
|
|
char name[32];
|
|
|
|
|
2018-08-17 16:50:02 +08:00
|
|
|
const struct uvc_device_info *info;
|
|
|
|
|
2013-04-26 09:28:51 +08:00
|
|
|
struct mutex lock; /* Protects users */
|
|
|
|
unsigned int users;
|
2010-09-08 15:15:23 +08:00
|
|
|
atomic_t nmappings;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Video control interface */
|
2010-01-21 16:39:47 +08:00
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
|
|
|
struct media_device mdev;
|
|
|
|
#endif
|
|
|
|
struct v4l2_device vdev;
|
2018-01-17 01:45:36 +08:00
|
|
|
u16 uvc_version;
|
|
|
|
u32 clock_frequency;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
struct list_head entities;
|
2009-07-02 07:24:47 +08:00
|
|
|
struct list_head chains;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2009-06-28 19:37:50 +08:00
|
|
|
/* Video Streaming interfaces */
|
|
|
|
struct list_head streams;
|
2017-08-08 20:56:23 +08:00
|
|
|
struct kref ref;
|
2009-06-28 19:37:50 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
/* Status Interrupt Endpoint */
|
|
|
|
struct usb_host_endpoint *int_ep;
|
|
|
|
struct urb *int_urb;
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 *status;
|
2008-07-01 02:04:50 +08:00
|
|
|
struct input_dev *input;
|
2009-01-22 23:45:10 +08:00
|
|
|
char input_phys[64];
|
2018-07-26 16:17:53 +08:00
|
|
|
|
|
|
|
struct uvc_ctrl_work {
|
|
|
|
struct work_struct work;
|
|
|
|
struct urb *urb;
|
|
|
|
struct uvc_video_chain *chain;
|
|
|
|
struct uvc_control *ctrl;
|
|
|
|
const void *data;
|
|
|
|
} async_ctrl;
|
2008-07-01 02:04:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum uvc_handle_state {
|
|
|
|
UVC_HANDLE_PASSIVE = 0,
|
|
|
|
UVC_HANDLE_ACTIVE = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_fh {
|
2012-04-08 23:59:51 +08:00
|
|
|
struct v4l2_fh vfh;
|
2009-07-02 07:24:47 +08:00
|
|
|
struct uvc_video_chain *chain;
|
2009-06-28 19:37:50 +08:00
|
|
|
struct uvc_streaming *stream;
|
2008-07-01 02:04:50 +08:00
|
|
|
enum uvc_handle_state state;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uvc_driver {
|
|
|
|
struct usb_driver driver;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------
|
|
|
|
* Debugging, printing and logging
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define UVC_TRACE_PROBE (1 << 0)
|
|
|
|
#define UVC_TRACE_DESCR (1 << 1)
|
|
|
|
#define UVC_TRACE_CONTROL (1 << 2)
|
|
|
|
#define UVC_TRACE_FORMAT (1 << 3)
|
|
|
|
#define UVC_TRACE_CAPTURE (1 << 4)
|
|
|
|
#define UVC_TRACE_CALLS (1 << 5)
|
|
|
|
#define UVC_TRACE_FRAME (1 << 7)
|
|
|
|
#define UVC_TRACE_SUSPEND (1 << 8)
|
|
|
|
#define UVC_TRACE_STATUS (1 << 9)
|
2009-08-06 22:41:17 +08:00
|
|
|
#define UVC_TRACE_VIDEO (1 << 10)
|
2011-11-03 22:40:08 +08:00
|
|
|
#define UVC_TRACE_STATS (1 << 11)
|
2011-09-24 21:46:55 +08:00
|
|
|
#define UVC_TRACE_CLOCK (1 << 12)
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2008-11-09 06:14:50 +08:00
|
|
|
#define UVC_WARN_MINMAX 0
|
|
|
|
#define UVC_WARN_PROBE_DEF 1
|
2010-09-30 20:04:03 +08:00
|
|
|
#define UVC_WARN_XU_GET_RES 2
|
2008-11-09 06:14:50 +08:00
|
|
|
|
2009-12-10 09:57:48 +08:00
|
|
|
extern unsigned int uvc_clock_param;
|
2008-12-07 03:25:14 +08:00
|
|
|
extern unsigned int uvc_no_drop_param;
|
2008-07-01 02:04:50 +08:00
|
|
|
extern unsigned int uvc_trace_param;
|
2009-10-10 07:55:23 +08:00
|
|
|
extern unsigned int uvc_timeout_param;
|
2015-07-27 22:06:48 +08:00
|
|
|
extern unsigned int uvc_hw_timestamps_param;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
#define uvc_trace(flag, msg...) \
|
|
|
|
do { \
|
|
|
|
if (uvc_trace_param & flag) \
|
|
|
|
printk(KERN_DEBUG "uvcvideo: " msg); \
|
|
|
|
} while (0)
|
|
|
|
|
2008-11-09 06:14:50 +08:00
|
|
|
#define uvc_warn_once(dev, warn, msg...) \
|
|
|
|
do { \
|
|
|
|
if (!test_and_set_bit(warn, &dev->warnings)) \
|
|
|
|
printk(KERN_INFO "uvcvideo: " msg); \
|
|
|
|
} while (0)
|
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
#define uvc_printk(level, msg...) \
|
|
|
|
printk(level "uvcvideo: " msg)
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
* Internal functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Core driver */
|
|
|
|
extern struct uvc_driver uvc_driver;
|
|
|
|
|
2018-01-17 01:32:54 +08:00
|
|
|
struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
|
2010-01-21 16:39:52 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
/* Video buffers queue management. */
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
|
|
|
|
int drop_corrupted);
|
|
|
|
void uvc_queue_release(struct uvc_video_queue *queue);
|
|
|
|
int uvc_request_buffers(struct uvc_video_queue *queue,
|
|
|
|
struct v4l2_requestbuffers *rb);
|
|
|
|
int uvc_query_buffer(struct uvc_video_queue *queue,
|
|
|
|
struct v4l2_buffer *v4l2_buf);
|
|
|
|
int uvc_create_buffers(struct uvc_video_queue *queue,
|
|
|
|
struct v4l2_create_buffers *v4l2_cb);
|
|
|
|
int uvc_queue_buffer(struct uvc_video_queue *queue,
|
2018-05-30 14:46:22 +08:00
|
|
|
struct media_device *mdev,
|
2018-01-17 01:32:54 +08:00
|
|
|
struct v4l2_buffer *v4l2_buf);
|
|
|
|
int uvc_export_buffer(struct uvc_video_queue *queue,
|
|
|
|
struct v4l2_exportbuffer *exp);
|
|
|
|
int uvc_dequeue_buffer(struct uvc_video_queue *queue,
|
|
|
|
struct v4l2_buffer *v4l2_buf, int nonblocking);
|
|
|
|
int uvc_queue_streamon(struct uvc_video_queue *queue, enum v4l2_buf_type type);
|
|
|
|
int uvc_queue_streamoff(struct uvc_video_queue *queue, enum v4l2_buf_type type);
|
|
|
|
void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect);
|
|
|
|
struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
|
|
|
|
struct uvc_buffer *buf);
|
2017-03-23 20:25:14 +08:00
|
|
|
struct uvc_buffer *uvc_queue_get_current_buffer(struct uvc_video_queue *queue);
|
2017-03-16 21:33:05 +08:00
|
|
|
void uvc_queue_buffer_release(struct uvc_buffer *buf);
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_queue_mmap(struct uvc_video_queue *queue,
|
|
|
|
struct vm_area_struct *vma);
|
|
|
|
__poll_t uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
|
|
|
|
poll_table *wait);
|
2011-04-29 18:11:35 +08:00
|
|
|
#ifndef CONFIG_MMU
|
2018-01-17 01:32:54 +08:00
|
|
|
unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
|
|
|
|
unsigned long pgoff);
|
2011-04-29 18:11:35 +08:00
|
|
|
#endif
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_queue_allocated(struct uvc_video_queue *queue);
|
2008-07-01 02:04:50 +08:00
|
|
|
static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
|
|
|
|
{
|
2011-10-24 22:53:59 +08:00
|
|
|
return vb2_is_streaming(&queue->queue);
|
2008-07-01 02:04:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* V4L2 interface */
|
2010-09-30 21:17:54 +08:00
|
|
|
extern const struct v4l2_ioctl_ops uvc_ioctl_ops;
|
2008-12-30 17:58:20 +08:00
|
|
|
extern const struct v4l2_file_operations uvc_fops;
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2010-01-21 16:39:52 +08:00
|
|
|
/* Media controller */
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_mc_register_entities(struct uvc_video_chain *chain);
|
|
|
|
void uvc_mc_cleanup_entity(struct uvc_entity *entity);
|
2010-01-21 16:39:52 +08:00
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
/* Video */
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_video_init(struct uvc_streaming *stream);
|
|
|
|
int uvc_video_suspend(struct uvc_streaming *stream);
|
|
|
|
int uvc_video_resume(struct uvc_streaming *stream, int reset);
|
2018-11-05 23:28:24 +08:00
|
|
|
int uvc_video_start_streaming(struct uvc_streaming *stream);
|
|
|
|
void uvc_video_stop_streaming(struct uvc_streaming *stream);
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_probe_video(struct uvc_streaming *stream,
|
|
|
|
struct uvc_streaming_control *probe);
|
2018-01-17 01:45:36 +08:00
|
|
|
int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
|
|
|
|
u8 intfnum, u8 cs, void *data, u16 size);
|
2011-09-24 21:46:55 +08:00
|
|
|
void uvc_video_clock_update(struct uvc_streaming *stream,
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 21:30:30 +08:00
|
|
|
struct vb2_v4l2_buffer *vbuf,
|
2011-09-24 21:46:55 +08:00
|
|
|
struct uvc_buffer *buf);
|
2017-12-06 23:15:40 +08:00
|
|
|
int uvc_meta_register(struct uvc_streaming *stream);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2017-12-05 07:05:17 +08:00
|
|
|
int uvc_register_video_device(struct uvc_device *dev,
|
|
|
|
struct uvc_streaming *stream,
|
|
|
|
struct video_device *vdev,
|
|
|
|
struct uvc_video_queue *queue,
|
|
|
|
enum v4l2_buf_type type,
|
|
|
|
const struct v4l2_file_operations *fops,
|
|
|
|
const struct v4l2_ioctl_ops *ioctl_ops);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Status */
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_status_init(struct uvc_device *dev);
|
media: uvcvideo: Refactor teardown of uvc on USB disconnect
Currently, disconnecting a USB webcam while it is in use prints out a
number of warnings, such as:
WARNING: CPU: 2 PID: 3118 at /build/linux-ezBi1T/linux-4.8.0/fs/sysfs/group.c:237 sysfs_remove_group+0x8b/0x90
sysfs group ffffffffa7cd0780 not found for kobject 'event13'
This has been noticed before. [0]
This is because of the order in which things are torn down.
If there are no streams active during a USB disconnect:
- uvc_disconnect() is invoked via device_del() through the bus
notifier mechanism.
- this calls uvc_unregister_video().
- uvc_unregister_video() unregisters the video device for each
stream,
- because there are no streams open, it calls uvc_delete()
- uvc_delete() calls uvc_status_cleanup(), which cleans up the status
input device.
- uvc_delete() calls media_device_unregister(), which cleans up the
media device
- uvc_delete(), uvc_unregister_video() and uvc_disconnect() all
return, and we end up back in device_del().
- device_del() then cleans up the sysfs folder for the camera with
dpm_sysfs_remove(). Because uvc_status_cleanup() and
media_device_unregister() have already been called, this all works
nicely.
If, on the other hand, there *are* streams active during a USB disconnect:
- uvc_disconnect() is invoked
- this calls uvc_unregister_video()
- uvc_unregister_video() unregisters the video device for each
stream,
- uvc_unregister_video() and uvc_disconnect() return, and we end up
back in device_del().
- device_del() then cleans up the sysfs folder for the camera with
dpm_sysfs_remove(). Because the status input device and the media
device are children of the USB device, this also deletes their
sysfs folders.
- Sometime later, the final stream is closed, invoking uvc_release().
- uvc_release() calls uvc_delete()
- uvc_delete() calls uvc_status_cleanup(), which cleans up the status
input device. Because the sysfs directory has already been removed,
this causes a WARNing.
- uvc_delete() calls media_device_unregister(), which cleans up the
media device. Because the sysfs directory has already been removed,
this causes another WARNing.
To fix this, we need to make sure the devices are always unregistered
before the end of uvc_disconnect(). To this, move the unregistration
into the disconnect path:
- split uvc_status_cleanup() into two parts, one on disconnect that
unregisters and one on delete that frees.
- move v4l2_device_unregister() and media_device_unregister() into
the disconnect path.
[0]: https://lkml.org/lkml/2016/12/8/657
[Renamed uvc_input_cleanup() to uvc_input_unregister()]
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2017-04-23 12:53:49 +08:00
|
|
|
void uvc_status_unregister(struct uvc_device *dev);
|
2018-01-17 01:32:54 +08:00
|
|
|
void uvc_status_cleanup(struct uvc_device *dev);
|
|
|
|
int uvc_status_start(struct uvc_device *dev, gfp_t flags);
|
|
|
|
void uvc_status_stop(struct uvc_device *dev);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Controls */
|
2012-04-08 23:59:51 +08:00
|
|
|
extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
|
|
|
|
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
|
|
|
|
struct v4l2_queryctrl *v4l2_ctrl);
|
|
|
|
int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
|
|
|
|
struct v4l2_querymenu *query_menu);
|
|
|
|
|
|
|
|
int uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
|
|
|
|
const struct uvc_control_mapping *mapping);
|
|
|
|
int uvc_ctrl_init_device(struct uvc_device *dev);
|
|
|
|
void uvc_ctrl_cleanup_device(struct uvc_device *dev);
|
|
|
|
int uvc_ctrl_restore_values(struct uvc_device *dev);
|
2018-07-26 16:17:53 +08:00
|
|
|
bool uvc_ctrl_status_event(struct urb *urb, struct uvc_video_chain *chain,
|
|
|
|
struct uvc_control *ctrl, const u8 *data);
|
2018-01-17 01:32:54 +08:00
|
|
|
|
|
|
|
int uvc_ctrl_begin(struct uvc_video_chain *chain);
|
|
|
|
int __uvc_ctrl_commit(struct uvc_fh *handle, int rollback,
|
|
|
|
const struct v4l2_ext_control *xctrls,
|
|
|
|
unsigned int xctrls_count);
|
2012-04-08 23:59:51 +08:00
|
|
|
static inline int uvc_ctrl_commit(struct uvc_fh *handle,
|
2018-01-17 01:32:54 +08:00
|
|
|
const struct v4l2_ext_control *xctrls,
|
|
|
|
unsigned int xctrls_count)
|
2008-07-01 02:04:50 +08:00
|
|
|
{
|
2012-04-08 23:59:51 +08:00
|
|
|
return __uvc_ctrl_commit(handle, 0, xctrls, xctrls_count);
|
2008-07-01 02:04:50 +08:00
|
|
|
}
|
2012-04-08 23:59:51 +08:00
|
|
|
static inline int uvc_ctrl_rollback(struct uvc_fh *handle)
|
2008-07-01 02:04:50 +08:00
|
|
|
{
|
2012-04-08 23:59:51 +08:00
|
|
|
return __uvc_ctrl_commit(handle, 1, NULL, 0);
|
2008-07-01 02:04:50 +08:00
|
|
|
}
|
|
|
|
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_ctrl_get(struct uvc_video_chain *chain, struct v4l2_ext_control *xctrl);
|
2018-07-26 16:17:53 +08:00
|
|
|
int uvc_ctrl_set(struct uvc_fh *handle, struct v4l2_ext_control *xctrl);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2018-01-17 01:32:54 +08:00
|
|
|
int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
|
|
|
|
struct uvc_xu_control_query *xqry);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Utility functions */
|
2018-01-17 01:35:17 +08:00
|
|
|
void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
|
2018-01-17 01:32:54 +08:00
|
|
|
unsigned int n_terms, unsigned int threshold);
|
2018-01-17 01:35:17 +08:00
|
|
|
u32 uvc_fraction_to_interval(u32 numerator, u32 denominator);
|
2018-01-17 01:32:54 +08:00
|
|
|
struct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
|
2018-01-17 01:45:36 +08:00
|
|
|
u8 epaddr);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
|
|
|
/* Quirks support */
|
2017-03-15 17:39:14 +08:00
|
|
|
void uvc_video_decode_isight(struct uvc_urb *uvc_urb,
|
2018-01-17 01:32:54 +08:00
|
|
|
struct uvc_buffer *buf,
|
|
|
|
struct uvc_buffer *meta_buf);
|
2008-07-01 02:04:50 +08:00
|
|
|
|
2011-11-03 22:40:08 +08:00
|
|
|
/* debugfs and statistics */
|
2017-01-12 09:31:21 +08:00
|
|
|
void uvc_debugfs_init(void);
|
2011-11-03 20:39:37 +08:00
|
|
|
void uvc_debugfs_cleanup(void);
|
2017-01-12 09:31:21 +08:00
|
|
|
void uvc_debugfs_init_stream(struct uvc_streaming *stream);
|
2011-11-03 20:39:37 +08:00
|
|
|
void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream);
|
|
|
|
|
2011-11-03 22:40:08 +08:00
|
|
|
size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
|
|
|
|
size_t size);
|
|
|
|
|
2008-07-01 02:04:50 +08:00
|
|
|
#endif
|