X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fmedia-ctl%2F0001-add-kernel-headers-for-compatibility-with-old-toolchains.patch;fp=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fmedia-ctl%2F0001-add-kernel-headers-for-compatibility-with-old-toolchains.patch;h=17b52ced73ac6af6a0e81c4b37ddca94e3973c11;hb=b0a0f15dfaa205161a7fcb20cf1b8cd4948c2ef3;hp=0000000000000000000000000000000000000000;hpb=c6ac3cd55ee2da956195eee393b0882105dfad4e;p=packages%2Ftrusty%2Fcirros-testvm.git diff --git a/cirros-testvm/src-cirros/buildroot-2015.05/package/media-ctl/0001-add-kernel-headers-for-compatibility-with-old-toolchains.patch b/cirros-testvm/src-cirros/buildroot-2015.05/package/media-ctl/0001-add-kernel-headers-for-compatibility-with-old-toolchains.patch new file mode 100644 index 0000000..17b52ce --- /dev/null +++ b/cirros-testvm/src-cirros/buildroot-2015.05/package/media-ctl/0001-add-kernel-headers-for-compatibility-with-old-toolchains.patch @@ -0,0 +1,303 @@ +From 480b9effa08541b5df369dd6516013282cf28bd8 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sun, 6 Oct 2013 17:24:04 +0200 +Subject: [PATCH] Add kernel headers for compatibility with old toolchains + +The media controller mechanism is relatively new in the Linux kernel, +and therefore all toolchains don't yet have the necessary +headers. This patch makes sure that media-ctl provides such headers, +as was already the case with v4l2-common.h, v4l2-subdev.h and +videodev2.h. + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 +-- + src/linux/media.h | 132 ++++++++++++++++++++++++++++++++++++++++++++++ + src/linux/v4l2-mediabus.h | 119 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 252 insertions(+), 5 deletions(-) + create mode 100644 src/linux/media.h + create mode 100644 src/linux/v4l2-mediabus.h + +diff --git a/configure.ac b/configure.ac +index a749794..56eb71f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -51,11 +51,7 @@ AC_ARG_WITH(kernel-headers, + CPPFLAGS="$CPPFLAGS -I$KERNEL_HEADERS_DIR/include" + + # Checks for header files. +-AC_CHECK_HEADERS([linux/media.h \ +- linux/types.h \ +- linux/v4l2-mediabus.h \ +- linux/v4l2-subdev.h \ +- linux/videodev2.h], ++AC_CHECK_HEADERS([linux/types.h], + [], + [echo "ERROR: Kernel header file not found or not usable!"; exit 1]) + +diff --git a/src/linux/media.h b/src/linux/media.h +new file mode 100644 +index 0000000..410e7cc +--- /dev/null ++++ b/src/linux/media.h +@@ -0,0 +1,132 @@ ++/* ++ * Multimedia device API ++ * ++ * Copyright (C) 2010 Nokia Corporation ++ * ++ * Contacts: Laurent Pinchart ++ * Sakari Ailus ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef __LINUX_MEDIA_H ++#define __LINUX_MEDIA_H ++ ++#include ++#include ++#include ++ ++#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) ++ ++struct media_device_info { ++ char driver[16]; ++ char model[32]; ++ char serial[40]; ++ char bus_info[32]; ++ __u32 media_version; ++ __u32 hw_revision; ++ __u32 driver_version; ++ __u32 reserved[31]; ++}; ++ ++#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) ++ ++#define MEDIA_ENT_TYPE_SHIFT 16 ++#define MEDIA_ENT_TYPE_MASK 0x00ff0000 ++#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff ++ ++#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) ++#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) ++#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) ++#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) ++#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) ++ ++#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) ++#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) ++#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) ++#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) ++ ++#define MEDIA_ENT_FL_DEFAULT (1 << 0) ++ ++struct media_entity_desc { ++ __u32 id; ++ char name[32]; ++ __u32 type; ++ __u32 revision; ++ __u32 flags; ++ __u32 group_id; ++ __u16 pads; ++ __u16 links; ++ ++ __u32 reserved[4]; ++ ++ union { ++ /* Node specifications */ ++ struct { ++ __u32 major; ++ __u32 minor; ++ } v4l; ++ struct { ++ __u32 major; ++ __u32 minor; ++ } fb; ++ struct { ++ __u32 card; ++ __u32 device; ++ __u32 subdevice; ++ } alsa; ++ int dvb; ++ ++ /* Sub-device specifications */ ++ /* Nothing needed yet */ ++ __u8 raw[184]; ++ }; ++}; ++ ++#define MEDIA_PAD_FL_SINK (1 << 0) ++#define MEDIA_PAD_FL_SOURCE (1 << 1) ++ ++struct media_pad_desc { ++ __u32 entity; /* entity ID */ ++ __u16 index; /* pad index */ ++ __u32 flags; /* pad flags */ ++ __u32 reserved[2]; ++}; ++ ++#define MEDIA_LNK_FL_ENABLED (1 << 0) ++#define MEDIA_LNK_FL_IMMUTABLE (1 << 1) ++#define MEDIA_LNK_FL_DYNAMIC (1 << 2) ++ ++struct media_link_desc { ++ struct media_pad_desc source; ++ struct media_pad_desc sink; ++ __u32 flags; ++ __u32 reserved[2]; ++}; ++ ++struct media_links_enum { ++ __u32 entity; ++ /* Should have enough room for pads elements */ ++ struct media_pad_desc *pads; ++ /* Should have enough room for links elements */ ++ struct media_link_desc *links; ++ __u32 reserved[4]; ++}; ++ ++#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) ++#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) ++#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) ++#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) ++ ++#endif /* __LINUX_MEDIA_H */ +diff --git a/src/linux/v4l2-mediabus.h b/src/linux/v4l2-mediabus.h +new file mode 100644 +index 0000000..7d64e0e +--- /dev/null ++++ b/src/linux/v4l2-mediabus.h +@@ -0,0 +1,119 @@ ++/* ++ * Media Bus API header ++ * ++ * Copyright (C) 2009, Guennadi Liakhovetski ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef __LINUX_V4L2_MEDIABUS_H ++#define __LINUX_V4L2_MEDIABUS_H ++ ++#include ++#include ++ ++/* ++ * These pixel codes uniquely identify data formats on the media bus. Mostly ++ * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is ++ * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the ++ * data format is fixed. Additionally, "2X8" means that one pixel is transferred ++ * in two 8-bit samples, "BE" or "LE" specify in which order those samples are ++ * transferred over the bus: "LE" means that the least significant bits are ++ * transferred first, "BE" means that the most significant bits are transferred ++ * first, and "PADHI" and "PADLO" define which bits - low or high, in the ++ * incomplete high byte, are filled with padding bits. ++ * ++ * The pixel codes are grouped by type, bus_width, bits per component, samples ++ * per pixel and order of subsamples. Numerical values are sorted using generic ++ * numerical sort order (8 thus comes before 10). ++ * ++ * As their value can't change when a new pixel code is inserted in the ++ * enumeration, the pixel codes are explicitly given a numerical value. The next ++ * free values for each category are listed below, update them when inserting ++ * new pixel codes. ++ */ ++enum v4l2_mbus_pixelcode { ++ V4L2_MBUS_FMT_FIXED = 0x0001, ++ ++ /* RGB - next is 0x1009 */ ++ V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001, ++ V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002, ++ V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003, ++ V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004, ++ V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005, ++ V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006, ++ V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, ++ V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, ++ ++ /* YUV (including grey) - next is 0x2014 */ ++ V4L2_MBUS_FMT_Y8_1X8 = 0x2001, ++ V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, ++ V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003, ++ V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004, ++ V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005, ++ V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006, ++ V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007, ++ V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008, ++ V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009, ++ V4L2_MBUS_FMT_Y10_1X10 = 0x200a, ++ V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, ++ V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, ++ V4L2_MBUS_FMT_Y12_1X12 = 0x2013, ++ V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f, ++ V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, ++ V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, ++ V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012, ++ V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, ++ V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, ++ ++ /* Bayer - next is 0x3015 */ ++ V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, ++ V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013, ++ V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002, ++ V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014, ++ V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b, ++ V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c, ++ V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009, ++ V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d, ++ V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003, ++ V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004, ++ V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005, ++ V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006, ++ V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007, ++ V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e, ++ V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a, ++ V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f, ++ V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008, ++ V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010, ++ V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011, ++ V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012, ++ ++ /* JPEG compressed formats - next is 0x4002 */ ++ V4L2_MBUS_FMT_JPEG_1X8 = 0x4001, ++ ++ /* Vendor specific formats - next is 0x5002 */ ++ ++ /* S5C73M3 sensor specific interleaved UYVY and JPEG */ ++ V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 0x5001, ++}; ++ ++/** ++ * struct v4l2_mbus_framefmt - frame format on the media bus ++ * @width: frame width ++ * @height: frame height ++ * @code: data format code (from enum v4l2_mbus_pixelcode) ++ * @field: used interlacing type (from enum v4l2_field) ++ * @colorspace: colorspace of the data (from enum v4l2_colorspace) ++ */ ++struct v4l2_mbus_framefmt { ++ __u32 width; ++ __u32 height; ++ __u32 code; ++ __u32 field; ++ __u32 colorspace; ++ __u32 reserved[7]; ++}; ++ ++#endif +-- +1.8.1.2 +