s5p_fimc.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Samsung S5P/Exynos4 SoC series camera interface driver header
  3. *
  4. * Copyright (C) 2010 - 2013 Samsung Electronics Co., Ltd.
  5. * Sylwester Nawrocki <s.nawrocki@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef S5P_FIMC_H_
  12. #define S5P_FIMC_H_
  13. #include <media/media-entity.h>
  14. #include <media/v4l2-mediabus.h>
  15. /*
  16. * Enumeration of data inputs to the camera subsystem.
  17. */
  18. enum fimc_input {
  19. FIMC_INPUT_PARALLEL_0 = 1,
  20. FIMC_INPUT_PARALLEL_1,
  21. FIMC_INPUT_MIPI_CSI2_0 = 3,
  22. FIMC_INPUT_MIPI_CSI2_1,
  23. FIMC_INPUT_WRITEBACK_A = 5,
  24. FIMC_INPUT_WRITEBACK_B,
  25. FIMC_INPUT_WRITEBACK_ISP = 5,
  26. };
  27. /*
  28. * Enumeration of the FIMC data bus types.
  29. */
  30. enum fimc_bus_type {
  31. /* Camera parallel bus */
  32. FIMC_BUS_TYPE_ITU_601 = 1,
  33. /* Camera parallel bus with embedded synchronization */
  34. FIMC_BUS_TYPE_ITU_656,
  35. /* Camera MIPI-CSI2 serial bus */
  36. FIMC_BUS_TYPE_MIPI_CSI2,
  37. /* FIFO link from LCD controller (WriteBack A) */
  38. FIMC_BUS_TYPE_LCD_WRITEBACK_A,
  39. /* FIFO link from LCD controller (WriteBack B) */
  40. FIMC_BUS_TYPE_LCD_WRITEBACK_B,
  41. /* FIFO link from FIMC-IS */
  42. FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B,
  43. };
  44. #define fimc_input_is_parallel(x) ((x) == 1 || (x) == 2)
  45. #define fimc_input_is_mipi_csi(x) ((x) == 3 || (x) == 4)
  46. struct i2c_board_info;
  47. /**
  48. * struct fimc_source_info - video source description required for the host
  49. * interface configuration
  50. *
  51. * @board_info: pointer to I2C subdevice's board info
  52. * @clk_frequency: frequency of the clock the host interface provides to sensor
  53. * @fimc_bus_type: FIMC camera input type
  54. * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc.
  55. * @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*)
  56. * @i2c_bus_num: i2c control bus id the sensor is attached to
  57. * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
  58. * @clk_id: index of the SoC peripheral clock for sensors
  59. */
  60. struct fimc_source_info {
  61. struct i2c_board_info *board_info;
  62. unsigned long clk_frequency;
  63. enum fimc_bus_type fimc_bus_type;
  64. enum fimc_bus_type sensor_bus_type;
  65. u16 flags;
  66. u16 i2c_bus_num;
  67. u16 mux_id;
  68. u8 clk_id;
  69. };
  70. /**
  71. * struct s5p_platform_fimc - camera host interface platform data
  72. *
  73. * @source_info: properties of an image source for the host interface setup
  74. * @num_clients: the number of attached image sources
  75. */
  76. struct s5p_platform_fimc {
  77. struct fimc_source_info *source_info;
  78. int num_clients;
  79. };
  80. /*
  81. * v4l2_device notification id. This is only for internal use in the kernel.
  82. * Sensor subdevs should issue S5P_FIMC_TX_END_NOTIFY notification in single
  83. * frame capture mode when there is only one VSYNC pulse issued by the sensor
  84. * at begining of the frame transmission.
  85. */
  86. #define S5P_FIMC_TX_END_NOTIFY _IO('e', 0)
  87. #define FIMC_MAX_PLANES 3
  88. /**
  89. * struct fimc_fmt - color format data structure
  90. * @mbus_code: media bus pixel code, -1 if not applicable
  91. * @name: format description
  92. * @fourcc: fourcc code for this format, 0 if not applicable
  93. * @color: the driver's private color format id
  94. * @memplanes: number of physically non-contiguous data planes
  95. * @colplanes: number of physically contiguous data planes
  96. * @depth: per plane driver's private 'number of bits per pixel'
  97. * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no)
  98. * @flags: flags indicating which operation mode format applies to
  99. */
  100. struct fimc_fmt {
  101. enum v4l2_mbus_pixelcode mbus_code;
  102. char *name;
  103. u32 fourcc;
  104. u32 color;
  105. u16 memplanes;
  106. u16 colplanes;
  107. u8 depth[FIMC_MAX_PLANES];
  108. u16 mdataplanes;
  109. u16 flags;
  110. #define FMT_FLAGS_CAM (1 << 0)
  111. #define FMT_FLAGS_M2M_IN (1 << 1)
  112. #define FMT_FLAGS_M2M_OUT (1 << 2)
  113. #define FMT_FLAGS_M2M (1 << 1 | 1 << 2)
  114. #define FMT_HAS_ALPHA (1 << 3)
  115. #define FMT_FLAGS_COMPRESSED (1 << 4)
  116. #define FMT_FLAGS_WRITEBACK (1 << 5)
  117. };
  118. enum fimc_subdev_index {
  119. IDX_SENSOR,
  120. IDX_CSIS,
  121. IDX_FLITE,
  122. IDX_IS_ISP,
  123. IDX_FIMC,
  124. IDX_MAX,
  125. };
  126. struct media_pipeline;
  127. struct v4l2_subdev;
  128. struct fimc_pipeline {
  129. struct v4l2_subdev *subdevs[IDX_MAX];
  130. struct media_pipeline *m_pipeline;
  131. };
  132. /*
  133. * Media pipeline operations to be called from within the fimc(-lite)
  134. * video node when it is the last entity of the pipeline. Implemented
  135. * by corresponding media device driver.
  136. */
  137. struct fimc_pipeline_ops {
  138. int (*open)(struct fimc_pipeline *p, struct media_entity *me,
  139. bool resume);
  140. int (*close)(struct fimc_pipeline *p);
  141. int (*set_stream)(struct fimc_pipeline *p, bool state);
  142. };
  143. #define fimc_pipeline_call(f, op, p, args...) \
  144. (!(f) ? -ENODEV : (((f)->pipeline_ops && (f)->pipeline_ops->op) ? \
  145. (f)->pipeline_ops->op((p), ##args) : -ENOIOCTLCMD))
  146. #endif /* S5P_FIMC_H_ */