v4l2: Update kernel headers to latest from media tree
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Mon, 8 Jun 2015 21:01:15 +0000 (17:01 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Mon, 8 Jun 2015 21:56:48 +0000 (17:56 -0400)
This is the latest from media tree. This should enable more development
of the v4l2 elements. This includes new flags requires to fix draining
path in decoder, colorimetry and much more.

sys/v4l2/ext/types-compat.h
sys/v4l2/ext/v4l2-common.h
sys/v4l2/ext/v4l2-controls.h
sys/v4l2/ext/videodev2.h

index 2748248..f1095cb 100644 (file)
@@ -44,4 +44,6 @@
 #define __s32 gint32
 #define __le32 guint32 __bitwise
 
+#define __user
+
 #endif /* __TYPES_COMPAT_H__ */
index 4f0667e..e2da593 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef __V4L2_COMMON__
 #define __V4L2_COMMON__
 
+#include "ext/types-compat.h"
+
 /*
  *
  * Selection interface definitions
@@ -41,6 +43,8 @@
 #define V4L2_SEL_TGT_CROP_DEFAULT      0x0001
 /* Cropping bounds */
 #define V4L2_SEL_TGT_CROP_BOUNDS       0x0002
+/* Native frame size */
+#define V4L2_SEL_TGT_NATIVE_SIZE       0x0003
 /* Current composing area */
 #define V4L2_SEL_TGT_COMPOSE           0x0100
 /* Default composing area */
 #define V4L2_SUBDEV_SEL_FLAG_SIZE_LE   V4L2_SEL_FLAG_LE
 #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
 
+struct v4l2_edid {
+       __u32 pad;
+       __u32 start_block;
+       __u32 blocks;
+       __u32 reserved[5];
+       __u8  *edid;
+};
+
 #endif /* __V4L2_COMMON__ */
index 1666aab..9f6e108 100644 (file)
@@ -60,6 +60,8 @@
 #define V4L2_CTRL_CLASS_IMAGE_PROC     0x009f0000      /* Image processing controls */
 #define V4L2_CTRL_CLASS_DV             0x00a00000      /* Digital Video controls */
 #define V4L2_CTRL_CLASS_FM_RX          0x00a10000      /* FM Receiver controls */
+#define V4L2_CTRL_CLASS_RF_TUNER       0x00a20000      /* RF tuner controls */
+#define V4L2_CTRL_CLASS_DETECT         0x00a30000      /* Detection controls */
 
 /* User-class control IDs */
 
@@ -164,6 +166,14 @@ enum v4l2_colorfx {
  * this driver */
 #define V4L2_CID_USER_TI_VPE_BASE              (V4L2_CID_USER_BASE + 0x1050)
 
+/* The base for the saa7134 driver controls.
+ * We reserve 16 controls for this driver. */
+#define V4L2_CID_USER_SAA7134_BASE             (V4L2_CID_USER_BASE + 0x1060)
+
+/* The base for the adv7180 driver controls.
+ * We reserve 16 controls for this driver. */
+#define V4L2_CID_USER_ADV7180_BASE             (V4L2_CID_USER_BASE + 0x1070)
+
 /* MPEG-class control IDs */
 /* The MPEG controls are applicable to all codec controls
  * and the 'MPEG' part of the define is historical */
@@ -372,6 +382,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_DEC_FRAME                  (V4L2_CID_MPEG_BASE+224)
 #define V4L2_CID_MPEG_VIDEO_VBV_DELAY                  (V4L2_CID_MPEG_BASE+225)
 #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER          (V4L2_CID_MPEG_BASE+226)
+#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE          (V4L2_CID_MPEG_BASE+227)
+#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE          (V4L2_CID_MPEG_BASE+228)
 
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP            (V4L2_CID_MPEG_BASE+300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP            (V4L2_CID_MPEG_BASE+301)
@@ -554,6 +566,11 @@ enum v4l2_vp8_golden_frame_sel {
        V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV           = 0,
        V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD     = 1,
 };
+#define V4L2_CID_MPEG_VIDEO_VPX_MIN_QP                 (V4L2_CID_MPEG_BASE+507)
+#define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP                 (V4L2_CID_MPEG_BASE+508)
+#define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP             (V4L2_CID_MPEG_BASE+509)
+#define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP             (V4L2_CID_MPEG_BASE+510)
+#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE                        (V4L2_CID_MPEG_BASE+511)
 
 /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
 #define V4L2_CID_MPEG_CX2341X_BASE                             (V4L2_CTRL_CLASS_MPEG | 0x1000)
@@ -733,6 +750,8 @@ enum v4l2_auto_focus_range {
        V4L2_AUTO_FOCUS_RANGE_INFINITY          = 3,
 };
 
+#define V4L2_CID_PAN_SPEED                     (V4L2_CID_CAMERA_CLASS_BASE+32)
+#define V4L2_CID_TILT_SPEED                    (V4L2_CID_CAMERA_CLASS_BASE+33)
 
 /* FM Modulator class control IDs */
 
@@ -744,6 +763,15 @@ enum v4l2_auto_focus_range {
 #define V4L2_CID_RDS_TX_PTY                    (V4L2_CID_FM_TX_CLASS_BASE + 3)
 #define V4L2_CID_RDS_TX_PS_NAME                        (V4L2_CID_FM_TX_CLASS_BASE + 5)
 #define V4L2_CID_RDS_TX_RADIO_TEXT             (V4L2_CID_FM_TX_CLASS_BASE + 6)
+#define V4L2_CID_RDS_TX_MONO_STEREO            (V4L2_CID_FM_TX_CLASS_BASE + 7)
+#define V4L2_CID_RDS_TX_ARTIFICIAL_HEAD                (V4L2_CID_FM_TX_CLASS_BASE + 8)
+#define V4L2_CID_RDS_TX_COMPRESSED             (V4L2_CID_FM_TX_CLASS_BASE + 9)
+#define V4L2_CID_RDS_TX_DYNAMIC_PTY            (V4L2_CID_FM_TX_CLASS_BASE + 10)
+#define V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT   (V4L2_CID_FM_TX_CLASS_BASE + 11)
+#define V4L2_CID_RDS_TX_TRAFFIC_PROGRAM                (V4L2_CID_FM_TX_CLASS_BASE + 12)
+#define V4L2_CID_RDS_TX_MUSIC_SPEECH           (V4L2_CID_FM_TX_CLASS_BASE + 13)
+#define V4L2_CID_RDS_TX_ALT_FREQS_ENABLE       (V4L2_CID_FM_TX_CLASS_BASE + 14)
+#define V4L2_CID_RDS_TX_ALT_FREQS              (V4L2_CID_FM_TX_CLASS_BASE + 15)
 
 #define V4L2_CID_AUDIO_LIMITER_ENABLED         (V4L2_CID_FM_TX_CLASS_BASE + 64)
 #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME    (V4L2_CID_FM_TX_CLASS_BASE + 65)
@@ -803,6 +831,9 @@ enum v4l2_flash_strobe_source {
 #define V4L2_FLASH_FAULT_SHORT_CIRCUIT         (1 << 3)
 #define V4L2_FLASH_FAULT_OVER_CURRENT          (1 << 4)
 #define V4L2_FLASH_FAULT_INDICATOR             (1 << 5)
+#define V4L2_FLASH_FAULT_UNDER_VOLTAGE         (1 << 6)
+#define V4L2_FLASH_FAULT_INPUT_VOLTAGE         (1 << 7)
+#define V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE  (1 << 8)
 
 #define V4L2_CID_FLASH_CHARGE                  (V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY                   (V4L2_CID_FLASH_CLASS_BASE + 12)
@@ -840,6 +871,10 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_VBLANK                                (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
 #define V4L2_CID_HBLANK                                (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
 #define V4L2_CID_ANALOGUE_GAIN                 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
+#define V4L2_CID_TEST_PATTERN_RED              (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 4)
+#define V4L2_CID_TEST_PATTERN_GREENR           (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5)
+#define V4L2_CID_TEST_PATTERN_BLUE             (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
+#define V4L2_CID_TEST_PATTERN_GREENB           (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
 
 
 /* Image processing controls */
@@ -885,5 +920,40 @@ enum v4l2_deemphasis {
 };
 
 #define V4L2_CID_RDS_RECEPTION                 (V4L2_CID_FM_RX_CLASS_BASE + 2)
+#define V4L2_CID_RDS_RX_PTY                    (V4L2_CID_FM_RX_CLASS_BASE + 3)
+#define V4L2_CID_RDS_RX_PS_NAME                        (V4L2_CID_FM_RX_CLASS_BASE + 4)
+#define V4L2_CID_RDS_RX_RADIO_TEXT             (V4L2_CID_FM_RX_CLASS_BASE + 5)
+#define V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT   (V4L2_CID_FM_RX_CLASS_BASE + 6)
+#define V4L2_CID_RDS_RX_TRAFFIC_PROGRAM                (V4L2_CID_FM_RX_CLASS_BASE + 7)
+#define V4L2_CID_RDS_RX_MUSIC_SPEECH           (V4L2_CID_FM_RX_CLASS_BASE + 8)
+
+#define V4L2_CID_RF_TUNER_CLASS_BASE           (V4L2_CTRL_CLASS_RF_TUNER | 0x900)
+#define V4L2_CID_RF_TUNER_CLASS                        (V4L2_CTRL_CLASS_RF_TUNER | 1)
+
+#define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO       (V4L2_CID_RF_TUNER_CLASS_BASE + 11)
+#define V4L2_CID_RF_TUNER_BANDWIDTH            (V4L2_CID_RF_TUNER_CLASS_BASE + 12)
+#define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO                (V4L2_CID_RF_TUNER_CLASS_BASE + 41)
+#define V4L2_CID_RF_TUNER_LNA_GAIN             (V4L2_CID_RF_TUNER_CLASS_BASE + 42)
+#define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO      (V4L2_CID_RF_TUNER_CLASS_BASE + 51)
+#define V4L2_CID_RF_TUNER_MIXER_GAIN           (V4L2_CID_RF_TUNER_CLASS_BASE + 52)
+#define V4L2_CID_RF_TUNER_IF_GAIN_AUTO         (V4L2_CID_RF_TUNER_CLASS_BASE + 61)
+#define V4L2_CID_RF_TUNER_IF_GAIN              (V4L2_CID_RF_TUNER_CLASS_BASE + 62)
+#define V4L2_CID_RF_TUNER_PLL_LOCK                     (V4L2_CID_RF_TUNER_CLASS_BASE + 91)
+
+
+/*  Detection-class control IDs defined by V4L2 */
+#define V4L2_CID_DETECT_CLASS_BASE             (V4L2_CTRL_CLASS_DETECT | 0x900)
+#define V4L2_CID_DETECT_CLASS                  (V4L2_CTRL_CLASS_DETECT | 1)
+
+#define V4L2_CID_DETECT_MD_MODE                        (V4L2_CID_DETECT_CLASS_BASE + 1)
+enum v4l2_detect_md_mode {
+       V4L2_DETECT_MD_MODE_DISABLED            = 0,
+       V4L2_DETECT_MD_MODE_GLOBAL              = 1,
+       V4L2_DETECT_MD_MODE_THRESHOLD_GRID      = 2,
+       V4L2_DETECT_MD_MODE_REGION_GRID         = 3,
+};
+#define V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD    (V4L2_CID_DETECT_CLASS_BASE + 2)
+#define V4L2_CID_DETECT_MD_THRESHOLD_GRID      (V4L2_CID_DETECT_CLASS_BASE + 3)
+#define V4L2_CID_DETECT_MD_REGION_GRID         (V4L2_CID_DETECT_CLASS_BASE + 4)
 
 #endif
index 2b4d1f5..68e82be 100644 (file)
@@ -77,6 +77,7 @@
 /*  Four-character-code (FOURCC) */
 #define v4l2_fourcc(a, b, c, d)\
        ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
+#define v4l2_fourcc_be(a, b, c, d)     (v4l2_fourcc(a, b, c, d) | (1 << 31))
 
 /*
  *     E N U M S
@@ -122,6 +123,10 @@ enum v4l2_field {
         (field) == V4L2_FIELD_INTERLACED_BT ||\
         (field) == V4L2_FIELD_SEQ_TB ||\
         (field) == V4L2_FIELD_SEQ_BT)
+#define V4L2_FIELD_HAS_T_OR_B(field)   \
+       ((field) == V4L2_FIELD_BOTTOM ||\
+        (field) == V4L2_FIELD_TOP ||\
+        (field) == V4L2_FIELD_ALTERNATE)
 
 enum v4l2_buf_type {
        V4L2_BUF_TYPE_VIDEO_CAPTURE        = 1,
@@ -137,6 +142,7 @@ enum v4l2_buf_type {
 #endif
        V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
        V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE  = 10,
+       V4L2_BUF_TYPE_SDR_CAPTURE          = 11,
        /* Deprecated, do not use */
        V4L2_BUF_TYPE_PRIVATE              = 0x80,
 };
@@ -157,6 +163,8 @@ enum v4l2_tuner_type {
        V4L2_TUNER_RADIO             = 1,
        V4L2_TUNER_ANALOG_TV         = 2,
        V4L2_TUNER_DIGITAL_TV        = 3,
+       V4L2_TUNER_ADC               = 4,
+       V4L2_TUNER_RF                = 5,
 };
 
 enum v4l2_memory {
@@ -168,32 +176,181 @@ enum v4l2_memory {
 
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
 enum v4l2_colorspace {
-       /* ITU-R 601 -- broadcast NTSC/PAL */
+       /*
+        * Default colorspace, i.e. let the driver figure it out.
+        * Can only be used with video capture.
+        */
+       V4L2_COLORSPACE_DEFAULT       = 0,
+
+       /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
        V4L2_COLORSPACE_SMPTE170M     = 1,
 
-       /* 1125-Line (US) HDTV */
+       /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
        V4L2_COLORSPACE_SMPTE240M     = 2,
 
-       /* HD and modern captures. */
+       /* Rec.709: used for HDTV */
        V4L2_COLORSPACE_REC709        = 3,
 
-       /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
+       /*
+        * Deprecated, do not use. No driver will ever return this. This was
+        * based on a misunderstanding of the bt878 datasheet.
+        */
        V4L2_COLORSPACE_BT878         = 4,
 
-       /* These should be useful.  Assume 601 extents. */
+       /*
+        * NTSC 1953 colorspace. This only makes sense when dealing with
+        * really, really old NTSC recordings. Superseded by SMPTE 170M.
+        */
        V4L2_COLORSPACE_470_SYSTEM_M  = 5,
+
+       /*
+        * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
+        * dealing with really old PAL/SECAM recordings. Superseded by
+        * SMPTE 170M.
+        */
        V4L2_COLORSPACE_470_SYSTEM_BG = 6,
 
-       /* I know there will be cameras that send this.  So, this is
-        * unspecified chromaticities and full 0-255 on each of the
-        * Y'CbCr components
+       /*
+        * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
+        * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
         */
        V4L2_COLORSPACE_JPEG          = 7,
 
-       /* For RGB colourspaces, this is probably a good start. */
+       /* For RGB colorspaces such as produces by most webcams. */
        V4L2_COLORSPACE_SRGB          = 8,
+
+       /* AdobeRGB colorspace */
+       V4L2_COLORSPACE_ADOBERGB      = 9,
+
+       /* BT.2020 colorspace, used for UHDTV. */
+       V4L2_COLORSPACE_BT2020        = 10,
+
+       /* Raw colorspace: for RAW unprocessed images */
+       V4L2_COLORSPACE_RAW           = 11,
+};
+
+/*
+ * Determine how COLORSPACE_DEFAULT should map to a proper colorspace.
+ * This depends on whether this is a SDTV image (use SMPTE 170M), an
+ * HDTV image (use Rec. 709), or something else (use sRGB).
+ */
+#define V4L2_MAP_COLORSPACE_DEFAULT(is_sdtv, is_hdtv) \
+       ((is_sdtv) ? V4L2_COLORSPACE_SMPTE170M : \
+        ((is_hdtv) ? V4L2_COLORSPACE_REC709 : V4L2_COLORSPACE_SRGB))
+
+enum v4l2_xfer_func {
+       /*
+        * Mapping of V4L2_XFER_FUNC_DEFAULT to actual transfer functions
+        * for the various colorspaces:
+        *
+        * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
+        * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_REC709 and
+        * V4L2_COLORSPACE_BT2020: V4L2_XFER_FUNC_709
+        *
+        * V4L2_COLORSPACE_SRGB, V4L2_COLORSPACE_JPEG: V4L2_XFER_FUNC_SRGB
+        *
+        * V4L2_COLORSPACE_ADOBERGB: V4L2_XFER_FUNC_ADOBERGB
+        *
+        * V4L2_COLORSPACE_SMPTE240M: V4L2_XFER_FUNC_SMPTE240M
+        *
+        * V4L2_COLORSPACE_RAW: V4L2_XFER_FUNC_NONE
+        */
+       V4L2_XFER_FUNC_DEFAULT     = 0,
+       V4L2_XFER_FUNC_709         = 1,
+       V4L2_XFER_FUNC_SRGB        = 2,
+       V4L2_XFER_FUNC_ADOBERGB    = 3,
+       V4L2_XFER_FUNC_SMPTE240M   = 4,
+       V4L2_XFER_FUNC_NONE        = 5,
+};
+
+/*
+ * Determine how XFER_FUNC_DEFAULT should map to a proper transfer function.
+ * This depends on the colorspace.
+ */
+#define V4L2_MAP_XFER_FUNC_DEFAULT(colsp) \
+       ((colsp) == V4L2_XFER_FUNC_ADOBERGB ? V4L2_XFER_FUNC_ADOBERGB : \
+        ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_XFER_FUNC_SMPTE240M : \
+         ((colsp) == V4L2_COLORSPACE_RAW ? V4L2_XFER_FUNC_NONE : \
+          ((colsp) == V4L2_COLORSPACE_SRGB || (colsp) == V4L2_COLORSPACE_JPEG ? \
+           V4L2_XFER_FUNC_SRGB : V4L2_XFER_FUNC_709))))
+
+enum v4l2_ycbcr_encoding {
+       /*
+        * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
+        * various colorspaces:
+        *
+        * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
+        * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
+        * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
+        *
+        * V4L2_COLORSPACE_REC709: V4L2_YCBCR_ENC_709
+        *
+        * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC
+        *
+        * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020
+        *
+        * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M
+        */
+       V4L2_YCBCR_ENC_DEFAULT        = 0,
+
+       /* ITU-R 601 -- SDTV */
+       V4L2_YCBCR_ENC_601            = 1,
+
+       /* Rec. 709 -- HDTV */
+       V4L2_YCBCR_ENC_709            = 2,
+
+       /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */
+       V4L2_YCBCR_ENC_XV601          = 3,
+
+       /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */
+       V4L2_YCBCR_ENC_XV709          = 4,
+
+       /* sYCC (Y'CbCr encoding of sRGB) */
+       V4L2_YCBCR_ENC_SYCC           = 5,
+
+       /* BT.2020 Non-constant Luminance Y'CbCr */
+       V4L2_YCBCR_ENC_BT2020         = 6,
+
+       /* BT.2020 Constant Luminance Y'CbcCrc */
+       V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7,
+
+       /* SMPTE 240M -- Obsolete HDTV */
+       V4L2_YCBCR_ENC_SMPTE240M      = 8,
 };
 
+/*
+ * Determine how YCBCR_ENC_DEFAULT should map to a proper Y'CbCr encoding.
+ * This depends on the colorspace.
+ */
+#define V4L2_MAP_YCBCR_ENC_DEFAULT(colsp) \
+       ((colsp) == V4L2_COLORSPACE_REC709 ? V4L2_YCBCR_ENC_709 : \
+        ((colsp) == V4L2_COLORSPACE_BT2020 ? V4L2_YCBCR_ENC_BT2020 : \
+         ((colsp) == V4L2_COLORSPACE_SMPTE240M ? V4L2_YCBCR_ENC_SMPTE240M : \
+          V4L2_YCBCR_ENC_601)))
+
+enum v4l2_quantization {
+       /*
+        * The default for R'G'B' quantization is always full range, except
+        * for the BT2020 colorspace. For Y'CbCr the quantization is always
+        * limited range, except for COLORSPACE_JPEG, SYCC, XV601 or XV709:
+        * those are full range.
+        */
+       V4L2_QUANTIZATION_DEFAULT     = 0,
+       V4L2_QUANTIZATION_FULL_RANGE  = 1,
+       V4L2_QUANTIZATION_LIM_RANGE   = 2,
+};
+
+/*
+ * Determine how QUANTIZATION_DEFAULT should map to a proper quantization.
+ * This depends on whether the image is RGB or not, the colorspace and the
+ * Y'CbCr encoding.
+ */
+#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \
+       (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \
+        (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \
+         (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) ? \
+        V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
+
 enum v4l2_priority {
        V4L2_PRIORITY_UNSET       = 0,  /* not initialized */
        V4L2_PRIORITY_BACKGROUND  = 1,
@@ -205,8 +362,8 @@ enum v4l2_priority {
 struct v4l2_rect {
        __s32   left;
        __s32   top;
-       __s32   width;
-       __s32   height;
+       __u32   width;
+       __u32   height;
 };
 
 struct v4l2_fract {
@@ -262,6 +419,9 @@ struct v4l2_capability {
 #define V4L2_CAP_RADIO                 0x00040000  /* is a radio device */
 #define V4L2_CAP_MODULATOR             0x00080000  /* has a modulator */
 
+#define V4L2_CAP_SDR_CAPTURE           0x00100000  /* Is a SDR capture device */
+#define V4L2_CAP_EXT_PIX_FORMAT                0x00200000  /* Supports the extended pixel format */
+
 #define V4L2_CAP_READWRITE              0x01000000  /* read/write systemcalls */
 #define V4L2_CAP_ASYNCIO                0x02000000  /* async I/O */
 #define V4L2_CAP_STREAMING              0x04000000  /* streaming I/O ioctls */
@@ -280,6 +440,10 @@ struct v4l2_pix_format {
        __u32                   sizeimage;
        __u32                   colorspace;     /* enum v4l2_colorspace */
        __u32                   priv;           /* private data, depends on pixelformat */
+       __u32                   flags;          /* format flags (V4L2_PIX_FMT_FLAG_*) */
+       __u32                   ycbcr_enc;      /* enum v4l2_ycbcr_encoding */
+       __u32                   quantization;   /* enum v4l2_quantization */
+       __u32                   xfer_func;      /* enum v4l2_xfer_func */
 };
 
 /*      Pixel format         FOURCC                          depth  Description  */
@@ -287,15 +451,25 @@ struct v4l2_pix_format {
 /* RGB formats */
 #define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R', 'G', 'B', '1') /*  8  RGB-3-3-2     */
 #define V4L2_PIX_FMT_RGB444  v4l2_fourcc('R', '4', '4', '4') /* 16  xxxxrrrr ggggbbbb */
+#define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2') /* 16  aaaarrrr ggggbbbb */
+#define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2') /* 16  xxxxrrrr ggggbbbb */
 #define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R', 'G', 'B', 'O') /* 16  RGB-5-5-5     */
+#define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5') /* 16  ARGB-1-5-5-5  */
+#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16  XRGB-1-5-5-5  */
 #define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R', 'G', 'B', 'P') /* 16  RGB-5-6-5     */
 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16  RGB-5-5-5 BE  */
+#define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5') /* 16  ARGB-5-5-5 BE */
+#define V4L2_PIX_FMT_XRGB555X v4l2_fourcc_be('X', 'R', '1', '5') /* 16  XRGB-5-5-5 BE */
 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16  RGB-5-6-5 BE  */
 #define V4L2_PIX_FMT_BGR666  v4l2_fourcc('B', 'G', 'R', 'H') /* 18  BGR-6-6-6    */
 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B', 'G', 'R', '3') /* 24  BGR-8-8-8     */
 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R', 'G', 'B', '3') /* 24  RGB-8-8-8     */
 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B', 'G', 'R', '4') /* 32  BGR-8-8-8-8   */
+#define V4L2_PIX_FMT_ABGR32  v4l2_fourcc('A', 'R', '2', '4') /* 32  BGRA-8-8-8-8  */
+#define V4L2_PIX_FMT_XBGR32  v4l2_fourcc('X', 'R', '2', '4') /* 32  BGRX-8-8-8-8  */
 #define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R', 'G', 'B', '4') /* 32  RGB-8-8-8-8   */
+#define V4L2_PIX_FMT_ARGB32  v4l2_fourcc('B', 'A', '2', '4') /* 32  ARGB-8-8-8-8  */
+#define V4L2_PIX_FMT_XRGB32  v4l2_fourcc('B', 'X', '2', '4') /* 32  XRGB-8-8-8-8  */
 
 /* Grey formats */
 #define V4L2_PIX_FMT_GREY    v4l2_fourcc('G', 'R', 'E', 'Y') /*  8  Greyscale     */
@@ -304,6 +478,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_Y10     v4l2_fourcc('Y', '1', '0', ' ') /* 10  Greyscale     */
 #define V4L2_PIX_FMT_Y12     v4l2_fourcc('Y', '1', '2', ' ') /* 12  Greyscale     */
 #define V4L2_PIX_FMT_Y16     v4l2_fourcc('Y', '1', '6', ' ') /* 16  Greyscale     */
+#define V4L2_PIX_FMT_Y16_BE  v4l2_fourcc_be('Y', '1', '6', ' ') /* 16  Greyscale BE  */
 
 /* Grey bit-packed formats */
 #define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
@@ -364,10 +539,11 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10  GBGB.. RGRG.. */
 #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10  GRGR.. BGBG.. */
 #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10  RGRG.. GBGB.. */
-#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12  BGBG.. GRGR.. */
-#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
-#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
-#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
+       /* 10bit raw bayer packed, 5 bytes for every 4 pixels */
+#define V4L2_PIX_FMT_SBGGR10P v4l2_fourcc('p', 'B', 'A', 'A')
+#define V4L2_PIX_FMT_SGBRG10P v4l2_fourcc('p', 'G', 'A', 'A')
+#define V4L2_PIX_FMT_SGRBG10P v4l2_fourcc('p', 'g', 'A', 'A')
+#define V4L2_PIX_FMT_SRGGB10P v4l2_fourcc('p', 'R', 'A', 'A')
        /* 10bit raw bayer a-law compressed to 8 bits */
 #define V4L2_PIX_FMT_SBGGR10ALAW8 v4l2_fourcc('a', 'B', 'A', '8')
 #define V4L2_PIX_FMT_SGBRG10ALAW8 v4l2_fourcc('a', 'G', 'A', '8')
@@ -378,10 +554,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
 #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
 #define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
-       /*
-        * 10bit raw bayer, expanded to 16 bits
-        * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
-        */
+#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
@@ -429,6 +605,19 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SE401      v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
 #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
 
+/* SDR formats - used only for Software Defined Radio devices */
+#define V4L2_SDR_FMT_CU8          v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
+#define V4L2_SDR_FMT_CU16LE       v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */
+#define V4L2_SDR_FMT_CS8          v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */
+#define V4L2_SDR_FMT_CS14LE       v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */
+#define V4L2_SDR_FMT_RU12LE       v4l2_fourcc('R', 'U', '1', '2') /* real u12le */
+
+/* priv field value to indicates that subsequent fields are valid. */
+#define V4L2_PIX_FMT_PRIV_MAGIC                0xfeedcafe
+
+/* Flags */
+#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
+
 /*
  *     F O R M A T   E N U M E R A T I O N
  */
@@ -638,7 +827,6 @@ struct v4l2_plane {
  * @length:    size in bytes of the buffer (NOT its payload) for single-plane
  *             buffers (when type != *_MPLANE); number of elements in the
  *             planes array for multi-plane buffers
- * @input:     input number from which the video data has has been captured
  *
  * Contains data exchanged by application and driver using one of the Streaming
  * I/O methods.
@@ -667,24 +855,38 @@ struct v4l2_buffer {
 };
 
 /*  Flags for 'flags' field */
-#define V4L2_BUF_FLAG_MAPPED   0x0001  /* Buffer is mapped (flag) */
-#define V4L2_BUF_FLAG_QUEUED   0x0002  /* Buffer is queued for processing */
-#define V4L2_BUF_FLAG_DONE     0x0004  /* Buffer is ready */
-#define V4L2_BUF_FLAG_KEYFRAME 0x0008  /* Image is a keyframe (I-frame) */
-#define V4L2_BUF_FLAG_PFRAME   0x0010  /* Image is a P-frame */
-#define V4L2_BUF_FLAG_BFRAME   0x0020  /* Image is a B-frame */
+/* Buffer is mapped (flag) */
+#define V4L2_BUF_FLAG_MAPPED                   0x00000001
+/* Buffer is queued for processing */
+#define V4L2_BUF_FLAG_QUEUED                   0x00000002
+/* Buffer is ready */
+#define V4L2_BUF_FLAG_DONE                     0x00000004
+/* Image is a keyframe (I-frame) */
+#define V4L2_BUF_FLAG_KEYFRAME                 0x00000008
+/* Image is a P-frame */
+#define V4L2_BUF_FLAG_PFRAME                   0x00000010
+/* Image is a B-frame */
+#define V4L2_BUF_FLAG_BFRAME                   0x00000020
 /* Buffer is ready, but the data contained within is corrupted. */
-#define V4L2_BUF_FLAG_ERROR    0x0040
-#define V4L2_BUF_FLAG_TIMECODE 0x0100  /* timecode field is valid */
-#define V4L2_BUF_FLAG_PREPARED 0x0400  /* Buffer is prepared for queuing */
+#define V4L2_BUF_FLAG_ERROR                    0x00000040
+/* timecode field is valid */
+#define V4L2_BUF_FLAG_TIMECODE                 0x00000100
+/* Buffer is prepared for queuing */
+#define V4L2_BUF_FLAG_PREPARED                 0x00000400
 /* Cache handling flags */
-#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE      0x0800
-#define V4L2_BUF_FLAG_NO_CACHE_CLEAN           0x1000
+#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE      0x00000800
+#define V4L2_BUF_FLAG_NO_CACHE_CLEAN           0x00001000
 /* Timestamp type */
-#define V4L2_BUF_FLAG_TIMESTAMP_MASK           0xe000
-#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN                0x0000
-#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC      0x2000
-#define V4L2_BUF_FLAG_TIMESTAMP_COPY           0x4000
+#define V4L2_BUF_FLAG_TIMESTAMP_MASK           0x0000e000
+#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN                0x00000000
+#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC      0x00002000
+#define V4L2_BUF_FLAG_TIMESTAMP_COPY           0x00004000
+/* Timestamp sources. */
+#define V4L2_BUF_FLAG_TSTAMP_SRC_MASK          0x00070000
+#define V4L2_BUF_FLAG_TSTAMP_SRC_EOF           0x00000000
+#define V4L2_BUF_FLAG_TSTAMP_SRC_SOE           0x00010000
+/* mem2mem encoder/decoder */
+#define V4L2_BUF_FLAG_LAST                     0x00100000
 
 /**
  * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
@@ -722,7 +924,16 @@ struct v4l2_framebuffer {
 /* FIXME: in theory we should pass something like PCI device + memory
  * region + offset instead of some physical address */
        void                    *base;
-       struct v4l2_pix_format  fmt;
+       struct {
+               __u32           width;
+               __u32           height;
+               __u32           pixelformat;
+               __u32           field;          /* enum v4l2_field */
+               __u32           bytesperline;   /* for padding, zero if unused */
+               __u32           sizeimage;
+               __u32           colorspace;     /* enum v4l2_colorspace */
+               __u32           priv;           /* reserved field, set to 0 */
+       } fmt;
 };
 /*  Flags for the 'capability' field. Read only */
 #define V4L2_FBUF_CAP_EXTERNOVERLAY    0x0001
@@ -744,16 +955,16 @@ struct v4l2_framebuffer {
 
 struct v4l2_clip {
        struct v4l2_rect        c;
-       struct v4l2_clip        *next;
+       struct v4l2_clip        __user *next;
 };
 
 struct v4l2_window {
        struct v4l2_rect        w;
        __u32                   field;   /* enum v4l2_field */
        __u32                   chromakey;
-       struct v4l2_clip        *clips;
+       struct v4l2_clip        __user *clips;
        __u32                   clipcount;
-       void                    *bitmap;
+       void                    __user *bitmap;
        __u8                    global_alpha;
 };
 
@@ -1054,17 +1265,23 @@ struct v4l2_bt_timings {
    exactly the same number of half-lines. Whether half-lines can be detected
    or used depends on the hardware. */
 #define V4L2_DV_FL_HALF_LINE                   (1 << 3)
+/* If set, then this is a Consumer Electronics (CE) video format. Such formats
+ * differ from other formats (commonly called IT formats) in that if RGB
+ * encoding is used then by default the RGB values use limited range (i.e.
+ * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861
+ * except for the 640x480 format are CE formats. */
+#define V4L2_DV_FL_IS_CE_VIDEO                 (1 << 4)
 
 /* A few useful defines to calculate the total blanking and frame sizes */
 #define V4L2_DV_BT_BLANKING_WIDTH(bt) \
-       (bt->hfrontporch + bt->hsync + bt->hbackporch)
+       ((bt)->hfrontporch + (bt)->hsync + (bt)->hbackporch)
 #define V4L2_DV_BT_FRAME_WIDTH(bt) \
-       (bt->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
+       ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
 #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
-       (bt->vfrontporch + bt->vsync + bt->vbackporch + \
-        bt->il_vfrontporch + bt->il_vsync + bt->il_vbackporch)
+       ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \
+        (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch)
 #define V4L2_DV_BT_FRAME_HEIGHT(bt) \
-       (bt->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
+       ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
 
 /** struct v4l2_dv_timings - DV timings
  * @type:      the type of the timings
@@ -1084,12 +1301,15 @@ struct v4l2_dv_timings {
 
 /** struct v4l2_enum_dv_timings - DV timings enumeration
  * @index:     enumeration index
+ * @pad:       the pad number for which to enumerate timings (used with
+ *             v4l-subdev nodes only)
  * @reserved:  must be zeroed
  * @timings:   the timings for the given index
  */
 struct v4l2_enum_dv_timings {
        __u32 index;
-       __u32 reserved[3];
+       __u32 pad;
+       __u32 reserved[2];
        struct v4l2_dv_timings timings;
 };
 
@@ -1127,11 +1347,14 @@ struct v4l2_bt_timings_cap {
 
 /** struct v4l2_dv_timings_cap - DV timings capabilities
  * @type:      the type of the timings (same as in struct v4l2_dv_timings)
+ * @pad:       the pad number for which to query capabilities (used with
+ *             v4l-subdev nodes only)
  * @bt:                the BT656/1120 timings capabilities
  */
 struct v4l2_dv_timings_cap {
        __u32 type;
-       __u32 reserved[3];
+       __u32 pad;
+       __u32 reserved[2];
        union {
                struct v4l2_bt_timings_cap bt;
                __u32 raw_data[32];
@@ -1186,6 +1409,7 @@ struct v4l2_input {
 #define V4L2_IN_CAP_DV_TIMINGS         0x00000002 /* Supports S_DV_TIMINGS */
 #define V4L2_IN_CAP_CUSTOM_TIMINGS     V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
 #define V4L2_IN_CAP_STD                        0x00000004 /* Supports S_STD */
+#define V4L2_IN_CAP_NATIVE_SIZE                0x00000008 /* Supports setting native size */
 
 /*
  *     V I D E O   O U T P U T S
@@ -1209,6 +1433,7 @@ struct v4l2_output {
 #define V4L2_OUT_CAP_DV_TIMINGS                0x00000002 /* Supports S_DV_TIMINGS */
 #define V4L2_OUT_CAP_CUSTOM_TIMINGS    V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
 #define V4L2_OUT_CAP_STD               0x00000004 /* Supports S_STD */
+#define V4L2_OUT_CAP_NATIVE_SIZE       0x00000008 /* Supports setting native size */
 
 /*
  *     C O N T R O L S
@@ -1225,7 +1450,11 @@ struct v4l2_ext_control {
        union {
                __s32 value;
                __s64 value64;
-               char *string;
+               char __user *string;
+               __u8 __user *p_u8;
+               __u16 __user *p_u16;
+               __u32 __user *p_u32;
+               void __user *ptr;
        };
 } __attribute__ ((packed));
 
@@ -1240,6 +1469,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_ID_MASK                (0x0fffffff)
 #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
 #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
+#define V4L2_CTRL_MAX_DIMS       (4)
 
 enum v4l2_ctrl_type {
        V4L2_CTRL_TYPE_INTEGER       = 1,
@@ -1250,7 +1480,13 @@ enum v4l2_ctrl_type {
        V4L2_CTRL_TYPE_CTRL_CLASS    = 6,
        V4L2_CTRL_TYPE_STRING        = 7,
        V4L2_CTRL_TYPE_BITMASK       = 8,
-       V4L2_CTRL_TYPE_INTEGER_MENU = 9,
+       V4L2_CTRL_TYPE_INTEGER_MENU  = 9,
+
+       /* Compound types are >= 0x0100 */
+       V4L2_CTRL_COMPOUND_TYPES     = 0x0100,
+       V4L2_CTRL_TYPE_U8            = 0x0100,
+       V4L2_CTRL_TYPE_U16           = 0x0101,
+       V4L2_CTRL_TYPE_U32           = 0x0102,
 };
 
 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
@@ -1266,6 +1502,23 @@ struct v4l2_queryctrl {
        __u32                reserved[2];
 };
 
+/*  Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls */
+struct v4l2_query_ext_ctrl {
+       __u32                id;
+       __u32                type;
+       char                 name[32];
+       __s64                minimum;
+       __s64                maximum;
+       __u64                step;
+       __s64                default_value;
+       __u32                flags;
+       __u32                elem_size;
+       __u32                elems;
+       __u32                nr_of_dims;
+       __u32                dims[V4L2_CTRL_MAX_DIMS];
+       __u32                reserved[32];
+};
+
 /*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
 struct v4l2_querymenu {
        __u32           id;
@@ -1286,9 +1539,12 @@ struct v4l2_querymenu {
 #define V4L2_CTRL_FLAG_SLIDER          0x0020
 #define V4L2_CTRL_FLAG_WRITE_ONLY      0x0040
 #define V4L2_CTRL_FLAG_VOLATILE                0x0080
+#define V4L2_CTRL_FLAG_HAS_PAYLOAD     0x0100
+#define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE        0x0200
 
-/*  Query flag, to be ORed with the control ID */
+/*  Query flags, to be ORed with the control ID */
 #define V4L2_CTRL_FLAG_NEXT_CTRL       0x80000000
+#define V4L2_CTRL_FLAG_NEXT_COMPOUND   0x40000000
 
 /*  User-class control IDs defined by V4L2 */
 #define V4L2_CID_MAX_CTRLS             1024
@@ -1337,6 +1593,7 @@ struct v4l2_modulator {
 #define V4L2_TUNER_CAP_RDS_CONTROLS    0x0200
 #define V4L2_TUNER_CAP_FREQ_BANDS      0x0400
 #define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800
+#define V4L2_TUNER_CAP_1HZ             0x1000
 
 /*  Flags for the 'rxsubchans' field */
 #define V4L2_TUNER_SUB_MONO            0x0001
@@ -1553,6 +1810,12 @@ struct v4l2_vbi_format {
 #define V4L2_VBI_UNSYNC                (1 << 0)
 #define V4L2_VBI_INTERLACED    (1 << 1)
 
+/* ITU-R start lines for each field */
+#define V4L2_VBI_ITU_525_F1_START (1)
+#define V4L2_VBI_ITU_525_F2_START (264)
+#define V4L2_VBI_ITU_625_F1_START (1)
+#define V4L2_VBI_ITU_625_F2_START (314)
+
 /* Sliced VBI
  *
  *    This implements is a proposal V4L2 API to allow SLICED VBI
@@ -1663,8 +1926,8 @@ struct v4l2_mpeg_vbi_fmt_ivtv {
  */
 struct v4l2_plane_pix_format {
        __u32           sizeimage;
-       __u16           bytesperline;
-       __u16           reserved[7];
+       __u32           bytesperline;
+       __u16           reserved[6];
 } __attribute__ ((packed));
 
 /**
@@ -1676,6 +1939,10 @@ struct v4l2_plane_pix_format {
  * @colorspace:                enum v4l2_colorspace; supplemental to pixelformat
  * @plane_fmt:         per-plane information
  * @num_planes:                number of planes for this format
+ * @flags:             format flags (V4L2_PIX_FMT_FLAG_*)
+ * @ycbcr_enc:         enum v4l2_ycbcr_encoding, Y'CbCr encoding
+ * @quantization:      enum v4l2_quantization, colorspace quantization
+ * @xfer_func:         enum v4l2_xfer_func, colorspace transfer function
  */
 struct v4l2_pix_format_mplane {
        __u32                           width;
@@ -1686,7 +1953,22 @@ struct v4l2_pix_format_mplane {
 
        struct v4l2_plane_pix_format    plane_fmt[VIDEO_MAX_PLANES];
        __u8                            num_planes;
-       __u8                            reserved[11];
+       __u8                            flags;
+       __u8                            ycbcr_enc;
+       __u8                            quantization;
+       __u8                            xfer_func;
+       __u8                            reserved[7];
+} __attribute__ ((packed));
+
+/**
+ * struct v4l2_sdr_format - SDR format definition
+ * @pixelformat:       little endian four character code (fourcc)
+ * @buffersize:                maximum size in bytes required for data
+ */
+struct v4l2_sdr_format {
+       __u32                           pixelformat;
+       __u32                           buffersize;
+       __u8                            reserved[24];
 } __attribute__ ((packed));
 
 /**
@@ -1707,6 +1989,7 @@ struct v4l2_format {
                struct v4l2_window              win;     /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
                struct v4l2_vbi_format          vbi;     /* V4L2_BUF_TYPE_VBI_CAPTURE */
                struct v4l2_sliced_vbi_format   sliced;  /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
+               struct v4l2_sdr_format          sdr;     /* V4L2_BUF_TYPE_SDR_CAPTURE */
                __u8    raw_data[200];                   /* user-defined */
        } fmt;
 };
@@ -1731,6 +2014,8 @@ struct v4l2_streamparm {
 #define V4L2_EVENT_EOS                         2
 #define V4L2_EVENT_CTRL                                3
 #define V4L2_EVENT_FRAME_SYNC                  4
+#define V4L2_EVENT_SOURCE_CHANGE               5
+#define V4L2_EVENT_MOTION_DET                  6
 #define V4L2_EVENT_PRIVATE_START               0x08000000
 
 /* Payload for V4L2_EVENT_VSYNC */
@@ -1762,12 +2047,35 @@ struct v4l2_event_frame_sync {
        __u32 frame_sequence;
 };
 
+#define V4L2_EVENT_SRC_CH_RESOLUTION           (1 << 0)
+
+struct v4l2_event_src_change {
+       __u32 changes;
+};
+
+#define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ        (1 << 0)
+
+/**
+ * struct v4l2_event_motion_det - motion detection event
+ * @flags:             if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the
+ *                     frame_sequence field is valid.
+ * @frame_sequence:    the frame sequence number associated with this event.
+ * @region_mask:       which regions detected motion.
+ */
+struct v4l2_event_motion_det {
+       __u32 flags;
+       __u32 frame_sequence;
+       __u32 region_mask;
+};
+
 struct v4l2_event {
        __u32                           type;
        union {
                struct v4l2_event_vsync         vsync;
                struct v4l2_event_ctrl          ctrl;
                struct v4l2_event_frame_sync    frame_sync;
+               struct v4l2_event_src_change    src_change;
+               struct v4l2_event_motion_det    motion_det;
                __u8                            data[64];
        } u;
        __u32                           pending;
@@ -1883,6 +2191,8 @@ struct v4l2_create_buffers {
 #define VIDIOC_QUERYMENU       _IOWR('V', 37, struct v4l2_querymenu)
 #define VIDIOC_G_INPUT          _IOR('V', 38, int)
 #define VIDIOC_S_INPUT         _IOWR('V', 39, int)
+#define VIDIOC_G_EDID          _IOWR('V', 40, struct v4l2_edid)
+#define VIDIOC_S_EDID          _IOWR('V', 41, struct v4l2_edid)
 #define VIDIOC_G_OUTPUT                 _IOR('V', 46, int)
 #define VIDIOC_S_OUTPUT                _IOWR('V', 47, int)
 #define VIDIOC_ENUMOUTPUT      _IOWR('V', 48, struct v4l2_output)
@@ -1956,6 +2266,8 @@ struct v4l2_create_buffers {
    Never use these in applications! */
 #define VIDIOC_DBG_G_CHIP_INFO  _IOWR('V', 102, struct v4l2_dbg_chip_info)
 
+#define VIDIOC_QUERY_EXT_CTRL  _IOWR('V', 103, struct v4l2_query_ext_ctrl)
+
 /* Reminder: when adding new ioctls please add support for them to
    drivers/media/video/v4l2-compat-ioctl32.c as well! */