v4l2-mediabus.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #ifndef __LINUX_V4L2_MEDIABUS_H
  11. #define __LINUX_V4L2_MEDIABUS_H
  12. #include <linux/types.h>
  13. #include <linux/videodev2.h>
  14. /*
  15. * These pixel codes uniquely identify data formats on the media bus. Mostly
  16. * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
  17. * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
  18. * data format is fixed. Additionally, "2X8" means that one pixel is transferred
  19. * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
  20. * transferred over the bus: "LE" means that the least significant bits are
  21. * transferred first, "BE" means that the most significant bits are transferred
  22. * first, and "PADHI" and "PADLO" define which bits - low or high, in the
  23. * incomplete high byte, are filled with padding bits.
  24. *
  25. * The pixel codes are grouped by type, bus_width, bits per component, samples
  26. * per pixel and order of subsamples. Numerical values are sorted using generic
  27. * numerical sort order (8 thus comes before 10).
  28. *
  29. * As their value can't change when a new pixel code is inserted in the
  30. * enumeration, the pixel codes are explicitly given a numerical value. The next
  31. * free values for each category are listed below, update them when inserting
  32. * new pixel codes.
  33. */
  34. enum v4l2_mbus_pixelcode {
  35. V4L2_MBUS_FMT_FIXED = 0x0001,
  36. /* RGB - next is 0x1009 */
  37. V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
  38. V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
  39. V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
  40. V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
  41. V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
  42. V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
  43. V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
  44. V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
  45. /* YUV (including grey) - next is 0x200f */
  46. V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
  47. V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
  48. V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
  49. V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
  50. V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
  51. V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
  52. V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
  53. V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
  54. V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
  55. V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
  56. V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
  57. V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
  58. V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
  59. V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
  60. /* Bayer - next is 0x3009 */
  61. V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
  62. V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
  63. V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
  64. V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
  65. V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
  66. V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
  67. V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
  68. V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
  69. };
  70. /**
  71. * struct v4l2_mbus_framefmt - frame format on the media bus
  72. * @width: frame width
  73. * @height: frame height
  74. * @code: data format code (from enum v4l2_mbus_pixelcode)
  75. * @field: used interlacing type (from enum v4l2_field)
  76. * @colorspace: colorspace of the data (from enum v4l2_colorspace)
  77. */
  78. struct v4l2_mbus_framefmt {
  79. __u32 width;
  80. __u32 height;
  81. __u32 code;
  82. __u32 field;
  83. __u32 colorspace;
  84. __u32 reserved[7];
  85. };
  86. #endif