The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / media-ctl / 0001-add-kernel-headers-for-compatibility-with-old-toolchains.patch
1 From 480b9effa08541b5df369dd6516013282cf28bd8 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Sun, 6 Oct 2013 17:24:04 +0200
4 Subject: [PATCH] Add kernel headers for compatibility with old toolchains
5
6 The media controller mechanism is relatively new in the Linux kernel,
7 and therefore all toolchains don't yet have the necessary
8 headers. This patch makes sure that media-ctl provides such headers,
9 as was already the case with v4l2-common.h, v4l2-subdev.h and
10 videodev2.h.
11
12 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13 ---
14  configure.ac              |   6 +--
15  src/linux/media.h         | 132 ++++++++++++++++++++++++++++++++++++++++++++++
16  src/linux/v4l2-mediabus.h | 119 +++++++++++++++++++++++++++++++++++++++++
17  3 files changed, 252 insertions(+), 5 deletions(-)
18  create mode 100644 src/linux/media.h
19  create mode 100644 src/linux/v4l2-mediabus.h
20
21 diff --git a/configure.ac b/configure.ac
22 index a749794..56eb71f 100644
23 --- a/configure.ac
24 +++ b/configure.ac
25 @@ -51,11 +51,7 @@ AC_ARG_WITH(kernel-headers,
26  CPPFLAGS="$CPPFLAGS -I$KERNEL_HEADERS_DIR/include"
27  
28  # Checks for header files.
29 -AC_CHECK_HEADERS([linux/media.h \
30 -                 linux/types.h \
31 -                 linux/v4l2-mediabus.h \
32 -                 linux/v4l2-subdev.h \
33 -                 linux/videodev2.h],
34 +AC_CHECK_HEADERS([linux/types.h],
35                   [],
36                   [echo "ERROR: Kernel header file not found or not usable!"; exit 1])
37  
38 diff --git a/src/linux/media.h b/src/linux/media.h
39 new file mode 100644
40 index 0000000..410e7cc
41 --- /dev/null
42 +++ b/src/linux/media.h
43 @@ -0,0 +1,132 @@
44 +/*
45 + * Multimedia device API
46 + *
47 + * Copyright (C) 2010 Nokia Corporation
48 + *
49 + * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
50 + *          Sakari Ailus <sakari.ailus@iki.fi>
51 + *
52 + * This program is free software; you can redistribute it and/or modify
53 + * it under the terms of the GNU General Public License version 2 as
54 + * published by the Free Software Foundation.
55 + *
56 + * This program is distributed in the hope that it will be useful,
57 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
58 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59 + * GNU General Public License for more details.
60 + *
61 + * You should have received a copy of the GNU General Public License
62 + * along with this program; if not, write to the Free Software
63 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
64 + */
65 +
66 +#ifndef __LINUX_MEDIA_H
67 +#define __LINUX_MEDIA_H
68 +
69 +#include <linux/ioctl.h>
70 +#include <linux/types.h>
71 +#include <linux/version.h>
72 +
73 +#define MEDIA_API_VERSION      KERNEL_VERSION(0, 1, 0)
74 +
75 +struct media_device_info {
76 +       char driver[16];
77 +       char model[32];
78 +       char serial[40];
79 +       char bus_info[32];
80 +       __u32 media_version;
81 +       __u32 hw_revision;
82 +       __u32 driver_version;
83 +       __u32 reserved[31];
84 +};
85 +
86 +#define MEDIA_ENT_ID_FLAG_NEXT         (1 << 31)
87 +
88 +#define MEDIA_ENT_TYPE_SHIFT           16
89 +#define MEDIA_ENT_TYPE_MASK            0x00ff0000
90 +#define MEDIA_ENT_SUBTYPE_MASK         0x0000ffff
91 +
92 +#define MEDIA_ENT_T_DEVNODE            (1 << MEDIA_ENT_TYPE_SHIFT)
93 +#define MEDIA_ENT_T_DEVNODE_V4L                (MEDIA_ENT_T_DEVNODE + 1)
94 +#define MEDIA_ENT_T_DEVNODE_FB         (MEDIA_ENT_T_DEVNODE + 2)
95 +#define MEDIA_ENT_T_DEVNODE_ALSA       (MEDIA_ENT_T_DEVNODE + 3)
96 +#define MEDIA_ENT_T_DEVNODE_DVB                (MEDIA_ENT_T_DEVNODE + 4)
97 +
98 +#define MEDIA_ENT_T_V4L2_SUBDEV                (2 << MEDIA_ENT_TYPE_SHIFT)
99 +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
100 +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH  (MEDIA_ENT_T_V4L2_SUBDEV + 2)
101 +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS   (MEDIA_ENT_T_V4L2_SUBDEV + 3)
102 +
103 +#define MEDIA_ENT_FL_DEFAULT           (1 << 0)
104 +
105 +struct media_entity_desc {
106 +       __u32 id;
107 +       char name[32];
108 +       __u32 type;
109 +       __u32 revision;
110 +       __u32 flags;
111 +       __u32 group_id;
112 +       __u16 pads;
113 +       __u16 links;
114 +
115 +       __u32 reserved[4];
116 +
117 +       union {
118 +               /* Node specifications */
119 +               struct {
120 +                       __u32 major;
121 +                       __u32 minor;
122 +               } v4l;
123 +               struct {
124 +                       __u32 major;
125 +                       __u32 minor;
126 +               } fb;
127 +               struct {
128 +                       __u32 card;
129 +                       __u32 device;
130 +                       __u32 subdevice;
131 +               } alsa;
132 +               int dvb;
133 +
134 +               /* Sub-device specifications */
135 +               /* Nothing needed yet */
136 +               __u8 raw[184];
137 +       };
138 +};
139 +
140 +#define MEDIA_PAD_FL_SINK              (1 << 0)
141 +#define MEDIA_PAD_FL_SOURCE            (1 << 1)
142 +
143 +struct media_pad_desc {
144 +       __u32 entity;           /* entity ID */
145 +       __u16 index;            /* pad index */
146 +       __u32 flags;            /* pad flags */
147 +       __u32 reserved[2];
148 +};
149 +
150 +#define MEDIA_LNK_FL_ENABLED           (1 << 0)
151 +#define MEDIA_LNK_FL_IMMUTABLE         (1 << 1)
152 +#define MEDIA_LNK_FL_DYNAMIC           (1 << 2)
153 +
154 +struct media_link_desc {
155 +       struct media_pad_desc source;
156 +       struct media_pad_desc sink;
157 +       __u32 flags;
158 +       __u32 reserved[2];
159 +};
160 +
161 +struct media_links_enum {
162 +       __u32 entity;
163 +       /* Should have enough room for pads elements */
164 +       struct media_pad_desc *pads;
165 +       /* Should have enough room for links elements */
166 +       struct media_link_desc *links;
167 +       __u32 reserved[4];
168 +};
169 +
170 +#define MEDIA_IOC_DEVICE_INFO          _IOWR('|', 0x00, struct media_device_info)
171 +#define MEDIA_IOC_ENUM_ENTITIES                _IOWR('|', 0x01, struct media_entity_desc)
172 +#define MEDIA_IOC_ENUM_LINKS           _IOWR('|', 0x02, struct media_links_enum)
173 +#define MEDIA_IOC_SETUP_LINK           _IOWR('|', 0x03, struct media_link_desc)
174 +
175 +#endif /* __LINUX_MEDIA_H */
176 diff --git a/src/linux/v4l2-mediabus.h b/src/linux/v4l2-mediabus.h
177 new file mode 100644
178 index 0000000..7d64e0e
179 --- /dev/null
180 +++ b/src/linux/v4l2-mediabus.h
181 @@ -0,0 +1,119 @@
182 +/*
183 + * Media Bus API header
184 + *
185 + * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
186 + *
187 + * This program is free software; you can redistribute it and/or modify
188 + * it under the terms of the GNU General Public License version 2 as
189 + * published by the Free Software Foundation.
190 + */
191 +
192 +#ifndef __LINUX_V4L2_MEDIABUS_H
193 +#define __LINUX_V4L2_MEDIABUS_H
194 +
195 +#include <linux/types.h>
196 +#include <linux/videodev2.h>
197 +
198 +/*
199 + * These pixel codes uniquely identify data formats on the media bus. Mostly
200 + * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
201 + * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
202 + * data format is fixed. Additionally, "2X8" means that one pixel is transferred
203 + * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
204 + * transferred over the bus: "LE" means that the least significant bits are
205 + * transferred first, "BE" means that the most significant bits are transferred
206 + * first, and "PADHI" and "PADLO" define which bits - low or high, in the
207 + * incomplete high byte, are filled with padding bits.
208 + *
209 + * The pixel codes are grouped by type, bus_width, bits per component, samples
210 + * per pixel and order of subsamples. Numerical values are sorted using generic
211 + * numerical sort order (8 thus comes before 10).
212 + *
213 + * As their value can't change when a new pixel code is inserted in the
214 + * enumeration, the pixel codes are explicitly given a numerical value. The next
215 + * free values for each category are listed below, update them when inserting
216 + * new pixel codes.
217 + */
218 +enum v4l2_mbus_pixelcode {
219 +       V4L2_MBUS_FMT_FIXED = 0x0001,
220 +
221 +       /* RGB - next is 0x1009 */
222 +       V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
223 +       V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
224 +       V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
225 +       V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
226 +       V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
227 +       V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
228 +       V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
229 +       V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
230 +
231 +       /* YUV (including grey) - next is 0x2014 */
232 +       V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
233 +       V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
234 +       V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
235 +       V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
236 +       V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
237 +       V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
238 +       V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
239 +       V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
240 +       V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
241 +       V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
242 +       V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
243 +       V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
244 +       V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
245 +       V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
246 +       V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
247 +       V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
248 +       V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
249 +       V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
250 +       V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
251 +
252 +       /* Bayer - next is 0x3015 */
253 +       V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
254 +       V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
255 +       V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
256 +       V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
257 +       V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
258 +       V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
259 +       V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
260 +       V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
261 +       V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
262 +       V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
263 +       V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
264 +       V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
265 +       V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
266 +       V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
267 +       V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
268 +       V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
269 +       V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
270 +       V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
271 +       V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
272 +       V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
273 +
274 +       /* JPEG compressed formats - next is 0x4002 */
275 +       V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
276 +
277 +       /* Vendor specific formats - next is 0x5002 */
278 +
279 +       /* S5C73M3 sensor specific interleaved UYVY and JPEG */
280 +       V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 0x5001,
281 +};
282 +
283 +/**
284 + * struct v4l2_mbus_framefmt - frame format on the media bus
285 + * @width:     frame width
286 + * @height:    frame height
287 + * @code:      data format code (from enum v4l2_mbus_pixelcode)
288 + * @field:     used interlacing type (from enum v4l2_field)
289 + * @colorspace:        colorspace of the data (from enum v4l2_colorspace)
290 + */
291 +struct v4l2_mbus_framefmt {
292 +       __u32                   width;
293 +       __u32                   height;
294 +       __u32                   code;
295 +       __u32                   field;
296 +       __u32                   colorspace;
297 +       __u32                   reserved[7];
298 +};
299 +
300 +#endif
301 -- 
302 1.8.1.2
303