4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #ifndef __LINUX_V4L2_MEDIABUS_H
12 #define __LINUX_V4L2_MEDIABUS_H
14 #include <linux/media-bus-format.h>
15 #include <linux/types.h>
16 #include <linux/videodev2.h>
19 * These pixel codes uniquely identify data formats on the media bus. Mostly
20 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
21 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
22 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
23 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
24 * transferred over the bus: "LE" means that the least significant bits are
25 * transferred first, "BE" means that the most significant bits are transferred
26 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
27 * incomplete high byte, are filled with padding bits.
29 * The pixel codes are grouped by type, bus_width, bits per component, samples
30 * per pixel and order of subsamples. Numerical values are sorted using generic
31 * numerical sort order (8 thus comes before 10).
33 * As their value can't change when a new pixel code is inserted in the
34 * enumeration, the pixel codes are explicitly given a numerical value. The next
35 * free values for each category are listed below, update them when inserting
38 enum v4l2_mbus_pixelcode {
39 V4L2_MBUS_FMT_FIXED = 0x0001,
41 /* RGB - next is 0x100f */
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
43 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
44 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
45 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
46 V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
47 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
48 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
49 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
50 V4L2_MBUS_FMT_RGB666_1X18 = 0x1009,
51 V4L2_MBUS_FMT_RGB888_1X24 = 0x100a,
52 V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b,
53 V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,
54 V4L2_MBUS_FMT_RGBA8888_4X8_BE = 0x100d,
55 V4L2_MBUS_FMT_RGBA8888_4X8_LE = 0x100e,
57 /* YUV (including grey) - next is 0x2017 */
58 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
59 V4L2_MBUS_FMT_UV8_1X8 = 0x2015,
60 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
61 V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
62 V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
63 V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
64 V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
65 V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
66 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
67 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
68 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
69 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
70 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
71 V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
72 V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
73 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
74 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
75 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
76 V4L2_MBUS_FMT_YDYUYDYV8_1X16 = 0x2014,
77 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
78 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
79 V4L2_MBUS_FMT_YUV10_1X30 = 0x2016,
81 /* Bayer - next is 0x3019 */
82 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
83 V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
84 V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
85 V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
86 V4L2_MBUS_FMT_SBGGR10_ALAW8_1X8 = 0x3015,
87 V4L2_MBUS_FMT_SGBRG10_ALAW8_1X8 = 0x3016,
88 V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8 = 0x3017,
89 V4L2_MBUS_FMT_SRGGB10_ALAW8_1X8 = 0x3018,
90 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
91 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
92 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
93 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
94 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
95 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
96 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
97 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
98 V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
99 V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
100 V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
101 V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
102 V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
103 V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
104 V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
105 V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
107 /* JPEG compressed formats - next is 0x4002 */
108 V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
110 /* Vendor specific formats - next is 0x5002 */
112 /* S5C73M3 sensor specific interleaved UYVY and JPEG */
113 V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 0x5001,
117 * struct v4l2_mbus_framefmt - frame format on the media bus
118 * @width: frame width
119 * @height: frame height
120 * @code: data format code (from enum v4l2_mbus_pixelcode)
121 * @field: used interlacing type (from enum v4l2_field)
122 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
124 struct v4l2_mbus_framefmt {