blob: 5ea7f753a3488757ab7f2a06132fd7a8b2ce46e8 [file] [log] [blame]
Laurent Pinchart2ef2d5a2010-03-15 19:33:31 -03001/*
2 * Media Bus API header
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
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.
9 */
10
11#ifndef __LINUX_V4L2_MEDIABUS_H
12#define __LINUX_V4L2_MEDIABUS_H
13
14#include <linux/types.h>
15#include <linux/videodev2.h>
16
17/*
18 * These pixel codes uniquely identify data formats on the media bus. Mostly
19 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
20 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
21 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
22 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
23 * transferred over the bus: "LE" means that the least significant bits are
24 * transferred first, "BE" means that the most significant bits are transferred
25 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
26 * incomplete high byte, are filled with padding bits.
Laurent Pinchartdacdde72010-09-01 12:58:22 -030027 *
28 * The pixel codes are grouped by type, bus_width, bits per component, samples
29 * per pixel and order of subsamples. Numerical values are sorted using generic
30 * numerical sort order (8 thus comes before 10).
31 *
32 * As their value can't change when a new pixel code is inserted in the
33 * enumeration, the pixel codes are explicitly given a numerical value. The next
34 * free values for each category are listed below, update them when inserting
35 * new pixel codes.
Laurent Pinchart2ef2d5a2010-03-15 19:33:31 -030036 */
37enum v4l2_mbus_pixelcode {
Laurent Pinchartdacdde72010-09-01 12:58:22 -030038 V4L2_MBUS_FMT_FIXED = 0x0001,
39
40 /* RGB - next is 0x1009 */
41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
44 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
45 V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49
Michael Jonescbbc69a2011-03-29 05:19:07 -030050 /* YUV (including grey) - next is 0x2014 */
Laurent Pinchartdacdde72010-09-01 12:58:22 -030051 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
52 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
53 V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
54 V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
55 V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
56 V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
57 V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
58 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
59 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
60 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
61 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
62 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
Michael Jonescbbc69a2011-03-29 05:19:07 -030063 V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
Laurent Pinchart2d8deaf2010-09-01 12:59:36 -030064 V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
65 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
66 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
67 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
Laurent Pinchartdacdde72010-09-01 12:58:22 -030068 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
69 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
70
Michael Jonescbbc69a2011-03-29 05:19:07 -030071 /* Bayer - next is 0x3015 */
Laurent Pinchartdacdde72010-09-01 12:58:22 -030072 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
Michael Jonescbbc69a2011-03-29 05:19:07 -030073 V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
Laurent Pinchartdacdde72010-09-01 12:58:22 -030074 V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
Michael Jonescbbc69a2011-03-29 05:19:07 -030075 V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
Laurent Pinchartb1fd18c2010-09-03 05:47:25 -030076 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
77 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
Laurent Pinchart2d8deaf2010-09-01 12:59:36 -030078 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
Laurent Pinchartb1fd18c2010-09-03 05:47:25 -030079 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
Laurent Pinchartdacdde72010-09-01 12:58:22 -030080 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
81 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
82 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
83 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
84 V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
Laurent Pinchartb1fd18c2010-09-03 05:47:25 -030085 V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
Laurent Pinchart2d8deaf2010-09-01 12:59:36 -030086 V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
Laurent Pinchartb1fd18c2010-09-03 05:47:25 -030087 V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
Laurent Pinchartdacdde72010-09-01 12:58:22 -030088 V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
Laurent Pinchart7140c552010-12-23 11:14:49 -030089 V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
90 V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
91 V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
Sylwester Nawrocki16846522011-03-25 12:09:43 -030092
93 /* JPEG compressed formats - next is 0x4002 */
94 V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
Laurent Pinchart2ef2d5a2010-03-15 19:33:31 -030095};
96
97/**
98 * struct v4l2_mbus_framefmt - frame format on the media bus
99 * @width: frame width
100 * @height: frame height
Laurent Pinchart84d06882010-10-06 03:30:26 -0300101 * @code: data format code (from enum v4l2_mbus_pixelcode)
102 * @field: used interlacing type (from enum v4l2_field)
103 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
Laurent Pinchart2ef2d5a2010-03-15 19:33:31 -0300104 */
105struct v4l2_mbus_framefmt {
Laurent Pinchart84d06882010-10-06 03:30:26 -0300106 __u32 width;
107 __u32 height;
108 __u32 code;
109 __u32 field;
110 __u32 colorspace;
111 __u32 reserved[7];
Laurent Pinchart2ef2d5a2010-03-15 19:33:31 -0300112};
113
114#endif