blob: 020714d2c5bdd33237da7bbfac3fe453c4907045 [file] [log] [blame]
Greg Kroah-Hartman6f52b162017-11-01 15:08:43 +01001/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
Laurent Pinchart5f708812010-11-21 17:15:44 -03002#ifndef __LINUX_UVCVIDEO_H_
3#define __LINUX_UVCVIDEO_H_
4
5#include <linux/ioctl.h>
6#include <linux/types.h>
7
8/*
9 * Dynamic controls
10 */
11
12/* Data types for UVC control data */
13#define UVC_CTRL_DATA_TYPE_RAW 0
14#define UVC_CTRL_DATA_TYPE_SIGNED 1
15#define UVC_CTRL_DATA_TYPE_UNSIGNED 2
16#define UVC_CTRL_DATA_TYPE_BOOLEAN 3
17#define UVC_CTRL_DATA_TYPE_ENUM 4
18#define UVC_CTRL_DATA_TYPE_BITMASK 5
19
20/* Control flags */
21#define UVC_CTRL_FLAG_SET_CUR (1 << 0)
22#define UVC_CTRL_FLAG_GET_CUR (1 << 1)
23#define UVC_CTRL_FLAG_GET_MIN (1 << 2)
24#define UVC_CTRL_FLAG_GET_MAX (1 << 3)
25#define UVC_CTRL_FLAG_GET_RES (1 << 4)
26#define UVC_CTRL_FLAG_GET_DEF (1 << 5)
27/* Control should be saved at suspend and restored at resume. */
28#define UVC_CTRL_FLAG_RESTORE (1 << 6)
29/* Control can be updated by the camera. */
30#define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7)
31
32#define UVC_CTRL_FLAG_GET_RANGE \
33 (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \
34 UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \
35 UVC_CTRL_FLAG_GET_DEF)
36
37struct uvc_menu_info {
38 __u32 value;
39 __u8 name[32];
40};
41
42struct uvc_xu_control_mapping {
43 __u32 id;
44 __u8 name[32];
45 __u8 entity[16];
46 __u8 selector;
47
48 __u8 size;
49 __u8 offset;
50 __u32 v4l2_type;
51 __u32 data_type;
52
53 struct uvc_menu_info __user *menu_info;
54 __u32 menu_count;
55
56 __u32 reserved[4];
57};
58
59struct uvc_xu_control_query {
60 __u8 unit;
61 __u8 selector;
Laurent Pinchart7078daa2012-05-14 04:34:34 -030062 __u8 query; /* Video Class-Specific Request Code, */
63 /* defined in linux/usb/video.h A.8. */
Laurent Pinchart5f708812010-11-21 17:15:44 -030064 __u16 size;
65 __u8 __user *data;
66};
67
68#define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping)
69#define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query)
70
Guennadi Liakhovetski088ead22017-12-06 10:15:40 -050071/*
72 * Metadata node
73 */
74
75/**
76 * struct uvc_meta_buf - metadata buffer building block
77 * @ns - system timestamp of the payload in nanoseconds
78 * @sof - USB Frame Number
79 * @length - length of the payload header
80 * @flags - payload header flags
81 * @buf - optional device-specific header data
82 *
83 * UVC metadata nodes fill buffers with possibly multiple instances of this
84 * struct. The first two fields are added by the driver, they can be used for
85 * clock synchronisation. The rest is an exact copy of a UVC payload header.
86 * Only complete objects with complete buffers are included. Therefore it's
87 * always sizeof(meta->ts) + sizeof(meta->sof) + meta->length bytes large.
88 */
89struct uvc_meta_buf {
90 __u64 ns;
91 __u16 sof;
92 __u8 length;
93 __u8 flags;
94 __u8 buf[];
95} __packed;
96
Laurent Pinchart5f708812010-11-21 17:15:44 -030097#endif