Laurent Pinchart | 2ef2d5a | 2010-03-15 19:33:31 -0300 | [diff] [blame] | 1 | /* |
| 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 Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 27 | * |
| 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 Pinchart | 2ef2d5a | 2010-03-15 19:33:31 -0300 | [diff] [blame] | 36 | */ |
| 37 | enum v4l2_mbus_pixelcode { |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 38 | V4L2_MBUS_FMT_FIXED = 0x0001, |
| 39 | |
Laurent Pinchart | f57fa21 | 2013-06-05 04:19:53 -0300 | [diff] [blame] | 40 | /* RGB - next is 0x100e */ |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 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, |
Phil Edworthy | 7b88fc0 | 2013-03-18 08:47:59 -0300 | [diff] [blame] | 49 | V4L2_MBUS_FMT_RGB666_1X18 = 0x1009, |
| 50 | V4L2_MBUS_FMT_RGB888_1X24 = 0x100a, |
| 51 | V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b, |
| 52 | V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c, |
Laurent Pinchart | f57fa21 | 2013-06-05 04:19:53 -0300 | [diff] [blame] | 53 | V4L2_MBUS_FMT_ARGB8888_1X32 = 0x100d, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 54 | |
Laurent Pinchart | f57fa21 | 2013-06-05 04:19:53 -0300 | [diff] [blame] | 55 | /* YUV (including grey) - next is 0x2018 */ |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 56 | V4L2_MBUS_FMT_Y8_1X8 = 0x2001, |
Manjunath Hadli | c196f6e | 2012-10-18 07:54:59 -0300 | [diff] [blame] | 57 | V4L2_MBUS_FMT_UV8_1X8 = 0x2015, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 58 | V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, |
| 59 | V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003, |
| 60 | V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004, |
| 61 | V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005, |
| 62 | V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006, |
| 63 | V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007, |
| 64 | V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008, |
| 65 | V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009, |
| 66 | V4L2_MBUS_FMT_Y10_1X10 = 0x200a, |
| 67 | V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, |
| 68 | V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, |
Michael Jones | cbbc69a | 2011-03-29 05:19:07 -0300 | [diff] [blame] | 69 | V4L2_MBUS_FMT_Y12_1X12 = 0x2013, |
Laurent Pinchart | 2d8deaf | 2010-09-01 12:59:36 -0300 | [diff] [blame] | 70 | V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f, |
| 71 | V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, |
| 72 | V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, |
| 73 | V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012, |
Manjunath Hadli | c196f6e | 2012-10-18 07:54:59 -0300 | [diff] [blame] | 74 | V4L2_MBUS_FMT_YDYUYDYV8_1X16 = 0x2014, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 75 | V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, |
| 76 | V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, |
Sylwester Nawrocki | b01189b | 2012-11-28 14:40:32 -0300 | [diff] [blame] | 77 | V4L2_MBUS_FMT_YUV10_1X30 = 0x2016, |
Laurent Pinchart | f57fa21 | 2013-06-05 04:19:53 -0300 | [diff] [blame] | 78 | V4L2_MBUS_FMT_AYUV8_1X32 = 0x2017, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 79 | |
Manjunath Hadli | c196f6e | 2012-10-18 07:54:59 -0300 | [diff] [blame] | 80 | /* Bayer - next is 0x3019 */ |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 81 | V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, |
Michael Jones | cbbc69a | 2011-03-29 05:19:07 -0300 | [diff] [blame] | 82 | V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 83 | V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002, |
Michael Jones | cbbc69a | 2011-03-29 05:19:07 -0300 | [diff] [blame] | 84 | V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014, |
Manjunath Hadli | c196f6e | 2012-10-18 07:54:59 -0300 | [diff] [blame] | 85 | V4L2_MBUS_FMT_SBGGR10_ALAW8_1X8 = 0x3015, |
| 86 | V4L2_MBUS_FMT_SGBRG10_ALAW8_1X8 = 0x3016, |
| 87 | V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8 = 0x3017, |
| 88 | V4L2_MBUS_FMT_SRGGB10_ALAW8_1X8 = 0x3018, |
Laurent Pinchart | b1fd18c | 2010-09-03 05:47:25 -0300 | [diff] [blame] | 89 | V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b, |
| 90 | V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c, |
Laurent Pinchart | 2d8deaf | 2010-09-01 12:59:36 -0300 | [diff] [blame] | 91 | V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009, |
Laurent Pinchart | b1fd18c | 2010-09-03 05:47:25 -0300 | [diff] [blame] | 92 | V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 93 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003, |
| 94 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004, |
| 95 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005, |
| 96 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006, |
| 97 | V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007, |
Laurent Pinchart | b1fd18c | 2010-09-03 05:47:25 -0300 | [diff] [blame] | 98 | V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e, |
Laurent Pinchart | 2d8deaf | 2010-09-01 12:59:36 -0300 | [diff] [blame] | 99 | V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a, |
Laurent Pinchart | b1fd18c | 2010-09-03 05:47:25 -0300 | [diff] [blame] | 100 | V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f, |
Laurent Pinchart | dacdde7 | 2010-09-01 12:58:22 -0300 | [diff] [blame] | 101 | V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008, |
Laurent Pinchart | 7140c55 | 2010-12-23 11:14:49 -0300 | [diff] [blame] | 102 | V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010, |
| 103 | V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011, |
| 104 | V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012, |
Sylwester Nawrocki | 1684652 | 2011-03-25 12:09:43 -0300 | [diff] [blame] | 105 | |
| 106 | /* JPEG compressed formats - next is 0x4002 */ |
| 107 | V4L2_MBUS_FMT_JPEG_1X8 = 0x4001, |
Sylwester Nawrocki | d264248 | 2012-02-16 14:23:54 -0300 | [diff] [blame] | 108 | |
| 109 | /* Vendor specific formats - next is 0x5002 */ |
| 110 | |
| 111 | /* S5C73M3 sensor specific interleaved UYVY and JPEG */ |
| 112 | V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 0x5001, |
Laurent Pinchart | 7e941a7 | 2013-07-10 12:05:06 -0300 | [diff] [blame] | 113 | |
| 114 | /* HSV - next is 0x6002 */ |
| 115 | V4L2_MBUS_FMT_AHSV8888_1X32 = 0x6001, |
Laurent Pinchart | 2ef2d5a | 2010-03-15 19:33:31 -0300 | [diff] [blame] | 116 | }; |
| 117 | |
| 118 | /** |
| 119 | * struct v4l2_mbus_framefmt - frame format on the media bus |
| 120 | * @width: frame width |
| 121 | * @height: frame height |
Laurent Pinchart | 84d0688 | 2010-10-06 03:30:26 -0300 | [diff] [blame] | 122 | * @code: data format code (from enum v4l2_mbus_pixelcode) |
| 123 | * @field: used interlacing type (from enum v4l2_field) |
| 124 | * @colorspace: colorspace of the data (from enum v4l2_colorspace) |
Laurent Pinchart | 2ef2d5a | 2010-03-15 19:33:31 -0300 | [diff] [blame] | 125 | */ |
| 126 | struct v4l2_mbus_framefmt { |
Laurent Pinchart | 84d0688 | 2010-10-06 03:30:26 -0300 | [diff] [blame] | 127 | __u32 width; |
| 128 | __u32 height; |
| 129 | __u32 code; |
| 130 | __u32 field; |
| 131 | __u32 colorspace; |
| 132 | __u32 reserved[7]; |
Laurent Pinchart | 2ef2d5a | 2010-03-15 19:33:31 -0300 | [diff] [blame] | 133 | }; |
| 134 | |
| 135 | #endif |